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

Unified Diff: src/compiler/common-operator.cc

Issue 771153002: [turbofan] Cache the Branch operator(s). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | 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 b0af2fd002598a7c1931a90aae6656a4a2ec61c8..58f62c88ee9b2479061ab2c020454e9e9672b864 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -124,6 +124,19 @@ struct CommonOperatorGlobalCache FINAL {
Name##Operator k##Name##Operator;
CACHED_OP_LIST(CACHED)
#undef CACHED
+
+ template <BranchHint kBranchHint>
+ struct BranchOperator FINAL : public Operator1<BranchHint> {
+ BranchOperator()
+ : Operator1<BranchHint>( // --
+ IrOpcode::kBranch, Operator::kFoldable, // opcode
+ "Branch", // name
+ 1, 0, 1, 0, 0, 2, // counts
+ kBranchHint) {} // parameter
+ };
+ BranchOperator<BranchHint::kNone> kBranchNoneOperator;
+ BranchOperator<BranchHint::kTrue> kBranchTrueOperator;
+ BranchOperator<BranchHint::kFalse> kBranchFalseOperator;
};
@@ -145,8 +158,16 @@ CACHED_OP_LIST(CACHED)
const Operator* CommonOperatorBuilder::Branch(BranchHint hint) {
- return new (zone()) Operator1<BranchHint>(
- IrOpcode::kBranch, Operator::kFoldable, "Branch", 1, 0, 1, 0, 0, 2, hint);
+ switch (hint) {
+ case BranchHint::kNone:
+ return &cache_.kBranchNoneOperator;
+ case BranchHint::kTrue:
+ return &cache_.kBranchTrueOperator;
+ case BranchHint::kFalse:
+ return &cache_.kBranchFalseOperator;
+ }
+ UNREACHABLE();
+ return nullptr;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698