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

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

Issue 1309813007: [es6] implement destructuring assignment (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cache te right scope in DeclareAndInitializeVariables() Created 5 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 unified diff | Download patch
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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast-expression-visitor.h" 7 #include "src/ast-expression-visitor.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 14 matching lines...) Expand all
25 #define RECURSE_EXPRESSION(call) \ 25 #define RECURSE_EXPRESSION(call) \
26 do { \ 26 do { \
27 DCHECK(!HasStackOverflow()); \ 27 DCHECK(!HasStackOverflow()); \
28 ++depth_; \ 28 ++depth_; \
29 call; \ 29 call; \
30 --depth_; \ 30 --depth_; \
31 if (HasStackOverflow()) return; \ 31 if (HasStackOverflow()) return; \
32 } while (false) 32 } while (false)
33 33
34 34
35 #define RECURSE_EXPRESSION_RETURN_IF_VISIT_NODE(call) \
36 do { \
37 AstNode* node = call; \
38 if (node) { \
39 RECURSE_EXPRESSION(Visit(node)); \
40 return; \
41 } \
42 } while (false)
43
44
35 AstExpressionVisitor::AstExpressionVisitor(Isolate* isolate, Expression* root) 45 AstExpressionVisitor::AstExpressionVisitor(Isolate* isolate, Expression* root)
36 : root_(root), depth_(0) { 46 : root_(root), depth_(0) {
37 InitializeAstVisitor(isolate); 47 InitializeAstVisitor(isolate);
38 } 48 }
39 49
40 50
41 AstExpressionVisitor::AstExpressionVisitor(uintptr_t stack_limit, 51 AstExpressionVisitor::AstExpressionVisitor(uintptr_t stack_limit,
42 Expression* root) 52 Expression* root)
43 : root_(root), depth_(0) { 53 : root_(root), depth_(0) {
44 InitializeAstVisitor(stack_limit); 54 InitializeAstVisitor(stack_limit);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 VisitExpression(expr); 258 VisitExpression(expr);
249 ZoneList<Expression*>* values = expr->values(); 259 ZoneList<Expression*>* values = expr->values();
250 for (int i = 0; i < values->length(); ++i) { 260 for (int i = 0; i < values->length(); ++i) {
251 Expression* value = values->at(i); 261 Expression* value = values->at(i);
252 RECURSE_EXPRESSION(Visit(value)); 262 RECURSE_EXPRESSION(Visit(value));
253 } 263 }
254 } 264 }
255 265
256 266
257 void AstExpressionVisitor::VisitAssignment(Assignment* expr) { 267 void AstExpressionVisitor::VisitAssignment(Assignment* expr) {
268 RETURN_IF_VISIT_NODE(expr->destructuring_assignment());
258 VisitExpression(expr); 269 VisitExpression(expr);
270 RECURSE_EXPRESSION_RETURN_IF_VISIT_NODE(expr->destructuring_assignment());
adamk 2015/11/25 21:05:28 Is this needed because VisitExpression could mutat
caitp (gmail) 2015/11/25 21:41:51 I suppose it can, the InitializerRewriter visitor
259 RECURSE_EXPRESSION(Visit(expr->target())); 271 RECURSE_EXPRESSION(Visit(expr->target()));
260 RECURSE_EXPRESSION(Visit(expr->value())); 272 RECURSE_EXPRESSION(Visit(expr->value()));
261 } 273 }
262 274
263 275
264 void AstExpressionVisitor::VisitYield(Yield* expr) { 276 void AstExpressionVisitor::VisitYield(Yield* expr) {
265 VisitExpression(expr); 277 VisitExpression(expr);
266 RECURSE_EXPRESSION(Visit(expr->generator_object())); 278 RECURSE_EXPRESSION(Visit(expr->generator_object()));
267 RECURSE_EXPRESSION(Visit(expr->expression())); 279 RECURSE_EXPRESSION(Visit(expr->expression()));
268 } 280 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 void AstExpressionVisitor::VisitSuperCallReference(SuperCallReference* expr) { 401 void AstExpressionVisitor::VisitSuperCallReference(SuperCallReference* expr) {
390 VisitExpression(expr); 402 VisitExpression(expr);
391 RECURSE_EXPRESSION(VisitVariableProxy(expr->this_var())); 403 RECURSE_EXPRESSION(VisitVariableProxy(expr->this_var()));
392 RECURSE_EXPRESSION(VisitVariableProxy(expr->new_target_var())); 404 RECURSE_EXPRESSION(VisitVariableProxy(expr->new_target_var()));
393 RECURSE_EXPRESSION(VisitVariableProxy(expr->this_function_var())); 405 RECURSE_EXPRESSION(VisitVariableProxy(expr->this_function_var()));
394 } 406 }
395 407
396 408
397 } // namespace internal 409 } // namespace internal
398 } // namespace v8 410 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698