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

Unified Diff: src/ast/scopes.cc

Issue 2685683002: [async-await] (simpler) fix for Return in try/finally in async functions (Closed)
Patch Set: also shrink the bitfield for ReturnStatement::Type Created 3 years, 10 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/ast/scopes.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index bd91e16a5220cccfab9ccb59f7eee7464dedac52..48f163aff7c40903090d523086fff2129c0a9a26 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -297,7 +297,7 @@ void DeclarationScope::SetDefaults() {
new_target_ = nullptr;
function_ = nullptr;
arguments_ = nullptr;
- this_function_ = nullptr;
+ rare_data_ = nullptr;
should_eager_compile_ = false;
was_lazily_parsed_ = false;
#ifdef DEBUG
@@ -682,7 +682,7 @@ void DeclarationScope::DeclareDefaultFunctionVariables(
if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) ||
IsAccessorFunction(function_kind_)) {
- this_function_ =
+ EnsureRareData()->this_function =
Declare(zone(), ast_value_factory->this_function_string(), CONST);
}
}
@@ -703,6 +703,24 @@ Variable* DeclarationScope::DeclareFunctionVar(const AstRawString* name) {
return function_;
}
+Variable* DeclarationScope::DeclareGeneratorObjectVar(
+ const AstRawString* name) {
+ DCHECK(is_function_scope() || is_module_scope());
+ DCHECK_NULL(generator_object_var());
+
+ Variable* result = EnsureRareData()->generator_object = NewTemporary(name);
+ result->set_is_used();
+ return result;
+}
+
+Variable* DeclarationScope::DeclarePromiseVar(const AstRawString* name) {
+ DCHECK(is_function_scope());
+ DCHECK_NULL(promise_var());
+ Variable* result = EnsureRareData()->promise = NewTemporary(name);
+ result->set_is_used();
+ return result;
+}
+
bool Scope::HasBeenRemoved() const {
if (sibling() == this) {
DCHECK_NULL(inner_scope_);
@@ -2110,9 +2128,8 @@ void DeclarationScope::AllocateLocals() {
new_target_ = nullptr;
}
- if (this_function_ != nullptr && !MustAllocate(this_function_)) {
- this_function_ = nullptr;
- }
+ NullifyRareVariableIf(RareVariable::kThisFunction,
+ [=](Variable* var) { return !MustAllocate(var); });
}
void ModuleScope::AllocateModuleVariables() {
« no previous file with comments | « src/ast/scopes.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698