| OLD | NEW | 
|---|
| 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 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3163   virtual void VisitExpressions(ZoneList<Expression*>* expressions); | 3163   virtual void VisitExpressions(ZoneList<Expression*>* expressions); | 
| 3164 | 3164 | 
| 3165   // Individual AST nodes. | 3165   // Individual AST nodes. | 
| 3166 #define DEF_VISIT(type)                         \ | 3166 #define DEF_VISIT(type)                         \ | 
| 3167   virtual void Visit##type(type* node) = 0; | 3167   virtual void Visit##type(type* node) = 0; | 
| 3168   AST_NODE_LIST(DEF_VISIT) | 3168   AST_NODE_LIST(DEF_VISIT) | 
| 3169 #undef DEF_VISIT | 3169 #undef DEF_VISIT | 
| 3170 }; | 3170 }; | 
| 3171 | 3171 | 
| 3172 | 3172 | 
| 3173 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS()                    \ | 3173 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS()               \ | 
| 3174  public:                                                         \ | 3174  public:                                                    \ | 
| 3175   void Visit(AstNode* node) final {                              \ | 3175   void Visit(AstNode* node) final {                         \ | 
| 3176     if (!CheckStackOverflow()) node->Accept(this);               \ | 3176     if (!CheckStackOverflow()) node->Accept(this);          \ | 
| 3177   }                                                              \ | 3177   }                                                         \ | 
| 3178                                                                  \ | 3178                                                             \ | 
| 3179   void SetStackOverflow() { stack_overflow_ = true; }            \ | 3179   void SetStackOverflow() { stack_overflow_ = true; }       \ | 
| 3180   void ClearStackOverflow() { stack_overflow_ = false; }         \ | 3180   void ClearStackOverflow() { stack_overflow_ = false; }    \ | 
| 3181   bool HasStackOverflow() const { return stack_overflow_; }      \ | 3181   bool HasStackOverflow() const { return stack_overflow_; } \ | 
| 3182                                                                  \ | 3182                                                             \ | 
| 3183   bool CheckStackOverflow() {                                    \ | 3183   bool CheckStackOverflow() {                               \ | 
| 3184     if (stack_overflow_) return true;                            \ | 3184     if (stack_overflow_) return true;                       \ | 
| 3185     if (GetCurrentStackPosition() < stack_limit_) {              \ | 3185     if (GetCurrentStackPosition() < stack_limit_) {         \ | 
| 3186       stack_overflow_ = true;                                    \ | 3186       stack_overflow_ = true;                               \ | 
| 3187       return true;                                               \ | 3187       return true;                                          \ | 
| 3188     }                                                            \ | 3188     }                                                       \ | 
| 3189     return false;                                                \ | 3189     return false;                                           \ | 
| 3190   }                                                              \ | 3190   }                                                         \ | 
| 3191                                                                  \ | 3191                                                             \ | 
| 3192  private:                                                        \ | 3192  private:                                                   \ | 
| 3193   void InitializeAstVisitor(Isolate* isolate) {                  \ | 3193   void InitializeAstVisitor(Isolate* isolate) {             \ | 
| 3194     InitializeAstVisitor(isolate->stack_guard()->real_climit()); \ | 3194     stack_limit_ = isolate->stack_guard()->real_climit();   \ | 
| 3195   }                                                              \ | 3195     stack_overflow_ = false;                                \ | 
| 3196                                                                  \ | 3196   }                                                         \ | 
| 3197   void InitializeAstVisitor(uintptr_t stack_limit) {             \ | 3197                                                             \ | 
| 3198     stack_limit_ = stack_limit;                                  \ | 3198   uintptr_t stack_limit_;                                   \ | 
| 3199     stack_overflow_ = false;                                     \ |  | 
| 3200   }                                                              \ |  | 
| 3201                                                                  \ |  | 
| 3202   uintptr_t stack_limit_;                                        \ |  | 
| 3203   bool stack_overflow_ | 3199   bool stack_overflow_ | 
| 3204 | 3200 | 
| 3205 | 3201 | 
| 3206 // ---------------------------------------------------------------------------- | 3202 // ---------------------------------------------------------------------------- | 
| 3207 // AstNode factory | 3203 // AstNode factory | 
| 3208 | 3204 | 
| 3209 class AstNodeFactory final BASE_EMBEDDED { | 3205 class AstNodeFactory final BASE_EMBEDDED { | 
| 3210  public: | 3206  public: | 
| 3211   explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3207   explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 
| 3212       : local_zone_(ast_value_factory->zone()), | 3208       : local_zone_(ast_value_factory->zone()), | 
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3637   // the parser-level zone. | 3633   // the parser-level zone. | 
| 3638   Zone* parser_zone_; | 3634   Zone* parser_zone_; | 
| 3639   AstValueFactory* ast_value_factory_; | 3635   AstValueFactory* ast_value_factory_; | 
| 3640 }; | 3636 }; | 
| 3641 | 3637 | 
| 3642 | 3638 | 
| 3643 }  // namespace internal | 3639 }  // namespace internal | 
| 3644 }  // namespace v8 | 3640 }  // namespace v8 | 
| 3645 | 3641 | 
| 3646 #endif  // V8_AST_H_ | 3642 #endif  // V8_AST_H_ | 
| OLD | NEW | 
|---|