Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (188770 => 188771)
--- trunk/Source/_javascript_Core/ChangeLog 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-08-21 20:48:59 UTC (rev 188771)
@@ -1,3 +1,27 @@
+2015-08-21 Filip Pizlo <[email protected]>
+
+ DFG::NodeOrigin should have a flag determining if exiting is OK right now
+ https://bugs.webkit.org/show_bug.cgi?id=148323
+
+ Reviewed by Saam Barati.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::currentNodeOrigin):
+ (JSC::DFG::ByteCodeParser::branchData):
+ * dfg/DFGInsertionSet.h:
+ (JSC::DFG::InsertionSet::insertConstant):
+ (JSC::DFG::InsertionSet::insertConstantForUse):
+ (JSC::DFG::InsertionSet::insertBottomConstantForUse):
+ * dfg/DFGIntegerCheckCombiningPhase.cpp:
+ (JSC::DFG::IntegerCheckCombiningPhase::handleBlock):
+ * dfg/DFGLICMPhase.cpp:
+ (JSC::DFG::LICMPhase::attemptHoist):
+ * dfg/DFGNodeOrigin.h:
+ (JSC::DFG::NodeOrigin::NodeOrigin):
+ (JSC::DFG::NodeOrigin::isSet):
+ (JSC::DFG::NodeOrigin::withSemantic):
+ * dfg/DFGObjectAllocationSinkingPhase.cpp:
+
2015-08-21 Saam barati <[email protected]>
DFG callOperations should not implicitly emit an exception check. At callOperation call sites, we should explicitly emit exception checks
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (188770 => 188771)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2015-08-21 20:48:59 UTC (rev 188771)
@@ -653,9 +653,13 @@
{
// FIXME: We should set the forExit origin only on those nodes that can exit.
// https://bugs.webkit.org/show_bug.cgi?id=145204
+ CodeOrigin semantic;
if (m_currentSemanticOrigin.isSet())
- return NodeOrigin(m_currentSemanticOrigin, currentCodeOrigin());
- return NodeOrigin(currentCodeOrigin());
+ semantic = m_currentSemanticOrigin;
+ else
+ semantic = currentCodeOrigin();
+
+ return NodeOrigin(semantic, currentCodeOrigin(), true);
}
BranchData* branchData(unsigned taken, unsigned notTaken)
Modified: trunk/Source/_javascript_Core/dfg/DFGInsertionSet.h (188770 => 188771)
--- trunk/Source/_javascript_Core/dfg/DFGInsertionSet.h 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/dfg/DFGInsertionSet.h 2015-08-21 20:48:59 UTC (rev 188771)
@@ -71,12 +71,6 @@
index, speculationFromValue(value->value()), op, origin, OpInfo(value));
}
- Node* insertConstant(
- size_t index, CodeOrigin origin, FrozenValue* value, NodeType op = JSConstant)
- {
- return insertConstant(index, NodeOrigin(origin), value, op);
- }
-
Edge insertConstantForUse(
size_t index, NodeOrigin origin, FrozenValue* value, UseKind useKind)
{
@@ -90,32 +84,16 @@
return Edge(insertConstant(index, origin, value, op), useKind);
}
- Edge insertConstantForUse(
- size_t index, CodeOrigin origin, FrozenValue* value, UseKind useKind)
- {
- return insertConstantForUse(index, NodeOrigin(origin), value, useKind);
- }
-
Node* insertConstant(size_t index, NodeOrigin origin, JSValue value, NodeType op = JSConstant)
{
return insertConstant(index, origin, m_graph.freeze(value), op);
}
- Node* insertConstant(size_t index, CodeOrigin origin, JSValue value, NodeType op = JSConstant)
- {
- return insertConstant(index, origin, m_graph.freeze(value), op);
- }
-
Edge insertConstantForUse(size_t index, NodeOrigin origin, JSValue value, UseKind useKind)
{
return insertConstantForUse(index, origin, m_graph.freeze(value), useKind);
}
- Edge insertConstantForUse(size_t index, CodeOrigin origin, JSValue value, UseKind useKind)
- {
- return insertConstantForUse(index, NodeOrigin(origin), value, useKind);
- }
-
Edge insertBottomConstantForUse(size_t index, NodeOrigin origin, UseKind useKind)
{
if (isDouble(useKind))
Modified: trunk/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp (188770 => 188771)
--- trunk/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp 2015-08-21 20:48:59 UTC (rev 188771)
@@ -233,18 +233,15 @@
// Do the hoisting.
if (!range.m_hoisted) {
+ NodeOrigin minOrigin = node->origin.withSemantic(range.m_minOrigin);
+ NodeOrigin maxOrigin = node->origin.withSemantic(range.m_maxOrigin);
+
switch (data.m_key.m_kind) {
case Addition: {
- if (range.m_minBound < 0) {
- insertAdd(
- nodeIndex, NodeOrigin(range.m_minOrigin, node->origin.forExit),
- data.m_key.m_source, range.m_minBound);
- }
- if (range.m_maxBound > 0) {
- insertAdd(
- nodeIndex, NodeOrigin(range.m_maxOrigin, node->origin.forExit),
- data.m_key.m_source, range.m_maxBound);
- }
+ if (range.m_minBound < 0)
+ insertAdd(nodeIndex, minOrigin, data.m_key.m_source, range.m_minBound);
+ if (range.m_maxBound > 0)
+ insertAdd(nodeIndex, maxOrigin, data.m_key.m_source, range.m_maxBound);
break;
}
@@ -255,14 +252,14 @@
if (!data.m_key.m_source) {
minNode = 0;
maxNode = m_insertionSet.insertConstant(
- nodeIndex, range.m_maxOrigin, jsNumber(range.m_maxBound));
+ nodeIndex, maxOrigin, jsNumber(range.m_maxBound));
} else {
minNode = insertAdd(
- nodeIndex, NodeOrigin(range.m_minOrigin, node->origin.forExit),
- data.m_key.m_source, range.m_minBound, Arith::Unchecked);
+ nodeIndex, minOrigin, data.m_key.m_source, range.m_minBound,
+ Arith::Unchecked);
maxNode = insertAdd(
- nodeIndex, NodeOrigin(range.m_maxOrigin, node->origin.forExit),
- data.m_key.m_source, range.m_maxBound, Arith::Unchecked);
+ nodeIndex, maxOrigin, data.m_key.m_source, range.m_maxBound,
+ Arith::Unchecked);
}
if (minNode) {
Modified: trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp (188770 => 188771)
--- trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2015-08-21 20:48:59 UTC (rev 188771)
@@ -287,9 +287,7 @@
data.preHeader->insertBeforeTerminal(node);
node->owner = data.preHeader;
NodeOrigin originalOrigin = node->origin;
- node->origin.forExit = data.preHeader->terminal()->origin.forExit;
- if (!node->origin.semantic.isSet())
- node->origin.semantic = node->origin.forExit;
+ node->origin = data.preHeader->terminal()->origin.withSemantic(node->origin.semantic);
// Modify the states at the end of the preHeader of the loop we hoisted to,
// and all pre-headers inside the loop.
Modified: trunk/Source/_javascript_Core/dfg/DFGNodeOrigin.h (188770 => 188771)
--- trunk/Source/_javascript_Core/dfg/DFGNodeOrigin.h 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/dfg/DFGNodeOrigin.h 2015-08-21 20:48:59 UTC (rev 188771)
@@ -35,29 +35,37 @@
struct NodeOrigin {
NodeOrigin() { }
- explicit NodeOrigin(CodeOrigin codeOrigin)
- : semantic(codeOrigin)
- , forExit(codeOrigin)
- {
- }
-
- NodeOrigin(CodeOrigin semantic, CodeOrigin forExit)
+ NodeOrigin(CodeOrigin semantic, CodeOrigin forExit, bool exitOK)
: semantic(semantic)
, forExit(forExit)
+ , exitOK(exitOK)
{
}
-
+
bool isSet() const
{
ASSERT(semantic.isSet() == forExit.isSet());
return semantic.isSet();
}
+ NodeOrigin withSemantic(CodeOrigin semantic)
+ {
+ if (!isSet())
+ return NodeOrigin();
+
+ NodeOrigin result = *this;
+ if (semantic.isSet())
+ result.semantic = semantic;
+ return result;
+ }
+
// Used for determining what bytecode this came from. This is important for
// debugging, exceptions, and even basic execution semantics.
CodeOrigin semantic;
// Code origin for where the node exits to.
CodeOrigin forExit;
+ // Whether or not it is legal to exit here.
+ bool exitOK { false };
};
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/dfg/DFGObjectAllocationSinkingPhase.cpp (188770 => 188771)
--- trunk/Source/_javascript_Core/dfg/DFGObjectAllocationSinkingPhase.cpp 2015-08-21 20:00:48 UTC (rev 188770)
+++ trunk/Source/_javascript_Core/dfg/DFGObjectAllocationSinkingPhase.cpp 2015-08-21 20:48:59 UTC (rev 188771)
@@ -1483,9 +1483,7 @@
return m_graph.addNode(
allocation.identifier()->prediction(), Node::VarArg, MaterializeNewObject,
- NodeOrigin(
- allocation.identifier()->origin.semantic,
- where->origin.forExit),
+ where->origin.withSemantic(allocation.identifier()->origin.semantic),
OpInfo(set), OpInfo(data), 0, 0);
}
@@ -1497,9 +1495,8 @@
return m_graph.addNode(
allocation.identifier()->prediction(), nodeType,
- NodeOrigin(
- allocation.identifier()->origin.semantic,
- where->origin.forExit),
+ where->origin.withSemantic(
+ allocation.identifier()->origin.semantic),
OpInfo(executable));
break;
}
@@ -1510,9 +1507,8 @@
return m_graph.addNode(
allocation.identifier()->prediction(), Node::VarArg, MaterializeCreateActivation,
- NodeOrigin(
- allocation.identifier()->origin.semantic,
- where->origin.forExit),
+ where->origin.withSemantic(
+ allocation.identifier()->origin.semantic),
OpInfo(symbolTable), OpInfo(data), 0, 0);
}
@@ -2093,11 +2089,7 @@
if (base->isPhantomAllocation()) {
return PromotedHeapLocation(base, location.descriptor()).createHint(
- m_graph,
- NodeOrigin(
- base->origin.semantic,
- where->origin.forExit),
- value);
+ m_graph, where->origin.withSemantic(base->origin.semantic), value);
}
switch (location.kind()) {
@@ -2160,9 +2152,7 @@
return m_graph.addNode(
SpecNone,
MultiPutByOffset,
- NodeOrigin(
- base->origin.semantic,
- where->origin.forExit),
+ where->origin.withSemantic(base->origin.semantic),
OpInfo(data),
Edge(base, KnownCellUse),
value->defaultEdge());
@@ -2173,9 +2163,7 @@
return m_graph.addNode(
SpecNone,
PutClosureVar,
- NodeOrigin(
- base->origin.semantic,
- where->origin.forExit),
+ where->origin.withSemantic(base->origin.semantic),
OpInfo(location.info()),
Edge(base, KnownCellUse),
value->defaultEdge());