Ignore:
Timestamp:
Nov 13, 2012, 11:22:57 PM (13 years ago)
Author:
[email protected]
Message:

DFG CreateThis should be able to statically account for the structure of the object it creates, if profiling indicates that this structure is always the same
https://bugs.webkit.org/show_bug.cgi?id=102017

Reviewed by Geoffrey Garen.

This adds a watchpoint in JSFunction on the cached inheritor ID. It also changes
NewObject to take a structure as an operand (previously it implicitly used the owning
global object's empty object structure). Any GetCallee where the callee is predictable
is turned into a CheckFunction + WeakJSConstant, and any CreateThis on a WeakJSConstant
where the inheritor ID watchpoint is still valid is turned into an InheritorIDWatchpoint
followed by a NewObject. NewObject already accounts for the structure it uses for object
creation in the CFA.

  • dfg/DFGAbstractState.cpp:

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

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::checkFunctionElimination):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGNode.h:

(JSC::DFG::Node::hasFunction):
(JSC::DFG::Node::function):
(JSC::DFG::Node::hasStructure):

  • dfg/DFGNodeType.h:

(DFG):

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

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

  • dfg/DFGSpeculativeJIT.h:

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

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • runtime/Executable.h:

(JSC::JSFunction::JSFunction):

  • runtime/JSBoundFunction.cpp:

(JSC):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::JSFunction):
(JSC::JSFunction::put):
(JSC::JSFunction::defineOwnProperty):

  • runtime/JSFunction.h:

(JSC::JSFunction::tryGetKnownInheritorID):
(JSFunction):
(JSC::JSFunction::addInheritorIDWatchpoint):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSFunction.h

    r134460 r134555  
    2828#include "JSDestructibleObject.h"
    2929#include "JSScope.h"
     30#include "Watchpoint.h"
    3031
    3132namespace JSC {
     
    133134        }
    134135
     136        Structure* tryGetKnownInheritorID()
     137        {
     138            if (!m_cachedInheritorID)
     139                return 0;
     140            if (m_inheritorIDWatchpoint.hasBeenInvalidated())
     141                return 0;
     142            return m_cachedInheritorID.get();
     143        }
     144       
     145        void addInheritorIDWatchpoint(Watchpoint* watchpoint)
     146        {
     147            ASSERT(tryGetKnownInheritorID());
     148            m_inheritorIDWatchpoint.add(watchpoint);
     149        }
     150
    135151        static size_t offsetOfCachedInheritorID()
    136152        {
     
    173189        WriteBarrier<JSScope> m_scope;
    174190        WriteBarrier<Structure> m_cachedInheritorID;
     191        InlineWatchpointSet m_inheritorIDWatchpoint;
    175192    };
    176193
Note: See TracChangeset for help on using the changeset viewer.