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

Side by Side Diff: src/ast.h

Issue 9288011: Include what you use for allocation, api, assembler, and ast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/assembler.cc ('k') | src/ast.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_AST_H_ 28 #ifndef V8_AST_H_
29 #define V8_AST_H_ 29 #define V8_AST_H_
30 30
31 #include "allocation.h" 31 #include "v8.h"
32 #include "execution.h" 32
33 #include "assembler.h"
33 #include "factory.h" 34 #include "factory.h"
35 #include "isolate.h"
34 #include "jsregexp.h" 36 #include "jsregexp.h"
37 #include "list-inl.h"
35 #include "runtime.h" 38 #include "runtime.h"
36 #include "small-pointer-list.h" 39 #include "small-pointer-list.h"
40 #include "smart-array-pointer.h"
37 #include "token.h" 41 #include "token.h"
38 #include "variables.h" 42 #include "variables.h"
43 #include "zone-inl.h"
39 44
40 namespace v8 { 45 namespace v8 {
41 namespace internal { 46 namespace internal {
42 47
43 // The abstract syntax tree is an intermediate, light-weight 48 // The abstract syntax tree is an intermediate, light-weight
44 // representation of the parsed JavaScript code suitable for 49 // representation of the parsed JavaScript code suitable for
45 // compilation to native code. 50 // compilation to native code.
46 51
47 // Nodes are allocated in a separate zone, which allows faster 52 // Nodes are allocated in a separate zone, which allows faster
48 // allocation and constant-time deallocation of the entire syntax 53 // allocation and constant-time deallocation of the entire syntax
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 V(BinaryOperation) \ 96 V(BinaryOperation) \
92 V(CompareOperation) \ 97 V(CompareOperation) \
93 V(ThisFunction) 98 V(ThisFunction)
94 99
95 #define AST_NODE_LIST(V) \ 100 #define AST_NODE_LIST(V) \
96 V(Declaration) \ 101 V(Declaration) \
97 STATEMENT_NODE_LIST(V) \ 102 STATEMENT_NODE_LIST(V) \
98 EXPRESSION_NODE_LIST(V) 103 EXPRESSION_NODE_LIST(V)
99 104
100 // Forward declarations 105 // Forward declarations
101 class BitVector; 106 class AstVisitor;
102 class DefinitionInfo; 107 class BreakableStatement;
108 class Expression;
109 class IterationStatement;
103 class MaterializedLiteral; 110 class MaterializedLiteral;
111 class Statement;
104 class TargetCollector; 112 class TargetCollector;
105 class TypeFeedbackOracle; 113 class TypeFeedbackOracle;
106 114
115 class RegExpAlternative;
116 class RegExpAssertion;
117 class RegExpAtom;
118 class RegExpBackReference;
119 class RegExpCapture;
120 class RegExpCharacterClass;
121 class RegExpCompiler;
122 class RegExpDisjunction;
123 class RegExpEmpty;
124 class RegExpLookahead;
125 class RegExpQuantifier;
126 class RegExpText;
127
107 #define DEF_FORWARD_DECLARATION(type) class type; 128 #define DEF_FORWARD_DECLARATION(type) class type;
108 AST_NODE_LIST(DEF_FORWARD_DECLARATION) 129 AST_NODE_LIST(DEF_FORWARD_DECLARATION)
109 #undef DEF_FORWARD_DECLARATION 130 #undef DEF_FORWARD_DECLARATION
110 131
111 132
112 // Typedef only introduced to avoid unreadable code. 133 // Typedef only introduced to avoid unreadable code.
113 // Please do appreciate the required space in "> >". 134 // Please do appreciate the required space in "> >".
114 typedef ZoneList<Handle<String> > ZoneStringList; 135 typedef ZoneList<Handle<String> > ZoneStringList;
115 typedef ZoneList<Handle<Object> > ZoneObjectList; 136 typedef ZoneList<Handle<Object> > ZoneObjectList;
116 137
117 138
118 #define DECLARE_NODE_TYPE(type) \
119 virtual void Accept(AstVisitor* v); \
120 virtual AstNode::Type node_type() const { return AstNode::k##type; } \
121
122
123 class AstNode: public ZoneObject { 139 class AstNode: public ZoneObject {
124 public: 140 public:
125 #define DECLARE_TYPE_ENUM(type) k##type, 141 #define DECLARE_TYPE_ENUM(type) k##type,
126 enum Type { 142 enum Type {
127 AST_NODE_LIST(DECLARE_TYPE_ENUM) 143 AST_NODE_LIST(DECLARE_TYPE_ENUM)
128 kInvalid = -1 144 kInvalid = -1
129 }; 145 };
130 #undef DECLARE_TYPE_ENUM 146 #undef DECLARE_TYPE_ENUM
131 147
132 static const int kNoNumber = -1; 148 static const int kNoNumber = -1;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 199
184 private: 200 private:
185 // Hidden to prevent accidental usage. It would have to load the 201 // Hidden to prevent accidental usage. It would have to load the
186 // current zone from the TLS. 202 // current zone from the TLS.
187 void* operator new(size_t size); 203 void* operator new(size_t size);
188 204
189 friend class CaseClause; // Generates AST IDs. 205 friend class CaseClause; // Generates AST IDs.
190 }; 206 };
191 207
192 208
209 #define DECLARE_NODE_TYPE(type) \
210 virtual void Accept(AstVisitor* v); \
211 virtual AstNode::Type node_type() const { return AstNode::k##type; } \
212
213
193 class Statement: public AstNode { 214 class Statement: public AstNode {
194 public: 215 public:
195 Statement() : statement_pos_(RelocInfo::kNoPosition) {} 216 Statement() : statement_pos_(RelocInfo::kNoPosition) {}
196 217
197 virtual Statement* AsStatement() { return this; } 218 virtual Statement* AsStatement() { return this; }
198 219
199 bool IsEmpty() { return AsEmptyStatement() != NULL; } 220 bool IsEmpty() { return AsEmptyStatement() != NULL; }
200 221
201 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } 222 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
202 int statement_pos() const { return statement_pos_; } 223 int statement_pos() const { return statement_pos_; }
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 2203
2183 private: 2204 private:
2184 Isolate* isolate_; 2205 Isolate* isolate_;
2185 bool stack_overflow_; 2206 bool stack_overflow_;
2186 }; 2207 };
2187 2208
2188 2209
2189 } } // namespace v8::internal 2210 } } // namespace v8::internal
2190 2211
2191 #endif // V8_AST_H_ 2212 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698