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

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

Issue 2302013002: Store the scope info in catch contexts (Closed)
Patch Set: updates Created 4 years, 3 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/contexts.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 c2fea50388eb41c4bae1e46dda249e8ea314bae0..f26a96cd28ea4631359d630109205c40d1dae993 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -157,6 +157,37 @@ ContextAccess const& ContextAccessOf(Operator const* op) {
return OpParameter<ContextAccess>(op);
}
+CreateCatchContextParameters::CreateCatchContextParameters(
+ Handle<String> catch_name, Handle<ScopeInfo> scope_info)
+ : catch_name_(catch_name), scope_info_(scope_info) {}
+
+bool operator==(CreateCatchContextParameters const& lhs,
+ CreateCatchContextParameters const& rhs) {
+ return lhs.catch_name().location() == rhs.catch_name().location() &&
+ lhs.scope_info().location() == rhs.scope_info().location();
+}
+
+bool operator!=(CreateCatchContextParameters const& lhs,
+ CreateCatchContextParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+size_t hash_value(CreateCatchContextParameters const& parameters) {
+ return base::hash_combine(parameters.catch_name().location(),
+ parameters.scope_info().location());
+}
+
+std::ostream& operator<<(std::ostream& os,
+ CreateCatchContextParameters const& parameters) {
+ return os << Brief(*parameters.catch_name()) << ", "
+ << Brief(*parameters.scope_info());
+}
+
+CreateCatchContextParameters const& CreateCatchContextParametersOf(
+ Operator const* op) {
+ DCHECK_EQ(IrOpcode::kJSCreateCatchContext, op->opcode());
+ return OpParameter<CreateCatchContextParameters>(op);
+}
bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
return lhs.name().location() == rhs.name().location() &&
@@ -809,14 +840,14 @@ const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) {
slot_count); // parameter
}
-
const Operator* JSOperatorBuilder::CreateCatchContext(
- const Handle<String>& name) {
- return new (zone()) Operator1<Handle<String>>( // --
+ const Handle<String>& name, const Handle<ScopeInfo>& scope_info) {
+ CreateCatchContextParameters parameters(name, scope_info);
+ return new (zone()) Operator1<CreateCatchContextParameters>(
IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
"JSCreateCatchContext", // name
2, 1, 1, 1, 1, 2, // counts
- name); // parameter
+ parameters); // parameter
}
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698