Changeset 119655 in webkit for trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
- Timestamp:
- Jun 6, 2012, 5:49:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r119441 r119655 80 80 namespace JSC { 81 81 82 const ClassInfo JSGlobalObject::s_info = { "GlobalObject", &JS VariableObject::s_info, 0, ExecState::globalObjectTable, CREATE_METHOD_TABLE(JSGlobalObject) };82 const ClassInfo JSGlobalObject::s_info = { "GlobalObject", &JSSegmentedVariableObject::s_info, 0, ExecState::globalObjectTable, CREATE_METHOD_TABLE(JSGlobalObject) }; 83 83 84 84 const GlobalObjectMethodTable JSGlobalObject::s_globalObjectMethodTable = { &allowsAccessFrom, &supportsProfiling, &supportsRichSourceInfo, &shouldInterruptScript, &javaScriptExperimentsEnabled }; … … 149 149 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); 150 150 151 if ( thisObject->symbolTablePut(exec, propertyName, value, slot.isStrictMode()))151 if (symbolTablePut(thisObject, exec, propertyName, value, slot.isStrictMode())) 152 152 return; 153 JS VariableObject::put(thisObject, exec, propertyName, value, slot);153 JSSegmentedVariableObject::put(thisObject, exec, propertyName, value, slot); 154 154 } 155 155 … … 159 159 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); 160 160 161 if ( thisObject->symbolTablePutWithAttributes(exec->globalData(), propertyName, value, attributes))161 if (symbolTablePutWithAttributes(thisObject, exec->globalData(), propertyName, value, attributes)) 162 162 return; 163 163 164 164 JSValue valueBefore = thisObject->getDirect(exec->globalData(), propertyName); 165 165 PutPropertySlot slot; 166 JS VariableObject::put(thisObject, exec, propertyName, value, slot);166 JSSegmentedVariableObject::put(thisObject, exec, propertyName, value, slot); 167 167 if (!valueBefore) { 168 168 JSValue valueAfter = thisObject->getDirect(exec->globalData(), propertyName); … … 177 177 PropertySlot slot; 178 178 // silently ignore attempts to add accessors aliasing vars. 179 if (descriptor.isAccessorDescriptor() && thisObject->symbolTableGet(propertyName, slot))179 if (descriptor.isAccessorDescriptor() && symbolTableGet(thisObject, propertyName, slot)) 180 180 return false; 181 181 return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); … … 346 346 COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); 347 347 ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); 348 JS VariableObject::visitChildren(thisObject, visitor);348 JSSegmentedVariableObject::visitChildren(thisObject, visitor); 349 349 350 350 visitIfNeeded(visitor, &thisObject->m_globalScopeChain); … … 394 394 visitIfNeeded(visitor, &thisObject->m_stringObjectStructure); 395 395 visitIfNeeded(visitor, &thisObject->m_internalFunctionStructure); 396 397 if (thisObject->m_registerArray) {398 // Outside the execution of global code, when our variables are torn off,399 // we can mark the torn-off array.400 visitor.appendValues(thisObject->m_registerArray.get(), thisObject->m_registerArraySize);401 } else if (thisObject->m_registers) {402 // During execution of global code, when our variables are in the register file,403 // the symbol table tells us how many variables there are, and registers404 // points to where they end, and the registers used for execution begin.405 visitor.appendValues(thisObject->m_registers - thisObject->symbolTable().size(), thisObject->symbolTable().size());406 }407 396 } 408 397 … … 412 401 } 413 402 414 void JSGlobalObject::resizeRegisters(size_t newSize)415 {416 // Previous duplicate symbols may have created spare capacity in m_registerArray.417 if (newSize <= m_registerArraySize)418 return;419 420 size_t oldSize = m_registerArraySize;421 OwnArrayPtr<WriteBarrier<Unknown> > registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[newSize]);422 for (size_t i = 0; i < oldSize; ++i)423 registerArray[i].set(globalData(), this, m_registerArray[i].get());424 for (size_t i = oldSize; i < newSize; ++i)425 registerArray[i].setUndefined();426 427 WriteBarrier<Unknown>* registers = registerArray.get();428 setRegisters(registers, registerArray.release(), newSize);429 }430 431 403 void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count) 432 404 { 433 resizeRegisters(symbolTable().size() +count);405 addRegisters(count); 434 406 435 407 for (int i = 0; i < count; ++i) { … … 447 419 { 448 420 JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(cell); 449 if (getStaticFunctionSlot<JS VariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, slot))421 if (getStaticFunctionSlot<JSSegmentedVariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, slot)) 450 422 return true; 451 return thisObject->symbolTableGet(propertyName, slot);423 return symbolTableGet(thisObject, propertyName, slot); 452 424 } 453 425 … … 455 427 { 456 428 JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); 457 if (getStaticFunctionDescriptor<JS VariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, descriptor))429 if (getStaticFunctionDescriptor<JSSegmentedVariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, descriptor)) 458 430 return true; 459 return thisObject->symbolTableGet(propertyName, descriptor);431 return symbolTableGet(thisObject, propertyName, descriptor); 460 432 } 461 433
Note:
See TracChangeset
for help on using the changeset viewer.