Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 1894983002: [turbofan] Introduce CallDescriptorOf helper for safety. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_issue-4924
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/int64-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 linkage()->GetParameterType(index).representation()); 1444 linkage()->GetParameterType(index).representation());
1445 1445
1446 Emit(kArchNop, op); 1446 Emit(kArchNop, op);
1447 } 1447 }
1448 1448
1449 1449
1450 void InstructionSelector::VisitIfException(Node* node) { 1450 void InstructionSelector::VisitIfException(Node* node) {
1451 OperandGenerator g(this); 1451 OperandGenerator g(this);
1452 Node* call = node->InputAt(1); 1452 Node* call = node->InputAt(1);
1453 DCHECK_EQ(IrOpcode::kCall, call->opcode()); 1453 DCHECK_EQ(IrOpcode::kCall, call->opcode());
1454 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(call); 1454 const CallDescriptor* descriptor = CallDescriptorOf(call->op());
1455 Emit(kArchNop, 1455 Emit(kArchNop,
1456 g.DefineAsLocation(node, descriptor->GetReturnLocation(0), 1456 g.DefineAsLocation(node, descriptor->GetReturnLocation(0),
1457 descriptor->GetReturnType(0).representation())); 1457 descriptor->GetReturnType(0).representation()));
1458 } 1458 }
1459 1459
1460 1460
1461 void InstructionSelector::VisitOsrValue(Node* node) { 1461 void InstructionSelector::VisitOsrValue(Node* node) {
1462 OperandGenerator g(this); 1462 OperandGenerator g(this);
1463 int index = OpParameter<int>(node); 1463 int index = OpParameter<int>(node);
1464 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetOsrValueLocation(index), 1464 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetOsrValueLocation(index),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 void InstructionSelector::VisitConstant(Node* node) { 1516 void InstructionSelector::VisitConstant(Node* node) {
1517 // We must emit a NOP here because every live range needs a defining 1517 // We must emit a NOP here because every live range needs a defining
1518 // instruction in the register allocator. 1518 // instruction in the register allocator.
1519 OperandGenerator g(this); 1519 OperandGenerator g(this);
1520 Emit(kArchNop, g.DefineAsConstant(node)); 1520 Emit(kArchNop, g.DefineAsConstant(node));
1521 } 1521 }
1522 1522
1523 1523
1524 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { 1524 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
1525 OperandGenerator g(this); 1525 OperandGenerator g(this);
1526 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); 1526 const CallDescriptor* descriptor = CallDescriptorOf(node->op());
1527 1527
1528 FrameStateDescriptor* frame_state_descriptor = nullptr; 1528 FrameStateDescriptor* frame_state_descriptor = nullptr;
1529 if (descriptor->NeedsFrameState()) { 1529 if (descriptor->NeedsFrameState()) {
1530 frame_state_descriptor = GetFrameStateDescriptor( 1530 frame_state_descriptor = GetFrameStateDescriptor(
1531 node->InputAt(static_cast<int>(descriptor->InputCount()))); 1531 node->InputAt(static_cast<int>(descriptor->InputCount())));
1532 } 1532 }
1533 1533
1534 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); 1534 CallBuffer buffer(zone(), descriptor, frame_state_descriptor);
1535 1535
1536 // Compute InstructionOperands for inputs and outputs. 1536 // Compute InstructionOperands for inputs and outputs.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 size_t const output_count = buffer.outputs.size(); 1584 size_t const output_count = buffer.outputs.size();
1585 auto* outputs = output_count ? &buffer.outputs.front() : nullptr; 1585 auto* outputs = output_count ? &buffer.outputs.front() : nullptr;
1586 Emit(opcode, output_count, outputs, buffer.instruction_args.size(), 1586 Emit(opcode, output_count, outputs, buffer.instruction_args.size(),
1587 &buffer.instruction_args.front()) 1587 &buffer.instruction_args.front())
1588 ->MarkAsCall(); 1588 ->MarkAsCall();
1589 } 1589 }
1590 1590
1591 1591
1592 void InstructionSelector::VisitTailCall(Node* node) { 1592 void InstructionSelector::VisitTailCall(Node* node) {
1593 OperandGenerator g(this); 1593 OperandGenerator g(this);
1594 CallDescriptor const* descriptor = OpParameter<CallDescriptor const*>(node); 1594 CallDescriptor const* descriptor = CallDescriptorOf(node->op());
1595 DCHECK_NE(0, descriptor->flags() & CallDescriptor::kSupportsTailCalls); 1595 DCHECK_NE(0, descriptor->flags() & CallDescriptor::kSupportsTailCalls);
1596 DCHECK_EQ(0, descriptor->flags() & CallDescriptor::kPatchableCallSite); 1596 DCHECK_EQ(0, descriptor->flags() & CallDescriptor::kPatchableCallSite);
1597 DCHECK_EQ(0, descriptor->flags() & CallDescriptor::kNeedsNopAfterCall); 1597 DCHECK_EQ(0, descriptor->flags() & CallDescriptor::kNeedsNopAfterCall);
1598 1598
1599 // TODO(turbofan): Relax restriction for stack parameters. 1599 // TODO(turbofan): Relax restriction for stack parameters.
1600 1600
1601 int stack_param_delta = 0; 1601 int stack_param_delta = 0;
1602 if (linkage()->GetIncomingDescriptor()->CanTailCall(node, 1602 if (linkage()->GetIncomingDescriptor()->CanTailCall(node,
1603 &stack_param_delta)) { 1603 &stack_param_delta)) {
1604 CallBuffer buffer(zone(), descriptor, nullptr); 1604 CallBuffer buffer(zone(), descriptor, nullptr);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 return new (instruction_zone()) FrameStateDescriptor( 1802 return new (instruction_zone()) FrameStateDescriptor(
1803 instruction_zone(), state_info.type(), state_info.bailout_id(), 1803 instruction_zone(), state_info.type(), state_info.bailout_id(),
1804 state_info.state_combine(), parameters, locals, stack, 1804 state_info.state_combine(), parameters, locals, stack,
1805 state_info.shared_info(), outer_state); 1805 state_info.shared_info(), outer_state);
1806 } 1806 }
1807 1807
1808 1808
1809 } // namespace compiler 1809 } // namespace compiler
1810 } // namespace internal 1810 } // namespace internal
1811 } // namespace v8 1811 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/int64-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698