| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 pushed_nodes.reserve(input_count()); | 390 pushed_nodes.reserve(input_count()); |
| 391 instruction_args.reserve(input_count() + frame_state_value_count()); | 391 instruction_args.reserve(input_count() + frame_state_value_count()); |
| 392 } | 392 } |
| 393 | 393 |
| 394 | 394 |
| 395 const CallDescriptor* descriptor; | 395 const CallDescriptor* descriptor; |
| 396 FrameStateDescriptor* frame_state_descriptor; | 396 FrameStateDescriptor* frame_state_descriptor; |
| 397 NodeVector output_nodes; | 397 NodeVector output_nodes; |
| 398 InstructionOperandVector outputs; | 398 InstructionOperandVector outputs; |
| 399 InstructionOperandVector instruction_args; | 399 InstructionOperandVector instruction_args; |
| 400 NodeVector pushed_nodes; | 400 ZoneVector<PushParameter> pushed_nodes; |
| 401 | 401 |
| 402 size_t input_count() const { return descriptor->InputCount(); } | 402 size_t input_count() const { return descriptor->InputCount(); } |
| 403 | 403 |
| 404 size_t frame_state_count() const { return descriptor->FrameStateCount(); } | 404 size_t frame_state_count() const { return descriptor->FrameStateCount(); } |
| 405 | 405 |
| 406 size_t frame_state_value_count() const { | 406 size_t frame_state_value_count() const { |
| 407 return (frame_state_descriptor == NULL) | 407 return (frame_state_descriptor == NULL) |
| 408 ? 0 | 408 ? 0 |
| 409 : (frame_state_descriptor->GetTotalSize() + | 409 : (frame_state_descriptor->GetTotalSize() + |
| 410 1); // Include deopt id. | 410 1); // Include deopt id. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (call_tail) { | 532 if (call_tail) { |
| 533 location = LinkageLocation::ConvertToTailCallerLocation( | 533 location = LinkageLocation::ConvertToTailCallerLocation( |
| 534 location, stack_param_delta); | 534 location, stack_param_delta); |
| 535 } | 535 } |
| 536 InstructionOperand op = | 536 InstructionOperand op = |
| 537 g.UseLocation(*iter, location, | 537 g.UseLocation(*iter, location, |
| 538 buffer->descriptor->GetInputType(index).representation()); | 538 buffer->descriptor->GetInputType(index).representation()); |
| 539 if (UnallocatedOperand::cast(op).HasFixedSlotPolicy() && !call_tail) { | 539 if (UnallocatedOperand::cast(op).HasFixedSlotPolicy() && !call_tail) { |
| 540 int stack_index = -UnallocatedOperand::cast(op).fixed_slot_index() - 1; | 540 int stack_index = -UnallocatedOperand::cast(op).fixed_slot_index() - 1; |
| 541 if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) { | 541 if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) { |
| 542 buffer->pushed_nodes.resize(stack_index + 1, NULL); | 542 buffer->pushed_nodes.resize(stack_index + 1); |
| 543 } | 543 } |
| 544 DCHECK(!buffer->pushed_nodes[stack_index]); | 544 PushParameter parameter(*iter, buffer->descriptor->GetInputType(index)); |
| 545 buffer->pushed_nodes[stack_index] = *iter; | 545 buffer->pushed_nodes[stack_index] = parameter; |
| 546 pushed_count++; | 546 pushed_count++; |
| 547 } else { | 547 } else { |
| 548 buffer->instruction_args.push_back(op); | 548 buffer->instruction_args.push_back(op); |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 DCHECK_EQ(input_count, buffer->instruction_args.size() + pushed_count - | 551 DCHECK_EQ(input_count, buffer->instruction_args.size() + pushed_count - |
| 552 buffer->frame_state_value_count()); | 552 buffer->frame_state_value_count()); |
| 553 if (V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK && call_tail && | 553 if (V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK && call_tail && |
| 554 stack_param_delta != 0) { | 554 stack_param_delta != 0) { |
| 555 // For tail calls that change the size of their parameter list and keep | 555 // For tail calls that change the size of their parameter list and keep |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 return new (instruction_zone()) FrameStateDescriptor( | 1512 return new (instruction_zone()) FrameStateDescriptor( |
| 1513 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1513 instruction_zone(), state_info.type(), state_info.bailout_id(), |
| 1514 state_info.state_combine(), parameters, locals, stack, | 1514 state_info.state_combine(), parameters, locals, stack, |
| 1515 state_info.shared_info(), outer_state); | 1515 state_info.shared_info(), outer_state); |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 | 1518 |
| 1519 } // namespace compiler | 1519 } // namespace compiler |
| 1520 } // namespace internal | 1520 } // namespace internal |
| 1521 } // namespace v8 | 1521 } // namespace v8 |
| OLD | NEW |