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

Unified Diff: test/compiler-unittests/instruction-selector-unittest.cc

Issue 522873002: Removal of the deoptimization block from Turbofan (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Change constant capitalization Created 6 years, 4 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/compiler-unittests/instruction-selector-unittest.h ('k') | test/mjsunit/debug-clearbreakpointgroup.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/compiler-unittests/instruction-selector-unittest.cc
diff --git a/test/compiler-unittests/instruction-selector-unittest.cc b/test/compiler-unittests/instruction-selector-unittest.cc
index 1cf46f8728717d01f73d615ac72dfc930529a1d6..4536cd01254112da91b360e9b603d4927aa3d5bd 100644
--- a/test/compiler-unittests/instruction-selector-unittest.cc
+++ b/test/compiler-unittests/instruction-selector-unittest.cc
@@ -97,8 +97,9 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
s.references_.insert(virtual_register);
}
}
- for (int i = 0; i < sequence.GetDeoptimizationEntryCount(); i++) {
- s.deoptimization_entries_.push_back(sequence.GetDeoptimizationEntry(i));
+ for (int i = 0; i < sequence.GetFrameStateDescriptorCount(); i++) {
+ s.deoptimization_entries_.push_back(sequence.GetFrameStateDescriptor(
+ InstructionSequence::StateId::FromInt(i)));
}
return s;
}
@@ -323,25 +324,16 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
Node* function_node = m.Parameter(0);
Node* receiver = m.Parameter(1);
- StreamBuilder::Label deopt, cont;
-
- // TODO(jarin) Add frame state.
- Node* call = m.CallJS0(function_node, receiver, &cont, &deopt);
-
- m.Bind(&cont);
- m.NewNode(m.common()->Continuation(), call);
- m.Return(call);
-
- m.Bind(&deopt);
- m.NewNode(m.common()->LazyDeoptimization(), call);
Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1));
Node* locals = m.NewNode(m.common()->StateValues(0));
Node* stack = m.NewNode(m.common()->StateValues(0));
+ Node* context_dummy = m.Int32Constant(0);
- Node* state_node =
- m.NewNode(m.common()->FrameState(bailout_id), parameters, locals, stack);
- m.Deoptimize(state_node);
+ Node* state_node = m.NewNode(m.common()->FrameState(bailout_id, kPushOutput),
+ parameters, locals, stack, context_dummy);
+ Node* call = m.CallJS0(function_node, receiver, state_node);
+ m.Return(call);
Stream s = m.Build(kAllExceptNopInstructions);
@@ -350,13 +342,13 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction;
index++) {
}
- // Now we should have three instructions: call, return and deoptimize.
- ASSERT_EQ(index + 3, s.size());
+ // Now we should have two instructions: call and return.
+ ASSERT_EQ(index + 2, s.size());
EXPECT_EQ(kArchCallJSFunction, s[index++]->arch_opcode());
EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
- EXPECT_EQ(kArchDeoptimize, s[index++]->arch_opcode());
- EXPECT_EQ(index, s.size());
+
+ // TODO(jarin) Check deoptimization table.
}
@@ -365,7 +357,6 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
kMachAnyTagged);
BailoutId bailout_id_before(42);
- BailoutId bailout_id_after(54);
// Some arguments for the call node.
Node* function_node = m.Parameter(0);
@@ -376,31 +367,17 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43));
Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44));
Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45));
- Node* frame_state_before = m.NewNode(
- m.common()->FrameState(bailout_id_before), parameters, locals, stack);
+ Node* context_sentinel = m.Int32Constant(0);
+ Node* frame_state_before =
+ m.NewNode(m.common()->FrameState(bailout_id_before, kPushOutput),
+ parameters, locals, stack, context_sentinel);
- StreamBuilder::Label deopt, cont;
// Build the call.
- Node* call =
- m.CallFunctionStub0(function_node, receiver, context, frame_state_before,
- &cont, &deopt, CALL_AS_METHOD);
+ Node* call = m.CallFunctionStub0(function_node, receiver, context,
+ frame_state_before, CALL_AS_METHOD);
- // Create the continuation branch.
- m.Bind(&cont);
- m.NewNode(m.common()->Continuation(), call);
m.Return(call);
- // Create the lazy deoptimization block (with a different frame state).
- m.Bind(&deopt);
- m.NewNode(m.common()->LazyDeoptimization(), call);
-
- Node* stack_after =
- m.NewNode(m.common()->StateValues(2), m.Int32Constant(55), call);
-
- Node* frame_state_after = m.NewNode(m.common()->FrameState(bailout_id_after),
- parameters, locals, stack_after);
- m.Deoptimize(frame_state_after);
-
Stream s = m.Build(kAllExceptNopInstructions);
// Skip until kArchCallJSFunction.
@@ -408,8 +385,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject;
index++) {
}
- // Now we should have three instructions: call, return and deoptimize.
- ASSERT_EQ(index + 3, s.size());
+ // Now we should have two instructions: call, return.
+ ASSERT_EQ(index + 2, s.size());
// Check the call instruction
const Instruction* call_instr = s[index++];
@@ -417,10 +394,9 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
size_t num_operands =
1 + // Code object.
1 +
- 3 + // Frame state deopt id + one input for each value in frame state.
+ 4 + // Frame state deopt id + one input for each value in frame state.
1 + // Function.
- 1 + // Context.
- 2; // Continuation and deoptimization block labels.
+ 1; // Context.
ASSERT_EQ(num_operands, call_instr->InputCount());
// Code object.
@@ -428,41 +404,25 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
// Deoptimization id.
int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1));
- FrameStateDescriptor* desc_before = s.GetDeoptimizationEntry(deopt_id_before);
+ FrameStateDescriptor* desc_before =
+ s.GetFrameStateDescriptor(deopt_id_before);
EXPECT_EQ(bailout_id_before, desc_before->bailout_id());
+ EXPECT_EQ(kPushOutput, desc_before->state_combine());
EXPECT_EQ(1, desc_before->parameters_count());
EXPECT_EQ(1, desc_before->locals_count());
EXPECT_EQ(1, desc_before->stack_count());
EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2)));
- EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(3)));
- EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(4)));
+ EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3)));
+ EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(4)));
+ EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(5)));
// Function.
- EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(5)));
+ EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(6)));
// Context.
- EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(6)));
- // Continuation.
- EXPECT_EQ(cont.block()->id(), s.ToInt32(call_instr->InputAt(7)));
- // Deoptimization.
- EXPECT_EQ(deopt.block()->id(), s.ToInt32(call_instr->InputAt(8)));
+ EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7)));
EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
- // Check the deoptimize instruction.
- const Instruction* deopt_instr = s[index++];
- EXPECT_EQ(kArchDeoptimize, deopt_instr->arch_opcode());
- ASSERT_EQ(5U, deopt_instr->InputCount());
- int32_t deopt_id_after = s.ToInt32(deopt_instr->InputAt(0));
- FrameStateDescriptor* desc_after = s.GetDeoptimizationEntry(deopt_id_after);
- EXPECT_EQ(bailout_id_after, desc_after->bailout_id());
- EXPECT_EQ(1, desc_after->parameters_count());
- EXPECT_EQ(1, desc_after->locals_count());
- EXPECT_EQ(2, desc_after->stack_count());
- // Parameter value from the frame state.
- EXPECT_EQ(43, s.ToInt32(deopt_instr->InputAt(1)));
- EXPECT_EQ(44, s.ToInt32(deopt_instr->InputAt(2)));
- EXPECT_EQ(55, s.ToInt32(deopt_instr->InputAt(3)));
- EXPECT_EQ(call->id(), s.ToVreg(deopt_instr->InputAt(4)));
EXPECT_EQ(index, s.size());
}
« no previous file with comments | « test/compiler-unittests/instruction-selector-unittest.h ('k') | test/mjsunit/debug-clearbreakpointgroup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698