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/bytecode/CodeBlock.h

    r62677 r64790  
    276276        friend class JIT;
    277277    protected:
    278         CodeBlock(ScriptExecutable* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
     278        CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
     279
     280        JSGlobalObject* m_globalObject;
     281
    279282    public:
    280283        virtual ~CodeBlock();
     
    484487        RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
    485488
     489        JSGlobalObject* globalObject() { return m_globalObject; }
    486490
    487491        // Jump Tables
     
    603607    class GlobalCodeBlock : public CodeBlock {
    604608    public:
    605         GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject)
    606             : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false)
    607             , m_globalObject(globalObject)
     609        GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
     610            : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false)
    608611        {
    609612            m_globalObject->codeBlocks().add(this);
     
    619622
    620623    private:
    621         JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
    622624        SymbolTable m_unsharedSymbolTable;
    623625    };
     
    626628    public:
    627629        ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
    628             : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject)
     630            : GlobalCodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, 0)
    629631        {
    630632        }
     
    634636    public:
    635637        EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
    636             : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject)
     638            : GlobalCodeBlock(ownerExecutable, EvalCode, globalObject, sourceProvider, 0)
    637639            , m_baseScopeDepth(baseScopeDepth)
    638640        {
     
    660662        // symbol table, so we just pass as a raw pointer with a ref count of 1.  We then manually deref
    661663        // in the destructor.
    662         FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor)
    663             : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, SharedSymbolTable::create().releaseRef(), isConstructor)
     664        FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor)
     665            : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, SharedSymbolTable::create().releaseRef(), isConstructor)
    664666        {
    665667        }
Note: See TracChangeset for help on using the changeset viewer.