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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 void Visit(AstNode* node) FINAL { \ | 3136 void Visit(AstNode* node) FINAL { \ |
3137 if (!CheckStackOverflow()) node->Accept(this); \ | 3137 if (!CheckStackOverflow()) node->Accept(this); \ |
3138 } \ | 3138 } \ |
3139 \ | 3139 \ |
3140 void SetStackOverflow() { stack_overflow_ = true; } \ | 3140 void SetStackOverflow() { stack_overflow_ = true; } \ |
3141 void ClearStackOverflow() { stack_overflow_ = false; } \ | 3141 void ClearStackOverflow() { stack_overflow_ = false; } \ |
3142 bool HasStackOverflow() const { return stack_overflow_; } \ | 3142 bool HasStackOverflow() const { return stack_overflow_; } \ |
3143 \ | 3143 \ |
3144 bool CheckStackOverflow() { \ | 3144 bool CheckStackOverflow() { \ |
3145 if (stack_overflow_) return true; \ | 3145 if (stack_overflow_) return true; \ |
3146 StackLimitCheck check(zone_->isolate()); \ | 3146 StackLimitCheck check(isolate_); \ |
3147 if (!check.HasOverflowed()) return false; \ | 3147 if (!check.HasOverflowed()) return false; \ |
3148 stack_overflow_ = true; \ | 3148 stack_overflow_ = true; \ |
3149 return true; \ | 3149 return true; \ |
3150 } \ | 3150 } \ |
3151 \ | 3151 \ |
3152 private: \ | 3152 private: \ |
3153 void InitializeAstVisitor(Zone* zone) { \ | 3153 void InitializeAstVisitor(Isolate* isolate, Zone* zone) { \ |
| 3154 isolate_ = isolate; \ |
3154 zone_ = zone; \ | 3155 zone_ = zone; \ |
3155 stack_overflow_ = false; \ | 3156 stack_overflow_ = false; \ |
3156 } \ | 3157 } \ |
3157 Zone* zone() { return zone_; } \ | 3158 Zone* zone() { return zone_; } \ |
3158 Isolate* isolate() { return zone_->isolate(); } \ | 3159 Isolate* isolate() { return isolate_; } \ |
3159 \ | 3160 \ |
| 3161 Isolate* isolate_; \ |
3160 Zone* zone_; \ | 3162 Zone* zone_; \ |
3161 bool stack_overflow_ | 3163 bool stack_overflow_ |
3162 | 3164 |
3163 | 3165 |
3164 // ---------------------------------------------------------------------------- | 3166 // ---------------------------------------------------------------------------- |
3165 // AstNode factory | 3167 // AstNode factory |
3166 | 3168 |
3167 class AstNodeFactory FINAL BASE_EMBEDDED { | 3169 class AstNodeFactory FINAL BASE_EMBEDDED { |
3168 public: | 3170 public: |
3169 explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3171 explicit AstNodeFactory(AstValueFactory* ast_value_factory) |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3533 | 3535 |
3534 private: | 3536 private: |
3535 Zone* zone_; | 3537 Zone* zone_; |
3536 AstValueFactory* ast_value_factory_; | 3538 AstValueFactory* ast_value_factory_; |
3537 }; | 3539 }; |
3538 | 3540 |
3539 | 3541 |
3540 } } // namespace v8::internal | 3542 } } // namespace v8::internal |
3541 | 3543 |
3542 #endif // V8_AST_H_ | 3544 #endif // V8_AST_H_ |
OLD | NEW |