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

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

Issue 1475613002: [turbofan] Introduce proper CreateLiteralParameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ArrayLiteral_LiteralIndexPush
Patch Set: Created 5 years, 1 month 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/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-operator.cc
diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc
index 7913491b46b6688b54da7459e30db3d8e7724729..a771cd543494644e7fc598c39ecebb5f6ab1590d 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -410,6 +410,36 @@ const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) {
}
+bool operator==(CreateLiteralParameters const& lhs,
+ CreateLiteralParameters const& rhs) {
+ return lhs.constants().location() == rhs.constants().location() &&
+ lhs.flags() == rhs.flags() && lhs.index() == rhs.index();
+}
+
+
+bool operator!=(CreateLiteralParameters const& lhs,
+ CreateLiteralParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(CreateLiteralParameters const& p) {
+ return base::hash_combine(p.constants().location(), p.flags(), p.index());
+}
+
+
+std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) {
+ return os << Brief(*p.constants()) << ", " << p.flags() << ", " << p.index();
+}
+
+
+const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray ||
+ op->opcode() == IrOpcode::kJSCreateLiteralObject);
+ return OpParameter<CreateLiteralParameters>(op);
+}
+
+
#define CACHED_OP_LIST(V) \
V(Equal, Operator::kNoProperties, 2, 1) \
V(NotEqual, Operator::kNoProperties, 2, 1) \
@@ -723,21 +753,29 @@ const Operator* JSOperatorBuilder::CreateClosure(
}
-const Operator* JSOperatorBuilder::CreateLiteralArray(int literal_flags) {
- return new (zone()) Operator1<int>( // --
+const Operator* JSOperatorBuilder::CreateLiteralArray(
+ Handle<FixedArray> constant_elements, int literal_flags,
+ int literal_index) {
+ CreateLiteralParameters parameters(constant_elements, literal_flags,
+ literal_index);
+ return new (zone()) Operator1<CreateLiteralParameters>( // --
IrOpcode::kJSCreateLiteralArray, Operator::kNoProperties, // opcode
"JSCreateLiteralArray", // name
- 3, 1, 1, 1, 1, 2, // counts
- literal_flags); // parameter
+ 1, 1, 1, 1, 1, 2, // counts
+ parameters); // parameter
}
-const Operator* JSOperatorBuilder::CreateLiteralObject(int literal_flags) {
- return new (zone()) Operator1<int>( // --
+const Operator* JSOperatorBuilder::CreateLiteralObject(
+ Handle<FixedArray> constant_properties, int literal_flags,
+ int literal_index) {
+ CreateLiteralParameters parameters(constant_properties, literal_flags,
+ literal_index);
+ return new (zone()) Operator1<CreateLiteralParameters>( // --
IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode
"JSCreateLiteralObject", // name
- 3, 1, 1, 1, 1, 2, // counts
- literal_flags); // parameter
+ 1, 1, 1, 1, 1, 2, // counts
+ parameters); // parameter
}
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698