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

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

Issue 1418993002: [turbofan] Unify NamedAccess and PropertyAccess operator parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/js-operator.h ('k') | src/compiler/js-type-feedback.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 5860c925a124c2ad5cb1bcd642ef7183d4ad0c9a..f1ca84b3646c535fd0cf4c29a60de2b8e1478b89 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -205,66 +205,64 @@ DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) {
}
-bool operator==(LoadNamedParameters const& lhs,
- LoadNamedParameters const& rhs) {
+bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
return lhs.name().location() == rhs.name().location() &&
lhs.language_mode() == rhs.language_mode() &&
lhs.feedback() == rhs.feedback();
}
-bool operator!=(LoadNamedParameters const& lhs,
- LoadNamedParameters const& rhs) {
+bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) {
return !(lhs == rhs);
}
-size_t hash_value(LoadNamedParameters const& p) {
+size_t hash_value(NamedAccess const& p) {
return base::hash_combine(p.name().location(), p.language_mode(),
p.feedback());
}
-std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) {
+std::ostream& operator<<(std::ostream& os, NamedAccess const& p) {
return os << Brief(*p.name()) << ", " << p.language_mode();
}
-std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) {
+NamedAccess const& NamedAccessOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kJSLoadNamed ||
+ op->opcode() == IrOpcode::kJSStoreNamed);
+ return OpParameter<NamedAccess>(op);
+}
+
+
+std::ostream& operator<<(std::ostream& os, PropertyAccess const& p) {
return os << p.language_mode();
}
-bool operator==(LoadPropertyParameters const& lhs,
- LoadPropertyParameters const& rhs) {
+bool operator==(PropertyAccess const& lhs, PropertyAccess const& rhs) {
return lhs.language_mode() == rhs.language_mode() &&
lhs.feedback() == rhs.feedback();
}
-bool operator!=(LoadPropertyParameters const& lhs,
- LoadPropertyParameters const& rhs) {
+bool operator!=(PropertyAccess const& lhs, PropertyAccess const& rhs) {
return !(lhs == rhs);
}
-const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode());
- return OpParameter<LoadPropertyParameters>(op);
+PropertyAccess const& PropertyAccessOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kJSLoadProperty ||
+ op->opcode() == IrOpcode::kJSStoreProperty);
+ return OpParameter<PropertyAccess>(op);
}
-size_t hash_value(LoadPropertyParameters const& p) {
+size_t hash_value(PropertyAccess const& p) {
return base::hash_combine(p.language_mode(), p.feedback());
}
-const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
- return OpParameter<LoadNamedParameters>(op);
-}
-
-
bool operator==(LoadGlobalParameters const& lhs,
LoadGlobalParameters const& rhs) {
return lhs.name().location() == rhs.name().location() &&
@@ -331,66 +329,6 @@ const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) {
}
-bool operator==(StoreNamedParameters const& lhs,
- StoreNamedParameters const& rhs) {
- return lhs.language_mode() == rhs.language_mode() &&
- lhs.name().location() == rhs.name().location() &&
- lhs.feedback() == rhs.feedback();
-}
-
-
-bool operator!=(StoreNamedParameters const& lhs,
- StoreNamedParameters const& rhs) {
- return !(lhs == rhs);
-}
-
-
-size_t hash_value(StoreNamedParameters const& p) {
- return base::hash_combine(p.language_mode(), p.name().location(),
- p.feedback());
-}
-
-
-std::ostream& operator<<(std::ostream& os, StoreNamedParameters const& p) {
- return os << p.language_mode() << ", " << Brief(*p.name());
-}
-
-
-const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode());
- return OpParameter<StoreNamedParameters>(op);
-}
-
-
-bool operator==(StorePropertyParameters const& lhs,
- StorePropertyParameters const& rhs) {
- return lhs.language_mode() == rhs.language_mode() &&
- lhs.feedback() == rhs.feedback();
-}
-
-
-bool operator!=(StorePropertyParameters const& lhs,
- StorePropertyParameters const& rhs) {
- return !(lhs == rhs);
-}
-
-
-size_t hash_value(StorePropertyParameters const& p) {
- return base::hash_combine(p.language_mode(), p.feedback());
-}
-
-
-std::ostream& operator<<(std::ostream& os, StorePropertyParameters const& p) {
- return os << p.language_mode();
-}
-
-
-const StorePropertyParameters& StorePropertyParametersOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kJSStoreProperty, op->opcode());
- return OpParameter<StorePropertyParameters>(op);
-}
-
-
bool operator==(CreateArgumentsParameters const& lhs,
CreateArgumentsParameters const& rhs) {
return lhs.type() == rhs.type() && lhs.start_index() == rhs.start_index();
@@ -600,49 +538,49 @@ const Operator* JSOperatorBuilder::CallConstruct(int arguments) {
}
-const Operator* JSOperatorBuilder::LoadNamed(const Handle<Name>& name,
- const VectorSlotPair& feedback,
- LanguageMode language_mode) {
- LoadNamedParameters parameters(name, feedback, language_mode);
- return new (zone()) Operator1<LoadNamedParameters>( // --
+const Operator* JSOperatorBuilder::LoadNamed(LanguageMode language_mode,
+ Handle<Name> name,
+ const VectorSlotPair& feedback) {
+ NamedAccess access(language_mode, name, feedback);
+ return new (zone()) Operator1<NamedAccess>( // --
IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
"JSLoadNamed", // name
2, 1, 1, 1, 1, 2, // counts
- parameters); // parameter
+ access); // parameter
}
-const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback,
- LanguageMode language_mode) {
- LoadPropertyParameters parameters(feedback, language_mode);
- return new (zone()) Operator1<LoadPropertyParameters>( // --
+const Operator* JSOperatorBuilder::LoadProperty(
+ LanguageMode language_mode, VectorSlotPair const& feedback) {
+ PropertyAccess access(language_mode, feedback);
+ return new (zone()) Operator1<PropertyAccess>( // --
IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
"JSLoadProperty", // name
3, 1, 1, 1, 1, 2, // counts
- parameters); // parameter
+ access); // parameter
}
const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
- const Handle<Name>& name,
- const VectorSlotPair& feedback) {
- StoreNamedParameters parameters(language_mode, feedback, name);
- return new (zone()) Operator1<StoreNamedParameters>( // --
+ Handle<Name> name,
+ VectorSlotPair const& feedback) {
+ NamedAccess access(language_mode, name, feedback);
+ return new (zone()) Operator1<NamedAccess>( // --
IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode
"JSStoreNamed", // name
3, 1, 1, 0, 1, 2, // counts
- parameters); // parameter
+ access); // parameter
}
const Operator* JSOperatorBuilder::StoreProperty(
- LanguageMode language_mode, const VectorSlotPair& feedback) {
- StorePropertyParameters parameters(language_mode, feedback);
- return new (zone()) Operator1<StorePropertyParameters>( // --
+ LanguageMode language_mode, VectorSlotPair const& feedback) {
+ PropertyAccess access(language_mode, feedback);
+ return new (zone()) Operator1<PropertyAccess>( // --
IrOpcode::kJSStoreProperty, Operator::kNoProperties, // opcode
"JSStoreProperty", // name
4, 1, 1, 0, 1, 2, // counts
- parameters); // parameter
+ access); // parameter
}
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-type-feedback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698