Changeset 64790 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Aug 5, 2010, 3:22:49 PM (15 years ago)
Author:
[email protected]
Message:

2010-08-05 Nathan Lawrence <[email protected]>

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=43464

Currently, the global object is being embedded in the JavaScriptCore
bytecode, however since the global object is the same for all opcodes
in a code block, we can have the global object just be a member of the
associated code block.

Additionally, I added an assert inside of emitOpcode that verifies
that the last generated opcode was of the correct length.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::markAggregate):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::globalObject): (JSC::GlobalCodeBlock::GlobalCodeBlock): (JSC::ProgramCodeBlock::ProgramCodeBlock): (JSC::EvalCodeBlock::EvalCodeBlock): (JSC::FunctionCodeBlock::FunctionCodeBlock):
  • bytecode/Opcode.h: (JSC::opcodeLength):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitOpcode):

Added an assert to check that the last generated opcode is the
correct length.

(JSC::BytecodeGenerator::rewindBinaryOp):

Changed the last opcode to op_end since the length will no longer
be correct.

(JSC::BytecodeGenerator::rewindUnaryOp):

Changed the last opcode to op_end since the length will no longer
be correct.

(JSC::BytecodeGenerator::emitResolve):
(JSC::BytecodeGenerator::emitGetScopedVar):
(JSC::BytecodeGenerator::emitPutScopedVar):
(JSC::BytecodeGenerator::emitResolveWithBase):

  • bytecompiler/BytecodeGenerator.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::resolveGlobal): (JSC::Interpreter::resolveGlobalDynamic): (JSC::Interpreter::privateExecute):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_get_global_var): (JSC::JIT::emit_op_put_global_var): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emitSlow_op_resolve_global): (JSC::JIT::emit_op_resolve_global_dynamic): (JSC::JIT::emitSlow_op_resolve_global_dynamic):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_get_global_var): (JSC::JIT::emit_op_put_global_var): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emitSlow_op_resolve_global):
  • jit/JITStubs.cpp: (JSC::cti_op_resolve_global):
  • runtime/Executable.cpp: (JSC::FunctionExecutable::compileForCallInternal): (JSC::FunctionExecutable::compileForConstructInternal): (JSC::FunctionExecutable::reparseExceptionInfo):
File:
1 edited

Legend:

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

    r63267 r64790  
    145145{
    146146    int dst = vPC[1].u.operand;
    147     JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
     147    CodeBlock* codeBlock = callFrame->codeBlock();
     148    JSGlobalObject* globalObject = codeBlock->globalObject();
    148149    ASSERT(globalObject->isGlobalObject());
    149     int property = vPC[3].u.operand;
    150     Structure* structure = vPC[4].u.structure;
    151     int offset = vPC[5].u.operand;
     150    int property = vPC[2].u.operand;
     151    Structure* structure = vPC[3].u.structure;
     152    int offset = vPC[4].u.operand;
    152153
    153154    if (structure == globalObject->structure()) {
     
    156157    }
    157158
    158     CodeBlock* codeBlock = callFrame->codeBlock();
    159159    Identifier& ident = codeBlock->identifier(property);
    160160    PropertySlot slot(globalObject);
     
    162162        JSValue result = slot.getValue(callFrame, ident);
    163163        if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    164             if (vPC[4].u.structure)
    165                 vPC[4].u.structure->deref();
     164            if (vPC[3].u.structure)
     165                vPC[3].u.structure->deref();
    166166            globalObject->structure()->ref();
    167             vPC[4] = globalObject->structure();
    168             vPC[5] = slot.cachedOffset();
     167            vPC[3] = globalObject->structure();
     168            vPC[4] = slot.cachedOffset();
    169169            callFrame->r(dst) = JSValue(result);
    170170            return true;
     
    185185{
    186186    int dst = vPC[1].u.operand;
    187     JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
     187    CodeBlock* codeBlock = callFrame->codeBlock();
     188    JSGlobalObject* globalObject = codeBlock->globalObject();
    188189    ASSERT(globalObject->isGlobalObject());
    189     int property = vPC[3].u.operand;
    190     Structure* structure = vPC[4].u.structure;
    191     int offset = vPC[5].u.operand;
    192     CodeBlock* codeBlock = callFrame->codeBlock();
    193     int skip = vPC[6].u.operand;
     190    int property = vPC[2].u.operand;
     191    Structure* structure = vPC[3].u.structure;
     192    int offset = vPC[4].u.operand;
     193    int skip = vPC[5].u.operand;
    194194   
    195195    ScopeChainNode* scopeChain = callFrame->scopeChain();
     
    232232        JSValue result = slot.getValue(callFrame, ident);
    233233        if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    234             if (vPC[4].u.structure)
    235                 vPC[4].u.structure->deref();
     234            if (vPC[3].u.structure)
     235                vPC[3].u.structure->deref();
    236236            globalObject->structure()->ref();
    237             vPC[4] = globalObject->structure();
    238             vPC[5] = slot.cachedOffset();
     237            vPC[3] = globalObject->structure();
     238            vPC[4] = slot.cachedOffset();
    239239            callFrame->r(dst) = JSValue(result);
    240240            return true;
     
    22852285         */
    22862286        int dst = vPC[1].u.operand;
    2287         JSGlobalObject* scope = static_cast<JSGlobalObject*>(vPC[2].u.jsCell);
     2287        JSGlobalObject* scope = codeBlock->globalObject();
    22882288        ASSERT(scope->isGlobalObject());
    2289         int index = vPC[3].u.operand;
     2289        int index = vPC[2].u.operand;
    22902290
    22912291        callFrame->r(dst) = scope->registerAt(index);
     
    22982298           Puts value into global slot index.
    22992299         */
    2300         JSGlobalObject* scope = static_cast<JSGlobalObject*>(vPC[1].u.jsCell);
     2300        JSGlobalObject* scope = codeBlock->globalObject();
    23012301        ASSERT(scope->isGlobalObject());
    2302         int index = vPC[2].u.operand;
    2303         int value = vPC[3].u.operand;
     2302        int index = vPC[1].u.operand;
     2303        int value = vPC[2].u.operand;
    23042304       
    23052305        scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
Note: See TracChangeset for help on using the changeset viewer.