Ignore:
Timestamp:
Feb 28, 2011, 1:05:22 PM (14 years ago)
Author:
[email protected]
Message:

2011-02-28 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Make ScopeChainNode GC allocated
https://bugs.webkit.org/show_bug.cgi?id=55283

Simplify lifetime and other issues with the scopechain
by making it gc allocated. This allows us to simplify
function exit and unwinding, as well as making the
current iterative refcounting go away.

  • JavaScriptCore.exp:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::createActivation):
  • bytecode/StructureStubInfo.cpp:
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
  • bytecompiler/BytecodeGenerator.h:
  • debugger/Debugger.cpp: (JSC::Recompiler::operator()):
  • debugger/DebuggerCallFrame.h: (JSC::DebuggerCallFrame::scopeChain):
  • interpreter/CachedCall.h: (JSC::CachedCall::CachedCall):
  • interpreter/CallFrame.h:
  • interpreter/Interpreter.cpp: (JSC::depth): (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::throwException): (JSC::Interpreter::execute): (JSC::Interpreter::executeCall): (JSC::Interpreter::executeConstruct): (JSC::Interpreter::privateExecute):
  • jit/JITCall.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCall):
  • jit/JITCall32_64.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_ret_object_or_this): (JSC::JIT::compileOpCall):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_ret_object_or_this):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_end):
  • jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
  • jit/JITStubs.h:
  • runtime/ArgList.cpp:
  • runtime/Completion.cpp: (JSC::evaluate):
  • runtime/Completion.h:
  • runtime/DateConversion.cpp:
  • runtime/Executable.cpp: (JSC::EvalExecutable::compileInternal): (JSC::ProgramExecutable::compileInternal): (JSC::FunctionExecutable::compileForCallInternal): (JSC::FunctionExecutable::compileForConstructInternal):
  • runtime/FunctionConstructor.cpp: (JSC::constructFunction):
  • runtime/GCActivityCallbackCF.cpp:
  • runtime/Identifier.cpp:
  • runtime/JSCell.h:
  • runtime/JSChunk.cpp: Added.
  • runtime/JSChunk.h: Added.
  • runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::markChildren): (JSC::JSFunction::getCallData): (JSC::JSFunction::getOwnPropertySlot): (JSC::JSFunction::getConstructData):
  • runtime/JSFunction.h: (JSC::JSFunction::scope): (JSC::JSFunction::setScope):
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::markChildren):
  • runtime/JSGlobalObject.h: (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): (JSC::JSGlobalObject::globalScopeChain):
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval):
  • runtime/JSLock.cpp:
  • runtime/JSNumberCell.cpp:
  • runtime/JSZombie.cpp:
  • runtime/MarkedBlock.cpp:
  • runtime/MarkedSpace.cpp:
  • runtime/PropertyNameArray.cpp:
  • runtime/ScopeChain.cpp: (JSC::ScopeChainNode::print): (JSC::ScopeChainNode::localDepth): (JSC::ScopeChainNode::markChildren):
  • runtime/ScopeChain.h: (JSC::ScopeChainNode::ScopeChainNode): (JSC::ScopeChainNode::createStructure): (JSC::ScopeChainNode::push): (JSC::ScopeChainNode::pop): (JSC::ScopeChainIterator::ScopeChainIterator): (JSC::ScopeChainIterator::operator*): (JSC::ScopeChainIterator::operator->): (JSC::ScopeChainIterator::operator++): (JSC::ScopeChainNode::begin): (JSC::ScopeChainNode::end): (JSC::ExecState::globalData): (JSC::ExecState::lexicalGlobalObject): (JSC::ExecState::globalThisValue):
  • runtime/ScopeChainMark.h:
  • wtf/DateMath.cpp:

2011-02-28 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Make ScopeChainNode GC allocated
https://bugs.webkit.org/show_bug.cgi?id=55283

Update WebCore to deal with the absence of the ScopeChain
class.

  • ForwardingHeaders/runtime/ScopeChain.h: Added.
  • bindings/js/JSHTMLElementCustom.cpp: (WebCore::JSHTMLElement::pushEventHandlerScope):
  • bindings/js/JSJavaScriptCallFrameCustom.cpp: (WebCore::JSJavaScriptCallFrame::scopeChain): (WebCore::JSJavaScriptCallFrame::scopeType):
  • bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::initializeJSFunction):
  • bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::evaluate):
  • bindings/js/JSNodeCustom.cpp: (WebCore::JSNode::pushEventHandlerScope):
  • bindings/js/JavaScriptCallFrame.cpp: (WebCore::JavaScriptCallFrame::scopeChain):
  • bindings/js/JavaScriptCallFrame.h:
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/c/c_class.cpp:
  • bridge/c/c_runtime.cpp:
  • bridge/jni/JNIBridge.cpp:
  • bridge/qt/qt_runtime.cpp: (JSC::Bindings::QtConnectionObject::execute):
  • plugins/PluginViewNone.cpp:

2011-02-28 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Make ScopeChainNode GC allocated
https://bugs.webkit.org/show_bug.cgi?id=55283

