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

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

Issue 1224793002: Loads and stores to global vars are now made via property cell shortcuts installed into parent scri… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 years, 5 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-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 1966724a86a1ab2df7a5cfe5579e79ee51e70e3b..a0f3d3972ed3dd8a165b5056325598ee6537942a 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -256,9 +256,66 @@ const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
}
-const LoadNamedParameters& LoadGlobalParametersOf(const Operator* op) {
+bool operator==(LoadGlobalParameters const& lhs,
+ LoadGlobalParameters const& rhs) {
+ return lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() &&
+ lhs.contextual_mode() == rhs.contextual_mode() &&
+ lhs.slot_index() == rhs.slot_index();
+}
+
+
+bool operator!=(LoadGlobalParameters const& lhs,
+ LoadGlobalParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(LoadGlobalParameters const& p) {
+ return base::hash_combine(p.name(), p.contextual_mode(), p.slot_index());
+}
+
+
+std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) {
+ return os << Brief(*p.name().handle()) << ", " << p.contextual_mode()
+ << ", slot: " << p.slot_index();
+}
+
+
+const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode());
- return OpParameter<LoadNamedParameters>(op);
+ return OpParameter<LoadGlobalParameters>(op);
+}
+
+
+bool operator==(StoreGlobalParameters const& lhs,
+ StoreGlobalParameters const& rhs) {
+ return lhs.language_mode() == rhs.language_mode() &&
+ lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() &&
+ lhs.slot_index() == rhs.slot_index();
+}
+
+
+bool operator!=(StoreGlobalParameters const& lhs,
+ StoreGlobalParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(StoreGlobalParameters const& p) {
+ return base::hash_combine(p.language_mode(), p.name(), p.feedback(),
+ p.slot_index());
+}
+
+
+std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) {
+ return os << p.language_mode() << ", " << Brief(*p.name().handle())
+ << ", slot: " << p.slot_index();
+}
+
+
+const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) {
+ DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
+ return OpParameter<StoreGlobalParameters>(op);
}
@@ -291,12 +348,6 @@ const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) {
}
-const StoreNamedParameters& StoreGlobalParametersOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
- return OpParameter<StoreNamedParameters>(op);
-}
-
-
bool operator==(StorePropertyParameters const& lhs,
StorePropertyParameters const& rhs) {
return lhs.language_mode() == rhs.language_mode() &&
@@ -568,24 +619,26 @@ const Operator* JSOperatorBuilder::DeleteProperty(LanguageMode language_mode) {
const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name,
const VectorSlotPair& feedback,
- ContextualMode contextual_mode) {
- LoadNamedParameters parameters(name, feedback, SLOPPY, contextual_mode);
- return new (zone()) Operator1<LoadNamedParameters>( // --
+ ContextualMode contextual_mode,
+ int slot_index) {
+ LoadGlobalParameters parameters(name, feedback, contextual_mode, slot_index);
+ return new (zone()) Operator1<LoadGlobalParameters>( // --
IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
"JSLoadGlobal", // name
- 2, 1, 1, 1, 1, 2, // counts
+ 3, 1, 1, 1, 1, 2, // counts
parameters); // parameter
}
const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
const Unique<Name>& name,
- const VectorSlotPair& feedback) {
- StoreNamedParameters parameters(language_mode, feedback, name);
- return new (zone()) Operator1<StoreNamedParameters>( // --
+ const VectorSlotPair& feedback,
+ int slot_index) {
+ StoreGlobalParameters parameters(language_mode, feedback, name, slot_index);
+ return new (zone()) Operator1<StoreGlobalParameters>( // --
IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode
"JSStoreGlobal", // name
- 3, 1, 1, 0, 1, 2, // counts
+ 4, 1, 1, 0, 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