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

Side by Side Diff: src/compiler/common-operator.cc

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
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/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/base/lazy-instance.h" 8 #include "src/base/lazy-instance.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) { 96 std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
97 if (i.debug_name()) os << i.debug_name() << '#'; 97 if (i.debug_name()) os << i.debug_name() << '#';
98 os << i.index(); 98 os << i.index();
99 return os; 99 return os;
100 } 100 }
101 101
102 102
103 #define CACHED_OP_LIST(V) \ 103 #define CACHED_OP_LIST(V) \
104 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ 104 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \
105 V(End, Operator::kKontrol, 0, 0, 1, 0, 0, 0) \
106 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 105 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
107 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 106 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
108 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 107 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
109 V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \ 108 V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \
110 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 109 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
111 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ 110 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
112 V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ 111 V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \
113 V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ 112 V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \
114 V(Terminate, Operator::kNoThrow, 0, 1, 1, 0, 0, 1) \ 113 V(Terminate, Operator::kNoThrow, 0, 1, 1, 0, 0, 1) \
115 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ 114 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
116 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) 115 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1)
117 116
118 117
118 #define CACHED_END_LIST(V) \
119 V(1) \
120 V(2) \
121 V(3) \
122 V(4) \
123 V(5) \
124 V(6) \
125 V(7) \
126 V(8)
127
128
119 #define CACHED_EFFECT_PHI_LIST(V) \ 129 #define CACHED_EFFECT_PHI_LIST(V) \
120 V(1) \ 130 V(1) \
121 V(2) \ 131 V(2) \
122 V(3) \ 132 V(3) \
123 V(4) \ 133 V(4) \
124 V(5) \ 134 V(5) \
125 V(6) 135 V(6)
126 136
127 137
128 #define CACHED_LOOP_LIST(V) \ 138 #define CACHED_LOOP_LIST(V) \
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 Name##Operator() \ 203 Name##Operator() \
194 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ 204 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \
195 effect_input_count, control_input_count, \ 205 effect_input_count, control_input_count, \
196 value_output_count, effect_output_count, \ 206 value_output_count, effect_output_count, \
197 control_output_count) {} \ 207 control_output_count) {} \
198 }; \ 208 }; \
199 Name##Operator k##Name##Operator; 209 Name##Operator k##Name##Operator;
200 CACHED_OP_LIST(CACHED) 210 CACHED_OP_LIST(CACHED)
201 #undef CACHED 211 #undef CACHED
202 212
213 template <size_t kInputCount>
214 struct EndOperator final : public Operator {
215 EndOperator()
216 : Operator( // --
217 IrOpcode::kEnd, Operator::kKontrol, // opcode
218 "End", // name
219 0, 0, kInputCount, 0, 0, 0) {} // counts
220 };
221 #define CACHED_END(input_count) \
222 EndOperator<input_count> kEnd##input_count##Operator;
223 CACHED_END_LIST(CACHED_END)
224 #undef CACHED_END
225
203 template <BranchHint kBranchHint> 226 template <BranchHint kBranchHint>
204 struct BranchOperator final : public Operator1<BranchHint> { 227 struct BranchOperator final : public Operator1<BranchHint> {
205 BranchOperator() 228 BranchOperator()
206 : Operator1<BranchHint>( // -- 229 : Operator1<BranchHint>( // --
207 IrOpcode::kBranch, Operator::kKontrol, // opcode 230 IrOpcode::kBranch, Operator::kKontrol, // opcode
208 "Branch", // name 231 "Branch", // name
209 1, 0, 1, 0, 0, 2, // counts 232 1, 0, 1, 0, 0, 2, // counts
210 kBranchHint) {} // parameter 233 kBranchHint) {} // parameter
211 }; 234 };
212 BranchOperator<BranchHint::kNone> kBranchNoneOperator; 235 BranchOperator<BranchHint::kNone> kBranchNoneOperator;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 #define CACHED(Name, properties, value_input_count, effect_input_count, \ 345 #define CACHED(Name, properties, value_input_count, effect_input_count, \
323 control_input_count, value_output_count, effect_output_count, \ 346 control_input_count, value_output_count, effect_output_count, \
324 control_output_count) \ 347 control_output_count) \
325 const Operator* CommonOperatorBuilder::Name() { \ 348 const Operator* CommonOperatorBuilder::Name() { \
326 return &cache_.k##Name##Operator; \ 349 return &cache_.k##Name##Operator; \
327 } 350 }
328 CACHED_OP_LIST(CACHED) 351 CACHED_OP_LIST(CACHED)
329 #undef CACHED 352 #undef CACHED
330 353
331 354
355 const Operator* CommonOperatorBuilder::End(size_t control_input_count) {
356 DCHECK_NE(0u, control_input_count); // Disallow empty ends.
357 switch (control_input_count) {
358 #define CACHED_END(input_count) \
359 case input_count: \
360 return &cache_.kEnd##input_count##Operator;
361 CACHED_END_LIST(CACHED_END)
362 #undef CACHED_END
363 default:
364 break;
365 }
366 // Uncached.
367 return new (zone()) Operator( //--
368 IrOpcode::kEnd, Operator::kKontrol, // opcode
369 "End", // name
370 0, 0, control_input_count, 0, 0, 0); // counts
371 }
372
373
332 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { 374 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) {
333 switch (hint) { 375 switch (hint) {
334 case BranchHint::kNone: 376 case BranchHint::kNone:
335 return &cache_.kBranchNoneOperator; 377 return &cache_.kBranchNoneOperator;
336 case BranchHint::kTrue: 378 case BranchHint::kTrue:
337 return &cache_.kBranchTrueOperator; 379 return &cache_.kBranchTrueOperator;
338 case BranchHint::kFalse: 380 case BranchHint::kFalse:
339 return &cache_.kBranchFalseOperator; 381 return &cache_.kBranchFalseOperator;
340 } 382 }
341 UNREACHABLE(); 383 UNREACHABLE();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } else { 732 } else {
691 UNREACHABLE(); 733 UNREACHABLE();
692 return nullptr; 734 return nullptr;
693 } 735 }
694 } 736 }
695 737
696 738
697 } // namespace compiler 739 } // namespace compiler
698 } // namespace internal 740 } // namespace internal
699 } // namespace v8 741 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698