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

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

Issue 2207533002: [turbofan] Remove IfExceptionHint from exception projections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 4 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/instruction-selector.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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 std::ostream& operator<<(std::ostream& os, DeoptimizeParameters p) { 69 std::ostream& operator<<(std::ostream& os, DeoptimizeParameters p) {
70 return os << p.kind() << ":" << p.reason(); 70 return os << p.kind() << ":" << p.reason();
71 } 71 }
72 72
73 DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) { 73 DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) {
74 DCHECK_EQ(IrOpcode::kDeoptimize, op->opcode()); 74 DCHECK_EQ(IrOpcode::kDeoptimize, op->opcode());
75 return OpParameter<DeoptimizeParameters>(op); 75 return OpParameter<DeoptimizeParameters>(op);
76 } 76 }
77 77
78 IfExceptionHint ExceptionHintFromCatchPrediction(
79 HandlerTable::CatchPrediction prediction) {
80 switch (prediction) {
81 case HandlerTable::UNCAUGHT:
82 return IfExceptionHint::kLocallyUncaught;
83 case HandlerTable::CAUGHT:
84 return IfExceptionHint::kLocallyCaught;
85 case HandlerTable::PROMISE:
86 return IfExceptionHint::kLocallyCaughtForPromiseReject;
87 }
88 UNREACHABLE();
89 return IfExceptionHint::kLocallyUncaught;
90 }
91
92 size_t hash_value(IfExceptionHint hint) { return static_cast<size_t>(hint); }
93
94
95 std::ostream& operator<<(std::ostream& os, IfExceptionHint hint) {
96 switch (hint) {
97 case IfExceptionHint::kLocallyUncaught:
98 return os << "Uncaught";
99 case IfExceptionHint::kLocallyCaught:
100 return os << "Caught";
101 case IfExceptionHint::kLocallyCaughtForPromiseReject:
102 return os << "CaughtForPromiseReject";
103 }
104 UNREACHABLE();
105 return os;
106 }
107
108 78
109 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) { 79 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
110 return lhs.representation() == rhs.representation() && 80 return lhs.representation() == rhs.representation() &&
111 lhs.hint() == rhs.hint(); 81 lhs.hint() == rhs.hint();
112 } 82 }
113 83
114 84
115 bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) { 85 bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) {
116 return !(lhs == rhs); 86 return !(lhs == rhs);
117 } 87 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 os << elem; 203 os << elem;
234 } 204 }
235 return os; 205 return os;
236 } 206 }
237 207
238 #define CACHED_OP_LIST(V) \ 208 #define CACHED_OP_LIST(V) \
239 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ 209 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \
240 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 210 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
241 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 211 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
242 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 212 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
213 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \
243 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 214 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
244 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ 215 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
245 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ 216 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
246 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ 217 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
247 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ 218 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
248 V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \ 219 V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \
249 V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \ 220 V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \
250 V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \ 221 V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \
251 V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \ 222 V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \
252 V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \ 223 V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 Name##Operator() \ 322 Name##Operator() \
352 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ 323 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \
353 effect_input_count, control_input_count, \ 324 effect_input_count, control_input_count, \
354 value_output_count, effect_output_count, \ 325 value_output_count, effect_output_count, \
355 control_output_count) {} \ 326 control_output_count) {} \
356 }; \ 327 }; \
357 Name##Operator k##Name##Operator; 328 Name##Operator k##Name##Operator;
358 CACHED_OP_LIST(CACHED) 329 CACHED_OP_LIST(CACHED)
359 #undef CACHED 330 #undef CACHED
360 331
361 template <IfExceptionHint kCaughtLocally>
362 struct IfExceptionOperator final : public Operator1<IfExceptionHint> {
363 IfExceptionOperator()
364 : Operator1<IfExceptionHint>( // --
365 IrOpcode::kIfException, Operator::kKontrol, // opcode
366 "IfException", // name
367 0, 1, 1, 1, 1, 1, // counts
368 kCaughtLocally) {} // parameter
369 };
370 IfExceptionOperator<IfExceptionHint::kLocallyUncaught> kIfExceptionUOperator;
371 IfExceptionOperator<IfExceptionHint::kLocallyCaught> kIfExceptionCOperator;
372 IfExceptionOperator<IfExceptionHint::kLocallyCaughtForPromiseReject>
373 kIfExceptionPOperator;
374
375 template <size_t kInputCount> 332 template <size_t kInputCount>
376 struct EndOperator final : public Operator { 333 struct EndOperator final : public Operator {
377 EndOperator() 334 EndOperator()
378 : Operator( // -- 335 : Operator( // --
379 IrOpcode::kEnd, Operator::kKontrol, // opcode 336 IrOpcode::kEnd, Operator::kKontrol, // opcode
380 "End", // name 337 "End", // name
381 0, 0, kInputCount, 0, 0, 0) {} // counts 338 0, 0, kInputCount, 0, 0, 0) {} // counts
382 }; 339 };
383 #define CACHED_END(input_count) \ 340 #define CACHED_END(input_count) \
384 EndOperator<input_count> kEnd##input_count##Operator; 341 EndOperator<input_count> kEnd##input_count##Operator;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 DeoptimizeReason reason) { 588 DeoptimizeReason reason) {
632 // TODO(turbofan): Cache the most common versions of this. 589 // TODO(turbofan): Cache the most common versions of this.
633 return new (zone()) Operator1<DeoptimizeReason>( // -- 590 return new (zone()) Operator1<DeoptimizeReason>( // --
634 IrOpcode::kDeoptimizeUnless, // opcode 591 IrOpcode::kDeoptimizeUnless, // opcode
635 Operator::kFoldable | Operator::kNoThrow, // properties 592 Operator::kFoldable | Operator::kNoThrow, // properties
636 "DeoptimizeUnless", // name 593 "DeoptimizeUnless", // name
637 2, 1, 1, 0, 1, 1, // counts 594 2, 1, 1, 0, 1, 1, // counts
638 reason); // parameter 595 reason); // parameter
639 } 596 }
640 597
641 const Operator* CommonOperatorBuilder::IfException(IfExceptionHint hint) {
642 switch (hint) {
643 case IfExceptionHint::kLocallyUncaught:
644 return &cache_.kIfExceptionUOperator;
645 case IfExceptionHint::kLocallyCaught:
646 return &cache_.kIfExceptionCOperator;
647 case IfExceptionHint::kLocallyCaughtForPromiseReject:
648 return &cache_.kIfExceptionPOperator;
649 }
650 UNREACHABLE();
651 return nullptr;
652 }
653
654 598
655 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) { 599 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) {
656 return new (zone()) Operator( // -- 600 return new (zone()) Operator( // --
657 IrOpcode::kSwitch, Operator::kKontrol, // opcode 601 IrOpcode::kSwitch, Operator::kKontrol, // opcode
658 "Switch", // name 602 "Switch", // name
659 1, 0, 1, 0, 0, control_output_count); // counts 603 1, 0, 1, 0, 0, control_output_count); // counts
660 } 604 }
661 605
662 606
663 const Operator* CommonOperatorBuilder::IfValue(int32_t index) { 607 const Operator* CommonOperatorBuilder::IfValue(int32_t index) {
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 CommonOperatorBuilder::CreateFrameStateFunctionInfo( 975 CommonOperatorBuilder::CreateFrameStateFunctionInfo(
1032 FrameStateType type, int parameter_count, int local_count, 976 FrameStateType type, int parameter_count, int local_count,
1033 Handle<SharedFunctionInfo> shared_info) { 977 Handle<SharedFunctionInfo> shared_info) {
1034 return new (zone()->New(sizeof(FrameStateFunctionInfo))) 978 return new (zone()->New(sizeof(FrameStateFunctionInfo)))
1035 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); 979 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info);
1036 } 980 }
1037 981
1038 } // namespace compiler 982 } // namespace compiler
1039 } // namespace internal 983 } // namespace internal
1040 } // namespace v8 984 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698