OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/instruction-selector-unittest.h" | 5 #include "src/compiler/instruction-selector-unittest.h" |
6 | 6 |
7 #include "src/flags.h" | 7 #include "src/flags.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); | 277 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); |
278 EXPECT_EQ(i1->InputCount(), i2->InputCount()); | 278 EXPECT_EQ(i1->InputCount(), i2->InputCount()); |
279 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); | 279 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 // ----------------------------------------------------------------------------- | 284 // ----------------------------------------------------------------------------- |
285 // Calls with deoptimization. | 285 // Calls with deoptimization. |
286 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { | 286 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
287 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged); | 287 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
| 288 kMachAnyTagged); |
288 | 289 |
289 BailoutId bailout_id(42); | 290 BailoutId bailout_id(42); |
290 | 291 |
291 Node* function_node = m.Parameter(0); | 292 Node* function_node = m.Parameter(0); |
292 Node* receiver = m.Parameter(1); | 293 Node* receiver = m.Parameter(1); |
| 294 Node* context = m.Parameter(2); |
293 | 295 |
294 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); | 296 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); |
295 Node* locals = m.NewNode(m.common()->StateValues(0)); | 297 Node* locals = m.NewNode(m.common()->StateValues(0)); |
296 Node* stack = m.NewNode(m.common()->StateValues(0)); | 298 Node* stack = m.NewNode(m.common()->StateValues(0)); |
297 Node* context_dummy = m.Int32Constant(0); | 299 Node* context_dummy = m.Int32Constant(0); |
298 | 300 |
299 Node* state_node = m.NewNode(m.common()->FrameState(bailout_id, kPushOutput), | 301 Node* state_node = m.NewNode(m.common()->FrameState(bailout_id, kPushOutput), |
300 parameters, locals, stack, context_dummy); | 302 parameters, locals, stack, context_dummy); |
301 Node* call = m.CallJS0(function_node, receiver, state_node); | 303 Node* call = m.CallJS0(function_node, receiver, context, state_node); |
302 m.Return(call); | 304 m.Return(call); |
303 | 305 |
304 Stream s = m.Build(kAllExceptNopInstructions); | 306 Stream s = m.Build(kAllExceptNopInstructions); |
305 | 307 |
306 // Skip until kArchCallJSFunction. | 308 // Skip until kArchCallJSFunction. |
307 size_t index = 0; | 309 size_t index = 0; |
308 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; | 310 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; |
309 index++) { | 311 index++) { |
310 } | 312 } |
311 // Now we should have two instructions: call and return. | 313 // Now we should have two instructions: call and return. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7))); | 390 EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7))); |
389 | 391 |
390 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 392 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
391 | 393 |
392 EXPECT_EQ(index, s.size()); | 394 EXPECT_EQ(index, s.size()); |
393 } | 395 } |
394 | 396 |
395 } // namespace compiler | 397 } // namespace compiler |
396 } // namespace internal | 398 } // namespace internal |
397 } // namespace v8 | 399 } // namespace v8 |
OLD | NEW |