Changeset 68171 in webkit for trunk/JavaScriptCore/parser


Ignore:
Timestamp:
Sep 23, 2010, 11:49:56 AM (15 years ago)
Author:
[email protected]
Message:

Only copy captured variables into activation
https://bugs.webkit.org/show_bug.cgi?id=46330

Reviewed by Geoff Garen

We now track free variable information which means that
we no longer need to copy every variable defined in a
function. With this patch activations only retain those
variables needed for correctness. In order to interact
safely with the inspector this means that JSActivation
now provides its own lookup functions so it can avoid
trying to read or write to variables that have been
optimised out.

  • bytecode/CodeBlock.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):

  • parser/Nodes.h:

(JSC::ScopeNode::capturedVariableCount):
(JSC::ScopeNode::captures):

  • runtime/Arguments.h:

(JSC::JSActivation::copyRegisters):

  • runtime/Executable.cpp:

(JSC::FunctionExecutable::FunctionExecutable):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

  • runtime/Executable.h:

(JSC::FunctionExecutable::capturedVariableCount):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::markChildren):
(JSC::JSActivation::symbolTableGet):
(JSC::JSActivation::symbolTablePut):
(JSC::JSActivation::getOwnPropertyNames):
(JSC::JSActivation::symbolTablePutWithAttributes):

  • runtime/JSActivation.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Nodes.h

    r67583 r68171  
    14151415        bool needsActivation() const { ASSERT(m_data); return (hasCapturedVariables()) || (m_features & (EvalFeature | WithFeature | CatchFeature)); }
    14161416        bool hasCapturedVariables() const { return !!m_data->m_capturedVariables.size(); }
     1417        size_t capturedVariableCount() const { return m_data->m_capturedVariables.size(); }
     1418        bool captures(const Identifier& ident) { return m_data->m_capturedVariables.contains(ident.impl()); }
    14171419
    14181420        VarStack& varStack() { ASSERT(m_data); return m_data->m_varStack; }
Note: See TracChangeset for help on using the changeset viewer.