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

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

Issue 2035383003: [turbofan] Type feedback for numeric comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 4 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/js-operator.cc
diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc
index cc02152442d25e3c76e5a8cd7503bca51dc691e4..fbb8a280519b08e9548587d5b21caf2cdac07178 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -377,20 +377,35 @@ const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) {
}
const BinaryOperationHints& BinaryOperationHintsOf(const Operator* op) {
- DCHECK(op->opcode() == IrOpcode::kJSAdd ||
- op->opcode() == IrOpcode::kJSSubtract);
+ DCHECK(op->opcode() == IrOpcode::kJSBitwiseOr ||
+ op->opcode() == IrOpcode::kJSBitwiseXor ||
+ op->opcode() == IrOpcode::kJSBitwiseAnd ||
+ op->opcode() == IrOpcode::kJSShiftLeft ||
+ op->opcode() == IrOpcode::kJSShiftRight ||
+ op->opcode() == IrOpcode::kJSShiftRightLogical ||
+ op->opcode() == IrOpcode::kJSAdd ||
+ op->opcode() == IrOpcode::kJSSubtract ||
+ op->opcode() == IrOpcode::kJSMultiply ||
+ op->opcode() == IrOpcode::kJSDivide ||
+ op->opcode() == IrOpcode::kJSModulus);
return OpParameter<BinaryOperationHints>(op);
}
+const CompareOperationHints& CompareOperationHintsOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kJSEqual ||
+ op->opcode() == IrOpcode::kJSNotEqual ||
+ op->opcode() == IrOpcode::kJSStrictEqual ||
+ op->opcode() == IrOpcode::kJSStrictNotEqual ||
+ op->opcode() == IrOpcode::kJSLessThan ||
+ op->opcode() == IrOpcode::kJSGreaterThan ||
+ op->opcode() == IrOpcode::kJSLessThanOrEqual ||
+ op->opcode() == IrOpcode::kJSGreaterThanOrEqual ||
+ op->opcode() == IrOpcode::kJSHasProperty ||
Benedikt Meurer 2016/06/07 04:11:00 HasProperty and InstanceOf don't have CompareOpera
Jarin 2016/06/09 13:37:31 Done.
+ op->opcode() == IrOpcode::kJSInstanceOf);
+ return OpParameter<CompareOperationHints>(op);
+}
+
#define CACHED_OP_LIST(V) \
- V(Equal, Operator::kNoProperties, 2, 1) \
- V(NotEqual, Operator::kNoProperties, 2, 1) \
- V(StrictEqual, Operator::kPure, 2, 1) \
- V(StrictNotEqual, Operator::kPure, 2, 1) \
- V(LessThan, Operator::kNoProperties, 2, 1) \
- V(GreaterThan, Operator::kNoProperties, 2, 1) \
- V(LessThanOrEqual, Operator::kNoProperties, 2, 1) \
- V(GreaterThanOrEqual, Operator::kNoProperties, 2, 1) \
V(ToInteger, Operator::kNoProperties, 1, 1) \
V(ToLength, Operator::kNoProperties, 1, 1) \
V(ToName, Operator::kNoProperties, 1, 1) \
@@ -399,9 +414,7 @@ const BinaryOperationHints& BinaryOperationHintsOf(const Operator* op) {
V(ToString, Operator::kNoProperties, 1, 1) \
V(Create, Operator::kEliminatable, 2, 1) \
V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \
- V(HasProperty, Operator::kNoProperties, 2, 1) \
Benedikt Meurer 2016/06/07 04:11:00 See comment above.
Jarin 2016/06/09 13:37:31 Done.
V(TypeOf, Operator::kPure, 1, 1) \
- V(InstanceOf, Operator::kNoProperties, 2, 1) \
Benedikt Meurer 2016/06/07 04:11:00 See comment above.
Jarin 2016/06/09 13:37:31 Done.
V(ForInDone, Operator::kPure, 2, 1) \
V(ForInNext, Operator::kNoProperties, 4, 1) \
V(ForInPrepare, Operator::kNoProperties, 1, 3) \
@@ -544,6 +557,98 @@ const Operator* JSOperatorBuilder::Modulus(BinaryOperationHints hints) {
hints); // parameter
}
+const Operator* JSOperatorBuilder::Equal(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSEqual, Operator::kNoProperties, // opcode
+ "JSEqual", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::NotEqual(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSNotEqual, Operator::kNoProperties, // opcode
+ "JSNotEqual", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::StrictEqual(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSStrictEqual, Operator::kPure, // opcode
+ "JSStrictEqual", // name
+ 2, 0, 0, 1, 0, 0, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::StrictNotEqual(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSStrictNotEqual, Operator::kPure, // opcode
+ "JSStrictNotEqual", // name
+ 2, 0, 0, 1, 0, 0, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::LessThan(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSLessThan, Operator::kNoProperties, // opcode
+ "JSLessThan", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::GreaterThan(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSGreaterThan, Operator::kNoProperties, // opcode
+ "JSGreaterThan", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::LessThanOrEqual(
+ CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSLessThanOrEqual, Operator::kNoProperties, // opcode
+ "JSLessThanOrEqual", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::GreaterThanOrEqual(
+ CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSGreaterThanOrEqual, Operator::kNoProperties, // opcode
+ "JSGreaterThanOrEqual", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::HasProperty(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSHasProperty, Operator::kNoProperties, // opcode
+ "JSHasProperty", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
+const Operator* JSOperatorBuilder::InstanceOf(CompareOperationHints hints) {
+ // TODO(turbofan): Cache most important versions of this operator.
+ return new (zone()) Operator1<CompareOperationHints>( //--
+ IrOpcode::kJSInstanceOf, Operator::kNoProperties, // opcode
+ "JSInstanceOf", // name
+ 2, 1, 1, 1, 1, 2, // inputs/outputs
+ hints); // parameter
+}
+
const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) {
// TODO(turbofan): Cache most important versions of this operator.

Powered by Google App Engine
This is Rietveld 408576698