Changeset 229842 in webkit for trunk/Source/JavaScriptCore/runtime/ScopedArguments.cpp
- Timestamp:
- Mar 21, 2018, 7:15:44 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/ScopedArguments.cpp
r222473 r229842 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 const ClassInfo ScopedArguments::s_info = { "Arguments", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ScopedArguments) }; 37 37 38 ScopedArguments::ScopedArguments(VM& vm, Structure* structure, unsigned totalLength)38 ScopedArguments::ScopedArguments(VM& vm, Structure* structure, WriteBarrier<Unknown>* storage) 39 39 : GenericArguments(vm, structure) 40 , m_overrodeThings(false) 41 , m_totalLength(totalLength) 40 , m_storage(vm, this, storage) 42 41 { 42 ASSERT(!storageHeader(storage).overrodeThings); 43 43 } 44 44 … … 58 58 else 59 59 overflowLength = 0; 60 61 void* rawStoragePtr = vm.jsValueGigacageAuxiliarySpace.allocateNonVirtual( 62 vm, storageSize(overflowLength), nullptr, AllocationFailureMode::Assert); 63 WriteBarrier<Unknown>* storage = static_cast<WriteBarrier<Unknown>*>(rawStoragePtr) + 1; 64 storageHeader(storage).overrodeThings = false; 65 storageHeader(storage).totalLength = totalLength; 66 60 67 ScopedArguments* result = new ( 61 68 NotNull, 62 allocateCell<ScopedArguments>(vm.heap , allocationSize(overflowLength)))63 ScopedArguments(vm, structure, totalLength);69 allocateCell<ScopedArguments>(vm.heap)) 70 ScopedArguments(vm, structure, storage); 64 71 result->finishCreation(vm, callee, table, scope); 65 72 return result; … … 108 115 visitor.append(thisObject->m_scope); 109 116 110 if (thisObject->m_totalLength > thisObject->m_table->length()) { 117 visitor.markAuxiliary(&thisObject->storageHeader()); 118 119 if (thisObject->storageHeader().totalLength > thisObject->m_table->length()) { 111 120 visitor.appendValues( 112 thisObject->overflowStorage(), thisObject-> m_totalLength - thisObject->m_table->length());121 thisObject->overflowStorage(), thisObject->storageHeader().totalLength - thisObject->m_table->length()); 113 122 } 114 123 … … 123 132 void ScopedArguments::overrideThings(VM& vm) 124 133 { 125 RELEASE_ASSERT(! m_overrodeThings);134 RELEASE_ASSERT(!storageHeader().overrodeThings); 126 135 127 136 putDirect(vm, vm.propertyNames->length, jsNumber(m_table->length()), static_cast<unsigned>(PropertyAttribute::DontEnum)); … … 129 138 putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject()->arrayProtoValuesFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum)); 130 139 131 m_overrodeThings = true;140 storageHeader().overrodeThings = true; 132 141 } 133 142 134 143 void ScopedArguments::overrideThingsIfNecessary(VM& vm) 135 144 { 136 if (! m_overrodeThings)145 if (!storageHeader().overrodeThings) 137 146 overrideThings(vm); 138 147 } … … 140 149 void ScopedArguments::unmapArgument(VM& vm, uint32_t i) 141 150 { 142 ASSERT_WITH_SECURITY_IMPLICATION(i < m_totalLength);151 ASSERT_WITH_SECURITY_IMPLICATION(i < storageHeader().totalLength); 143 152 unsigned namedLength = m_table->length(); 144 153 if (i < namedLength)
Note:
See TracChangeset
for help on using the changeset viewer.