Ignore:
Timestamp:
Oct 4, 2010, 3:43:18 PM (15 years ago)
Author:
[email protected]
Message:

2010-10-04 Oliver Hunt <[email protected]>

Reviewed by Geoff Garen.

Lazily create activation objects
https://bugs.webkit.org/show_bug.cgi?id=47107

Make it possible to lazily create the activation object
for a function that needs one. This allows us to reduce
the overhead of entering a function that may require
an activation in some cases, but not always.

This does make exception handling a little more complex as
it's now necessary to verify that a callframes activation
has been created, and create it if not, in all of the
paths used in exception handling.

We also need to add logic to check for the existence of
the activation in the scoped_var opcodes, as well as
op_ret, op_ret_object_or_this and op_tearoff_activation
so that we can avoid creating an activation unnecesarily
on function exit.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): (JSC::CodeBlock::createActivation):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::setActivationRegister): (JSC::CodeBlock::activationRegister):
  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitNewFunctionInternal): (JSC::BytecodeGenerator::emitNewFunctionExpression): (JSC::BytecodeGenerator::createActivationIfNecessary):
  • bytecompiler/BytecodeGenerator.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::resolveSkip): (JSC::Interpreter::resolveGlobalDynamic): (JSC::Interpreter::resolveBase): (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::throwException): (JSC::Interpreter::privateExecute):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass):
  • jit/JIT.h:
  • jit/JITCall32_64.cpp: (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_ret_object_or_this):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_tear_off_activation): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_ret_object_or_this): (JSC::JIT::emit_op_create_activation): (JSC::JIT::emit_op_resolve_global_dynamic):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_tear_off_activation): (JSC::JIT::emit_op_create_activation):
  • jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r68171 r69045  
    409409            return m_argumentsRegister;
    410410        }
     411        void setActivationRegister(int activationRegister)
     412        {
     413            m_activationRegister = activationRegister;
     414        }
     415        int activationRegister()
     416        {
     417            ASSERT(needsFullScopeChain());
     418            return m_activationRegister;
     419        }
    411420        bool usesArguments() const { return m_argumentsRegister != -1; }
    412421
     
    420429        unsigned jumpTarget(int index) const { return m_jumpTargets[index]; }
    421430        unsigned lastJumpTarget() const { return m_jumpTargets.last(); }
     431
     432        void createActivation(CallFrame*);
    422433
    423434#if ENABLE(INTERPRETER)
     
    549560        int m_thisRegister;
    550561        int m_argumentsRegister;
     562        int m_activationRegister;
    551563
    552564        bool m_needsFullScopeChain;
Note: See TracChangeset for help on using the changeset viewer.