Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: test/unittests/compiler/escape-analysis-unittest.cc

Issue 1485183002: [turbofan] Deopt support for escape analysis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ea-local
Patch Set: Rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/escape-analysis-unittest.cc
diff --git a/test/unittests/compiler/escape-analysis-unittest.cc b/test/unittests/compiler/escape-analysis-unittest.cc
index 1ea140651f70093baa6f43b2e6cb257f04ceb45c..23df8c811fce67de9e6d06c820fa8eba65ee727f 100644
--- a/test/unittests/compiler/escape-analysis-unittest.cc
+++ b/test/unittests/compiler/escape-analysis-unittest.cc
@@ -300,6 +300,90 @@ TEST_F(EscapeAnalysisTest, DanglingLoadOrder) {
ASSERT_EQ(object1, NodeProperties::GetValueInput(result, 0));
}
+
+TEST_F(EscapeAnalysisTest, DeoptReplacement) {
+ Node* object1 = Constant(1);
+ BeginRegion();
+ Node* allocation = Allocate(Constant(kPointerSize));
+ Store(AccessAtIndex(0), allocation, object1);
+ Node* finish = FinishRegion(allocation);
+ Node* effect1 = Store(AccessAtIndex(0), allocation, object1, finish);
+ Branch();
+ Node* ifFalse = IfFalse();
+ Node* state_values1 = graph()->NewNode(common()->StateValues(1), finish);
+ Node* state_values2 = graph()->NewNode(common()->StateValues(0));
+ Node* state_values3 = graph()->NewNode(common()->StateValues(0));
+ Node* frame_state = graph()->NewNode(
+ common()->FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(),
+ nullptr),
+ state_values1, state_values2, state_values3, UndefinedConstant(),
+ graph()->start(), graph()->start());
+ Node* deopt = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
+ frame_state, effect1, ifFalse);
+ Node* ifTrue = IfTrue();
+ Node* load = Load(AccessAtIndex(0), finish, effect1, ifTrue);
+ Node* result = Return(load, effect1, ifTrue);
+ EndGraph();
+ graph()->end()->AppendInput(zone(), deopt);
+ Analysis();
+
+ ExpectVirtual(allocation);
+ ExpectReplacement(load, object1);
+
+ Transformation();
+
+ ASSERT_EQ(object1, NodeProperties::GetValueInput(result, 0));
+ Node* object_state = NodeProperties::GetValueInput(state_values1, 0);
+ ASSERT_EQ(object_state->opcode(), IrOpcode::kObjectState);
+ ASSERT_EQ(1, object_state->op()->ValueInputCount());
+ ASSERT_EQ(object1, NodeProperties::GetValueInput(object_state, 0));
+}
+
+
+TEST_F(EscapeAnalysisTest, DeoptReplacementIdentity) {
+ Node* object1 = Constant(1);
+ BeginRegion();
+ Node* allocation = Allocate(Constant(kPointerSize * 2));
+ Store(AccessAtIndex(0), allocation, object1);
+ Store(AccessAtIndex(kPointerSize), allocation, allocation);
+ Node* finish = FinishRegion(allocation);
+ Node* effect1 = Store(AccessAtIndex(0), allocation, object1, finish);
+ Branch();
+ Node* ifFalse = IfFalse();
+ Node* state_values1 = graph()->NewNode(common()->StateValues(1), finish);
+ Node* state_values2 = graph()->NewNode(common()->StateValues(1), finish);
+ Node* state_values3 = graph()->NewNode(common()->StateValues(0));
+ Node* frame_state = graph()->NewNode(
+ common()->FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(),
+ nullptr),
+ state_values1, state_values2, state_values3, UndefinedConstant(),
+ graph()->start(), graph()->start());
+ Node* deopt = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
+ frame_state, effect1, ifFalse);
+ Node* ifTrue = IfTrue();
+ Node* load = Load(AccessAtIndex(0), finish, effect1, ifTrue);
+ Node* result = Return(load, effect1, ifTrue);
+ EndGraph();
+ graph()->end()->AppendInput(zone(), deopt);
+ Analysis();
+
+ ExpectVirtual(allocation);
+ ExpectReplacement(load, object1);
+
+ Transformation();
+
+ ASSERT_EQ(object1, NodeProperties::GetValueInput(result, 0));
+
+ Node* object_state = NodeProperties::GetValueInput(state_values1, 0);
+ ASSERT_EQ(object_state->opcode(), IrOpcode::kObjectState);
+ ASSERT_EQ(2, object_state->op()->ValueInputCount());
+ ASSERT_EQ(object1, NodeProperties::GetValueInput(object_state, 0));
+ ASSERT_EQ(object_state, NodeProperties::GetValueInput(object_state, 1));
+
+ Node* object_state2 = NodeProperties::GetValueInput(state_values1, 0);
+ ASSERT_EQ(object_state, object_state2);
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698