| 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 "test/compiler-unittests/instruction-selector-unittest.h" | 5 #include "test/compiler-unittests/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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 const Instruction* i2 = s2[i]; | 309 const Instruction* i2 = s2[i]; |
| 310 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); | 310 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); |
| 311 EXPECT_EQ(i1->InputCount(), i2->InputCount()); | 311 EXPECT_EQ(i1->InputCount(), i2->InputCount()); |
| 312 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); | 312 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 | 316 |
| 317 // ----------------------------------------------------------------------------- | 317 // ----------------------------------------------------------------------------- |
| 318 // Calls with deoptimization. | 318 // Calls with deoptimization. |
| 319 TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { | 319 TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) { |
| 320 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged); | 320 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged); |
| 321 | 321 |
| 322 BailoutId bailout_id(42); | 322 BailoutId bailout_id(42); |
| 323 | 323 |
| 324 Node* function_node = m.Parameter(0); | 324 Node* function_node = m.Parameter(0); |
| 325 Node* receiver = m.Parameter(1); | 325 Node* receiver = m.Parameter(1); |
| 326 StreamBuilder::Label deopt, cont; | 326 StreamBuilder::Label deopt, cont; |
| 327 | 327 |
| 328 // TODO(jarin) Add frame state. | 328 // TODO(jarin) Add frame state. |
| 329 Node* call = m.CallJS0(function_node, receiver, &cont, &deopt); | 329 Node* call = m.CallJS0(function_node, receiver, &cont, &deopt); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 353 // Now we should have three instructions: call, return and deoptimize. | 353 // Now we should have three instructions: call, return and deoptimize. |
| 354 ASSERT_EQ(index + 3, s.size()); | 354 ASSERT_EQ(index + 3, s.size()); |
| 355 | 355 |
| 356 EXPECT_EQ(kArchCallJSFunction, s[index++]->arch_opcode()); | 356 EXPECT_EQ(kArchCallJSFunction, s[index++]->arch_opcode()); |
| 357 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 357 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
| 358 EXPECT_EQ(kArchDeoptimize, s[index++]->arch_opcode()); | 358 EXPECT_EQ(kArchDeoptimize, s[index++]->arch_opcode()); |
| 359 EXPECT_EQ(index, s.size()); | 359 EXPECT_EQ(index, s.size()); |
| 360 } | 360 } |
| 361 | 361 |
| 362 | 362 |
| 363 TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) { | 363 TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) { |
| 364 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, | 364 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged, |
| 365 kMachAnyTagged); | 365 kMachAnyTagged); |
| 366 | 366 |
| 367 BailoutId bailout_id_before(42); | 367 BailoutId bailout_id_before(42); |
| 368 BailoutId bailout_id_after(54); | 368 BailoutId bailout_id_after(54); |
| 369 | 369 |
| 370 // Some arguments for the call node. | 370 // Some arguments for the call node. |
| 371 Node* function_node = m.Parameter(0); | 371 Node* function_node = m.Parameter(0); |
| 372 Node* receiver = m.Parameter(1); | 372 Node* receiver = m.Parameter(1); |
| 373 Node* context = m.Int32Constant(1); // Context is ignored. | 373 Node* context = m.Int32Constant(1); // Context is ignored. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 EXPECT_EQ(43, s.ToInt32(deopt_instr->InputAt(1))); | 462 EXPECT_EQ(43, s.ToInt32(deopt_instr->InputAt(1))); |
| 463 EXPECT_EQ(44, s.ToInt32(deopt_instr->InputAt(2))); | 463 EXPECT_EQ(44, s.ToInt32(deopt_instr->InputAt(2))); |
| 464 EXPECT_EQ(55, s.ToInt32(deopt_instr->InputAt(3))); | 464 EXPECT_EQ(55, s.ToInt32(deopt_instr->InputAt(3))); |
| 465 EXPECT_EQ(call->id(), s.ToVreg(deopt_instr->InputAt(4))); | 465 EXPECT_EQ(call->id(), s.ToVreg(deopt_instr->InputAt(4))); |
| 466 EXPECT_EQ(index, s.size()); | 466 EXPECT_EQ(index, s.size()); |
| 467 } | 467 } |
| 468 | 468 |
| 469 } // namespace compiler | 469 } // namespace compiler |
| 470 } // namespace internal | 470 } // namespace internal |
| 471 } // namespace v8 | 471 } // namespace v8 |
| OLD | NEW |