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

Side by Side Diff: src/parsing/parser.cc

Issue 2226803003: Replace SloppyBlockFunctionMap::Vector with linked list through SloppyBlockFunctionStatement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after
5276 } 5276 }
5277 } else { 5277 } else {
5278 if (scope->IsDeclaredParameter(name)) { 5278 if (scope->IsDeclaredParameter(name)) {
5279 continue; 5279 continue;
5280 } 5280 }
5281 } 5281 }
5282 5282
5283 bool var_created = false; 5283 bool var_created = false;
5284 5284
5285 // Write in assignments to var for each block-scoped function declaration 5285 // Write in assignments to var for each block-scoped function declaration
5286 auto delegates = static_cast<SloppyBlockFunctionMap::Vector*>(p->value); 5286 auto delegates = static_cast<SloppyBlockFunctionStatement*>(p->value);
5287 5287
5288 DeclarationScope* decl_scope = scope; 5288 DeclarationScope* decl_scope = scope;
5289 while (decl_scope->is_eval_scope()) { 5289 while (decl_scope->is_eval_scope()) {
5290 decl_scope = decl_scope->outer_scope()->GetDeclarationScope(); 5290 decl_scope = decl_scope->outer_scope()->GetDeclarationScope();
5291 } 5291 }
5292 Scope* outer_scope = decl_scope->outer_scope(); 5292 Scope* outer_scope = decl_scope->outer_scope();
5293 5293
5294 for (SloppyBlockFunctionStatement* delegate : *delegates) { 5294 for (SloppyBlockFunctionStatement* delegate = delegates;
5295 delegate != nullptr; delegate = delegate->next()) {
5295 // Check if there's a conflict with a lexical declaration 5296 // Check if there's a conflict with a lexical declaration
5296 Scope* query_scope = delegate->scope()->outer_scope(); 5297 Scope* query_scope = delegate->scope()->outer_scope();
5297 Variable* var = nullptr; 5298 Variable* var = nullptr;
5298 bool should_hoist = true; 5299 bool should_hoist = true;
5299 5300
5300 // Note that we perform this loop for each delegate named 'name', 5301 // Note that we perform this loop for each delegate named 'name',
5301 // which may duplicate work if those delegates share scopes. 5302 // which may duplicate work if those delegates share scopes.
5302 // It is not sufficient to just do a Lookup on query_scope: for 5303 // It is not sufficient to just do a Lookup on query_scope: for
5303 // example, that does not prevent hoisting of the function in 5304 // example, that does not prevent hoisting of the function in
5304 // `{ let e; try {} catch (e) { function e(){} } }` 5305 // `{ let e; try {} catch (e) { function e(){} } }`
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
7118 node->Print(Isolate::Current()); 7119 node->Print(Isolate::Current());
7119 } 7120 }
7120 #endif // DEBUG 7121 #endif // DEBUG
7121 7122
7122 #undef CHECK_OK 7123 #undef CHECK_OK
7123 #undef CHECK_OK_VOID 7124 #undef CHECK_OK_VOID
7124 #undef CHECK_FAILED 7125 #undef CHECK_FAILED
7125 7126
7126 } // namespace internal 7127 } // namespace internal
7127 } // namespace v8 7128 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698