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

Side by Side Diff: src/ast.h

Issue 850093004: Remove dead TargetCollector code from the parser (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix -Wpedantic error, restoring bogus kInvalid NodeType Created 5 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
« no previous file with comments | « no previous file | 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 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Forward declarations 107 // Forward declarations
108 class AstNodeFactory; 108 class AstNodeFactory;
109 class AstVisitor; 109 class AstVisitor;
110 class Declaration; 110 class Declaration;
111 class Module; 111 class Module;
112 class BreakableStatement; 112 class BreakableStatement;
113 class Expression; 113 class Expression;
114 class IterationStatement; 114 class IterationStatement;
115 class MaterializedLiteral; 115 class MaterializedLiteral;
116 class Statement; 116 class Statement;
117 class TargetCollector;
118 class TypeFeedbackOracle; 117 class TypeFeedbackOracle;
119 118
120 class RegExpAlternative; 119 class RegExpAlternative;
121 class RegExpAssertion; 120 class RegExpAssertion;
122 class RegExpAtom; 121 class RegExpAtom;
123 class RegExpBackReference; 122 class RegExpBackReference;
124 class RegExpCapture; 123 class RegExpCapture;
125 class RegExpCharacterClass; 124 class RegExpCharacterClass;
126 class RegExpCompiler; 125 class RegExpCompiler;
127 class RegExpDisjunction; 126 class RegExpDisjunction;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 bool Is##type() const { return node_type() == AstNode::k##type; } \ 217 bool Is##type() const { return node_type() == AstNode::k##type; } \
219 type* As##type() { \ 218 type* As##type() { \
220 return Is##type() ? reinterpret_cast<type*>(this) : NULL; \ 219 return Is##type() ? reinterpret_cast<type*>(this) : NULL; \
221 } \ 220 } \
222 const type* As##type() const { \ 221 const type* As##type() const { \
223 return Is##type() ? reinterpret_cast<const type*>(this) : NULL; \ 222 return Is##type() ? reinterpret_cast<const type*>(this) : NULL; \
224 } 223 }
225 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 224 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
226 #undef DECLARE_NODE_FUNCTIONS 225 #undef DECLARE_NODE_FUNCTIONS
227 226
228 virtual TargetCollector* AsTargetCollector() { return NULL; }
229 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 227 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
230 virtual IterationStatement* AsIterationStatement() { return NULL; } 228 virtual IterationStatement* AsIterationStatement() { return NULL; }
231 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 229 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
232 230
233 // The interface for feedback slots, with default no-op implementations for 231 // The interface for feedback slots, with default no-op implementations for
234 // node types which don't actually have this. Note that this is conceptually 232 // node types which don't actually have this. Note that this is conceptually
235 // not really nice, but multiple inheritance would introduce yet another 233 // not really nice, but multiple inheritance would introduce yet another
236 // vtable entry per node, something we don't want for space reasons. 234 // vtable entry per node, something we don't want for space reasons.
237 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 235 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
238 Isolate* isolate) { 236 Isolate* isolate) {
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 private: 1221 private:
1224 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1222 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1225 1223
1226 Expression* condition_; 1224 Expression* condition_;
1227 Statement* then_statement_; 1225 Statement* then_statement_;
1228 Statement* else_statement_; 1226 Statement* else_statement_;
1229 int base_id_; 1227 int base_id_;
1230 }; 1228 };
1231 1229
1232 1230
1233 // NOTE: TargetCollectors are represented as nodes to fit in the target
1234 // stack in the compiler; this should probably be reworked.
1235 class TargetCollector FINAL : public AstNode {
1236 public:
1237 explicit TargetCollector(Zone* zone)
1238 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { }
1239
1240 // Adds a jump target to the collector. The collector stores a pointer not
1241 // a copy of the target to make binding work, so make sure not to pass in
1242 // references to something on the stack.
1243 void AddTarget(Label* target, Zone* zone);
1244
1245 // Virtual behaviour. TargetCollectors are never part of the AST.
1246 void Accept(AstVisitor* v) OVERRIDE { UNREACHABLE(); }
1247 NodeType node_type() const OVERRIDE { return kInvalid; }
1248 TargetCollector* AsTargetCollector() OVERRIDE { return this; }
1249
1250 ZoneList<Label*>* targets() { return &targets_; }
1251
1252 private:
1253 ZoneList<Label*> targets_;
1254 };
1255
1256
1257 class TryStatement : public Statement { 1231 class TryStatement : public Statement {
1258 public: 1232 public:
1259 void set_escaping_targets(ZoneList<Label*>* targets) {
1260 escaping_targets_ = targets;
1261 }
1262
1263 int index() const { return index_; } 1233 int index() const { return index_; }
1264 Block* try_block() const { return try_block_; } 1234 Block* try_block() const { return try_block_; }
1265 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
1266 1235
1267 protected: 1236 protected:
1268 TryStatement(Zone* zone, int index, Block* try_block, int pos) 1237 TryStatement(Zone* zone, int index, Block* try_block, int pos)
1269 : Statement(zone, pos), 1238 : Statement(zone, pos), index_(index), try_block_(try_block) {}
1270 index_(index),
1271 try_block_(try_block),
1272 escaping_targets_(NULL) { }
1273 1239
1274 private: 1240 private:
1275 // Unique (per-function) index of this handler. This is not an AST ID. 1241 // Unique (per-function) index of this handler. This is not an AST ID.
1276 int index_; 1242 int index_;
1277 1243
1278 Block* try_block_; 1244 Block* try_block_;
1279 ZoneList<Label*>* escaping_targets_;
1280 }; 1245 };
1281 1246
1282 1247
1283 class TryCatchStatement FINAL : public TryStatement { 1248 class TryCatchStatement FINAL : public TryStatement {
1284 public: 1249 public:
1285 DECLARE_NODE_TYPE(TryCatchStatement) 1250 DECLARE_NODE_TYPE(TryCatchStatement)
1286 1251
1287 Scope* scope() { return scope_; } 1252 Scope* scope() { return scope_; }
1288 Variable* variable() { return variable_; } 1253 Variable* variable() { return variable_; }
1289 Block* catch_block() const { return catch_block_; } 1254 Block* catch_block() const { return catch_block_; }
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3547 3512
3548 private: 3513 private:
3549 Zone* zone_; 3514 Zone* zone_;
3550 AstValueFactory* ast_value_factory_; 3515 AstValueFactory* ast_value_factory_;
3551 }; 3516 };
3552 3517
3553 3518
3554 } } // namespace v8::internal 3519 } } // namespace v8::internal
3555 3520
3556 #endif // V8_AST_H_ 3521 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698