Changeset 210146 in webkit for trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp
- Timestamp:
- Dec 24, 2016, 1:26:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp
r209897 r210146 87 87 { 88 88 DirectArguments* thisObject = jsCast<DirectArguments*>(cell); 89 size_t overridesSize = thisObject->m_overrides ? thisObject->overridesSize() : 0; 90 return Base::estimatedSize(cell) + overridesSize; 89 size_t mappedArgumentsSize = thisObject->m_mappedArguments ? thisObject->mappedArgumentsSize() * sizeof(bool) : 0; 90 size_t modifiedArgumentsSize = thisObject->m_modifiedArgumentsDescriptor ? thisObject->m_length * sizeof(bool) : 0; 91 return Base::estimatedSize(cell) + mappedArgumentsSize + modifiedArgumentsSize; 91 92 } 92 93 … … 96 97 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 97 98 Base::visitChildren(thisObject, visitor); 98 99 99 100 visitor.appendValues(thisObject->storage(), std::max(thisObject->m_length, thisObject->m_minCapacity)); 100 101 visitor.append(thisObject->m_callee); 101 102 102 if (bool* override = thisObject->m_overrides.get()) 103 visitor.markAuxiliary(override); 103 if (thisObject->m_mappedArguments) 104 visitor.markAuxiliary(thisObject->m_mappedArguments.get()); 105 GenericArguments<DirectArguments>::visitChildren(thisCell, visitor); 104 106 } 105 107 … … 111 113 void DirectArguments::overrideThings(VM& vm) 112 114 { 113 RELEASE_ASSERT(!m_ overrides);115 RELEASE_ASSERT(!m_mappedArguments); 114 116 115 117 putDirect(vm, vm.propertyNames->length, jsNumber(m_length), DontEnum); … … 117 119 putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject()->arrayProtoValuesFunction(), DontEnum); 118 120 119 void* backingStore = vm.heap.tryAllocateAuxiliary(this, overridesSize());121 void* backingStore = vm.heap.tryAllocateAuxiliary(this, mappedArgumentsSize()); 120 122 RELEASE_ASSERT(backingStore); 121 123 bool* overrides = static_cast<bool*>(backingStore); 122 m_ overrides.set(vm, this, overrides);124 m_mappedArguments.set(vm, this, overrides); 123 125 for (unsigned i = m_length; i--;) 124 126 overrides[i] = false; … … 127 129 void DirectArguments::overrideThingsIfNecessary(VM& vm) 128 130 { 129 if (!m_ overrides)131 if (!m_mappedArguments) 130 132 overrideThings(vm); 131 133 } 132 134 133 void DirectArguments:: overrideArgument(VM& vm, unsigned index)135 void DirectArguments::unmapArgument(VM& vm, unsigned index) 134 136 { 135 137 overrideThingsIfNecessary(vm); 136 m_ overrides.get()[index] = true;138 m_mappedArguments.get()[index] = true; 137 139 } 138 140 139 141 void DirectArguments::copyToArguments(ExecState* exec, VirtualRegister firstElementDest, unsigned offset, unsigned length) 140 142 { 141 if (!m_ overrides) {143 if (!m_mappedArguments) { 142 144 unsigned limit = std::min(length + offset, m_length); 143 145 unsigned i; … … 153 155 } 154 156 155 unsigned DirectArguments:: overridesSize()157 unsigned DirectArguments::mappedArgumentsSize() 156 158 { 157 159 // We always allocate something; in the relatively uncommon case of overriding an empty argument we 158 // still allocate so that m_ overrides is non-null. We use that to indicate that the other properties160 // still allocate so that m_mappedArguments is non-null. We use that to indicate that the other properties 159 161 // (length, etc) are overridden. 160 162 return WTF::roundUpToMultipleOf<8>(m_length ? m_length : 1);
Note:
See TracChangeset
for help on using the changeset viewer.