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.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 500 } |
501 DCHECK(!buffer->pushed_nodes[stack_index]); | 501 DCHECK(!buffer->pushed_nodes[stack_index]); |
502 buffer->pushed_nodes[stack_index] = *iter; | 502 buffer->pushed_nodes[stack_index] = *iter; |
503 pushed_count++; | 503 pushed_count++; |
504 } else { | 504 } else { |
505 buffer->instruction_args.push_back(op); | 505 buffer->instruction_args.push_back(op); |
506 } | 506 } |
507 } | 507 } |
508 DCHECK_EQ(input_count, buffer->instruction_args.size() + pushed_count - | 508 DCHECK_EQ(input_count, buffer->instruction_args.size() + pushed_count - |
509 buffer->frame_state_value_count()); | 509 buffer->frame_state_value_count()); |
510 if (call_tail && stack_param_delta != 0) { | 510 if (V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK && call_tail && |
511 // For tail calls that change the size of their parameter list, move the | 511 stack_param_delta != 0) { |
512 // saved caller return address, parent frame pointer and parent constant | 512 // For tail calls that change the size of their parameter list and keep |
513 // pool pointer to just above the parameters. | 513 // their return address on the stack, move the return address to just above |
514 | 514 // the parameters. |
515 // Return address | |
516 LinkageLocation saved_return_location = | 515 LinkageLocation saved_return_location = |
517 LinkageLocation::ForSavedCallerReturnAddress(); | 516 LinkageLocation::ForSavedCallerReturnAddress(); |
518 InstructionOperand return_address = | 517 InstructionOperand return_address = |
519 g.UsePointerLocation(LinkageLocation::ConvertToTailCallerLocation( | 518 g.UsePointerLocation(LinkageLocation::ConvertToTailCallerLocation( |
520 saved_return_location, stack_param_delta), | 519 saved_return_location, stack_param_delta), |
521 saved_return_location); | 520 saved_return_location); |
522 buffer->instruction_args.push_back(return_address); | 521 buffer->instruction_args.push_back(return_address); |
523 | |
524 // Parent frame pointer | |
525 LinkageLocation saved_frame_location = | |
526 LinkageLocation::ForSavedCallerFramePtr(); | |
527 InstructionOperand saved_frame = | |
528 g.UsePointerLocation(LinkageLocation::ConvertToTailCallerLocation( | |
529 saved_frame_location, stack_param_delta), | |
530 saved_frame_location); | |
531 buffer->instruction_args.push_back(saved_frame); | |
532 | |
533 if (V8_EMBEDDED_CONSTANT_POOL) { | |
534 // Constant pool pointer | |
535 LinkageLocation saved_cp_location = | |
536 LinkageLocation::ForSavedCallerConstantPool(); | |
537 InstructionOperand saved_cp = | |
538 g.UsePointerLocation(LinkageLocation::ConvertToTailCallerLocation( | |
539 saved_cp_location, stack_param_delta), | |
540 saved_cp_location); | |
541 buffer->instruction_args.push_back(saved_cp); | |
542 } | |
543 } | 522 } |
544 } | 523 } |
545 | 524 |
546 | 525 |
547 void InstructionSelector::VisitBlock(BasicBlock* block) { | 526 void InstructionSelector::VisitBlock(BasicBlock* block) { |
548 DCHECK(!current_block_); | 527 DCHECK(!current_block_); |
549 current_block_ = block; | 528 current_block_ = block; |
550 int current_block_end = static_cast<int>(instructions_.size()); | 529 int current_block_end = static_cast<int>(instructions_.size()); |
551 | 530 |
552 // Generate code for the block control "top down", but schedule the code | 531 // Generate code for the block control "top down", but schedule the code |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 return new (instruction_zone()) FrameStateDescriptor( | 1456 return new (instruction_zone()) FrameStateDescriptor( |
1478 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1457 instruction_zone(), state_info.type(), state_info.bailout_id(), |
1479 state_info.state_combine(), parameters, locals, stack, | 1458 state_info.state_combine(), parameters, locals, stack, |
1480 state_info.shared_info(), outer_state); | 1459 state_info.shared_info(), outer_state); |
1481 } | 1460 } |
1482 | 1461 |
1483 | 1462 |
1484 } // namespace compiler | 1463 } // namespace compiler |
1485 } // namespace internal | 1464 } // namespace internal |
1486 } // namespace v8 | 1465 } // namespace v8 |
OLD | NEW |