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 "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "assembler.h" | 10 #include "assembler.h" |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 public: | 434 public: |
435 DECLARE_NODE_TYPE(Block) | 435 DECLARE_NODE_TYPE(Block) |
436 | 436 |
437 void AddStatement(Statement* statement, Zone* zone) { | 437 void AddStatement(Statement* statement, Zone* zone) { |
438 statements_.Add(statement, zone); | 438 statements_.Add(statement, zone); |
439 } | 439 } |
440 | 440 |
441 ZoneList<Statement*>* statements() { return &statements_; } | 441 ZoneList<Statement*>* statements() { return &statements_; } |
442 bool is_initializer_block() const { return is_initializer_block_; } | 442 bool is_initializer_block() const { return is_initializer_block_; } |
443 | 443 |
444 const BailoutId DeclsId() const { return decls_id_; } | |
rossberg
2014/06/04 12:54:53
nit: the first const here does not have any meanin
ulan
2014/06/04 14:02:05
Done.
| |
445 | |
444 virtual bool IsJump() const V8_OVERRIDE { | 446 virtual bool IsJump() const V8_OVERRIDE { |
445 return !statements_.is_empty() && statements_.last()->IsJump() | 447 return !statements_.is_empty() && statements_.last()->IsJump() |
446 && labels() == NULL; // Good enough as an approximation... | 448 && labels() == NULL; // Good enough as an approximation... |
447 } | 449 } |
448 | 450 |
449 Scope* scope() const { return scope_; } | 451 Scope* scope() const { return scope_; } |
450 void set_scope(Scope* scope) { scope_ = scope; } | 452 void set_scope(Scope* scope) { scope_ = scope; } |
451 | 453 |
452 protected: | 454 protected: |
453 Block(Zone* zone, | 455 Block(Zone* zone, |
454 ZoneStringList* labels, | 456 ZoneStringList* labels, |
455 int capacity, | 457 int capacity, |
456 bool is_initializer_block, | 458 bool is_initializer_block, |
457 int pos) | 459 int pos) |
458 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), | 460 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), |
459 statements_(capacity, zone), | 461 statements_(capacity, zone), |
460 is_initializer_block_(is_initializer_block), | 462 is_initializer_block_(is_initializer_block), |
463 decls_id_(GetNextId(zone)), | |
461 scope_(NULL) { | 464 scope_(NULL) { |
462 } | 465 } |
463 | 466 |
464 private: | 467 private: |
465 ZoneList<Statement*> statements_; | 468 ZoneList<Statement*> statements_; |
466 bool is_initializer_block_; | 469 bool is_initializer_block_; |
470 const BailoutId decls_id_; | |
467 Scope* scope_; | 471 Scope* scope_; |
468 }; | 472 }; |
469 | 473 |
470 | 474 |
471 class Declaration : public AstNode { | 475 class Declaration : public AstNode { |
472 public: | 476 public: |
473 VariableProxy* proxy() const { return proxy_; } | 477 VariableProxy* proxy() const { return proxy_; } |
474 VariableMode mode() const { return mode_; } | 478 VariableMode mode() const { return mode_; } |
475 Scope* scope() const { return scope_; } | 479 Scope* scope() const { return scope_; } |
476 virtual InitializationFlag initialization() const = 0; | 480 virtual InitializationFlag initialization() const = 0; |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3348 | 3352 |
3349 private: | 3353 private: |
3350 Zone* zone_; | 3354 Zone* zone_; |
3351 Visitor visitor_; | 3355 Visitor visitor_; |
3352 }; | 3356 }; |
3353 | 3357 |
3354 | 3358 |
3355 } } // namespace v8::internal | 3359 } } // namespace v8::internal |
3356 | 3360 |
3357 #endif // V8_AST_H_ | 3361 #endif // V8_AST_H_ |
OLD | NEW |