| Index: test/unittests/compiler/instruction-selector-unittest.cc
|
| diff --git a/test/unittests/compiler/instruction-selector-unittest.cc b/test/unittests/compiler/instruction-selector-unittest.cc
|
| index 8b759def7ea9d388e2d3dae02f9ed1445a5bb8a8..5bbf0ce2f4d1d7080d2f94705b4e0fb1cab4987d 100644
|
| --- a/test/unittests/compiler/instruction-selector-unittest.cc
|
| +++ b/test/unittests/compiler/instruction-selector-unittest.cc
|
| @@ -375,8 +375,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
|
|
|
| // Build frame state for the state before the call.
|
| 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* locals = m.NewNode(m.common()->StateValues(1), m.Float64Constant(0.5));
|
| + Node* stack = m.NewNode(m.common()->StateValues(1), m.UndefinedConstant());
|
|
|
| Node* context_sentinel = m.Int32Constant(0);
|
| Node* frame_state_before = m.NewNode(
|
| @@ -425,9 +425,15 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
|
| EXPECT_EQ(1u, desc_before->locals_count());
|
| EXPECT_EQ(1u, desc_before->stack_count());
|
| EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2)));
|
| - 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)));
|
| + EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3))); // This should be a context.
|
| + // We inserted 0 here.
|
| + EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(4)));
|
| + EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(5))->IsUndefined());
|
| + EXPECT_EQ(kMachInt32, desc_before->GetType(0));
|
| + EXPECT_EQ(kMachAnyTagged, desc_before->GetType(1)); // context is always
|
| + // tagged/any.
|
| + EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
|
| + EXPECT_EQ(kMachAnyTagged, desc_before->GetType(3));
|
|
|
| // Function.
|
| EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(6)));
|
| @@ -465,8 +471,10 @@ TARGET_TEST_F(InstructionSelectorTest,
|
| Node* context2 = m.Int32Constant(46);
|
| Node* parameters2 =
|
| m.NewNode(m.common()->StateValues(1), m.Int32Constant(43));
|
| - Node* locals2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44));
|
| - Node* stack2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45));
|
| + Node* locals2 =
|
| + m.NewNode(m.common()->StateValues(1), m.Float64Constant(0.25));
|
| + Node* stack2 = m.NewNode(m.common()->StateValues(2), m.Int32Constant(44),
|
| + m.Int32Constant(45));
|
| Node* frame_state_before =
|
| m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before,
|
| OutputFrameStateCombine::Push()),
|
| @@ -494,7 +502,7 @@ TARGET_TEST_F(InstructionSelectorTest,
|
| size_t num_operands =
|
| 1 + // Code object.
|
| 1 + // Frame state deopt id
|
| - 4 + // One input for each value in frame state + context.
|
| + 5 + // One input for each value in frame state + context.
|
| 4 + // One input for each value in the parent frame state + context.
|
| 1 + // Function.
|
| 1; // Context.
|
| @@ -506,25 +514,40 @@ TARGET_TEST_F(InstructionSelectorTest,
|
| int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1));
|
| FrameStateDescriptor* desc_before =
|
| s.GetFrameStateDescriptor(deopt_id_before);
|
| + FrameStateDescriptor* desc_before_outer = desc_before->outer_state();
|
| EXPECT_EQ(bailout_id_before, desc_before->bailout_id());
|
| - EXPECT_EQ(1u, desc_before->parameters_count());
|
| - EXPECT_EQ(1u, desc_before->locals_count());
|
| - EXPECT_EQ(1u, desc_before->stack_count());
|
| + EXPECT_EQ(1u, desc_before_outer->parameters_count());
|
| + EXPECT_EQ(1u, desc_before_outer->locals_count());
|
| + EXPECT_EQ(1u, desc_before_outer->stack_count());
|
| + // Values from parent environment.
|
| EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(2)));
|
| + EXPECT_EQ(kMachInt32, desc_before_outer->GetType(0));
|
| // Context:
|
| EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(3)));
|
| + EXPECT_EQ(kMachAnyTagged, desc_before_outer->GetType(1));
|
| EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(4)));
|
| + EXPECT_EQ(kMachInt32, desc_before_outer->GetType(2));
|
| EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(5)));
|
| - // Values from parent environment should follow.
|
| + EXPECT_EQ(kMachInt32, desc_before_outer->GetType(3));
|
| + // Values from the nested frame.
|
| + EXPECT_EQ(1u, desc_before->parameters_count());
|
| + EXPECT_EQ(1u, desc_before->locals_count());
|
| + EXPECT_EQ(2u, desc_before->stack_count());
|
| EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(6)));
|
| + EXPECT_EQ(kMachInt32, desc_before->GetType(0));
|
| EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(7)));
|
| - EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(8)));
|
| - EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(9)));
|
| + EXPECT_EQ(kMachAnyTagged, desc_before->GetType(1));
|
| + EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(8)));
|
| + EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
|
| + EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(9)));
|
| + EXPECT_EQ(kMachInt32, desc_before->GetType(3));
|
| + EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(10)));
|
| + EXPECT_EQ(kMachInt32, desc_before->GetType(4));
|
|
|
| // Function.
|
| - EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(10)));
|
| + EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(11)));
|
| // Context.
|
| - EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(11)));
|
| + EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
|
| // Continuation.
|
|
|
| EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
|
|
|