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

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

Issue 2435023002: Use a different map to distinguish eval contexts (Closed)
Patch Set: Changes from review Created 4 years 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/contexts.h » ('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 f577a455a8ee06c3a78fac6bd97eb9c4722be1f1..002481ee701ea7c94459715aeefa383470dc7aed 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -215,6 +215,37 @@ CreateCatchContextParameters const& CreateCatchContextParametersOf(
return OpParameter<CreateCatchContextParameters>(op);
}
+CreateFunctionContextParameters::CreateFunctionContextParameters(
+ int slot_count, ScopeType scope_type)
+ : slot_count_(slot_count), scope_type_(scope_type) {}
+
+bool operator==(CreateFunctionContextParameters const& lhs,
+ CreateFunctionContextParameters const& rhs) {
+ return lhs.slot_count() == rhs.slot_count() &&
+ lhs.scope_type() == rhs.scope_type();
+}
+
+bool operator!=(CreateFunctionContextParameters const& lhs,
+ CreateFunctionContextParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+size_t hash_value(CreateFunctionContextParameters const& parameters) {
+ return base::hash_combine(parameters.slot_count(),
+ static_cast<int>(parameters.scope_type()));
+}
+
+std::ostream& operator<<(std::ostream& os,
+ CreateFunctionContextParameters const& parameters) {
+ return os << parameters.slot_count() << ", " << parameters.scope_type();
+}
+
+CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
+ Operator const* op) {
+ DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, op->opcode());
+ return OpParameter<CreateFunctionContextParameters>(op);
+}
+
bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
return lhs.name().location() == rhs.name().location() &&
lhs.language_mode() == rhs.language_mode() &&
@@ -889,13 +920,14 @@ const Operator* JSOperatorBuilder::CreateLiteralRegExp(
parameters); // parameter
}
-
-const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) {
- return new (zone()) Operator1<int>( // --
+const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count,
+ ScopeType scope_type) {
+ CreateFunctionContextParameters parameters(slot_count, scope_type);
+ return new (zone()) Operator1<CreateFunctionContextParameters>( // --
IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode
"JSCreateFunctionContext", // name
1, 1, 1, 1, 1, 2, // counts
- slot_count); // parameter
+ parameters); // parameter
}
const Operator* JSOperatorBuilder::CreateCatchContext(
@@ -918,22 +950,21 @@ const Operator* JSOperatorBuilder::CreateWithContext(
}
const Operator* JSOperatorBuilder::CreateBlockContext(
- const Handle<ScopeInfo>& scpope_info) {
+ const Handle<ScopeInfo>& scope_info) {
return new (zone()) Operator1<Handle<ScopeInfo>>( // --
IrOpcode::kJSCreateBlockContext, Operator::kNoProperties, // opcode
"JSCreateBlockContext", // name
1, 1, 1, 1, 1, 2, // counts
- scpope_info); // parameter
+ scope_info); // parameter
}
-
const Operator* JSOperatorBuilder::CreateScriptContext(
- const Handle<ScopeInfo>& scpope_info) {
+ const Handle<ScopeInfo>& scope_info) {
return new (zone()) Operator1<Handle<ScopeInfo>>( // --
IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode
"JSCreateScriptContext", // name
1, 1, 1, 1, 1, 2, // counts
- scpope_info); // parameter
+ scope_info); // parameter
}
} // namespace compiler
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698