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

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

Issue 1134713004: [turbofan] Pass closure as node to FrameState. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
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 dfdb4c2b1f85bebc47afe1bf934523b20f4f5464..857d92fa2d9a766b6bac58f233a82f31b84638b7 100644
--- a/test/unittests/compiler/instruction-selector-unittest.cc
+++ b/test/unittests/compiler/instruction-selector-unittest.cc
@@ -362,10 +362,11 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types));
Node* context_dummy = m.Int32Constant(0);
- Node* state_node = m.NewNode(
- m.common()->FrameState(JS_FRAME, bailout_id,
- OutputFrameStateCombine::Push()),
- parameters, locals, stack, context_dummy, m.UndefinedConstant());
+ Node* state_node =
+ m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id,
+ OutputFrameStateCombine::Push()),
+ parameters, locals, stack, context_dummy, function_node,
+ m.UndefinedConstant());
Node* call = m.CallJS0(function_node, receiver, context, state_node);
m.Return(call);
@@ -410,10 +411,11 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
m.UndefinedConstant());
Node* context_sentinel = m.Int32Constant(0);
- Node* frame_state_before = m.NewNode(
- m.common()->FrameState(JS_FRAME, bailout_id_before,
- OutputFrameStateCombine::Push()),
- parameters, locals, stack, context_sentinel, m.UndefinedConstant());
+ Node* frame_state_before =
+ m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before,
+ OutputFrameStateCombine::Push()),
+ parameters, locals, stack, context_sentinel, function_node,
+ m.UndefinedConstant());
// Build the call.
Node* call = m.CallFunctionStub0(function_node, receiver, context,
@@ -437,7 +439,7 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
size_t num_operands =
1 + // Code object.
1 +
- 4 + // Frame state deopt id + one input for each value in frame state.
+ 5 + // Frame state deopt id + one input for each value in frame state.
1 + // Function.
1; // Context.
ASSERT_EQ(num_operands, call_instr->InputCount());
@@ -455,21 +457,23 @@ TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
EXPECT_EQ(1u, desc_before->parameters_count());
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))); // This should be a context.
+ EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(3)));
+ EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(4))); // 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
+ EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(5)));
+ EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(6))->IsUndefined());
+ EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0)); // function is always
+ // tagged/any.
+ EXPECT_EQ(kMachInt32, desc_before->GetType(1));
+ EXPECT_EQ(kMachAnyTagged, desc_before->GetType(2)); // context is always
// tagged/any.
- EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(3));
+ EXPECT_EQ(kMachFloat64, desc_before->GetType(3));
+ EXPECT_EQ(kMachAnyTagged, desc_before->GetType(4));
// Function.
- EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(6)));
+ EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(7)));
// Context.
- EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(7)));
+ EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(8)));
EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
@@ -501,10 +505,10 @@ TARGET_TEST_F(InstructionSelectorTest,
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64));
Node* stack =
m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65));
- Node* frame_state_parent =
- m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_parent,
- OutputFrameStateCombine::Ignore()),
- parameters, locals, stack, context, m.UndefinedConstant());
+ Node* frame_state_parent = m.NewNode(
+ m.common()->FrameState(JS_FRAME, bailout_id_parent,
+ OutputFrameStateCombine::Ignore()),
+ parameters, locals, stack, context, function_node, m.UndefinedConstant());
Node* context2 = m.Int32Constant(46);
Node* parameters2 =
@@ -516,7 +520,8 @@ TARGET_TEST_F(InstructionSelectorTest,
Node* frame_state_before =
m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before,
OutputFrameStateCombine::Push()),
- parameters2, locals2, stack2, context2, frame_state_parent);
+ parameters2, locals2, stack2, context2, function_node,
+ frame_state_parent);
// Build the call.
Node* call = m.CallFunctionStub0(function_node, receiver, context2,
@@ -540,8 +545,8 @@ TARGET_TEST_F(InstructionSelectorTest,
size_t num_operands =
1 + // Code object.
1 + // Frame state deopt id
- 5 + // One input for each value in frame state + context.
- 4 + // One input for each value in the parent frame state + context.
+ 6 + // One input for each value in frame state + context.
+ 5 + // One input for each value in the parent frame state + context.
1 + // Function.
1; // Context.
EXPECT_EQ(num_operands, call_instr->InputCount());
@@ -558,34 +563,36 @@ TARGET_TEST_F(InstructionSelectorTest,
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));
+ EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0));
+ EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(3)));
+ EXPECT_EQ(kMachInt32, desc_before_outer->GetType(1));
// 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)));
+ EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(4)));
+ EXPECT_EQ(kMachAnyTagged, desc_before_outer->GetType(2));
+ EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(5)));
EXPECT_EQ(kMachInt32, desc_before_outer->GetType(3));
+ EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(6)));
+ EXPECT_EQ(kMachInt32, desc_before_outer->GetType(4));
// 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(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(kMachAnyTagged, desc_before->GetType(0));
+ EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(8)));
+ EXPECT_EQ(kMachInt32, desc_before->GetType(1));
+ EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(9)));
+ EXPECT_EQ(kMachAnyTagged, desc_before->GetType(2));
+ EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(10)));
+ EXPECT_EQ(kMachFloat64, desc_before->GetType(3));
+ EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(11)));
EXPECT_EQ(kMachInt32, desc_before->GetType(4));
+ EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(12)));
+ EXPECT_EQ(kMachInt32, desc_before->GetType(5));
// Function.
- EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(11)));
+ EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(13)));
// Context.
- EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
+ EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14)));
// Continuation.
EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
« src/compiler/code-generator.cc ('K') | « test/cctest/compiler/test-codegen-deopt.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698