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

Side by Side Diff: src/ast/ast-expression-rewriter.cc

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 1 month 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/ast-expression-rewriter.h ('k') | src/ast/ast-literal-reindexer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/ast/ast.h" 5 #include "src/ast/ast.h"
6 #include "src/ast/ast-expression-rewriter.h" 6 #include "src/ast/ast-expression-rewriter.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 10
11 // ---------------------------------------------------------------------------- 11 // ----------------------------------------------------------------------------
12 // Implementation of AstExpressionRewriter 12 // Implementation of AstExpressionRewriter
13 // The AST is traversed but no actual rewriting takes place, unless the 13 // The AST is traversed but no actual rewriting takes place, unless the
14 // Visit methods are overriden in subclasses. 14 // Visit methods are overriden in subclasses.
15 15
16 #define REWRITE_THIS(node) \ 16 #define REWRITE_THIS(node) \
17 do { \ 17 do { \
18 if (!RewriteExpression(node)) return; \ 18 if (!RewriteExpression(node)) return; \
19 } while (false) 19 } while (false)
20 #define NOTHING() DCHECK_NULL(replacement_) 20 #define NOTHING() DCHECK_NULL(replacement_)
21 21
22 22
23 void AstExpressionRewriter::VisitDeclarations( 23 void AstExpressionRewriter::VisitDeclarations(
24 ZoneList<Declaration*>* declarations) { 24 ZoneList<Declaration*>* declarations) {
25 for (int i = 0; i < declarations->length(); i++) { 25 for (int i = 0; i < declarations->length(); i++) {
26 AST_REWRITE_LIST_ELEMENT(Declaration, declarations, i); 26 AST_REWRITE_LIST_ELEMENT(Declaration, declarations, i);
27 } 27 }
28 } 28 }
29 29
30 30 void AstExpressionRewriter::VisitStatements(
31 void AstExpressionRewriter::VisitStatements(ZoneList<Statement*>* statements) { 31 ZoneChunkList<Statement*>* statements) {
32 for (int i = 0; i < statements->length(); i++) { 32 for (auto it = statements->begin(); it != statements->end(); it++) {
33 AST_REWRITE_LIST_ELEMENT(Statement, statements, i); 33 AST_REWRITE(Statement, *it, *it = replacement);
34 // Not stopping when a jump statement is found. 34 // Not stopping when a jump statement is found.
35 } 35 }
36 } 36 }
37 37
38 38
39 void AstExpressionRewriter::VisitExpressions( 39 void AstExpressionRewriter::VisitExpressions(
40 ZoneList<Expression*>* expressions) { 40 ZoneList<Expression*>* expressions) {
41 for (int i = 0; i < expressions->length(); i++) { 41 for (int i = 0; i < expressions->length(); i++) {
42 // The variable statement visiting code may pass NULL expressions 42 // The variable statement visiting code may pass NULL expressions
43 // to this code. Maybe this should be handled by introducing an 43 // to this code. Maybe this should be handled by introducing an
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 181
182 void AstExpressionRewriter::VisitDebuggerStatement(DebuggerStatement* node) { 182 void AstExpressionRewriter::VisitDebuggerStatement(DebuggerStatement* node) {
183 NOTHING(); 183 NOTHING();
184 } 184 }
185 185
186 186
187 void AstExpressionRewriter::VisitFunctionLiteral(FunctionLiteral* node) { 187 void AstExpressionRewriter::VisitFunctionLiteral(FunctionLiteral* node) {
188 REWRITE_THIS(node); 188 REWRITE_THIS(node);
189 VisitDeclarations(node->scope()->declarations()); 189 VisitDeclarations(node->scope()->declarations());
190 ZoneList<Statement*>* body = node->body(); 190 ZoneChunkList<Statement*>* body = node->body();
191 if (body != nullptr) VisitStatements(body); 191 if (body != nullptr) VisitStatements(body);
192 } 192 }
193 193
194 194
195 void AstExpressionRewriter::VisitClassLiteral(ClassLiteral* node) { 195 void AstExpressionRewriter::VisitClassLiteral(ClassLiteral* node) {
196 REWRITE_THIS(node); 196 REWRITE_THIS(node);
197 // Not visiting `class_variable_proxy_`. 197 // Not visiting `class_variable_proxy_`.
198 if (node->extends() != nullptr) { 198 if (node->extends() != nullptr) {
199 AST_REWRITE_PROPERTY(Expression, node, extends); 199 AST_REWRITE_PROPERTY(Expression, node, extends);
200 } 200 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 void AstExpressionRewriter::VisitRewritableExpression( 384 void AstExpressionRewriter::VisitRewritableExpression(
385 RewritableExpression* node) { 385 RewritableExpression* node) {
386 REWRITE_THIS(node); 386 REWRITE_THIS(node);
387 AST_REWRITE(Expression, node->expression(), node->Rewrite(replacement)); 387 AST_REWRITE(Expression, node->expression(), node->Rewrite(replacement));
388 } 388 }
389 389
390 390
391 } // namespace internal 391 } // namespace internal
392 } // namespace v8 392 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-expression-rewriter.h ('k') | src/ast/ast-literal-reindexer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698