More updates for the absence of the ScopeChain class

  • WebView/WebScriptDebugDelegate.mm: (-[WebScriptCallFrame scopeChain]):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r79475 r79904  
    7777
    7878// Returns the depth of the scope chain within a given call frame.
    79 static int depth(CodeBlock* codeBlock, ScopeChain& sc)
     79static int depth(CodeBlock* codeBlock, ScopeChainNode* sc)
    8080{
    8181    if (!codeBlock->needsFullScopeChain())
    8282        return 0;
    83     return sc.localDepth();
     83    return sc->localDepth();
    8484}
    8585
     
    580580    }
    581581
    582     if (oldCodeBlock->needsFullScopeChain())
    583         scopeChain->deref();
    584 
    585582    CallFrame* callerFrame = callFrame->callerFrame();
    586583    if (callerFrame->hasHostCallFrameFlag())
     
    711708    // Unwind the scope chain within the exception handler's call frame.
    712709    ScopeChainNode* scopeChain = callFrame->scopeChain();
    713     ScopeChain sc(scopeChain);
    714710    int scopeDelta = 0;
    715711    if (!codeBlock->needsFullScopeChain() || codeBlock->codeType() != FunctionCode
    716712        || callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
    717         scopeDelta = depth(codeBlock, sc) - handler->scopeDepth;
     713        scopeDelta = depth(codeBlock, scopeChain) - handler->scopeDepth;
    718714    ASSERT(scopeDelta >= 0);
    719715    while (scopeDelta--)
     
    762758    newCallFrame->uncheckedR(newCallFrame->hostThisRegister()) = JSValue(thisObj);
    763759
    764     if (codeBlock->needsFullScopeChain())
    765         scopeChain->ref();
    766 
    767     DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
     760    DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject.get());
    768761
    769762    Profiler** profiler = Profiler::enabledProfilerReference();
     
    836829        newCallFrame->init(newCodeBlock, 0, callDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, function);
    837830
    838         DynamicGlobalObjectScope globalObjectScope(newCallFrame, callDataScopeChain->globalObject);
     831        DynamicGlobalObjectScope globalObjectScope(newCallFrame, callDataScopeChain->globalObject.get());
    839832
    840833        Profiler** profiler = Profiler::enabledProfilerReference();
     
    868861    newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, function);
    869862
    870     DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject);
     863    DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject.get());
    871864
    872865    Profiler** profiler = Profiler::enabledProfilerReference();
     
    925918        newCallFrame->init(newCodeBlock, 0, constructDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor);
    926919
    927         DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject);
     920        DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject.get());
    928921
    929922        Profiler** profiler = Profiler::enabledProfilerReference();
     
    960953    newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor);
    961954
    962     DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject);
     955    DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject.get());
    963956
    964957    Profiler** profiler = Profiler::enabledProfilerReference();
     
    10771070        return checkedReturn(throwStackOverflowError(callFrame));
    10781071
    1079     DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
     1072    DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject.get());
    10801073
    10811074    JSObject* compileError = eval->compile(callFrame, scopeChain);
     
    10851078
    10861079    JSObject* variableObject;
    1087     for (ScopeChainNode* node = scopeChain; ; node = node->next) {
     1080    for (ScopeChainNode* node = scopeChain; ; node = node->next.get()) {
    10881081        ASSERT(node);
    10891082        if (node->object->isVariableObject()) {
     
    11331126    newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), codeBlock->m_numParameters, 0);
    11341127    newCallFrame->uncheckedR(newCallFrame->hostThisRegister()) = JSValue(thisObj);
    1135 
    1136     if (codeBlock->needsFullScopeChain())
    1137         scopeChain->ref();
    11381128
    11391129    Profiler** profiler = Profiler::enabledProfilerReference();
     
    38063796        if (!function->name().isNull()) {
    38073797            JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete);
    3808             func->scope().push(functionScopeObject);
     3798            func->setScope(*globalData, func->scope()->push(functionScopeObject));
    38093799        }
    38103800
     
    38363826        Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
    38373827        JSValue thisValue = argv[0].jsValue();
    3838         JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;
     3828        JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject.get();
    38393829
    38403830        if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
     
    41514141        int result = vPC[1].u.operand;
    41524142
    4153         if (callFrame->codeBlock()->needsFullScopeChain() && callFrame->r(codeBlock->activationRegister()).jsValue())
    4154             callFrame->scopeChain()->deref();
    4155 
    41564143        JSValue returnValue = callFrame->r(result).jsValue();
    41574144
     
    41924179        int result = vPC[1].u.operand;
    41934180
    4194         if (codeBlock->needsFullScopeChain() && callFrame->r(codeBlock->activationRegister()).jsValue())
    4195             callFrame->scopeChain()->deref();
    4196 
    41974181        JSValue returnValue = callFrame->r(result).jsValue();
    41984182
     
    42394223            JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable()));
    42404224            callFrame->r(activationReg) = JSValue(activation);
    4241             callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
     4225            callFrame->setScopeChain(callFrame->scopeChain()->push(activation));
    42424226        }
    42434227        vPC += OPCODE_LENGTH(op_create_activation);
     
    42784262            structure = asObject(proto)->inheritorID();
    42794263        else
    4280             structure = constructor->scope().node()->globalObject->emptyObjectStructure();
     4264            structure = constructor->scope()->globalObject->emptyObjectStructure();
    42814265        callFrame->uncheckedR(thisRegister) = constructEmptyObject(callFrame, structure);
    42824266
     
    46444628        */
    46454629
    4646         if (codeBlock->needsFullScopeChain()) {
    4647             ScopeChainNode* scopeChain = callFrame->scopeChain();
    4648             ASSERT(scopeChain->refCount > 1);
    4649             scopeChain->deref();
    4650         }
    46514630        int result = vPC[1].u.operand;
    46524631        return callFrame->r(result).jsValue();
Note: See TracChangeset for help on using the changeset viewer.