Changeset 128260 in webkit for trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
- Timestamp:
- Sep 11, 2012, 9:08:18 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r127363 r128260 42 42 const ClassInfo JSActivation::s_info = { "JSActivation", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSActivation) }; 43 43 44 JSActivation::JSActivation(CallFrame* callFrame, FunctionExecutable* functionExecutable)45 : Base(46 callFrame->globalData(),47 callFrame->lexicalGlobalObject()->activationStructure(),48 callFrame->registers(),49 callFrame->scope()50 )51 , m_registerArray(callFrame->globalData(), this, 0)52 , m_numCapturedArgs(max(callFrame->argumentCount(), functionExecutable->parameterCount()))53 , m_numCapturedVars(functionExecutable->capturedVariableCount())54 , m_isTornOff(false)55 , m_requiresDynamicChecks(functionExecutable->usesEval() && !functionExecutable->isStrictMode())56 , m_argumentsRegister(functionExecutable->generatedBytecode().argumentsRegister())57 {58 }59 60 void JSActivation::finishCreation(CallFrame* callFrame, FunctionExecutable* functionExecutable)61 {62 Base::finishCreation(callFrame->globalData(), functionExecutable->symbolTable());63 ASSERT(inherits(&s_info));64 }65 66 44 void JSActivation::visitChildren(JSCell* cell, SlotVisitor& visitor) 67 45 { … … 73 51 74 52 // No need to mark our registers if they're still in the RegisterFile. 75 PropertyStorage registerArray = thisObject->m_registerArray.get(); 76 if (!registerArray) 53 if (!thisObject->isTornOff()) 77 54 return; 78 55 79 visitor.copyAndAppend(bitwise_cast<void**>(®isterArray), thisObject->registerArraySizeInBytes(), reinterpret_cast<JSValue*>(registerArray), thisObject->registerArraySize()); 80 thisObject->m_registerArray.set(registerArray, StorageBarrier::Unchecked); 81 thisObject->m_registers = registerArray + thisObject->registerOffset(); 82 83 // Update the arguments object, since it points at our buffer. 84 CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(thisObject->m_registers)); 85 if (JSValue v = callFrame->uncheckedR(unmodifiedArgumentsRegister(thisObject->m_argumentsRegister)).jsValue()) 86 jsCast<Arguments*>(v)->setRegisters(thisObject->m_registers); 56 for (size_t i = 0; i < thisObject->storageSize(); ++i) 57 visitor.append(&thisObject->storage()[i]); 87 58 } 88 59 … … 94 65 95 66 // Defend against the inspector asking for a var after it has been optimized out. 96 if ( m_isTornOff && entry.getIndex() >= m_numCapturedVars)67 if (isTornOff() && !isValid(entry)) 97 68 return false; 98 69 … … 108 79 109 80 // Defend against the inspector asking for a var after it has been optimized out. 110 if ( m_isTornOff && entry.getIndex() >= m_numCapturedVars)81 if (isTornOff() && !isValid(entry)) 111 82 return false; 112 83 … … 130 101 131 102 // Defend against the inspector asking for a var after it has been optimized out. 132 if ( m_isTornOff && entry.getIndex() >= m_numCapturedVars)103 if (isTornOff() && !isValid(entry)) 133 104 return false; 134 105 … … 141 112 JSActivation* thisObject = jsCast<JSActivation*>(object); 142 113 143 if (mode == IncludeDontEnumProperties )114 if (mode == IncludeDontEnumProperties && !thisObject->isTornOff()) 144 115 propertyNames.add(exec->propertyNames().arguments); 145 116 … … 148 119 if (it->second.getAttributes() & DontEnum && mode != IncludeDontEnumProperties) 149 120 continue; 150 if ( it->second.getIndex() >= thisObject->m_numCapturedVars)121 if (!thisObject->isValid(it->second)) 151 122 continue; 152 123 propertyNames.add(Identifier(exec, it->first.get())); … … 165 136 SymbolTableEntry& entry = iter->second; 166 137 ASSERT(!entry.isNull()); 167 if ( entry.getIndex() >= m_numCapturedVars)138 if (!isValid(entry)) 168 139 return false; 169 140 … … 179 150 if (propertyName == exec->propertyNames().arguments) { 180 151 // Defend against the inspector asking for the arguments object after it has been optimized out. 181 if (!thisObject-> m_isTornOff) {152 if (!thisObject->isTornOff()) { 182 153 slot.setCustom(thisObject, thisObject->getArgumentsGetter()); 183 154 return true; … … 206 177 if (propertyName == exec->propertyNames().arguments) { 207 178 // Defend against the inspector asking for the arguments object after it has been optimized out. 208 if (!thisObject-> m_isTornOff) {179 if (!thisObject->isTornOff()) { 209 180 PropertySlot slot; 210 181 JSActivation::getOwnPropertySlot(thisObject, exec, propertyName, slot); … … 266 237 JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, PropertyName) 267 238 { 268 JSActivation* activation = asActivation(slotBase); 239 JSActivation* activation = jsCast<JSActivation*>(slotBase); 240 if (activation->isTornOff()) 241 return jsUndefined(); 242 269 243 CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(activation->m_registers)); 270 int argumentsRegister = activation->m_argumentsRegister;244 int argumentsRegister = callFrame->codeBlock()->argumentsRegister(); 271 245 if (JSValue arguments = callFrame->uncheckedR(argumentsRegister).jsValue()) 272 246 return arguments;
Note:
See TracChangeset
for help on using the changeset viewer.