diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp')
| -rw-r--r-- | Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp b/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp index 5e5a1504c..4f82d15fa 100644 --- a/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Apple Inc. All rights reserved. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,7 @@ #include "DFGGraph.h" #include "DFGLoopPreHeaderCreationPhase.h" #include "DFGPhase.h" -#include "JSCInlines.h" +#include "Operations.h" namespace JSC { namespace DFG { @@ -54,7 +54,7 @@ public: RELEASE_ASSERT(bytecodeIndex != UINT_MAX); // Needed by createPreHeader(). - m_graph.ensureDominators(); + m_graph.m_dominators.computeIfNecessary(m_graph); CodeBlock* baseline = m_graph.m_profiledBlock; @@ -63,12 +63,9 @@ public: BasicBlock* block = m_graph.block(blockIndex); if (!block) continue; - unsigned nodeIndex = 0; Node* firstNode = block->at(0); - while (firstNode->isSemanticallySkippable()) - firstNode = block->at(++nodeIndex); if (firstNode->op() == LoopHint - && firstNode->origin.semantic == CodeOrigin(bytecodeIndex)) { + && firstNode->codeOrigin == CodeOrigin(bytecodeIndex)) { target = block; break; } @@ -83,34 +80,8 @@ public: BlockInsertionSet insertionSet(m_graph); - // We say that the execution count of the entry block is 1, because we know for sure - // that this must be the case. Under our definition of executionCount, "1" means "once - // per invocation". We could have said NaN here, since that would ask any clients of - // executionCount to use best judgement - but that seems unnecessary since we know for - // sure what the executionCount should be in this case. - BasicBlock* newRoot = insertionSet.insert(0, 1); - - // We'd really like to use an unset origin, but ThreadedCPS won't allow that. - NodeOrigin origin = NodeOrigin(CodeOrigin(0), CodeOrigin(0), false); - - Vector<Node*> locals(baseline->m_numCalleeLocals); - for (int local = 0; local < baseline->m_numCalleeLocals; ++local) { - Node* previousHead = target->variablesAtHead.local(local); - if (!previousHead) - continue; - VariableAccessData* variable = previousHead->variableAccessData(); - locals[local] = newRoot->appendNode( - m_graph, variable->prediction(), ExtractOSREntryLocal, origin, - OpInfo(variable->local().offset())); - - newRoot->appendNode( - m_graph, SpecNone, MovHint, origin, OpInfo(variable->local().offset()), - Edge(locals[local])); - } - - // Now use the origin of the target, since it's not OK to exit, and we will probably hoist - // type checks to here. - origin = target->at(0)->origin; + BasicBlock* newRoot = insertionSet.insert(0); + CodeOrigin codeOrigin = target->at(0)->codeOrigin; for (int argument = 0; argument < baseline->numParameters(); ++argument) { Node* oldNode = target->variablesAtHead.argument(argument); @@ -119,23 +90,36 @@ public: oldNode = m_graph.m_arguments[argument]; } Node* node = newRoot->appendNode( - m_graph, SpecNone, SetArgument, origin, + m_graph, SpecNone, SetArgument, codeOrigin, OpInfo(oldNode->variableAccessData())); m_graph.m_arguments[argument] = node; } - - for (int local = 0; local < baseline->m_numCalleeLocals; ++local) { + Vector<Node*> locals(baseline->m_numCalleeRegisters); + for (int local = 0; local < baseline->m_numCalleeRegisters; ++local) { + Node* previousHead = target->variablesAtHead.local(local); + if (!previousHead) + continue; + VariableAccessData* variable = previousHead->variableAccessData(); + locals[local] = newRoot->appendNode( + m_graph, variable->prediction(), ExtractOSREntryLocal, codeOrigin, + OpInfo(variable->local().offset())); + + newRoot->appendNode( + m_graph, SpecNone, MovHint, codeOrigin, OpInfo(variable->local().offset()), + Edge(locals[local])); + } + for (int local = 0; local < baseline->m_numCalleeRegisters; ++local) { Node* previousHead = target->variablesAtHead.local(local); if (!previousHead) continue; VariableAccessData* variable = previousHead->variableAccessData(); Node* node = locals[local]; newRoot->appendNode( - m_graph, SpecNone, SetLocal, origin, OpInfo(variable), Edge(node)); + m_graph, SpecNone, SetLocal, codeOrigin, OpInfo(variable), Edge(node)); } newRoot->appendNode( - m_graph, SpecNone, Jump, origin, + m_graph, SpecNone, Jump, codeOrigin, OpInfo(createPreHeader(m_graph, insertionSet, target))); insertionSet.execute(); |
