deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / test / unittests / compiler / instruction-selector-unittest.cc
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6
7 #include "src/compiler/graph.h"
8 #include "src/compiler/schedule.h"
9 #include "src/flags.h"
10 #include "test/unittests/compiler/compiler-test-utils.h"
11
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15
16 namespace {
17
18 typedef RawMachineAssembler::Label MLabel;
19
20 }  // namespace
21
22
23 InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {}
24
25
26 InstructionSelectorTest::~InstructionSelectorTest() {}
27
28
29 InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
30     InstructionSelector::Features features,
31     InstructionSelectorTest::StreamBuilderMode mode) {
32   Schedule* schedule = Export();
33   if (FLAG_trace_turbo) {
34     OFStream out(stdout);
35     out << "=== Schedule before instruction selection ===" << std::endl
36         << *schedule;
37   }
38   size_t const node_count = graph()->NodeCount();
39   EXPECT_NE(0u, node_count);
40   Linkage linkage(call_descriptor());
41   InstructionBlocks* instruction_blocks =
42       InstructionSequence::InstructionBlocksFor(test_->zone(), schedule);
43   InstructionSequence sequence(test_->isolate(), test_->zone(),
44                                instruction_blocks);
45   SourcePositionTable source_position_table(graph());
46   InstructionSelector selector(test_->zone(), node_count, &linkage, &sequence,
47                                schedule, &source_position_table, features);
48   selector.SelectInstructions();
49   if (FLAG_trace_turbo) {
50     OFStream out(stdout);
51     PrintableInstructionSequence printable = {
52         RegisterConfiguration::ArchDefault(), &sequence};
53     out << "=== Code sequence after instruction selection ===" << std::endl
54         << printable;
55   }
56   Stream s;
57   s.virtual_registers_ = selector.GetVirtualRegistersForTesting();
58   // Map virtual registers.
59   for (Instruction* const instr : sequence) {
60     if (instr->opcode() < 0) continue;
61     if (mode == kTargetInstructions) {
62       switch (instr->arch_opcode()) {
63 #define CASE(Name) \
64   case k##Name:    \
65     break;
66         TARGET_ARCH_OPCODE_LIST(CASE)
67 #undef CASE
68         default:
69           continue;
70       }
71     }
72     if (mode == kAllExceptNopInstructions && instr->arch_opcode() == kArchNop) {
73       continue;
74     }
75     for (size_t i = 0; i < instr->OutputCount(); ++i) {
76       InstructionOperand* output = instr->OutputAt(i);
77       EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind());
78       if (output->IsConstant()) {
79         s.constants_.insert(std::make_pair(
80             output->index(), sequence.GetConstant(output->index())));
81       }
82     }
83     for (size_t i = 0; i < instr->InputCount(); ++i) {
84       InstructionOperand* input = instr->InputAt(i);
85       EXPECT_NE(InstructionOperand::CONSTANT, input->kind());
86       if (input->IsImmediate()) {
87         s.immediates_.insert(std::make_pair(
88             input->index(), sequence.GetImmediate(input->index())));
89       }
90     }
91     s.instructions_.push_back(instr);
92   }
93   for (auto i : s.virtual_registers_) {
94     int const virtual_register = i.second;
95     if (sequence.IsDouble(virtual_register)) {
96       EXPECT_FALSE(sequence.IsReference(virtual_register));
97       s.doubles_.insert(virtual_register);
98     }
99     if (sequence.IsReference(virtual_register)) {
100       EXPECT_FALSE(sequence.IsDouble(virtual_register));
101       s.references_.insert(virtual_register);
102     }
103   }
104   for (int i = 0; i < sequence.GetFrameStateDescriptorCount(); i++) {
105     s.deoptimization_entries_.push_back(sequence.GetFrameStateDescriptor(
106         InstructionSequence::StateId::FromInt(i)));
107   }
108   return s;
109 }
110
111
112 int InstructionSelectorTest::Stream::ToVreg(const Node* node) const {
113   VirtualRegisters::const_iterator i = virtual_registers_.find(node->id());
114   CHECK(i != virtual_registers_.end());
115   return i->second;
116 }
117
118
119 bool InstructionSelectorTest::Stream::IsFixed(const InstructionOperand* operand,
120                                               Register reg) const {
121   if (!operand->IsUnallocated()) return false;
122   const UnallocatedOperand* unallocated = UnallocatedOperand::cast(operand);
123   if (!unallocated->HasFixedRegisterPolicy()) return false;
124   const int index = Register::ToAllocationIndex(reg);
125   return unallocated->fixed_register_index() == index;
126 }
127
128
129 bool InstructionSelectorTest::Stream::IsSameAsFirst(
130     const InstructionOperand* operand) const {
131   if (!operand->IsUnallocated()) return false;
132   const UnallocatedOperand* unallocated = UnallocatedOperand::cast(operand);
133   return unallocated->HasSameAsInputPolicy();
134 }
135
136
137 bool InstructionSelectorTest::Stream::IsUsedAtStart(
138     const InstructionOperand* operand) const {
139   if (!operand->IsUnallocated()) return false;
140   const UnallocatedOperand* unallocated = UnallocatedOperand::cast(operand);
141   return unallocated->IsUsedAtStart();
142 }
143
144
145 // -----------------------------------------------------------------------------
146 // Return.
147
148
149 TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) {
150   const float kValue = 4.2f;
151   StreamBuilder m(this, kMachFloat32);
152   m.Return(m.Float32Constant(kValue));
153   Stream s = m.Build(kAllInstructions);
154   ASSERT_EQ(3U, s.size());
155   EXPECT_EQ(kArchNop, s[0]->arch_opcode());
156   ASSERT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind());
157   EXPECT_FLOAT_EQ(kValue, s.ToFloat32(s[0]->OutputAt(0)));
158   EXPECT_EQ(kArchRet, s[1]->arch_opcode());
159   EXPECT_EQ(1U, s[1]->InputCount());
160 }
161
162
163 TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
164   StreamBuilder m(this, kMachInt32, kMachInt32);
165   m.Return(m.Parameter(0));
166   Stream s = m.Build(kAllInstructions);
167   ASSERT_EQ(3U, s.size());
168   EXPECT_EQ(kArchNop, s[0]->arch_opcode());
169   ASSERT_EQ(1U, s[0]->OutputCount());
170   EXPECT_EQ(kArchRet, s[1]->arch_opcode());
171   EXPECT_EQ(1U, s[1]->InputCount());
172 }
173
174
175 TARGET_TEST_F(InstructionSelectorTest, ReturnZero) {
176   StreamBuilder m(this, kMachInt32);
177   m.Return(m.Int32Constant(0));
178   Stream s = m.Build(kAllInstructions);
179   ASSERT_EQ(3U, s.size());
180   EXPECT_EQ(kArchNop, s[0]->arch_opcode());
181   ASSERT_EQ(1U, s[0]->OutputCount());
182   EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind());
183   EXPECT_EQ(0, s.ToInt32(s[0]->OutputAt(0)));
184   EXPECT_EQ(kArchRet, s[1]->arch_opcode());
185   EXPECT_EQ(1U, s[1]->InputCount());
186 }
187
188
189 // -----------------------------------------------------------------------------
190 // Conversions.
191
192
193 TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) {
194   StreamBuilder m(this, kMachInt32, kMachFloat64);
195   m.Return(m.TruncateFloat64ToInt32(m.Parameter(0)));
196   Stream s = m.Build(kAllInstructions);
197   ASSERT_EQ(4U, s.size());
198   EXPECT_EQ(kArchNop, s[0]->arch_opcode());
199   EXPECT_EQ(kArchTruncateDoubleToI, s[1]->arch_opcode());
200   EXPECT_EQ(1U, s[1]->InputCount());
201   EXPECT_EQ(1U, s[1]->OutputCount());
202   EXPECT_EQ(kArchRet, s[2]->arch_opcode());
203 }
204
205
206 // -----------------------------------------------------------------------------
207 // Parameters.
208
209
210 TARGET_TEST_F(InstructionSelectorTest, DoubleParameter) {
211   StreamBuilder m(this, kMachFloat64, kMachFloat64);
212   Node* param = m.Parameter(0);
213   m.Return(param);
214   Stream s = m.Build(kAllInstructions);
215   EXPECT_TRUE(s.IsDouble(param));
216 }
217
218
219 TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
220   StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
221   Node* param = m.Parameter(0);
222   m.Return(param);
223   Stream s = m.Build(kAllInstructions);
224   EXPECT_TRUE(s.IsReference(param));
225 }
226
227
228 // -----------------------------------------------------------------------------
229 // Finish.
230
231
232 TARGET_TEST_F(InstructionSelectorTest, Finish) {
233   StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
234   Node* param = m.Parameter(0);
235   Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start());
236   m.Return(finish);
237   Stream s = m.Build(kAllInstructions);
238   ASSERT_EQ(4U, s.size());
239   EXPECT_EQ(kArchNop, s[0]->arch_opcode());
240   ASSERT_EQ(1U, s[0]->OutputCount());
241   ASSERT_TRUE(s[0]->Output()->IsUnallocated());
242   EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[0]->Output()));
243   EXPECT_EQ(kArchNop, s[1]->arch_opcode());
244   ASSERT_EQ(1U, s[1]->InputCount());
245   ASSERT_TRUE(s[1]->InputAt(0)->IsUnallocated());
246   EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[1]->InputAt(0)));
247   ASSERT_EQ(1U, s[1]->OutputCount());
248   ASSERT_TRUE(s[1]->Output()->IsUnallocated());
249   EXPECT_TRUE(UnallocatedOperand::cast(s[1]->Output())->HasSameAsInputPolicy());
250   EXPECT_EQ(s.ToVreg(finish), s.ToVreg(s[1]->Output()));
251   EXPECT_TRUE(s.IsReference(finish));
252 }
253
254
255 // -----------------------------------------------------------------------------
256 // Phi.
257
258
259 typedef InstructionSelectorTestWithParam<MachineType>
260     InstructionSelectorPhiTest;
261
262
263 TARGET_TEST_P(InstructionSelectorPhiTest, Doubleness) {
264   const MachineType type = GetParam();
265   StreamBuilder m(this, type, type, type);
266   Node* param0 = m.Parameter(0);
267   Node* param1 = m.Parameter(1);
268   MLabel a, b, c;
269   m.Branch(m.Int32Constant(0), &a, &b);
270   m.Bind(&a);
271   m.Goto(&c);
272   m.Bind(&b);
273   m.Goto(&c);
274   m.Bind(&c);
275   Node* phi = m.Phi(type, param0, param1);
276   m.Return(phi);
277   Stream s = m.Build(kAllInstructions);
278   EXPECT_EQ(s.IsDouble(phi), s.IsDouble(param0));
279   EXPECT_EQ(s.IsDouble(phi), s.IsDouble(param1));
280 }
281
282
283 TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) {
284   const MachineType type = GetParam();
285   StreamBuilder m(this, type, type, type);
286   Node* param0 = m.Parameter(0);
287   Node* param1 = m.Parameter(1);
288   MLabel a, b, c;
289   m.Branch(m.Int32Constant(1), &a, &b);
290   m.Bind(&a);
291   m.Goto(&c);
292   m.Bind(&b);
293   m.Goto(&c);
294   m.Bind(&c);
295   Node* phi = m.Phi(type, param0, param1);
296   m.Return(phi);
297   Stream s = m.Build(kAllInstructions);
298   EXPECT_EQ(s.IsReference(phi), s.IsReference(param0));
299   EXPECT_EQ(s.IsReference(phi), s.IsReference(param1));
300 }
301
302
303 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorPhiTest,
304                         ::testing::Values(kMachFloat64, kMachInt8, kMachUint8,
305                                           kMachInt16, kMachUint16, kMachInt32,
306                                           kMachUint32, kMachInt64, kMachUint64,
307                                           kMachPtr, kMachAnyTagged));
308
309
310 // -----------------------------------------------------------------------------
311 // ValueEffect.
312
313
314 TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
315   StreamBuilder m1(this, kMachInt32, kMachPtr);
316   Node* p1 = m1.Parameter(0);
317   m1.Return(m1.Load(kMachInt32, p1, m1.Int32Constant(0)));
318   Stream s1 = m1.Build(kAllInstructions);
319   StreamBuilder m2(this, kMachInt32, kMachPtr);
320   Node* p2 = m2.Parameter(0);
321   m2.Return(m2.NewNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
322                        m2.NewNode(m2.common()->ValueEffect(1), p2)));
323   Stream s2 = m2.Build(kAllInstructions);
324   EXPECT_LE(3U, s1.size());
325   ASSERT_EQ(s1.size(), s2.size());
326   TRACED_FORRANGE(size_t, i, 0, s1.size() - 1) {
327     const Instruction* i1 = s1[i];
328     const Instruction* i2 = s2[i];
329     EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode());
330     EXPECT_EQ(i1->InputCount(), i2->InputCount());
331     EXPECT_EQ(i1->OutputCount(), i2->OutputCount());
332   }
333 }
334
335
336 // -----------------------------------------------------------------------------
337 // Calls with deoptimization.
338
339
340 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
341   StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
342                   kMachAnyTagged);
343
344   BailoutId bailout_id(42);
345
346   Node* function_node = m.Parameter(0);
347   Node* receiver = m.Parameter(1);
348   Node* context = m.Parameter(2);
349
350   ZoneVector<MachineType> int32_type(1, kMachInt32, zone());
351   ZoneVector<MachineType> empty_types(zone());
352
353   Node* parameters =
354       m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1));
355   Node* locals = m.NewNode(m.common()->TypedStateValues(&empty_types));
356   Node* stack = m.NewNode(m.common()->TypedStateValues(&empty_types));
357   Node* context_dummy = m.Int32Constant(0);
358
359   Node* state_node = m.NewNode(
360       m.common()->FrameState(JS_FRAME, bailout_id,
361                              OutputFrameStateCombine::Push()),
362       parameters, locals, stack, context_dummy, m.UndefinedConstant());
363   Node* call = m.CallJS0(function_node, receiver, context, state_node);
364   m.Return(call);
365
366   Stream s = m.Build(kAllExceptNopInstructions);
367
368   // Skip until kArchCallJSFunction.
369   size_t index = 0;
370   for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction;
371        index++) {
372   }
373   // Now we should have two instructions: call and return.
374   ASSERT_EQ(index + 2, s.size());
375
376   EXPECT_EQ(kArchCallJSFunction, s[index++]->arch_opcode());
377   EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
378
379   // TODO(jarin) Check deoptimization table.
380 }
381
382
383 TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
384   StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
385                   kMachAnyTagged);
386
387   BailoutId bailout_id_before(42);
388
389   // Some arguments for the call node.
390   Node* function_node = m.Parameter(0);
391   Node* receiver = m.Parameter(1);
392   Node* context = m.Int32Constant(1);  // Context is ignored.
393
394   ZoneVector<MachineType> int32_type(1, kMachInt32, zone());
395   ZoneVector<MachineType> float64_type(1, kMachFloat64, zone());
396   ZoneVector<MachineType> tagged_type(1, kMachAnyTagged, zone());
397
398   // Build frame state for the state before the call.
399   Node* parameters =
400       m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
401   Node* locals = m.NewNode(m.common()->TypedStateValues(&float64_type),
402                            m.Float64Constant(0.5));
403   Node* stack = m.NewNode(m.common()->TypedStateValues(&tagged_type),
404                           m.UndefinedConstant());
405
406   Node* context_sentinel = m.Int32Constant(0);
407   Node* frame_state_before = m.NewNode(
408       m.common()->FrameState(JS_FRAME, bailout_id_before,
409                              OutputFrameStateCombine::Push()),
410       parameters, locals, stack, context_sentinel, m.UndefinedConstant());
411
412   // Build the call.
413   Node* call = m.CallFunctionStub0(function_node, receiver, context,
414                                    frame_state_before, CALL_AS_METHOD);
415
416   m.Return(call);
417
418   Stream s = m.Build(kAllExceptNopInstructions);
419
420   // Skip until kArchCallJSFunction.
421   size_t index = 0;
422   for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject;
423        index++) {
424   }
425   // Now we should have two instructions: call, return.
426   ASSERT_EQ(index + 2, s.size());
427
428   // Check the call instruction
429   const Instruction* call_instr = s[index++];
430   EXPECT_EQ(kArchCallCodeObject, call_instr->arch_opcode());
431   size_t num_operands =
432       1 +  // Code object.
433       1 +
434       4 +  // Frame state deopt id + one input for each value in frame state.
435       1 +  // Function.
436       1;   // Context.
437   ASSERT_EQ(num_operands, call_instr->InputCount());
438
439   // Code object.
440   EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate());
441
442   // Deoptimization id.
443   int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1));
444   FrameStateDescriptor* desc_before =
445       s.GetFrameStateDescriptor(deopt_id_before);
446   EXPECT_EQ(bailout_id_before, desc_before->bailout_id());
447   EXPECT_EQ(OutputFrameStateCombine::kPushOutput,
448             desc_before->state_combine().kind());
449   EXPECT_EQ(1u, desc_before->parameters_count());
450   EXPECT_EQ(1u, desc_before->locals_count());
451   EXPECT_EQ(1u, desc_before->stack_count());
452   EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2)));
453   EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3)));  // This should be a context.
454                                                     // We inserted 0 here.
455   EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(4)));
456   EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(5))->IsUndefined());
457   EXPECT_EQ(kMachInt32, desc_before->GetType(0));
458   EXPECT_EQ(kMachAnyTagged, desc_before->GetType(1));  // context is always
459                                                        // tagged/any.
460   EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
461   EXPECT_EQ(kMachAnyTagged, desc_before->GetType(3));
462
463   // Function.
464   EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(6)));
465   // Context.
466   EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(7)));
467
468   EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
469
470   EXPECT_EQ(index, s.size());
471 }
472
473
474 TARGET_TEST_F(InstructionSelectorTest,
475               CallFunctionStubDeoptRecursiveFrameState) {
476   StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
477                   kMachAnyTagged);
478
479   BailoutId bailout_id_before(42);
480   BailoutId bailout_id_parent(62);
481
482   // Some arguments for the call node.
483   Node* function_node = m.Parameter(0);
484   Node* receiver = m.Parameter(1);
485   Node* context = m.Int32Constant(66);
486
487   ZoneVector<MachineType> int32_type(1, kMachInt32, zone());
488   ZoneVector<MachineType> int32x2_type(2, kMachInt32, zone());
489   ZoneVector<MachineType> float64_type(1, kMachFloat64, zone());
490
491   // Build frame state for the state before the call.
492   Node* parameters =
493       m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63));
494   Node* locals =
495       m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64));
496   Node* stack =
497       m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65));
498   Node* frame_state_parent =
499       m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_parent,
500                                        OutputFrameStateCombine::Ignore()),
501                 parameters, locals, stack, context, m.UndefinedConstant());
502
503   Node* context2 = m.Int32Constant(46);
504   Node* parameters2 =
505       m.NewNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
506   Node* locals2 = m.NewNode(m.common()->TypedStateValues(&float64_type),
507                             m.Float64Constant(0.25));
508   Node* stack2 = m.NewNode(m.common()->TypedStateValues(&int32x2_type),
509                            m.Int32Constant(44), m.Int32Constant(45));
510   Node* frame_state_before =
511       m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before,
512                                        OutputFrameStateCombine::Push()),
513                 parameters2, locals2, stack2, context2, frame_state_parent);
514
515   // Build the call.
516   Node* call = m.CallFunctionStub0(function_node, receiver, context2,
517                                    frame_state_before, CALL_AS_METHOD);
518
519   m.Return(call);
520
521   Stream s = m.Build(kAllExceptNopInstructions);
522
523   // Skip until kArchCallJSFunction.
524   size_t index = 0;
525   for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject;
526        index++) {
527   }
528   // Now we should have three instructions: call, return.
529   EXPECT_EQ(index + 2, s.size());
530
531   // Check the call instruction
532   const Instruction* call_instr = s[index++];
533   EXPECT_EQ(kArchCallCodeObject, call_instr->arch_opcode());
534   size_t num_operands =
535       1 +  // Code object.
536       1 +  // Frame state deopt id
537       5 +  // One input for each value in frame state + context.
538       4 +  // One input for each value in the parent frame state + context.
539       1 +  // Function.
540       1;   // Context.
541   EXPECT_EQ(num_operands, call_instr->InputCount());
542   // Code object.
543   EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate());
544
545   // Deoptimization id.
546   int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1));
547   FrameStateDescriptor* desc_before =
548       s.GetFrameStateDescriptor(deopt_id_before);
549   FrameStateDescriptor* desc_before_outer = desc_before->outer_state();
550   EXPECT_EQ(bailout_id_before, desc_before->bailout_id());
551   EXPECT_EQ(1u, desc_before_outer->parameters_count());
552   EXPECT_EQ(1u, desc_before_outer->locals_count());
553   EXPECT_EQ(1u, desc_before_outer->stack_count());
554   // Values from parent environment.
555   EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(2)));
556   EXPECT_EQ(kMachInt32, desc_before_outer->GetType(0));
557   // Context:
558   EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(3)));
559   EXPECT_EQ(kMachAnyTagged, desc_before_outer->GetType(1));
560   EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(4)));
561   EXPECT_EQ(kMachInt32, desc_before_outer->GetType(2));
562   EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(5)));
563   EXPECT_EQ(kMachInt32, desc_before_outer->GetType(3));
564   // Values from the nested frame.
565   EXPECT_EQ(1u, desc_before->parameters_count());
566   EXPECT_EQ(1u, desc_before->locals_count());
567   EXPECT_EQ(2u, desc_before->stack_count());
568   EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(6)));
569   EXPECT_EQ(kMachInt32, desc_before->GetType(0));
570   EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(7)));
571   EXPECT_EQ(kMachAnyTagged, desc_before->GetType(1));
572   EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(8)));
573   EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
574   EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(9)));
575   EXPECT_EQ(kMachInt32, desc_before->GetType(3));
576   EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(10)));
577   EXPECT_EQ(kMachInt32, desc_before->GetType(4));
578
579   // Function.
580   EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(11)));
581   // Context.
582   EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
583   // Continuation.
584
585   EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
586   EXPECT_EQ(index, s.size());
587 }
588
589 }  // namespace compiler
590 }  // namespace internal
591 }  // namespace v8