| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); | 311 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); |
| 312 EXPECT_EQ(i1->InputCount(), i2->InputCount()); | 312 EXPECT_EQ(i1->InputCount(), i2->InputCount()); |
| 313 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); | 313 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 | 317 |
| 318 // ----------------------------------------------------------------------------- | 318 // ----------------------------------------------------------------------------- |
| 319 // Calls with deoptimization. | 319 // Calls with deoptimization. |
| 320 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { | 320 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
| 321 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged); | 321 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
| 322 kMachAnyTagged); |
| 322 | 323 |
| 323 BailoutId bailout_id(42); | 324 BailoutId bailout_id(42); |
| 324 | 325 |
| 325 Node* function_node = m.Parameter(0); | 326 Node* function_node = m.Parameter(0); |
| 326 Node* receiver = m.Parameter(1); | 327 Node* receiver = m.Parameter(1); |
| 328 Node* context = m.Parameter(2); |
| 327 | 329 |
| 328 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); | 330 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); |
| 329 Node* locals = m.NewNode(m.common()->StateValues(0)); | 331 Node* locals = m.NewNode(m.common()->StateValues(0)); |
| 330 Node* stack = m.NewNode(m.common()->StateValues(0)); | 332 Node* stack = m.NewNode(m.common()->StateValues(0)); |
| 331 Node* context_dummy = m.Int32Constant(0); | 333 Node* context_dummy = m.Int32Constant(0); |
| 332 | 334 |
| 333 Node* state_node = m.NewNode(m.common()->FrameState(bailout_id, kPushOutput), | 335 Node* state_node = m.NewNode(m.common()->FrameState(bailout_id, kPushOutput), |
| 334 parameters, locals, stack, context_dummy); | 336 parameters, locals, stack, context_dummy); |
| 335 Node* call = m.CallJS0(function_node, receiver, state_node); | 337 Node* call = m.CallJS0(function_node, receiver, context, state_node); |
| 336 m.Return(call); | 338 m.Return(call); |
| 337 | 339 |
| 338 Stream s = m.Build(kAllExceptNopInstructions); | 340 Stream s = m.Build(kAllExceptNopInstructions); |
| 339 | 341 |
| 340 // Skip until kArchCallJSFunction. | 342 // Skip until kArchCallJSFunction. |
| 341 size_t index = 0; | 343 size_t index = 0; |
| 342 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; | 344 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; |
| 343 index++) { | 345 index++) { |
| 344 } | 346 } |
| 345 // Now we should have two instructions: call and return. | 347 // Now we should have two instructions: call and return. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7))); | 424 EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7))); |
| 423 | 425 |
| 424 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 426 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
| 425 | 427 |
| 426 EXPECT_EQ(index, s.size()); | 428 EXPECT_EQ(index, s.size()); |
| 427 } | 429 } |
| 428 | 430 |
| 429 } // namespace compiler | 431 } // namespace compiler |
| 430 } // namespace internal | 432 } // namespace internal |
| 431 } // namespace v8 | 433 } // namespace v8 |
| OLD | NEW |