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

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

Issue 1994503002: [turbofan] Turn common Guard operator into simplified TypeGuard. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/simplified-operator.h ('k') | src/compiler/simplified-operator-reducer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator.cc
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
index c3bbce6dca88110d0f76c45403b93a747891f8a9..03504035d715c0fa3466e94a13a2b3169beb98ad 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -172,6 +172,11 @@ const ElementAccess& ElementAccessOf(const Operator* op) {
return OpParameter<ElementAccess>(op);
}
+Type* TypeOf(const Operator* op) {
+ DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode());
+ return OpParameter<Type*>(op);
+}
+
#define PURE_OP_LIST(V) \
V(BooleanNot, Operator::kNoProperties, 1) \
V(BooleanToNumber, Operator::kNoProperties, 1) \
@@ -282,6 +287,22 @@ const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
"ReferenceEqual", 2, 0, 0, 1, 0, 0);
}
+const Operator* SimplifiedOperatorBuilder::TypeGuard(Type* type) {
+ class TypeGuardOperator final : public Operator1<Type*> {
+ public:
+ explicit TypeGuardOperator(Type* type)
+ : Operator1<Type*>( // --
+ IrOpcode::kTypeGuard, Operator::kPure, // opcode
+ "TypeGuard", // name
+ 1, 0, 1, 1, 0, 0, // counts
+ type) {} // parameter
+
+ void PrintParameter(std::ostream& os) const final {
+ parameter()->PrintTo(os);
+ }
+ };
+ return new (zone()) TypeGuardOperator(type);
+}
const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) {
switch (pretenure) {
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/simplified-operator-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698