[turbofan] Carefully update frame states during inlining.
authorbmeurer <bmeurer@chromium.org>
Tue, 19 May 2015 09:11:30 +0000 (02:11 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 19 May 2015 09:11:12 +0000 (09:11 +0000)
During inlining we should pay attention to only rewire the outer frame
states of the inlinee, but leave any inner frame states of the inlinee
untouched.  Otherwise we might run into trouble once we start caching
graphs, or do getter/setter inlining.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1134973006

Cr-Commit-Position: refs/heads/master@{#28466}

src/compiler/js-inlining.cc

index 66d71a6..90c6eec 100644 (file)
@@ -351,10 +351,15 @@ Reduction JSInliner::Reduce(Node* node) {
     outer_frame_state = CreateArgumentsAdaptorFrameState(&call, info.zone());
   }
 
-  for (Node* node : visitor.copies()) {
-    if (node && node->opcode() == IrOpcode::kFrameState) {
+  // Fix up all outer frame states from the inlinee.
+  for (Node* const node : visitor.copies()) {
+    if (node->opcode() == IrOpcode::kFrameState) {
       DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
-      NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state);
+      // Don't touch this frame state, if it already has an "outer frame state".
+      if (NodeProperties::GetFrameStateInput(node, 0)->opcode() !=
+          IrOpcode::kFrameState) {
+        NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state);
+      }
     }
   }