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_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
11 #include "src/ast/variables.h" | 11 #include "src/ast/variables.h" |
12 #include "src/bailout-reason.h" | 12 #include "src/bailout-reason.h" |
13 #include "src/base/flags.h" | 13 #include "src/base/flags.h" |
14 #include "src/factory.h" | 14 #include "src/factory.h" |
15 #include "src/globals.h" | 15 #include "src/globals.h" |
16 #include "src/isolate.h" | 16 #include "src/isolate.h" |
17 #include "src/label.h" | 17 #include "src/label.h" |
18 #include "src/list.h" | 18 #include "src/list.h" |
19 #include "src/parsing/token.h" | 19 #include "src/parsing/token.h" |
20 #include "src/runtime/runtime.h" | 20 #include "src/runtime/runtime.h" |
21 #include "src/small-pointer-list.h" | 21 #include "src/small-pointer-list.h" |
22 #include "src/utils.h" | |
23 | 22 |
24 namespace v8 { | 23 namespace v8 { |
25 namespace internal { | 24 namespace internal { |
26 | 25 |
27 // The abstract syntax tree is an intermediate, light-weight | 26 // The abstract syntax tree is an intermediate, light-weight |
28 // representation of the parsed JavaScript code suitable for | 27 // representation of the parsed JavaScript code suitable for |
29 // compilation to native code. | 28 // compilation to native code. |
30 | 29 |
31 // Nodes are allocated in a separate zone, which allows faster | 30 // Nodes are allocated in a separate zone, which allows faster |
32 // allocation and constant-time deallocation of the entire syntax | 31 // allocation and constant-time deallocation of the entire syntax |
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 DCHECK(is_jsruntime()); | 2047 DCHECK(is_jsruntime()); |
2049 context_index_ = index; | 2048 context_index_ = index; |
2050 } | 2049 } |
2051 const Runtime::Function* function() const { | 2050 const Runtime::Function* function() const { |
2052 DCHECK(!is_jsruntime()); | 2051 DCHECK(!is_jsruntime()); |
2053 return function_; | 2052 return function_; |
2054 } | 2053 } |
2055 | 2054 |
2056 static int num_ids() { return parent_num_ids() + 1; } | 2055 static int num_ids() { return parent_num_ids() + 1; } |
2057 BailoutId CallId() { return BailoutId(local_id(0)); } | 2056 BailoutId CallId() { return BailoutId(local_id(0)); } |
2058 | 2057 const char* debug_name(); |
2059 const char* debug_name() { | |
2060 return is_jsruntime() ? "(context function)" : function_->name; | |
2061 } | |
2062 | 2058 |
2063 private: | 2059 private: |
2064 friend class AstNodeFactory; | 2060 friend class AstNodeFactory; |
2065 | 2061 |
2066 CallRuntime(const Runtime::Function* function, | 2062 CallRuntime(const Runtime::Function* function, |
2067 ZoneList<Expression*>* arguments, int pos) | 2063 ZoneList<Expression*>* arguments, int pos) |
2068 : Expression(pos, kCallRuntime), | 2064 : Expression(pos, kCallRuntime), |
2069 function_(function), | 2065 function_(function), |
2070 arguments_(arguments) {} | 2066 arguments_(arguments) {} |
2071 CallRuntime(int context_index, ZoneList<Expression*>* arguments, int pos) | 2067 CallRuntime(int context_index, ZoneList<Expression*>* arguments, int pos) |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3656 : NULL; \ | 3652 : NULL; \ |
3657 } | 3653 } |
3658 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3654 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3659 #undef DECLARE_NODE_FUNCTIONS | 3655 #undef DECLARE_NODE_FUNCTIONS |
3660 | 3656 |
3661 | 3657 |
3662 } // namespace internal | 3658 } // namespace internal |
3663 } // namespace v8 | 3659 } // namespace v8 |
3664 | 3660 |
3665 #endif // V8_AST_AST_H_ | 3661 #endif // V8_AST_AST_H_ |
OLD | NEW |