Ignore:
Timestamp:
Feb 25, 2012, 3:05:38 PM (13 years ago)
Author:
[email protected]
Message:

DFG should support activations and nested functions
https://bugs.webkit.org/show_bug.cgi?id=79554

Reviewed by Oliver Hunt.

Wrote the simplest possible implementation of activations. Big speed-up on
code that uses activations, no speed-up on major benchmarks (SunSpider, V8,
Kraken) because they do not appear to have sufficient coverage over code
that uses activations.

  • bytecode/PredictedType.cpp:

(JSC::predictionToString):
(JSC::predictionFromValue):

  • bytecode/PredictedType.h:

(JSC):
(JSC::isEmptyPrediction):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::ByteCodeParser):
(ByteCodeParser):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::buildOperandMapsIfNecessary):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGCapabilities.h:

(JSC::DFG::canCompileOpcode):
(JSC::DFG::canInlineOpcode):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::needsActivation):

  • dfg/DFGNode.h:

(DFG):
(JSC::DFG::Node::storageAccessDataIndex):
(Node):
(JSC::DFG::Node::hasFunctionDeclIndex):
(JSC::DFG::Node::functionDeclIndex):
(JSC::DFG::Node::hasFunctionExprIndex):
(JSC::DFG::Node::functionExprIndex):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileNewFunctionNoCheck):
(DFG):
(JSC::DFG::SpeculativeJIT::compileNewFunctionExpression):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r108444 r108908  
    3434#include "InlineASM.h"
    3535#include "Interpreter.h"
     36#include "JSActivation.h"
    3637#include "JSByteArray.h"
    3738#include "JSGlobalData.h"
     39#include "JSStaticScopeObject.h"
    3840#include "Operations.h"
    3941
     
    973975   
    974976    return JSValue::encode(RegExpObject::create(exec->globalData(), exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regexp));
     977}
     978
     979JSCell* DFG_OPERATION operationCreateActivation(ExecState* exec)
     980{
     981    JSGlobalData& globalData = exec->globalData();
     982    JSActivation* activation = JSActivation::create(
     983        globalData, exec, static_cast<FunctionExecutable*>(exec->codeBlock()->ownerExecutable()));
     984    exec->setScopeChain(exec->scopeChain()->push(activation));
     985    return activation;
     986}
     987
     988void DFG_OPERATION operationTearOffActivation(ExecState* exec, JSCell* activation)
     989{
     990    ASSERT(activation);
     991    ASSERT(activation->inherits(&JSActivation::s_info));
     992    static_cast<JSActivation*>(activation)->tearOff(exec->globalData());
     993}
     994
     995JSCell* DFG_OPERATION operationNewFunction(ExecState* exec, JSCell* functionExecutable)
     996{
     997    ASSERT(functionExecutable->inherits(&FunctionExecutable::s_info));
     998    return static_cast<FunctionExecutable*>(functionExecutable)->make(exec, exec->scopeChain());
     999}
     1000
     1001JSCell* DFG_OPERATION operationNewFunctionExpression(ExecState* exec, JSCell* functionExecutableAsCell)
     1002{
     1003    ASSERT(functionExecutableAsCell->inherits(&FunctionExecutable::s_info));
     1004    FunctionExecutable* functionExecutable =
     1005        static_cast<FunctionExecutable*>(functionExecutableAsCell);
     1006    JSFunction *function = functionExecutable->make(exec, exec->scopeChain());
     1007    if (!functionExecutable->name().isNull()) {
     1008        JSStaticScopeObject* functionScopeObject =
     1009            JSStaticScopeObject::create(
     1010                exec, functionExecutable->name(), function, ReadOnly | DontDelete);
     1011        function->setScope(exec->globalData(), function->scope()->push(functionScopeObject));
     1012    }
     1013    return function;
    9751014}
    9761015
Note: See TracChangeset for help on using the changeset viewer.