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/compiler/compiler-test-utils.h" | 7 #include "src/compiler/compiler-test-utils.h" |
8 #include "src/flags.h" | 8 #include "src/flags.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 Node* function_node = m.Parameter(0); | 313 Node* function_node = m.Parameter(0); |
314 Node* receiver = m.Parameter(1); | 314 Node* receiver = m.Parameter(1); |
315 Node* context = m.Parameter(2); | 315 Node* context = m.Parameter(2); |
316 | 316 |
317 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); | 317 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); |
318 Node* locals = m.NewNode(m.common()->StateValues(0)); | 318 Node* locals = m.NewNode(m.common()->StateValues(0)); |
319 Node* stack = m.NewNode(m.common()->StateValues(0)); | 319 Node* stack = m.NewNode(m.common()->StateValues(0)); |
320 Node* context_dummy = m.Int32Constant(0); | 320 Node* context_dummy = m.Int32Constant(0); |
321 | 321 |
322 Node* state_node = m.NewNode( | 322 Node* state_node = m.NewNode( |
323 m.common()->FrameState(JS_FRAME, bailout_id, kPushOutput), parameters, | 323 m.common()->FrameState(JS_FRAME, bailout_id, |
324 locals, stack, context_dummy, m.UndefinedConstant()); | 324 OutputFrameStateCombine::Push()), |
| 325 parameters, locals, stack, context_dummy, m.UndefinedConstant()); |
325 Node* call = m.CallJS0(function_node, receiver, context, state_node); | 326 Node* call = m.CallJS0(function_node, receiver, context, state_node); |
326 m.Return(call); | 327 m.Return(call); |
327 | 328 |
328 Stream s = m.Build(kAllExceptNopInstructions); | 329 Stream s = m.Build(kAllExceptNopInstructions); |
329 | 330 |
330 // Skip until kArchCallJSFunction. | 331 // Skip until kArchCallJSFunction. |
331 size_t index = 0; | 332 size_t index = 0; |
332 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; | 333 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; |
333 index++) { | 334 index++) { |
334 } | 335 } |
(...skipping 18 matching lines...) Expand all Loading... |
353 Node* receiver = m.Parameter(1); | 354 Node* receiver = m.Parameter(1); |
354 Node* context = m.Int32Constant(1); // Context is ignored. | 355 Node* context = m.Int32Constant(1); // Context is ignored. |
355 | 356 |
356 // Build frame state for the state before the call. | 357 // Build frame state for the state before the call. |
357 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); | 358 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); |
358 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44)); | 359 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44)); |
359 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45)); | 360 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45)); |
360 | 361 |
361 Node* context_sentinel = m.Int32Constant(0); | 362 Node* context_sentinel = m.Int32Constant(0); |
362 Node* frame_state_before = m.NewNode( | 363 Node* frame_state_before = m.NewNode( |
363 m.common()->FrameState(JS_FRAME, bailout_id_before, kPushOutput), | 364 m.common()->FrameState(JS_FRAME, bailout_id_before, |
| 365 OutputFrameStateCombine::Push()), |
364 parameters, locals, stack, context_sentinel, m.UndefinedConstant()); | 366 parameters, locals, stack, context_sentinel, m.UndefinedConstant()); |
365 | 367 |
366 // Build the call. | 368 // Build the call. |
367 Node* call = m.CallFunctionStub0(function_node, receiver, context, | 369 Node* call = m.CallFunctionStub0(function_node, receiver, context, |
368 frame_state_before, CALL_AS_METHOD); | 370 frame_state_before, CALL_AS_METHOD); |
369 | 371 |
370 m.Return(call); | 372 m.Return(call); |
371 | 373 |
372 Stream s = m.Build(kAllExceptNopInstructions); | 374 Stream s = m.Build(kAllExceptNopInstructions); |
373 | 375 |
(...skipping 17 matching lines...) Expand all Loading... |
391 ASSERT_EQ(num_operands, call_instr->InputCount()); | 393 ASSERT_EQ(num_operands, call_instr->InputCount()); |
392 | 394 |
393 // Code object. | 395 // Code object. |
394 EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate()); | 396 EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate()); |
395 | 397 |
396 // Deoptimization id. | 398 // Deoptimization id. |
397 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1)); | 399 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1)); |
398 FrameStateDescriptor* desc_before = | 400 FrameStateDescriptor* desc_before = |
399 s.GetFrameStateDescriptor(deopt_id_before); | 401 s.GetFrameStateDescriptor(deopt_id_before); |
400 EXPECT_EQ(bailout_id_before, desc_before->bailout_id()); | 402 EXPECT_EQ(bailout_id_before, desc_before->bailout_id()); |
401 EXPECT_EQ(kPushOutput, desc_before->state_combine()); | 403 EXPECT_EQ(OutputFrameStateCombine::kPushOutput, |
| 404 desc_before->state_combine().kind()); |
402 EXPECT_EQ(1u, desc_before->parameters_count()); | 405 EXPECT_EQ(1u, desc_before->parameters_count()); |
403 EXPECT_EQ(1u, desc_before->locals_count()); | 406 EXPECT_EQ(1u, desc_before->locals_count()); |
404 EXPECT_EQ(1u, desc_before->stack_count()); | 407 EXPECT_EQ(1u, desc_before->stack_count()); |
405 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2))); | 408 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2))); |
406 EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3))); | 409 EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3))); |
407 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(4))); | 410 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(4))); |
408 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(5))); | 411 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(5))); |
409 | 412 |
410 // Function. | 413 // Function. |
411 EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(6))); | 414 EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(6))); |
(...skipping 16 matching lines...) Expand all Loading... |
428 | 431 |
429 // Some arguments for the call node. | 432 // Some arguments for the call node. |
430 Node* function_node = m.Parameter(0); | 433 Node* function_node = m.Parameter(0); |
431 Node* receiver = m.Parameter(1); | 434 Node* receiver = m.Parameter(1); |
432 Node* context = m.Int32Constant(66); | 435 Node* context = m.Int32Constant(66); |
433 | 436 |
434 // Build frame state for the state before the call. | 437 // Build frame state for the state before the call. |
435 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(63)); | 438 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(63)); |
436 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(64)); | 439 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(64)); |
437 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(65)); | 440 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(65)); |
438 Node* frame_state_parent = m.NewNode( | 441 Node* frame_state_parent = |
439 m.common()->FrameState(JS_FRAME, bailout_id_parent, kIgnoreOutput), | 442 m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_parent, |
440 parameters, locals, stack, context, m.UndefinedConstant()); | 443 OutputFrameStateCombine::Ignore()), |
| 444 parameters, locals, stack, context, m.UndefinedConstant()); |
441 | 445 |
442 Node* context2 = m.Int32Constant(46); | 446 Node* context2 = m.Int32Constant(46); |
443 Node* parameters2 = | 447 Node* parameters2 = |
444 m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); | 448 m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); |
445 Node* locals2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44)); | 449 Node* locals2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44)); |
446 Node* stack2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45)); | 450 Node* stack2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45)); |
447 Node* frame_state_before = m.NewNode( | 451 Node* frame_state_before = |
448 m.common()->FrameState(JS_FRAME, bailout_id_before, kPushOutput), | 452 m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before, |
449 parameters2, locals2, stack2, context2, frame_state_parent); | 453 OutputFrameStateCombine::Push()), |
| 454 parameters2, locals2, stack2, context2, frame_state_parent); |
450 | 455 |
451 // Build the call. | 456 // Build the call. |
452 Node* call = m.CallFunctionStub0(function_node, receiver, context2, | 457 Node* call = m.CallFunctionStub0(function_node, receiver, context2, |
453 frame_state_before, CALL_AS_METHOD); | 458 frame_state_before, CALL_AS_METHOD); |
454 | 459 |
455 m.Return(call); | 460 m.Return(call); |
456 | 461 |
457 Stream s = m.Build(kAllExceptNopInstructions); | 462 Stream s = m.Build(kAllExceptNopInstructions); |
458 | 463 |
459 // Skip until kArchCallJSFunction. | 464 // Skip until kArchCallJSFunction. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 EXPECT_EQ(context2->id(), s.ToVreg(call_instr->InputAt(11))); | 508 EXPECT_EQ(context2->id(), s.ToVreg(call_instr->InputAt(11))); |
504 // Continuation. | 509 // Continuation. |
505 | 510 |
506 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 511 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
507 EXPECT_EQ(index, s.size()); | 512 EXPECT_EQ(index, s.size()); |
508 } | 513 } |
509 | 514 |
510 } // namespace compiler | 515 } // namespace compiler |
511 } // namespace internal | 516 } // namespace internal |
512 } // namespace v8 | 517 } // namespace v8 |
OLD | NEW |