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

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

Issue 1158563008: [turbofan] Introduce prediction for exception handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Architecture ports. Created 5 years, 6 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.h ('k') | src/compiler/ia32/instruction-selector-ia32.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/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 18 matching lines...) Expand all
29 return os; 29 return os;
30 } 30 }
31 31
32 32
33 BranchHint BranchHintOf(const Operator* const op) { 33 BranchHint BranchHintOf(const Operator* const op) {
34 DCHECK_EQ(IrOpcode::kBranch, op->opcode()); 34 DCHECK_EQ(IrOpcode::kBranch, op->opcode());
35 return OpParameter<BranchHint>(op); 35 return OpParameter<BranchHint>(op);
36 } 36 }
37 37
38 38
39 size_t hash_value(IfExceptionHint hint) { return static_cast<size_t>(hint); }
40
41
42 std::ostream& operator<<(std::ostream& os, IfExceptionHint hint) {
43 switch (hint) {
44 case IfExceptionHint::kLocallyCaught:
45 return os << "Caught";
46 case IfExceptionHint::kLocallyUncaught:
47 return os << "Uncaught";
48 }
49 UNREACHABLE();
50 return os;
51 }
52
53
39 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) { 54 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
40 return lhs.type() == rhs.type() && lhs.hint() == rhs.hint(); 55 return lhs.type() == rhs.type() && lhs.hint() == rhs.hint();
41 } 56 }
42 57
43 58
44 bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) { 59 bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) {
45 return !(lhs == rhs); 60 return !(lhs == rhs);
46 } 61 }
47 62
48 63
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 os << i.index(); 113 os << i.index();
99 return os; 114 return os;
100 } 115 }
101 116
102 117
103 #define CACHED_OP_LIST(V) \ 118 #define CACHED_OP_LIST(V) \
104 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ 119 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \
105 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 120 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
106 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 121 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
107 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 122 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
108 V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \
109 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 123 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
110 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ 124 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
111 V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ 125 V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \
112 V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ 126 V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \
113 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ 127 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
114 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ 128 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
115 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) 129 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1)
116 130
117 131
118 #define CACHED_END_LIST(V) \ 132 #define CACHED_END_LIST(V) \
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Name##Operator() \ 217 Name##Operator() \
204 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ 218 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \
205 effect_input_count, control_input_count, \ 219 effect_input_count, control_input_count, \
206 value_output_count, effect_output_count, \ 220 value_output_count, effect_output_count, \
207 control_output_count) {} \ 221 control_output_count) {} \
208 }; \ 222 }; \
209 Name##Operator k##Name##Operator; 223 Name##Operator k##Name##Operator;
210 CACHED_OP_LIST(CACHED) 224 CACHED_OP_LIST(CACHED)
211 #undef CACHED 225 #undef CACHED
212 226
227 template <IfExceptionHint kCaughtLocally>
228 struct IfExceptionOperator final : public Operator1<IfExceptionHint> {
229 IfExceptionOperator()
230 : Operator1<IfExceptionHint>( // --
231 IrOpcode::kIfException, Operator::kKontrol, // opcode
232 "IfException", // name
233 0, 0, 1, 1, 0, 1, // counts
234 kCaughtLocally) {} // parameter
235 };
236 IfExceptionOperator<IfExceptionHint::kLocallyCaught> kIfExceptionCOperator;
237 IfExceptionOperator<IfExceptionHint::kLocallyUncaught> kIfExceptionUOperator;
238
213 template <size_t kInputCount> 239 template <size_t kInputCount>
214 struct EndOperator final : public Operator { 240 struct EndOperator final : public Operator {
215 EndOperator() 241 EndOperator()
216 : Operator( // -- 242 : Operator( // --
217 IrOpcode::kEnd, Operator::kKontrol, // opcode 243 IrOpcode::kEnd, Operator::kKontrol, // opcode
218 "End", // name 244 "End", // name
219 0, 0, kInputCount, 0, 0, 0) {} // counts 245 0, 0, kInputCount, 0, 0, 0) {} // counts
220 }; 246 };
221 #define CACHED_END(input_count) \ 247 #define CACHED_END(input_count) \
222 EndOperator<input_count> kEnd##input_count##Operator; 248 EndOperator<input_count> kEnd##input_count##Operator;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 case BranchHint::kTrue: 404 case BranchHint::kTrue:
379 return &cache_.kBranchTrueOperator; 405 return &cache_.kBranchTrueOperator;
380 case BranchHint::kFalse: 406 case BranchHint::kFalse:
381 return &cache_.kBranchFalseOperator; 407 return &cache_.kBranchFalseOperator;
382 } 408 }
383 UNREACHABLE(); 409 UNREACHABLE();
384 return nullptr; 410 return nullptr;
385 } 411 }
386 412
387 413
414 const Operator* CommonOperatorBuilder::IfException(IfExceptionHint hint) {
415 switch (hint) {
416 case IfExceptionHint::kLocallyCaught:
417 return &cache_.kIfExceptionCOperator;
418 case IfExceptionHint::kLocallyUncaught:
419 return &cache_.kIfExceptionUOperator;
420 }
421 UNREACHABLE();
422 return nullptr;
423 }
424
425
388 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) { 426 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) {
389 DCHECK_GE(control_output_count, 3u); // Disallow trivial switches. 427 DCHECK_GE(control_output_count, 3u); // Disallow trivial switches.
390 return new (zone()) Operator( // -- 428 return new (zone()) Operator( // --
391 IrOpcode::kSwitch, Operator::kKontrol, // opcode 429 IrOpcode::kSwitch, Operator::kKontrol, // opcode
392 "Switch", // name 430 "Switch", // name
393 1, 0, 1, 0, 0, control_output_count); // counts 431 1, 0, 1, 0, 0, control_output_count); // counts
394 } 432 }
395 433
396 434
397 const Operator* CommonOperatorBuilder::IfValue(int32_t index) { 435 const Operator* CommonOperatorBuilder::IfValue(int32_t index) {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 } else { 770 } else {
733 UNREACHABLE(); 771 UNREACHABLE();
734 return nullptr; 772 return nullptr;
735 } 773 }
736 } 774 }
737 775
738 776
739 } // namespace compiler 777 } // namespace compiler
740 } // namespace internal 778 } // namespace internal
741 } // namespace v8 779 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/ia32/instruction-selector-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698