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

Side by Side Diff: src/ast.h

Issue 1399893002: [es7] implement |do| expressions proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable CrankShaft Created 5 years, 2 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 | « no previous file | src/ast-expression-visitor.cc » ('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 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 #ifndef V8_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast-value-factory.h" 9 #include "src/ast-value-factory.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 V(CallRuntime) \ 83 V(CallRuntime) \
84 V(UnaryOperation) \ 84 V(UnaryOperation) \
85 V(CountOperation) \ 85 V(CountOperation) \
86 V(BinaryOperation) \ 86 V(BinaryOperation) \
87 V(CompareOperation) \ 87 V(CompareOperation) \
88 V(Spread) \ 88 V(Spread) \
89 V(ThisFunction) \ 89 V(ThisFunction) \
90 V(SuperPropertyReference) \ 90 V(SuperPropertyReference) \
91 V(SuperCallReference) \ 91 V(SuperCallReference) \
92 V(CaseClause) \ 92 V(CaseClause) \
93 V(EmptyParentheses) 93 V(EmptyParentheses) \
94 V(DoExpression)
94 95
95 #define AST_NODE_LIST(V) \ 96 #define AST_NODE_LIST(V) \
96 DECLARATION_NODE_LIST(V) \ 97 DECLARATION_NODE_LIST(V) \
97 STATEMENT_NODE_LIST(V) \ 98 STATEMENT_NODE_LIST(V) \
98 EXPRESSION_NODE_LIST(V) 99 EXPRESSION_NODE_LIST(V)
99 100
100 // Forward declarations 101 // Forward declarations
101 class AstNodeFactory; 102 class AstNodeFactory;
102 class AstVisitor; 103 class AstVisitor;
103 class Declaration; 104 class Declaration;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 484
484 private: 485 private:
485 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 486 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
486 487
487 ZoneList<Statement*> statements_; 488 ZoneList<Statement*> statements_;
488 bool ignore_completion_value_; 489 bool ignore_completion_value_;
489 Scope* scope_; 490 Scope* scope_;
490 }; 491 };
491 492
492 493
494 class DoExpression final : public Expression {
495 public:
496 DECLARE_NODE_TYPE(DoExpression)
497
498 Block* block() { return block_; }
499 VariableProxy* result() { return result_; }
500
501 protected:
502 DoExpression(Zone* zone, Block* block, VariableProxy* result, int pos)
503 : Expression(zone, pos), block_(block), result_(result) {
504 DCHECK_NOT_NULL(block_);
505 DCHECK_NOT_NULL(result_);
506 }
507 static int parent_num_ids() { return Expression::num_ids(); }
508
509 private:
510 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
511
512 Block* block_;
513 VariableProxy* result_;
514 };
515
516
493 class Declaration : public AstNode { 517 class Declaration : public AstNode {
494 public: 518 public:
495 VariableProxy* proxy() const { return proxy_; } 519 VariableProxy* proxy() const { return proxy_; }
496 VariableMode mode() const { return mode_; } 520 VariableMode mode() const { return mode_; }
497 Scope* scope() const { return scope_; } 521 Scope* scope() const { return scope_; }
498 virtual InitializationFlag initialization() const = 0; 522 virtual InitializationFlag initialization() const = 0;
499 virtual bool IsInlineable() const; 523 virtual bool IsInlineable() const;
500 524
501 protected: 525 protected:
502 Declaration(Zone* zone, VariableProxy* proxy, VariableMode mode, Scope* scope, 526 Declaration(Zone* zone, VariableProxy* proxy, VariableMode mode, Scope* scope,
(...skipping 2685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 } \ 3212 } \
3189 return false; \ 3213 return false; \
3190 } \ 3214 } \
3191 \ 3215 \
3192 private: \ 3216 private: \
3193 void InitializeAstVisitor(Isolate* isolate) { \ 3217 void InitializeAstVisitor(Isolate* isolate) { \
3194 stack_limit_ = isolate->stack_guard()->real_climit(); \ 3218 stack_limit_ = isolate->stack_guard()->real_climit(); \
3195 stack_overflow_ = false; \ 3219 stack_overflow_ = false; \
3196 } \ 3220 } \
3197 \ 3221 \
3222 void InitializeAstVisitor(uintptr_t stack_limit) { \
3223 stack_limit_ = stack_limit; \
3224 stack_overflow_ = false; \
3225 } \
3226 \
3198 uintptr_t stack_limit_; \ 3227 uintptr_t stack_limit_; \
3199 bool stack_overflow_ 3228 bool stack_overflow_
3200 3229
3201 3230
3202 // ---------------------------------------------------------------------------- 3231 // ----------------------------------------------------------------------------
3203 // AstNode factory 3232 // AstNode factory
3204 3233
3205 class AstNodeFactory final BASE_EMBEDDED { 3234 class AstNodeFactory final BASE_EMBEDDED {
3206 public: 3235 public:
3207 explicit AstNodeFactory(AstValueFactory* ast_value_factory) 3236 explicit AstNodeFactory(AstValueFactory* ast_value_factory)
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3574 properties, start_position, end_position); 3603 properties, start_position, end_position);
3575 } 3604 }
3576 3605
3577 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, 3606 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
3578 v8::Extension* extension, 3607 v8::Extension* extension,
3579 int pos) { 3608 int pos) {
3580 return new (parser_zone_) 3609 return new (parser_zone_)
3581 NativeFunctionLiteral(parser_zone_, name, extension, pos); 3610 NativeFunctionLiteral(parser_zone_, name, extension, pos);
3582 } 3611 }
3583 3612
3613 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) {
3614 VariableProxy* result = NewVariableProxy(result_var, pos);
3615 return new (parser_zone_) DoExpression(parser_zone_, block, result, pos);
marja 2016/07/13 12:08:04 Question: why is DoExpression in parser_zone_ and
3616 }
3617
3584 ThisFunction* NewThisFunction(int pos) { 3618 ThisFunction* NewThisFunction(int pos) {
3585 return new (local_zone_) ThisFunction(local_zone_, pos); 3619 return new (local_zone_) ThisFunction(local_zone_, pos);
3586 } 3620 }
3587 3621
3588 SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var, 3622 SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var,
3589 Expression* home_object, 3623 Expression* home_object,
3590 int pos) { 3624 int pos) {
3591 return new (parser_zone_) 3625 return new (parser_zone_)
3592 SuperPropertyReference(parser_zone_, this_var, home_object, pos); 3626 SuperPropertyReference(parser_zone_, this_var, home_object, pos);
3593 } 3627 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3633 // the parser-level zone. 3667 // the parser-level zone.
3634 Zone* parser_zone_; 3668 Zone* parser_zone_;
3635 AstValueFactory* ast_value_factory_; 3669 AstValueFactory* ast_value_factory_;
3636 }; 3670 };
3637 3671
3638 3672
3639 } // namespace internal 3673 } // namespace internal
3640 } // namespace v8 3674 } // namespace v8
3641 3675
3642 #endif // V8_AST_H_ 3676 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast-expression-visitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698