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

Unified 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, 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc
index 874ad29cef7d9efa7129fcd92e55333755159a1a..bf6b49eea29147c3d0a8ce94eddb2a413905441e 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -36,6 +36,21 @@ BranchHint BranchHintOf(const Operator* const op) {
}
+size_t hash_value(IfExceptionHint hint) { return static_cast<size_t>(hint); }
+
+
+std::ostream& operator<<(std::ostream& os, IfExceptionHint hint) {
+ switch (hint) {
+ case IfExceptionHint::kLocallyCaught:
+ return os << "Caught";
+ case IfExceptionHint::kLocallyUncaught:
+ return os << "Uncaught";
+ }
+ UNREACHABLE();
+ return os;
+}
+
+
bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
return lhs.type() == rhs.type() && lhs.hint() == rhs.hint();
}
@@ -105,7 +120,6 @@ std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
- V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \
V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \
@@ -210,6 +224,18 @@ struct CommonOperatorGlobalCache final {
CACHED_OP_LIST(CACHED)
#undef CACHED
+ template <IfExceptionHint kCaughtLocally>
+ struct IfExceptionOperator final : public Operator1<IfExceptionHint> {
+ IfExceptionOperator()
+ : Operator1<IfExceptionHint>( // --
+ IrOpcode::kIfException, Operator::kKontrol, // opcode
+ "IfException", // name
+ 0, 0, 1, 1, 0, 1, // counts
+ kCaughtLocally) {} // parameter
+ };
+ IfExceptionOperator<IfExceptionHint::kLocallyCaught> kIfExceptionCOperator;
+ IfExceptionOperator<IfExceptionHint::kLocallyUncaught> kIfExceptionUOperator;
+
template <size_t kInputCount>
struct EndOperator final : public Operator {
EndOperator()
@@ -385,6 +411,18 @@ const Operator* CommonOperatorBuilder::Branch(BranchHint hint) {
}
+const Operator* CommonOperatorBuilder::IfException(IfExceptionHint hint) {
+ switch (hint) {
+ case IfExceptionHint::kLocallyCaught:
+ return &cache_.kIfExceptionCOperator;
+ case IfExceptionHint::kLocallyUncaught:
+ return &cache_.kIfExceptionUOperator;
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
+
const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) {
DCHECK_GE(control_output_count, 3u); // Disallow trivial switches.
return new (zone()) Operator( // --
« 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