Title: [181487] trunk/Source/_javascript_Core
- Revision
- 181487
- Author
- [email protected]
- Date
- 2015-03-13 13:18:08 -0700 (Fri, 13 Mar 2015)
Log Message
DFG::PutStackSinkingPhase should eliminate GetStacks that have an obviously known source
https://bugs.webkit.org/show_bug.cgi?id=141624
Reviewed by Oliver Hunt.
This was an obvious omission from the original PutStackSinkingPhase. Previously, we would treat
GetStacks conservatively and assume that the stack slot escaped. That's pretty dumb, since a
GetStack is a local load of the stack. This change makes GetStack a no-op from the standpoint of
this phase's deferral analysis. At the end we either keep the GetStack (if there was no concrete
deferral) or we replace it with an identity over the value that would have been stored by the
deferred PutStack. Note that this might be a Phi that the phase creates, so this is strictly
stronger than what GCSE could do.
This is probably not a speed-up now, but it will be very useful for the varargs simplification
done in bug 141174.
* dfg/DFGPutStackSinkingPhase.cpp:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (181486 => 181487)
--- trunk/Source/_javascript_Core/ChangeLog 2015-03-13 20:14:39 UTC (rev 181486)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-03-13 20:18:08 UTC (rev 181487)
@@ -1,3 +1,23 @@
+2015-03-13 Filip Pizlo <[email protected]>
+
+ DFG::PutStackSinkingPhase should eliminate GetStacks that have an obviously known source
+ https://bugs.webkit.org/show_bug.cgi?id=141624
+
+ Reviewed by Oliver Hunt.
+
+ This was an obvious omission from the original PutStackSinkingPhase. Previously, we would treat
+ GetStacks conservatively and assume that the stack slot escaped. That's pretty dumb, since a
+ GetStack is a local load of the stack. This change makes GetStack a no-op from the standpoint of
+ this phase's deferral analysis. At the end we either keep the GetStack (if there was no concrete
+ deferral) or we replace it with an identity over the value that would have been stored by the
+ deferred PutStack. Note that this might be a Phi that the phase creates, so this is strictly
+ stronger than what GCSE could do.
+
+ This is probably not a speed-up now, but it will be very useful for the varargs simplification
+ done in bug 141174.
+
+ * dfg/DFGPutStackSinkingPhase.cpp:
+
2015-03-12 Geoffrey Garen <[email protected]>
Prohibit GC while sweeping
Modified: trunk/Source/_javascript_Core/dfg/DFGPutStackSinkingPhase.cpp (181486 => 181487)
--- trunk/Source/_javascript_Core/dfg/DFGPutStackSinkingPhase.cpp 2015-03-13 20:14:39 UTC (rev 181486)
+++ trunk/Source/_javascript_Core/dfg/DFGPutStackSinkingPhase.cpp 2015-03-13 20:18:08 UTC (rev 181487)
@@ -221,6 +221,12 @@
continue;
}
+ if (node->op() == GetStack) {
+ // A GetStack doesn't affect anything, since we know which local we are reading
+ // from.
+ continue;
+ }
+
auto escapeHandler = [&] (VirtualRegister operand) {
if (operand.isHeader())
return;
@@ -390,6 +396,28 @@
deferred.operand(node->unlinkedLocal()) = ConflictingFlush;
break;
}
+
+ case GetStack: {
+ StackAccessData* data = ""
+ FlushFormat format = deferred.operand(data->local);
+ if (!isConcrete(format)) {
+ // This means there is no deferral. No deferral means that the most
+ // authoritative value for this stack slot is what is stored in the stack. So,
+ // keep the GetStack.
+ break;
+ }
+
+ // We have a concrete deferral, which means a PutStack that hasn't executed yet. It
+ // would have stored a value with a certain format. That format must match our
+ // format. But more importantly, we can simply use the value that the PutStack would
+ // have stored and get rid of the GetStack.
+ DFG_ASSERT(m_graph, node, format == data->format);
+
+ Node* incoming = mapping.operand(data->local);
+ node->convertToIdentity();
+ node->child1() = incoming->defaultEdge();
+ break;
+ }
default: {
auto escapeHandler = [&] (VirtualRegister operand) {
@@ -418,16 +446,6 @@
preciseLocalClobberize(
m_graph, node, escapeHandler, escapeHandler,
[&] (VirtualRegister, Node*) { });
-
- // If we're a GetStack, then we also create a mapping.
- // FIXME: We should be able to just eliminate such GetLocals, when we know
- // what their incoming value will be.
- // https://bugs.webkit.org/show_bug.cgi?id=141624
- if (node->op() == GetStack) {
- StackAccessData* data = ""
- VirtualRegister operand = data->local;
- mapping.operand(operand) = node;
- }
break;
} }
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes