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

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

Issue 1645653002: [turbofan] Add the StackSlot operator to turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Explicitly state the type of test values. Created 4 years, 10 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/instruction-selector.h ('k') | src/compiler/machine-operator.h » ('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"
11 #include "src/compiler/node-matchers.h" 11 #include "src/compiler/node-matchers.h"
12 #include "src/compiler/pipeline.h" 12 #include "src/compiler/pipeline.h"
13 #include "src/compiler/schedule.h" 13 #include "src/compiler/schedule.h"
14 #include "src/compiler/state-values-utils.h" 14 #include "src/compiler/state-values-utils.h"
15 #include "src/deoptimizer.h" 15 #include "src/deoptimizer.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 namespace compiler { 19 namespace compiler {
20 20
21 InstructionSelector::InstructionSelector( 21 InstructionSelector::InstructionSelector(
22 Zone* zone, size_t node_count, Linkage* linkage, 22 Zone* zone, size_t node_count, Linkage* linkage,
23 InstructionSequence* sequence, Schedule* schedule, 23 InstructionSequence* sequence, Schedule* schedule,
24 SourcePositionTable* source_positions, 24 SourcePositionTable* source_positions, Frame* frame,
25 SourcePositionMode source_position_mode, Features features) 25 SourcePositionMode source_position_mode, Features features)
26 : zone_(zone), 26 : zone_(zone),
27 linkage_(linkage), 27 linkage_(linkage),
28 sequence_(sequence), 28 sequence_(sequence),
29 source_positions_(source_positions), 29 source_positions_(source_positions),
30 source_position_mode_(source_position_mode), 30 source_position_mode_(source_position_mode),
31 features_(features), 31 features_(features),
32 schedule_(schedule), 32 schedule_(schedule),
33 current_block_(nullptr), 33 current_block_(nullptr),
34 instructions_(zone), 34 instructions_(zone),
35 defined_(node_count, false, zone), 35 defined_(node_count, false, zone),
36 used_(node_count, false, zone), 36 used_(node_count, false, zone),
37 virtual_registers_(node_count, 37 virtual_registers_(node_count,
38 InstructionOperand::kInvalidVirtualRegister, zone), 38 InstructionOperand::kInvalidVirtualRegister, zone),
39 scheduler_(nullptr) { 39 scheduler_(nullptr),
40 frame_(frame) {
40 instructions_.reserve(node_count); 41 instructions_.reserve(node_count);
41 } 42 }
42 43
43 44
44 void InstructionSelector::SelectInstructions() { 45 void InstructionSelector::SelectInstructions() {
45 // Mark the inputs of all phis in loop headers as used. 46 // Mark the inputs of all phis in loop headers as used.
46 BasicBlockVector* blocks = schedule()->rpo_order(); 47 BasicBlockVector* blocks = schedule()->rpo_order();
47 for (auto const block : *blocks) { 48 for (auto const block : *blocks) {
48 if (!block->IsLoopHeader()) continue; 49 if (!block->IsLoopHeader()) continue;
49 DCHECK_LE(2u, block->PredecessorCount()); 50 DCHECK_LE(2u, block->PredecessorCount());
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 case IrOpcode::kFloat64RoundTiesEven: 1060 case IrOpcode::kFloat64RoundTiesEven:
1060 return MarkAsFloat64(node), VisitFloat64RoundTiesEven(node); 1061 return MarkAsFloat64(node), VisitFloat64RoundTiesEven(node);
1061 case IrOpcode::kFloat64ExtractLowWord32: 1062 case IrOpcode::kFloat64ExtractLowWord32:
1062 return MarkAsWord32(node), VisitFloat64ExtractLowWord32(node); 1063 return MarkAsWord32(node), VisitFloat64ExtractLowWord32(node);
1063 case IrOpcode::kFloat64ExtractHighWord32: 1064 case IrOpcode::kFloat64ExtractHighWord32:
1064 return MarkAsWord32(node), VisitFloat64ExtractHighWord32(node); 1065 return MarkAsWord32(node), VisitFloat64ExtractHighWord32(node);
1065 case IrOpcode::kFloat64InsertLowWord32: 1066 case IrOpcode::kFloat64InsertLowWord32:
1066 return MarkAsFloat64(node), VisitFloat64InsertLowWord32(node); 1067 return MarkAsFloat64(node), VisitFloat64InsertLowWord32(node);
1067 case IrOpcode::kFloat64InsertHighWord32: 1068 case IrOpcode::kFloat64InsertHighWord32:
1068 return MarkAsFloat64(node), VisitFloat64InsertHighWord32(node); 1069 return MarkAsFloat64(node), VisitFloat64InsertHighWord32(node);
1070 case IrOpcode::kStackSlot:
1071 return VisitStackSlot(node);
1069 case IrOpcode::kLoadStackPointer: 1072 case IrOpcode::kLoadStackPointer:
1070 return VisitLoadStackPointer(node); 1073 return VisitLoadStackPointer(node);
1071 case IrOpcode::kLoadFramePointer: 1074 case IrOpcode::kLoadFramePointer:
1072 return VisitLoadFramePointer(node); 1075 return VisitLoadFramePointer(node);
1073 case IrOpcode::kCheckedLoad: { 1076 case IrOpcode::kCheckedLoad: {
1074 MachineRepresentation rep = 1077 MachineRepresentation rep =
1075 CheckedLoadRepresentationOf(node->op()).representation(); 1078 CheckedLoadRepresentationOf(node->op()).representation();
1076 MarkAsRepresentation(rep, node); 1079 MarkAsRepresentation(rep, node);
1077 return VisitCheckedLoad(node); 1080 return VisitCheckedLoad(node);
1078 } 1081 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 inputs[1] = g.Label(sw.default_branch); 1129 inputs[1] = g.Label(sw.default_branch);
1127 for (size_t index = 0; index < sw.case_count; ++index) { 1130 for (size_t index = 0; index < sw.case_count; ++index) {
1128 int32_t value = sw.case_values[index]; 1131 int32_t value = sw.case_values[index];
1129 BasicBlock* branch = sw.case_branches[index]; 1132 BasicBlock* branch = sw.case_branches[index];
1130 inputs[index * 2 + 2 + 0] = g.TempImmediate(value); 1133 inputs[index * 2 + 2 + 0] = g.TempImmediate(value);
1131 inputs[index * 2 + 2 + 1] = g.Label(branch); 1134 inputs[index * 2 + 2 + 1] = g.Label(branch);
1132 } 1135 }
1133 Emit(kArchLookupSwitch, 0, nullptr, input_count, inputs, 0, nullptr); 1136 Emit(kArchLookupSwitch, 0, nullptr, input_count, inputs, 0, nullptr);
1134 } 1137 }
1135 1138
1139 void InstructionSelector::VisitStackSlot(Node* node) {
1140 int size = 1 << ElementSizeLog2Of(StackSlotRepresentationOf(node->op()));
1141 int slot = frame_->AllocateSpillSlot(size);
1142 OperandGenerator g(this);
1143
1144 Emit(kArchStackSlot, g.DefineAsRegister(node),
1145 sequence()->AddImmediate(Constant(slot)), 0, nullptr);
1146 }
1136 1147
1137 // 32 bit targets do not implement the following instructions. 1148 // 32 bit targets do not implement the following instructions.
1138 #if V8_TARGET_ARCH_32_BIT 1149 #if V8_TARGET_ARCH_32_BIT
1139 1150
1140 void InstructionSelector::VisitWord64And(Node* node) { UNIMPLEMENTED(); } 1151 void InstructionSelector::VisitWord64And(Node* node) { UNIMPLEMENTED(); }
1141 1152
1142 1153
1143 void InstructionSelector::VisitWord64Or(Node* node) { UNIMPLEMENTED(); } 1154 void InstructionSelector::VisitWord64Or(Node* node) { UNIMPLEMENTED(); }
1144 1155
1145 1156
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 return new (instruction_zone()) FrameStateDescriptor( 1636 return new (instruction_zone()) FrameStateDescriptor(
1626 instruction_zone(), state_info.type(), state_info.bailout_id(), 1637 instruction_zone(), state_info.type(), state_info.bailout_id(),
1627 state_info.state_combine(), parameters, locals, stack, 1638 state_info.state_combine(), parameters, locals, stack,
1628 state_info.shared_info(), outer_state); 1639 state_info.shared_info(), outer_state);
1629 } 1640 }
1630 1641
1631 1642
1632 } // namespace compiler 1643 } // namespace compiler
1633 } // namespace internal 1644 } // namespace internal
1634 } // namespace v8 1645 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698