| 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-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
| 9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
| 10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // sub-int32_t-sized fields for optimum packing efficiency. | 226 // sub-int32_t-sized fields for optimum packing efficiency. |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 | 229 |
| 230 class Statement : public AstNode { | 230 class Statement : public AstNode { |
| 231 public: | 231 public: |
| 232 bool IsEmpty() { return AsEmptyStatement() != NULL; } | 232 bool IsEmpty() { return AsEmptyStatement() != NULL; } |
| 233 bool IsJump() const; | 233 bool IsJump() const; |
| 234 | 234 |
| 235 protected: | 235 protected: |
| 236 Statement(Zone* zone, int position, NodeType type) | 236 Statement(int position, NodeType type) : AstNode(position, type) {} |
| 237 : AstNode(position, type) {} | |
| 238 }; | 237 }; |
| 239 | 238 |
| 240 | 239 |
| 241 class SmallMapList final { | 240 class SmallMapList final { |
| 242 public: | 241 public: |
| 243 SmallMapList() {} | 242 SmallMapList() {} |
| 244 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} | 243 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
| 245 | 244 |
| 246 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } | 245 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } |
| 247 void Clear() { list_.Clear(); } | 246 void Clear() { list_.Clear(); } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 KeyedAccessStoreMode GetStoreMode() const; | 343 KeyedAccessStoreMode GetStoreMode() const; |
| 345 IcCheckType GetKeyType() const; | 344 IcCheckType GetKeyType() const; |
| 346 bool IsMonomorphic() const; | 345 bool IsMonomorphic() const; |
| 347 | 346 |
| 348 void set_base_id(int id) { base_id_ = id; } | 347 void set_base_id(int id) { base_id_ = id; } |
| 349 static int num_ids() { return parent_num_ids() + 2; } | 348 static int num_ids() { return parent_num_ids() + 2; } |
| 350 BailoutId id() const { return BailoutId(local_id(0)); } | 349 BailoutId id() const { return BailoutId(local_id(0)); } |
| 351 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } | 350 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } |
| 352 | 351 |
| 353 protected: | 352 protected: |
| 354 Expression(Zone* zone, int pos, NodeType type) | 353 Expression(int pos, NodeType type) |
| 355 : AstNode(pos, type), | 354 : AstNode(pos, type), |
| 356 bit_field_(0), | 355 bit_field_(0), |
| 357 base_id_(BailoutId::None().ToInt()) {} | 356 base_id_(BailoutId::None().ToInt()) {} |
| 358 | 357 |
| 359 static int parent_num_ids() { return 0; } | 358 static int parent_num_ids() { return 0; } |
| 360 void set_to_boolean_types(uint16_t types) { | 359 void set_to_boolean_types(uint16_t types) { |
| 361 bit_field_ = ToBooleanTypesField::update(bit_field_, types); | 360 bit_field_ = ToBooleanTypesField::update(bit_field_, types); |
| 362 } | 361 } |
| 363 int base_id() const { | 362 int base_id() const { |
| 364 DCHECK(!BailoutId(base_id_).IsNone()); | 363 DCHECK(!BailoutId(base_id_).IsNone()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 392 bool is_target_for_anonymous() const { | 391 bool is_target_for_anonymous() const { |
| 393 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 392 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
| 394 } | 393 } |
| 395 | 394 |
| 396 void set_base_id(int id) { base_id_ = id; } | 395 void set_base_id(int id) { base_id_ = id; } |
| 397 static int num_ids() { return parent_num_ids() + 2; } | 396 static int num_ids() { return parent_num_ids() + 2; } |
| 398 BailoutId EntryId() const { return BailoutId(local_id(0)); } | 397 BailoutId EntryId() const { return BailoutId(local_id(0)); } |
| 399 BailoutId ExitId() const { return BailoutId(local_id(1)); } | 398 BailoutId ExitId() const { return BailoutId(local_id(1)); } |
| 400 | 399 |
| 401 protected: | 400 protected: |
| 402 BreakableStatement(Zone* zone, ZoneList<const AstRawString*>* labels, | 401 BreakableStatement(ZoneList<const AstRawString*>* labels, |
| 403 BreakableType breakable_type, int position, NodeType type) | 402 BreakableType breakable_type, int position, NodeType type) |
| 404 : Statement(zone, position, type), | 403 : Statement(position, type), |
| 405 breakable_type_(breakable_type), | 404 breakable_type_(breakable_type), |
| 406 base_id_(BailoutId::None().ToInt()), | 405 base_id_(BailoutId::None().ToInt()), |
| 407 labels_(labels) { | 406 labels_(labels) { |
| 408 DCHECK(labels == NULL || labels->length() > 0); | 407 DCHECK(labels == NULL || labels->length() > 0); |
| 409 } | 408 } |
| 410 static int parent_num_ids() { return 0; } | 409 static int parent_num_ids() { return 0; } |
| 411 | 410 |
| 412 int base_id() const { | 411 int base_id() const { |
| 413 DCHECK(!BailoutId(base_id_).IsNone()); | 412 DCHECK(!BailoutId(base_id_).IsNone()); |
| 414 return base_id_; | 413 return base_id_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 438 } | 437 } |
| 439 | 438 |
| 440 Scope* scope() const { return scope_; } | 439 Scope* scope() const { return scope_; } |
| 441 void set_scope(Scope* scope) { scope_ = scope; } | 440 void set_scope(Scope* scope) { scope_ = scope; } |
| 442 | 441 |
| 443 private: | 442 private: |
| 444 friend class AstNodeFactory; | 443 friend class AstNodeFactory; |
| 445 | 444 |
| 446 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, | 445 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, |
| 447 bool ignore_completion_value, int pos) | 446 bool ignore_completion_value, int pos) |
| 448 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos, kBlock), | 447 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY, pos, kBlock), |
| 449 statements_(capacity, zone), | 448 statements_(capacity, zone), |
| 450 ignore_completion_value_(ignore_completion_value), | 449 ignore_completion_value_(ignore_completion_value), |
| 451 scope_(NULL) {} | 450 scope_(NULL) {} |
| 452 static int parent_num_ids() { return BreakableStatement::num_ids(); } | 451 static int parent_num_ids() { return BreakableStatement::num_ids(); } |
| 453 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 452 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 454 | 453 |
| 455 ZoneList<Statement*> statements_; | 454 ZoneList<Statement*> statements_; |
| 456 bool ignore_completion_value_; | 455 bool ignore_completion_value_; |
| 457 Scope* scope_; | 456 Scope* scope_; |
| 458 }; | 457 }; |
| 459 | 458 |
| 460 | 459 |
| 461 class DoExpression final : public Expression { | 460 class DoExpression final : public Expression { |
| 462 public: | 461 public: |
| 463 Block* block() { return block_; } | 462 Block* block() { return block_; } |
| 464 void set_block(Block* b) { block_ = b; } | 463 void set_block(Block* b) { block_ = b; } |
| 465 VariableProxy* result() { return result_; } | 464 VariableProxy* result() { return result_; } |
| 466 void set_result(VariableProxy* v) { result_ = v; } | 465 void set_result(VariableProxy* v) { result_ = v; } |
| 467 FunctionLiteral* represented_function() { return represented_function_; } | 466 FunctionLiteral* represented_function() { return represented_function_; } |
| 468 void set_represented_function(FunctionLiteral* f) { | 467 void set_represented_function(FunctionLiteral* f) { |
| 469 represented_function_ = f; | 468 represented_function_ = f; |
| 470 } | 469 } |
| 471 bool IsAnonymousFunctionDefinition() const; | 470 bool IsAnonymousFunctionDefinition() const; |
| 472 | 471 |
| 473 private: | 472 private: |
| 474 friend class AstNodeFactory; | 473 friend class AstNodeFactory; |
| 475 | 474 |
| 476 DoExpression(Zone* zone, Block* block, VariableProxy* result, int pos) | 475 DoExpression(Block* block, VariableProxy* result, int pos) |
| 477 : Expression(zone, pos, kDoExpression), | 476 : Expression(pos, kDoExpression), |
| 478 block_(block), | 477 block_(block), |
| 479 result_(result), | 478 result_(result), |
| 480 represented_function_(nullptr) { | 479 represented_function_(nullptr) { |
| 481 DCHECK_NOT_NULL(block_); | 480 DCHECK_NOT_NULL(block_); |
| 482 DCHECK_NOT_NULL(result_); | 481 DCHECK_NOT_NULL(result_); |
| 483 } | 482 } |
| 484 static int parent_num_ids() { return Expression::num_ids(); } | 483 static int parent_num_ids() { return Expression::num_ids(); } |
| 485 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 484 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 486 | 485 |
| 487 Block* block_; | 486 Block* block_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 first_yield_id_ = first_yield_id; | 545 first_yield_id_ = first_yield_id; |
| 547 } | 546 } |
| 548 | 547 |
| 549 static int num_ids() { return parent_num_ids() + 1; } | 548 static int num_ids() { return parent_num_ids() + 1; } |
| 550 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); } | 549 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); } |
| 551 | 550 |
| 552 // Code generation | 551 // Code generation |
| 553 Label* continue_target() { return &continue_target_; } | 552 Label* continue_target() { return &continue_target_; } |
| 554 | 553 |
| 555 protected: | 554 protected: |
| 556 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 555 IterationStatement(ZoneList<const AstRawString*>* labels, int pos, |
| 557 NodeType type) | 556 NodeType type) |
| 558 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, type), | 557 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS, pos, type), |
| 559 body_(NULL), | 558 body_(NULL), |
| 560 yield_count_(0), | 559 yield_count_(0), |
| 561 first_yield_id_(0) {} | 560 first_yield_id_(0) {} |
| 562 static int parent_num_ids() { return BreakableStatement::num_ids(); } | 561 static int parent_num_ids() { return BreakableStatement::num_ids(); } |
| 563 void Initialize(Statement* body) { body_ = body; } | 562 void Initialize(Statement* body) { body_ = body; } |
| 564 | 563 |
| 565 private: | 564 private: |
| 566 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 565 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 567 | 566 |
| 568 Statement* body_; | 567 Statement* body_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 583 void set_cond(Expression* e) { cond_ = e; } | 582 void set_cond(Expression* e) { cond_ = e; } |
| 584 | 583 |
| 585 static int num_ids() { return parent_num_ids() + 2; } | 584 static int num_ids() { return parent_num_ids() + 2; } |
| 586 BailoutId ContinueId() const { return BailoutId(local_id(0)); } | 585 BailoutId ContinueId() const { return BailoutId(local_id(0)); } |
| 587 BailoutId StackCheckId() const { return BackEdgeId(); } | 586 BailoutId StackCheckId() const { return BackEdgeId(); } |
| 588 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } | 587 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } |
| 589 | 588 |
| 590 private: | 589 private: |
| 591 friend class AstNodeFactory; | 590 friend class AstNodeFactory; |
| 592 | 591 |
| 593 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 592 DoWhileStatement(ZoneList<const AstRawString*>* labels, int pos) |
| 594 : IterationStatement(zone, labels, pos, kDoWhileStatement), cond_(NULL) {} | 593 : IterationStatement(labels, pos, kDoWhileStatement), cond_(NULL) {} |
| 595 static int parent_num_ids() { return IterationStatement::num_ids(); } | 594 static int parent_num_ids() { return IterationStatement::num_ids(); } |
| 596 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 595 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 597 | 596 |
| 598 Expression* cond_; | 597 Expression* cond_; |
| 599 }; | 598 }; |
| 600 | 599 |
| 601 | 600 |
| 602 class WhileStatement final : public IterationStatement { | 601 class WhileStatement final : public IterationStatement { |
| 603 public: | 602 public: |
| 604 void Initialize(Expression* cond, Statement* body) { | 603 void Initialize(Expression* cond, Statement* body) { |
| 605 IterationStatement::Initialize(body); | 604 IterationStatement::Initialize(body); |
| 606 cond_ = cond; | 605 cond_ = cond; |
| 607 } | 606 } |
| 608 | 607 |
| 609 Expression* cond() const { return cond_; } | 608 Expression* cond() const { return cond_; } |
| 610 void set_cond(Expression* e) { cond_ = e; } | 609 void set_cond(Expression* e) { cond_ = e; } |
| 611 | 610 |
| 612 static int num_ids() { return parent_num_ids() + 1; } | 611 static int num_ids() { return parent_num_ids() + 1; } |
| 613 BailoutId ContinueId() const { return EntryId(); } | 612 BailoutId ContinueId() const { return EntryId(); } |
| 614 BailoutId StackCheckId() const { return BodyId(); } | 613 BailoutId StackCheckId() const { return BodyId(); } |
| 615 BailoutId BodyId() const { return BailoutId(local_id(0)); } | 614 BailoutId BodyId() const { return BailoutId(local_id(0)); } |
| 616 | 615 |
| 617 private: | 616 private: |
| 618 friend class AstNodeFactory; | 617 friend class AstNodeFactory; |
| 619 | 618 |
| 620 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 619 WhileStatement(ZoneList<const AstRawString*>* labels, int pos) |
| 621 : IterationStatement(zone, labels, pos, kWhileStatement), cond_(NULL) {} | 620 : IterationStatement(labels, pos, kWhileStatement), cond_(NULL) {} |
| 622 static int parent_num_ids() { return IterationStatement::num_ids(); } | 621 static int parent_num_ids() { return IterationStatement::num_ids(); } |
| 623 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 622 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 624 | 623 |
| 625 Expression* cond_; | 624 Expression* cond_; |
| 626 }; | 625 }; |
| 627 | 626 |
| 628 | 627 |
| 629 class ForStatement final : public IterationStatement { | 628 class ForStatement final : public IterationStatement { |
| 630 public: | 629 public: |
| 631 void Initialize(Statement* init, | 630 void Initialize(Statement* init, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 647 void set_next(Statement* s) { next_ = s; } | 646 void set_next(Statement* s) { next_ = s; } |
| 648 | 647 |
| 649 static int num_ids() { return parent_num_ids() + 2; } | 648 static int num_ids() { return parent_num_ids() + 2; } |
| 650 BailoutId ContinueId() const { return BailoutId(local_id(0)); } | 649 BailoutId ContinueId() const { return BailoutId(local_id(0)); } |
| 651 BailoutId StackCheckId() const { return BodyId(); } | 650 BailoutId StackCheckId() const { return BodyId(); } |
| 652 BailoutId BodyId() const { return BailoutId(local_id(1)); } | 651 BailoutId BodyId() const { return BailoutId(local_id(1)); } |
| 653 | 652 |
| 654 private: | 653 private: |
| 655 friend class AstNodeFactory; | 654 friend class AstNodeFactory; |
| 656 | 655 |
| 657 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 656 ForStatement(ZoneList<const AstRawString*>* labels, int pos) |
| 658 : IterationStatement(zone, labels, pos, kForStatement), | 657 : IterationStatement(labels, pos, kForStatement), |
| 659 init_(NULL), | 658 init_(NULL), |
| 660 cond_(NULL), | 659 cond_(NULL), |
| 661 next_(NULL) {} | 660 next_(NULL) {} |
| 662 static int parent_num_ids() { return IterationStatement::num_ids(); } | 661 static int parent_num_ids() { return IterationStatement::num_ids(); } |
| 663 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 662 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 664 | 663 |
| 665 Statement* init_; | 664 Statement* init_; |
| 666 Expression* cond_; | 665 Expression* cond_; |
| 667 Statement* next_; | 666 Statement* next_; |
| 668 }; | 667 }; |
| 669 | 668 |
| 670 | 669 |
| 671 class ForEachStatement : public IterationStatement { | 670 class ForEachStatement : public IterationStatement { |
| 672 public: | 671 public: |
| 673 enum VisitMode { | 672 enum VisitMode { |
| 674 ENUMERATE, // for (each in subject) body; | 673 ENUMERATE, // for (each in subject) body; |
| 675 ITERATE // for (each of subject) body; | 674 ITERATE // for (each of subject) body; |
| 676 }; | 675 }; |
| 677 | 676 |
| 678 using IterationStatement::Initialize; | 677 using IterationStatement::Initialize; |
| 679 | 678 |
| 680 static const char* VisitModeString(VisitMode mode) { | 679 static const char* VisitModeString(VisitMode mode) { |
| 681 return mode == ITERATE ? "for-of" : "for-in"; | 680 return mode == ITERATE ? "for-of" : "for-in"; |
| 682 } | 681 } |
| 683 | 682 |
| 684 protected: | 683 protected: |
| 685 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 684 ForEachStatement(ZoneList<const AstRawString*>* labels, int pos, |
| 686 NodeType type) | 685 NodeType type) |
| 687 : IterationStatement(zone, labels, pos, type) {} | 686 : IterationStatement(labels, pos, type) {} |
| 688 }; | 687 }; |
| 689 | 688 |
| 690 | 689 |
| 691 class ForInStatement final : public ForEachStatement { | 690 class ForInStatement final : public ForEachStatement { |
| 692 public: | 691 public: |
| 693 void Initialize(Expression* each, Expression* subject, Statement* body) { | 692 void Initialize(Expression* each, Expression* subject, Statement* body) { |
| 694 ForEachStatement::Initialize(body); | 693 ForEachStatement::Initialize(body); |
| 695 each_ = each; | 694 each_ = each; |
| 696 subject_ = subject; | 695 subject_ = subject; |
| 697 } | 696 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 725 BailoutId ToObjectId() const { return BailoutId(local_id(2)); } | 724 BailoutId ToObjectId() const { return BailoutId(local_id(2)); } |
| 726 BailoutId PrepareId() const { return BailoutId(local_id(3)); } | 725 BailoutId PrepareId() const { return BailoutId(local_id(3)); } |
| 727 BailoutId FilterId() const { return BailoutId(local_id(4)); } | 726 BailoutId FilterId() const { return BailoutId(local_id(4)); } |
| 728 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } | 727 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } |
| 729 BailoutId ContinueId() const { return EntryId(); } | 728 BailoutId ContinueId() const { return EntryId(); } |
| 730 BailoutId StackCheckId() const { return BodyId(); } | 729 BailoutId StackCheckId() const { return BodyId(); } |
| 731 | 730 |
| 732 private: | 731 private: |
| 733 friend class AstNodeFactory; | 732 friend class AstNodeFactory; |
| 734 | 733 |
| 735 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 734 ForInStatement(ZoneList<const AstRawString*>* labels, int pos) |
| 736 : ForEachStatement(zone, labels, pos, kForInStatement), | 735 : ForEachStatement(labels, pos, kForInStatement), |
| 737 each_(nullptr), | 736 each_(nullptr), |
| 738 subject_(nullptr), | 737 subject_(nullptr), |
| 739 for_in_type_(SLOW_FOR_IN) {} | 738 for_in_type_(SLOW_FOR_IN) {} |
| 740 static int parent_num_ids() { return ForEachStatement::num_ids(); } | 739 static int parent_num_ids() { return ForEachStatement::num_ids(); } |
| 741 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 740 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 742 | 741 |
| 743 Expression* each_; | 742 Expression* each_; |
| 744 Expression* subject_; | 743 Expression* subject_; |
| 745 ForInType for_in_type_; | 744 ForInType for_in_type_; |
| 746 FeedbackVectorSlot each_slot_; | 745 FeedbackVectorSlot each_slot_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 791 |
| 793 BailoutId ContinueId() const { return EntryId(); } | 792 BailoutId ContinueId() const { return EntryId(); } |
| 794 BailoutId StackCheckId() const { return BackEdgeId(); } | 793 BailoutId StackCheckId() const { return BackEdgeId(); } |
| 795 | 794 |
| 796 static int num_ids() { return parent_num_ids() + 1; } | 795 static int num_ids() { return parent_num_ids() + 1; } |
| 797 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); } | 796 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); } |
| 798 | 797 |
| 799 private: | 798 private: |
| 800 friend class AstNodeFactory; | 799 friend class AstNodeFactory; |
| 801 | 800 |
| 802 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 801 ForOfStatement(ZoneList<const AstRawString*>* labels, int pos) |
| 803 : ForEachStatement(zone, labels, pos, kForOfStatement), | 802 : ForEachStatement(labels, pos, kForOfStatement), |
| 804 iterator_(NULL), | 803 iterator_(NULL), |
| 805 assign_iterator_(NULL), | 804 assign_iterator_(NULL), |
| 806 next_result_(NULL), | 805 next_result_(NULL), |
| 807 result_done_(NULL), | 806 result_done_(NULL), |
| 808 assign_each_(NULL) {} | 807 assign_each_(NULL) {} |
| 809 static int parent_num_ids() { return ForEachStatement::num_ids(); } | 808 static int parent_num_ids() { return ForEachStatement::num_ids(); } |
| 810 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 809 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 811 | 810 |
| 812 Variable* iterator_; | 811 Variable* iterator_; |
| 813 Expression* assign_iterator_; | 812 Expression* assign_iterator_; |
| 814 Expression* next_result_; | 813 Expression* next_result_; |
| 815 Expression* result_done_; | 814 Expression* result_done_; |
| 816 Expression* assign_each_; | 815 Expression* assign_each_; |
| 817 }; | 816 }; |
| 818 | 817 |
| 819 | 818 |
| 820 class ExpressionStatement final : public Statement { | 819 class ExpressionStatement final : public Statement { |
| 821 public: | 820 public: |
| 822 void set_expression(Expression* e) { expression_ = e; } | 821 void set_expression(Expression* e) { expression_ = e; } |
| 823 Expression* expression() const { return expression_; } | 822 Expression* expression() const { return expression_; } |
| 824 bool IsJump() const { return expression_->IsThrow(); } | 823 bool IsJump() const { return expression_->IsThrow(); } |
| 825 | 824 |
| 826 private: | 825 private: |
| 827 friend class AstNodeFactory; | 826 friend class AstNodeFactory; |
| 828 | 827 |
| 829 ExpressionStatement(Zone* zone, Expression* expression, int pos) | 828 ExpressionStatement(Expression* expression, int pos) |
| 830 : Statement(zone, pos, kExpressionStatement), expression_(expression) {} | 829 : Statement(pos, kExpressionStatement), expression_(expression) {} |
| 831 | 830 |
| 832 Expression* expression_; | 831 Expression* expression_; |
| 833 }; | 832 }; |
| 834 | 833 |
| 835 | 834 |
| 836 class JumpStatement : public Statement { | 835 class JumpStatement : public Statement { |
| 837 public: | 836 public: |
| 838 bool IsJump() const { return true; } | 837 bool IsJump() const { return true; } |
| 839 | 838 |
| 840 protected: | 839 protected: |
| 841 JumpStatement(Zone* zone, int pos, NodeType type) | 840 JumpStatement(int pos, NodeType type) : Statement(pos, type) {} |
| 842 : Statement(zone, pos, type) {} | |
| 843 }; | 841 }; |
| 844 | 842 |
| 845 | 843 |
| 846 class ContinueStatement final : public JumpStatement { | 844 class ContinueStatement final : public JumpStatement { |
| 847 public: | 845 public: |
| 848 IterationStatement* target() const { return target_; } | 846 IterationStatement* target() const { return target_; } |
| 849 | 847 |
| 850 private: | 848 private: |
| 851 friend class AstNodeFactory; | 849 friend class AstNodeFactory; |
| 852 | 850 |
| 853 ContinueStatement(Zone* zone, IterationStatement* target, int pos) | 851 ContinueStatement(IterationStatement* target, int pos) |
| 854 : JumpStatement(zone, pos, kContinueStatement), target_(target) {} | 852 : JumpStatement(pos, kContinueStatement), target_(target) {} |
| 855 | 853 |
| 856 IterationStatement* target_; | 854 IterationStatement* target_; |
| 857 }; | 855 }; |
| 858 | 856 |
| 859 | 857 |
| 860 class BreakStatement final : public JumpStatement { | 858 class BreakStatement final : public JumpStatement { |
| 861 public: | 859 public: |
| 862 BreakableStatement* target() const { return target_; } | 860 BreakableStatement* target() const { return target_; } |
| 863 | 861 |
| 864 private: | 862 private: |
| 865 friend class AstNodeFactory; | 863 friend class AstNodeFactory; |
| 866 | 864 |
| 867 BreakStatement(Zone* zone, BreakableStatement* target, int pos) | 865 BreakStatement(BreakableStatement* target, int pos) |
| 868 : JumpStatement(zone, pos, kBreakStatement), target_(target) {} | 866 : JumpStatement(pos, kBreakStatement), target_(target) {} |
| 869 | 867 |
| 870 BreakableStatement* target_; | 868 BreakableStatement* target_; |
| 871 }; | 869 }; |
| 872 | 870 |
| 873 | 871 |
| 874 class ReturnStatement final : public JumpStatement { | 872 class ReturnStatement final : public JumpStatement { |
| 875 public: | 873 public: |
| 876 Expression* expression() const { return expression_; } | 874 Expression* expression() const { return expression_; } |
| 877 | 875 |
| 878 void set_expression(Expression* e) { expression_ = e; } | 876 void set_expression(Expression* e) { expression_ = e; } |
| 879 | 877 |
| 880 private: | 878 private: |
| 881 friend class AstNodeFactory; | 879 friend class AstNodeFactory; |
| 882 | 880 |
| 883 ReturnStatement(Zone* zone, Expression* expression, int pos) | 881 ReturnStatement(Expression* expression, int pos) |
| 884 : JumpStatement(zone, pos, kReturnStatement), expression_(expression) {} | 882 : JumpStatement(pos, kReturnStatement), expression_(expression) {} |
| 885 | 883 |
| 886 Expression* expression_; | 884 Expression* expression_; |
| 887 }; | 885 }; |
| 888 | 886 |
| 889 | 887 |
| 890 class WithStatement final : public Statement { | 888 class WithStatement final : public Statement { |
| 891 public: | 889 public: |
| 892 Scope* scope() { return scope_; } | 890 Scope* scope() { return scope_; } |
| 893 Expression* expression() const { return expression_; } | 891 Expression* expression() const { return expression_; } |
| 894 void set_expression(Expression* e) { expression_ = e; } | 892 void set_expression(Expression* e) { expression_ = e; } |
| 895 Statement* statement() const { return statement_; } | 893 Statement* statement() const { return statement_; } |
| 896 void set_statement(Statement* s) { statement_ = s; } | 894 void set_statement(Statement* s) { statement_ = s; } |
| 897 | 895 |
| 898 void set_base_id(int id) { base_id_ = id; } | 896 void set_base_id(int id) { base_id_ = id; } |
| 899 static int num_ids() { return parent_num_ids() + 2; } | 897 static int num_ids() { return parent_num_ids() + 2; } |
| 900 BailoutId ToObjectId() const { return BailoutId(local_id(0)); } | 898 BailoutId ToObjectId() const { return BailoutId(local_id(0)); } |
| 901 BailoutId EntryId() const { return BailoutId(local_id(1)); } | 899 BailoutId EntryId() const { return BailoutId(local_id(1)); } |
| 902 | 900 |
| 903 private: | 901 private: |
| 904 friend class AstNodeFactory; | 902 friend class AstNodeFactory; |
| 905 | 903 |
| 906 WithStatement(Zone* zone, Scope* scope, Expression* expression, | 904 WithStatement(Scope* scope, Expression* expression, Statement* statement, |
| 907 Statement* statement, int pos) | 905 int pos) |
| 908 : Statement(zone, pos, kWithStatement), | 906 : Statement(pos, kWithStatement), |
| 909 base_id_(BailoutId::None().ToInt()), | 907 base_id_(BailoutId::None().ToInt()), |
| 910 scope_(scope), | 908 scope_(scope), |
| 911 expression_(expression), | 909 expression_(expression), |
| 912 statement_(statement) {} | 910 statement_(statement) {} |
| 913 | 911 |
| 914 static int parent_num_ids() { return 0; } | 912 static int parent_num_ids() { return 0; } |
| 915 int base_id() const { | 913 int base_id() const { |
| 916 DCHECK(!BailoutId(base_id_).IsNone()); | 914 DCHECK(!BailoutId(base_id_).IsNone()); |
| 917 return base_id_; | 915 return base_id_; |
| 918 } | 916 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 940 BailoutId EntryId() const { return BailoutId(local_id(0)); } | 938 BailoutId EntryId() const { return BailoutId(local_id(0)); } |
| 941 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); } | 939 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); } |
| 942 | 940 |
| 943 Type* compare_type() { return compare_type_; } | 941 Type* compare_type() { return compare_type_; } |
| 944 void set_compare_type(Type* type) { compare_type_ = type; } | 942 void set_compare_type(Type* type) { compare_type_ = type; } |
| 945 | 943 |
| 946 private: | 944 private: |
| 947 friend class AstNodeFactory; | 945 friend class AstNodeFactory; |
| 948 | 946 |
| 949 static int parent_num_ids() { return Expression::num_ids(); } | 947 static int parent_num_ids() { return Expression::num_ids(); } |
| 950 CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements, | 948 CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos); |
| 951 int pos); | |
| 952 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 949 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 953 | 950 |
| 954 Expression* label_; | 951 Expression* label_; |
| 955 Label body_target_; | 952 Label body_target_; |
| 956 ZoneList<Statement*>* statements_; | 953 ZoneList<Statement*>* statements_; |
| 957 Type* compare_type_; | 954 Type* compare_type_; |
| 958 }; | 955 }; |
| 959 | 956 |
| 960 | 957 |
| 961 class SwitchStatement final : public BreakableStatement { | 958 class SwitchStatement final : public BreakableStatement { |
| 962 public: | 959 public: |
| 963 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 960 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| 964 tag_ = tag; | 961 tag_ = tag; |
| 965 cases_ = cases; | 962 cases_ = cases; |
| 966 } | 963 } |
| 967 | 964 |
| 968 Expression* tag() const { return tag_; } | 965 Expression* tag() const { return tag_; } |
| 969 ZoneList<CaseClause*>* cases() const { return cases_; } | 966 ZoneList<CaseClause*>* cases() const { return cases_; } |
| 970 | 967 |
| 971 void set_tag(Expression* t) { tag_ = t; } | 968 void set_tag(Expression* t) { tag_ = t; } |
| 972 | 969 |
| 973 private: | 970 private: |
| 974 friend class AstNodeFactory; | 971 friend class AstNodeFactory; |
| 975 | 972 |
| 976 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 973 SwitchStatement(ZoneList<const AstRawString*>* labels, int pos) |
| 977 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, | 974 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS, pos, kSwitchStatement), |
| 978 kSwitchStatement), | |
| 979 tag_(NULL), | 975 tag_(NULL), |
| 980 cases_(NULL) {} | 976 cases_(NULL) {} |
| 981 | 977 |
| 982 Expression* tag_; | 978 Expression* tag_; |
| 983 ZoneList<CaseClause*>* cases_; | 979 ZoneList<CaseClause*>* cases_; |
| 984 }; | 980 }; |
| 985 | 981 |
| 986 | 982 |
| 987 // If-statements always have non-null references to their then- and | 983 // If-statements always have non-null references to their then- and |
| 988 // else-parts. When parsing if-statements with no explicit else-part, | 984 // else-parts. When parsing if-statements with no explicit else-part, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1009 | 1005 |
| 1010 void set_base_id(int id) { base_id_ = id; } | 1006 void set_base_id(int id) { base_id_ = id; } |
| 1011 static int num_ids() { return parent_num_ids() + 3; } | 1007 static int num_ids() { return parent_num_ids() + 3; } |
| 1012 BailoutId IfId() const { return BailoutId(local_id(0)); } | 1008 BailoutId IfId() const { return BailoutId(local_id(0)); } |
| 1013 BailoutId ThenId() const { return BailoutId(local_id(1)); } | 1009 BailoutId ThenId() const { return BailoutId(local_id(1)); } |
| 1014 BailoutId ElseId() const { return BailoutId(local_id(2)); } | 1010 BailoutId ElseId() const { return BailoutId(local_id(2)); } |
| 1015 | 1011 |
| 1016 private: | 1012 private: |
| 1017 friend class AstNodeFactory; | 1013 friend class AstNodeFactory; |
| 1018 | 1014 |
| 1019 IfStatement(Zone* zone, Expression* condition, Statement* then_statement, | 1015 IfStatement(Expression* condition, Statement* then_statement, |
| 1020 Statement* else_statement, int pos) | 1016 Statement* else_statement, int pos) |
| 1021 : Statement(zone, pos, kIfStatement), | 1017 : Statement(pos, kIfStatement), |
| 1022 base_id_(BailoutId::None().ToInt()), | 1018 base_id_(BailoutId::None().ToInt()), |
| 1023 condition_(condition), | 1019 condition_(condition), |
| 1024 then_statement_(then_statement), | 1020 then_statement_(then_statement), |
| 1025 else_statement_(else_statement) {} | 1021 else_statement_(else_statement) {} |
| 1026 | 1022 |
| 1027 static int parent_num_ids() { return 0; } | 1023 static int parent_num_ids() { return 0; } |
| 1028 int base_id() const { | 1024 int base_id() const { |
| 1029 DCHECK(!BailoutId(base_id_).IsNone()); | 1025 DCHECK(!BailoutId(base_id_).IsNone()); |
| 1030 return base_id_; | 1026 return base_id_; |
| 1031 } | 1027 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1054 // Since it's generally undecidable whether an exception will be caught, our | 1050 // Since it's generally undecidable whether an exception will be caught, our |
| 1055 // prediction is only an approximation. | 1051 // prediction is only an approximation. |
| 1056 HandlerTable::CatchPrediction catch_prediction() const { | 1052 HandlerTable::CatchPrediction catch_prediction() const { |
| 1057 return catch_prediction_; | 1053 return catch_prediction_; |
| 1058 } | 1054 } |
| 1059 void set_catch_prediction(HandlerTable::CatchPrediction prediction) { | 1055 void set_catch_prediction(HandlerTable::CatchPrediction prediction) { |
| 1060 catch_prediction_ = prediction; | 1056 catch_prediction_ = prediction; |
| 1061 } | 1057 } |
| 1062 | 1058 |
| 1063 protected: | 1059 protected: |
| 1064 TryStatement(Zone* zone, Block* try_block, int pos, NodeType type) | 1060 TryStatement(Block* try_block, int pos, NodeType type) |
| 1065 : Statement(zone, pos, type), | 1061 : Statement(pos, type), |
| 1066 catch_prediction_(HandlerTable::UNCAUGHT), | 1062 catch_prediction_(HandlerTable::UNCAUGHT), |
| 1067 try_block_(try_block) {} | 1063 try_block_(try_block) {} |
| 1068 | 1064 |
| 1069 HandlerTable::CatchPrediction catch_prediction_; | 1065 HandlerTable::CatchPrediction catch_prediction_; |
| 1070 | 1066 |
| 1071 private: | 1067 private: |
| 1072 Block* try_block_; | 1068 Block* try_block_; |
| 1073 }; | 1069 }; |
| 1074 | 1070 |
| 1075 | 1071 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1090 // message instead of generating a new one. | 1086 // message instead of generating a new one. |
| 1091 // (When the catch block doesn't rethrow but is guaranteed to perform an | 1087 // (When the catch block doesn't rethrow but is guaranteed to perform an |
| 1092 // ordinary throw, not clearing the old message is safe but not very useful.) | 1088 // ordinary throw, not clearing the old message is safe but not very useful.) |
| 1093 bool clear_pending_message() const { | 1089 bool clear_pending_message() const { |
| 1094 return catch_prediction_ != HandlerTable::UNCAUGHT; | 1090 return catch_prediction_ != HandlerTable::UNCAUGHT; |
| 1095 } | 1091 } |
| 1096 | 1092 |
| 1097 private: | 1093 private: |
| 1098 friend class AstNodeFactory; | 1094 friend class AstNodeFactory; |
| 1099 | 1095 |
| 1100 TryCatchStatement(Zone* zone, Block* try_block, Scope* scope, | 1096 TryCatchStatement(Block* try_block, Scope* scope, Variable* variable, |
| 1101 Variable* variable, Block* catch_block, | 1097 Block* catch_block, |
| 1102 HandlerTable::CatchPrediction catch_prediction, int pos) | 1098 HandlerTable::CatchPrediction catch_prediction, int pos) |
| 1103 : TryStatement(zone, try_block, pos, kTryCatchStatement), | 1099 : TryStatement(try_block, pos, kTryCatchStatement), |
| 1104 scope_(scope), | 1100 scope_(scope), |
| 1105 variable_(variable), | 1101 variable_(variable), |
| 1106 catch_block_(catch_block) { | 1102 catch_block_(catch_block) { |
| 1107 catch_prediction_ = catch_prediction; | 1103 catch_prediction_ = catch_prediction; |
| 1108 } | 1104 } |
| 1109 | 1105 |
| 1110 Scope* scope_; | 1106 Scope* scope_; |
| 1111 Variable* variable_; | 1107 Variable* variable_; |
| 1112 Block* catch_block_; | 1108 Block* catch_block_; |
| 1113 }; | 1109 }; |
| 1114 | 1110 |
| 1115 | 1111 |
| 1116 class TryFinallyStatement final : public TryStatement { | 1112 class TryFinallyStatement final : public TryStatement { |
| 1117 public: | 1113 public: |
| 1118 Block* finally_block() const { return finally_block_; } | 1114 Block* finally_block() const { return finally_block_; } |
| 1119 void set_finally_block(Block* b) { finally_block_ = b; } | 1115 void set_finally_block(Block* b) { finally_block_ = b; } |
| 1120 | 1116 |
| 1121 private: | 1117 private: |
| 1122 friend class AstNodeFactory; | 1118 friend class AstNodeFactory; |
| 1123 | 1119 |
| 1124 TryFinallyStatement(Zone* zone, Block* try_block, Block* finally_block, | 1120 TryFinallyStatement(Block* try_block, Block* finally_block, int pos) |
| 1125 int pos) | 1121 : TryStatement(try_block, pos, kTryFinallyStatement), |
| 1126 : TryStatement(zone, try_block, pos, kTryFinallyStatement), | |
| 1127 finally_block_(finally_block) {} | 1122 finally_block_(finally_block) {} |
| 1128 | 1123 |
| 1129 Block* finally_block_; | 1124 Block* finally_block_; |
| 1130 }; | 1125 }; |
| 1131 | 1126 |
| 1132 | 1127 |
| 1133 class DebuggerStatement final : public Statement { | 1128 class DebuggerStatement final : public Statement { |
| 1134 public: | 1129 public: |
| 1135 void set_base_id(int id) { base_id_ = id; } | 1130 void set_base_id(int id) { base_id_ = id; } |
| 1136 static int num_ids() { return parent_num_ids() + 1; } | 1131 static int num_ids() { return parent_num_ids() + 1; } |
| 1137 BailoutId DebugBreakId() const { return BailoutId(local_id(0)); } | 1132 BailoutId DebugBreakId() const { return BailoutId(local_id(0)); } |
| 1138 | 1133 |
| 1139 private: | 1134 private: |
| 1140 friend class AstNodeFactory; | 1135 friend class AstNodeFactory; |
| 1141 | 1136 |
| 1142 DebuggerStatement(Zone* zone, int pos) | 1137 explicit DebuggerStatement(int pos) |
| 1143 : Statement(zone, pos, kDebuggerStatement), | 1138 : Statement(pos, kDebuggerStatement), |
| 1144 base_id_(BailoutId::None().ToInt()) {} | 1139 base_id_(BailoutId::None().ToInt()) {} |
| 1145 | 1140 |
| 1146 static int parent_num_ids() { return 0; } | 1141 static int parent_num_ids() { return 0; } |
| 1147 int base_id() const { | 1142 int base_id() const { |
| 1148 DCHECK(!BailoutId(base_id_).IsNone()); | 1143 DCHECK(!BailoutId(base_id_).IsNone()); |
| 1149 return base_id_; | 1144 return base_id_; |
| 1150 } | 1145 } |
| 1151 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1146 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1152 | 1147 |
| 1153 int base_id_; | 1148 int base_id_; |
| 1154 }; | 1149 }; |
| 1155 | 1150 |
| 1156 | 1151 |
| 1157 class EmptyStatement final : public Statement { | 1152 class EmptyStatement final : public Statement { |
| 1158 private: | 1153 private: |
| 1159 friend class AstNodeFactory; | 1154 friend class AstNodeFactory; |
| 1160 EmptyStatement(Zone* zone, int pos) : Statement(zone, pos, kEmptyStatement) {} | 1155 explicit EmptyStatement(int pos) : Statement(pos, kEmptyStatement) {} |
| 1161 }; | 1156 }; |
| 1162 | 1157 |
| 1163 | 1158 |
| 1164 // Delegates to another statement, which may be overwritten. | 1159 // Delegates to another statement, which may be overwritten. |
| 1165 // This was introduced to implement ES2015 Annex B3.3 for conditionally making | 1160 // This was introduced to implement ES2015 Annex B3.3 for conditionally making |
| 1166 // sloppy-mode block-scoped functions have a var binding, which is changed | 1161 // sloppy-mode block-scoped functions have a var binding, which is changed |
| 1167 // from one statement to another during parsing. | 1162 // from one statement to another during parsing. |
| 1168 class SloppyBlockFunctionStatement final : public Statement { | 1163 class SloppyBlockFunctionStatement final : public Statement { |
| 1169 public: | 1164 public: |
| 1170 Statement* statement() const { return statement_; } | 1165 Statement* statement() const { return statement_; } |
| 1171 void set_statement(Statement* statement) { statement_ = statement; } | 1166 void set_statement(Statement* statement) { statement_ = statement; } |
| 1172 Scope* scope() const { return scope_; } | 1167 Scope* scope() const { return scope_; } |
| 1173 SloppyBlockFunctionStatement* next() { return next_; } | 1168 SloppyBlockFunctionStatement* next() { return next_; } |
| 1174 void set_next(SloppyBlockFunctionStatement* next) { next_ = next; } | 1169 void set_next(SloppyBlockFunctionStatement* next) { next_ = next; } |
| 1175 | 1170 |
| 1176 private: | 1171 private: |
| 1177 friend class AstNodeFactory; | 1172 friend class AstNodeFactory; |
| 1178 | 1173 |
| 1179 SloppyBlockFunctionStatement(Zone* zone, Statement* statement, Scope* scope) | 1174 SloppyBlockFunctionStatement(Statement* statement, Scope* scope) |
| 1180 : Statement(zone, kNoSourcePosition, kSloppyBlockFunctionStatement), | 1175 : Statement(kNoSourcePosition, kSloppyBlockFunctionStatement), |
| 1181 statement_(statement), | 1176 statement_(statement), |
| 1182 scope_(scope), | 1177 scope_(scope), |
| 1183 next_(nullptr) {} | 1178 next_(nullptr) {} |
| 1184 | 1179 |
| 1185 Statement* statement_; | 1180 Statement* statement_; |
| 1186 Scope* const scope_; | 1181 Scope* const scope_; |
| 1187 SloppyBlockFunctionStatement* next_; | 1182 SloppyBlockFunctionStatement* next_; |
| 1188 }; | 1183 }; |
| 1189 | 1184 |
| 1190 | 1185 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1216 static bool Match(void* literal1, void* literal2); | 1211 static bool Match(void* literal1, void* literal2); |
| 1217 | 1212 |
| 1218 static int num_ids() { return parent_num_ids() + 1; } | 1213 static int num_ids() { return parent_num_ids() + 1; } |
| 1219 TypeFeedbackId LiteralFeedbackId() const { | 1214 TypeFeedbackId LiteralFeedbackId() const { |
| 1220 return TypeFeedbackId(local_id(0)); | 1215 return TypeFeedbackId(local_id(0)); |
| 1221 } | 1216 } |
| 1222 | 1217 |
| 1223 private: | 1218 private: |
| 1224 friend class AstNodeFactory; | 1219 friend class AstNodeFactory; |
| 1225 | 1220 |
| 1226 Literal(Zone* zone, const AstValue* value, int position) | 1221 Literal(const AstValue* value, int position) |
| 1227 : Expression(zone, position, kLiteral), value_(value) {} | 1222 : Expression(position, kLiteral), value_(value) {} |
| 1228 | 1223 |
| 1229 static int parent_num_ids() { return Expression::num_ids(); } | 1224 static int parent_num_ids() { return Expression::num_ids(); } |
| 1230 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1225 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1231 | 1226 |
| 1232 const AstValue* value_; | 1227 const AstValue* value_; |
| 1233 }; | 1228 }; |
| 1234 | 1229 |
| 1235 | 1230 |
| 1236 class AstLiteralReindexer; | 1231 class AstLiteralReindexer; |
| 1237 | 1232 |
| 1238 // Base class for literals that needs space in the corresponding JSFunction. | 1233 // Base class for literals that needs space in the corresponding JSFunction. |
| 1239 class MaterializedLiteral : public Expression { | 1234 class MaterializedLiteral : public Expression { |
| 1240 public: | 1235 public: |
| 1241 int literal_index() { return literal_index_; } | 1236 int literal_index() { return literal_index_; } |
| 1242 | 1237 |
| 1243 int depth() const { | 1238 int depth() const { |
| 1244 // only callable after initialization. | 1239 // only callable after initialization. |
| 1245 DCHECK(depth_ >= 1); | 1240 DCHECK(depth_ >= 1); |
| 1246 return depth_; | 1241 return depth_; |
| 1247 } | 1242 } |
| 1248 | 1243 |
| 1249 protected: | 1244 protected: |
| 1250 MaterializedLiteral(Zone* zone, int literal_index, int pos, NodeType type) | 1245 MaterializedLiteral(int literal_index, int pos, NodeType type) |
| 1251 : Expression(zone, pos, type), | 1246 : Expression(pos, type), |
| 1252 is_simple_(false), | 1247 is_simple_(false), |
| 1253 depth_(0), | 1248 depth_(0), |
| 1254 literal_index_(literal_index) {} | 1249 literal_index_(literal_index) {} |
| 1255 | 1250 |
| 1256 // A materialized literal is simple if the values consist of only | 1251 // A materialized literal is simple if the values consist of only |
| 1257 // constants and simple object and array literals. | 1252 // constants and simple object and array literals. |
| 1258 bool is_simple() const { return is_simple_; } | 1253 bool is_simple() const { return is_simple_; } |
| 1259 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } | 1254 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } |
| 1260 friend class CompileTimeValue; | 1255 friend class CompileTimeValue; |
| 1261 | 1256 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 } | 1418 } |
| 1424 | 1419 |
| 1425 // Object literals need one feedback slot for each non-trivial value, as well | 1420 // Object literals need one feedback slot for each non-trivial value, as well |
| 1426 // as some slots for home objects. | 1421 // as some slots for home objects. |
| 1427 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1422 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| 1428 FeedbackVectorSlotCache* cache); | 1423 FeedbackVectorSlotCache* cache); |
| 1429 | 1424 |
| 1430 private: | 1425 private: |
| 1431 friend class AstNodeFactory; | 1426 friend class AstNodeFactory; |
| 1432 | 1427 |
| 1433 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, | 1428 ObjectLiteral(ZoneList<Property*>* properties, int literal_index, |
| 1434 uint32_t boilerplate_properties, int pos) | 1429 uint32_t boilerplate_properties, int pos) |
| 1435 : MaterializedLiteral(zone, literal_index, pos, kObjectLiteral), | 1430 : MaterializedLiteral(literal_index, pos, kObjectLiteral), |
| 1436 boilerplate_properties_(boilerplate_properties), | 1431 boilerplate_properties_(boilerplate_properties), |
| 1437 fast_elements_(false), | 1432 fast_elements_(false), |
| 1438 has_elements_(false), | 1433 has_elements_(false), |
| 1439 may_store_doubles_(false), | 1434 may_store_doubles_(false), |
| 1440 properties_(properties) {} | 1435 properties_(properties) {} |
| 1441 | 1436 |
| 1442 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1437 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
| 1443 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1438 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1444 | 1439 |
| 1445 uint32_t boilerplate_properties_ : 29; | 1440 uint32_t boilerplate_properties_ : 29; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1476 | 1471 |
| 1477 // Node for capturing a regexp literal. | 1472 // Node for capturing a regexp literal. |
| 1478 class RegExpLiteral final : public MaterializedLiteral { | 1473 class RegExpLiteral final : public MaterializedLiteral { |
| 1479 public: | 1474 public: |
| 1480 Handle<String> pattern() const { return pattern_->string(); } | 1475 Handle<String> pattern() const { return pattern_->string(); } |
| 1481 int flags() const { return flags_; } | 1476 int flags() const { return flags_; } |
| 1482 | 1477 |
| 1483 private: | 1478 private: |
| 1484 friend class AstNodeFactory; | 1479 friend class AstNodeFactory; |
| 1485 | 1480 |
| 1486 RegExpLiteral(Zone* zone, const AstRawString* pattern, int flags, | 1481 RegExpLiteral(const AstRawString* pattern, int flags, int literal_index, |
| 1487 int literal_index, int pos) | 1482 int pos) |
| 1488 : MaterializedLiteral(zone, literal_index, pos, kRegExpLiteral), | 1483 : MaterializedLiteral(literal_index, pos, kRegExpLiteral), |
| 1489 flags_(flags), | 1484 flags_(flags), |
| 1490 pattern_(pattern) { | 1485 pattern_(pattern) { |
| 1491 set_depth(1); | 1486 set_depth(1); |
| 1492 } | 1487 } |
| 1493 | 1488 |
| 1494 int const flags_; | 1489 int const flags_; |
| 1495 const AstRawString* const pattern_; | 1490 const AstRawString* const pattern_; |
| 1496 }; | 1491 }; |
| 1497 | 1492 |
| 1498 | 1493 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 kDisableMementos = 1 << 1 | 1544 kDisableMementos = 1 << 1 |
| 1550 }; | 1545 }; |
| 1551 | 1546 |
| 1552 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1547 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| 1553 FeedbackVectorSlotCache* cache); | 1548 FeedbackVectorSlotCache* cache); |
| 1554 FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; } | 1549 FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; } |
| 1555 | 1550 |
| 1556 private: | 1551 private: |
| 1557 friend class AstNodeFactory; | 1552 friend class AstNodeFactory; |
| 1558 | 1553 |
| 1559 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, | 1554 ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index, |
| 1560 int first_spread_index, int literal_index, int pos) | 1555 int literal_index, int pos) |
| 1561 : MaterializedLiteral(zone, literal_index, pos, kArrayLiteral), | 1556 : MaterializedLiteral(literal_index, pos, kArrayLiteral), |
| 1562 first_spread_index_(first_spread_index), | 1557 first_spread_index_(first_spread_index), |
| 1563 values_(values) {} | 1558 values_(values) {} |
| 1564 | 1559 |
| 1565 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1560 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
| 1566 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1561 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1567 | 1562 |
| 1568 int first_spread_index_; | 1563 int first_spread_index_; |
| 1569 FeedbackVectorSlot literal_slot_; | 1564 FeedbackVectorSlot literal_slot_; |
| 1570 Handle<FixedArray> constant_elements_; | 1565 Handle<FixedArray> constant_elements_; |
| 1571 ZoneList<Expression*>* values_; | 1566 ZoneList<Expression*>* values_; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } | 1620 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } |
| 1626 | 1621 |
| 1627 static int num_ids() { return parent_num_ids() + 1; } | 1622 static int num_ids() { return parent_num_ids() + 1; } |
| 1628 BailoutId BeforeId() const { return BailoutId(local_id(0)); } | 1623 BailoutId BeforeId() const { return BailoutId(local_id(0)); } |
| 1629 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; } | 1624 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; } |
| 1630 VariableProxy* next_unresolved() { return next_unresolved_; } | 1625 VariableProxy* next_unresolved() { return next_unresolved_; } |
| 1631 | 1626 |
| 1632 private: | 1627 private: |
| 1633 friend class AstNodeFactory; | 1628 friend class AstNodeFactory; |
| 1634 | 1629 |
| 1635 VariableProxy(Zone* zone, Variable* var, int start_position, | 1630 VariableProxy(Variable* var, int start_position, int end_position); |
| 1636 int end_position); | 1631 VariableProxy(const AstRawString* name, Variable::Kind variable_kind, |
| 1637 VariableProxy(Zone* zone, const AstRawString* name, | 1632 int start_position, int end_position); |
| 1638 Variable::Kind variable_kind, int start_position, | 1633 explicit VariableProxy(const VariableProxy* copy_from); |
| 1639 int end_position); | |
| 1640 VariableProxy(Zone* zone, const VariableProxy* copy_from); | |
| 1641 | 1634 |
| 1642 static int parent_num_ids() { return Expression::num_ids(); } | 1635 static int parent_num_ids() { return Expression::num_ids(); } |
| 1643 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1636 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1644 | 1637 |
| 1645 class IsThisField : public BitField8<bool, 0, 1> {}; | 1638 class IsThisField : public BitField8<bool, 0, 1> {}; |
| 1646 class IsAssignedField : public BitField8<bool, 1, 1> {}; | 1639 class IsAssignedField : public BitField8<bool, 1, 1> {}; |
| 1647 class IsResolvedField : public BitField8<bool, 2, 1> {}; | 1640 class IsResolvedField : public BitField8<bool, 2, 1> {}; |
| 1648 class IsNewTargetField : public BitField8<bool, 3, 1> {}; | 1641 class IsNewTargetField : public BitField8<bool, 3, 1> {}; |
| 1649 | 1642 |
| 1650 uint8_t bit_field_; | 1643 uint8_t bit_field_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 if (property == NULL) return VARIABLE; | 1729 if (property == NULL) return VARIABLE; |
| 1737 bool super_access = property->IsSuperAccess(); | 1730 bool super_access = property->IsSuperAccess(); |
| 1738 return (property->key()->IsPropertyName()) | 1731 return (property->key()->IsPropertyName()) |
| 1739 ? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY) | 1732 ? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY) |
| 1740 : (super_access ? KEYED_SUPER_PROPERTY : KEYED_PROPERTY); | 1733 : (super_access ? KEYED_SUPER_PROPERTY : KEYED_PROPERTY); |
| 1741 } | 1734 } |
| 1742 | 1735 |
| 1743 private: | 1736 private: |
| 1744 friend class AstNodeFactory; | 1737 friend class AstNodeFactory; |
| 1745 | 1738 |
| 1746 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1739 Property(Expression* obj, Expression* key, int pos) |
| 1747 : Expression(zone, pos, kProperty), | 1740 : Expression(pos, kProperty), |
| 1748 bit_field_(IsForCallField::encode(false) | | 1741 bit_field_(IsForCallField::encode(false) | |
| 1749 IsStringAccessField::encode(false) | | 1742 IsStringAccessField::encode(false) | |
| 1750 InlineCacheStateField::encode(UNINITIALIZED)), | 1743 InlineCacheStateField::encode(UNINITIALIZED)), |
| 1751 obj_(obj), | 1744 obj_(obj), |
| 1752 key_(key) {} | 1745 key_(key) {} |
| 1753 | 1746 |
| 1754 static int parent_num_ids() { return Expression::num_ids(); } | 1747 static int parent_num_ids() { return Expression::num_ids(); } |
| 1755 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1748 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1756 | 1749 |
| 1757 class IsForCallField : public BitField8<bool, 0, 1> {}; | 1750 class IsForCallField : public BitField8<bool, 0, 1> {}; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1864 bool IsUsingCallFeedbackICSlot() const; | 1857 bool IsUsingCallFeedbackICSlot() const; |
| 1865 | 1858 |
| 1866 #ifdef DEBUG | 1859 #ifdef DEBUG |
| 1867 // Used to assert that the FullCodeGenerator records the return site. | 1860 // Used to assert that the FullCodeGenerator records the return site. |
| 1868 bool return_is_recorded_; | 1861 bool return_is_recorded_; |
| 1869 #endif | 1862 #endif |
| 1870 | 1863 |
| 1871 private: | 1864 private: |
| 1872 friend class AstNodeFactory; | 1865 friend class AstNodeFactory; |
| 1873 | 1866 |
| 1874 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1867 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos, |
| 1875 int pos, PossiblyEval possibly_eval) | 1868 PossiblyEval possibly_eval) |
| 1876 : Expression(zone, pos, kCall), | 1869 : Expression(pos, kCall), |
| 1877 bit_field_( | 1870 bit_field_( |
| 1878 IsUninitializedField::encode(false) | | 1871 IsUninitializedField::encode(false) | |
| 1879 IsPossiblyEvalField::encode(possibly_eval == IS_POSSIBLY_EVAL)), | 1872 IsPossiblyEvalField::encode(possibly_eval == IS_POSSIBLY_EVAL)), |
| 1880 expression_(expression), | 1873 expression_(expression), |
| 1881 arguments_(arguments) { | 1874 arguments_(arguments) { |
| 1882 if (expression->IsProperty()) { | 1875 if (expression->IsProperty()) { |
| 1883 expression->AsProperty()->mark_for_call(); | 1876 expression->AsProperty()->mark_for_call(); |
| 1884 } | 1877 } |
| 1885 } | 1878 } |
| 1886 | 1879 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 void set_is_monomorphic(bool monomorphic) { is_monomorphic_ = monomorphic; } | 1931 void set_is_monomorphic(bool monomorphic) { is_monomorphic_ = monomorphic; } |
| 1939 void set_target(Handle<JSFunction> target) { target_ = target; } | 1932 void set_target(Handle<JSFunction> target) { target_ = target; } |
| 1940 void SetKnownGlobalTarget(Handle<JSFunction> target) { | 1933 void SetKnownGlobalTarget(Handle<JSFunction> target) { |
| 1941 target_ = target; | 1934 target_ = target; |
| 1942 is_monomorphic_ = true; | 1935 is_monomorphic_ = true; |
| 1943 } | 1936 } |
| 1944 | 1937 |
| 1945 private: | 1938 private: |
| 1946 friend class AstNodeFactory; | 1939 friend class AstNodeFactory; |
| 1947 | 1940 |
| 1948 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1941 CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
| 1949 int pos) | 1942 : Expression(pos, kCallNew), |
| 1950 : Expression(zone, pos, kCallNew), | |
| 1951 is_monomorphic_(false), | 1943 is_monomorphic_(false), |
| 1952 expression_(expression), | 1944 expression_(expression), |
| 1953 arguments_(arguments) {} | 1945 arguments_(arguments) {} |
| 1954 | 1946 |
| 1955 static int parent_num_ids() { return Expression::num_ids(); } | 1947 static int parent_num_ids() { return Expression::num_ids(); } |
| 1956 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1948 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1957 | 1949 |
| 1958 bool is_monomorphic_; | 1950 bool is_monomorphic_; |
| 1959 FeedbackVectorSlot callnew_feedback_slot_; | 1951 FeedbackVectorSlot callnew_feedback_slot_; |
| 1960 Expression* expression_; | 1952 Expression* expression_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1985 static int num_ids() { return parent_num_ids() + 1; } | 1977 static int num_ids() { return parent_num_ids() + 1; } |
| 1986 BailoutId CallId() { return BailoutId(local_id(0)); } | 1978 BailoutId CallId() { return BailoutId(local_id(0)); } |
| 1987 | 1979 |
| 1988 const char* debug_name() { | 1980 const char* debug_name() { |
| 1989 return is_jsruntime() ? "(context function)" : function_->name; | 1981 return is_jsruntime() ? "(context function)" : function_->name; |
| 1990 } | 1982 } |
| 1991 | 1983 |
| 1992 private: | 1984 private: |
| 1993 friend class AstNodeFactory; | 1985 friend class AstNodeFactory; |
| 1994 | 1986 |
| 1995 CallRuntime(Zone* zone, const Runtime::Function* function, | 1987 CallRuntime(const Runtime::Function* function, |
| 1996 ZoneList<Expression*>* arguments, int pos) | 1988 ZoneList<Expression*>* arguments, int pos) |
| 1997 : Expression(zone, pos, kCallRuntime), | 1989 : Expression(pos, kCallRuntime), |
| 1998 function_(function), | 1990 function_(function), |
| 1999 arguments_(arguments) {} | 1991 arguments_(arguments) {} |
| 2000 CallRuntime(Zone* zone, int context_index, ZoneList<Expression*>* arguments, | 1992 CallRuntime(int context_index, ZoneList<Expression*>* arguments, int pos) |
| 2001 int pos) | 1993 : Expression(pos, kCallRuntime), |
| 2002 : Expression(zone, pos, kCallRuntime), | |
| 2003 context_index_(context_index), | 1994 context_index_(context_index), |
| 2004 function_(NULL), | 1995 function_(NULL), |
| 2005 arguments_(arguments) {} | 1996 arguments_(arguments) {} |
| 2006 | 1997 |
| 2007 static int parent_num_ids() { return Expression::num_ids(); } | 1998 static int parent_num_ids() { return Expression::num_ids(); } |
| 2008 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1999 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2009 | 2000 |
| 2010 int context_index_; | 2001 int context_index_; |
| 2011 const Runtime::Function* function_; | 2002 const Runtime::Function* function_; |
| 2012 ZoneList<Expression*>* arguments_; | 2003 ZoneList<Expression*>* arguments_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2023 // actually be materialized, respectively. | 2014 // actually be materialized, respectively. |
| 2024 static int num_ids() { return parent_num_ids() + 2; } | 2015 static int num_ids() { return parent_num_ids() + 2; } |
| 2025 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } | 2016 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } |
| 2026 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); } | 2017 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); } |
| 2027 | 2018 |
| 2028 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 2019 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
| 2029 | 2020 |
| 2030 private: | 2021 private: |
| 2031 friend class AstNodeFactory; | 2022 friend class AstNodeFactory; |
| 2032 | 2023 |
| 2033 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos) | 2024 UnaryOperation(Token::Value op, Expression* expression, int pos) |
| 2034 : Expression(zone, pos, kUnaryOperation), | 2025 : Expression(pos, kUnaryOperation), op_(op), expression_(expression) { |
| 2035 op_(op), | |
| 2036 expression_(expression) { | |
| 2037 DCHECK(Token::IsUnaryOp(op)); | 2026 DCHECK(Token::IsUnaryOp(op)); |
| 2038 } | 2027 } |
| 2039 | 2028 |
| 2040 static int parent_num_ids() { return Expression::num_ids(); } | 2029 static int parent_num_ids() { return Expression::num_ids(); } |
| 2041 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2030 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2042 | 2031 |
| 2043 Token::Value op_; | 2032 Token::Value op_; |
| 2044 Expression* expression_; | 2033 Expression* expression_; |
| 2045 }; | 2034 }; |
| 2046 | 2035 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 void set_fixed_right_arg(Maybe<int> arg) { | 2081 void set_fixed_right_arg(Maybe<int> arg) { |
| 2093 has_fixed_right_arg_ = arg.IsJust(); | 2082 has_fixed_right_arg_ = arg.IsJust(); |
| 2094 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); | 2083 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); |
| 2095 } | 2084 } |
| 2096 | 2085 |
| 2097 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 2086 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
| 2098 | 2087 |
| 2099 private: | 2088 private: |
| 2100 friend class AstNodeFactory; | 2089 friend class AstNodeFactory; |
| 2101 | 2090 |
| 2102 BinaryOperation(Zone* zone, Token::Value op, Expression* left, | 2091 BinaryOperation(Token::Value op, Expression* left, Expression* right, int pos) |
| 2103 Expression* right, int pos) | 2092 : Expression(pos, kBinaryOperation), |
| 2104 : Expression(zone, pos, kBinaryOperation), | |
| 2105 op_(static_cast<byte>(op)), | 2093 op_(static_cast<byte>(op)), |
| 2106 has_fixed_right_arg_(false), | 2094 has_fixed_right_arg_(false), |
| 2107 fixed_right_arg_value_(0), | 2095 fixed_right_arg_value_(0), |
| 2108 left_(left), | 2096 left_(left), |
| 2109 right_(right) { | 2097 right_(right) { |
| 2110 DCHECK(Token::IsBinaryOp(op)); | 2098 DCHECK(Token::IsBinaryOp(op)); |
| 2111 } | 2099 } |
| 2112 | 2100 |
| 2113 static int parent_num_ids() { return Expression::num_ids(); } | 2101 static int parent_num_ids() { return Expression::num_ids(); } |
| 2114 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2102 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 return binary_operation_slot_; | 2156 return binary_operation_slot_; |
| 2169 } | 2157 } |
| 2170 | 2158 |
| 2171 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 2159 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| 2172 FeedbackVectorSlotCache* cache); | 2160 FeedbackVectorSlotCache* cache); |
| 2173 FeedbackVectorSlot CountSlot() const { return slot_; } | 2161 FeedbackVectorSlot CountSlot() const { return slot_; } |
| 2174 | 2162 |
| 2175 private: | 2163 private: |
| 2176 friend class AstNodeFactory; | 2164 friend class AstNodeFactory; |
| 2177 | 2165 |
| 2178 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, | 2166 CountOperation(Token::Value op, bool is_prefix, Expression* expr, int pos) |
| 2179 int pos) | 2167 : Expression(pos, kCountOperation), |
| 2180 : Expression(zone, pos, kCountOperation), | |
| 2181 bit_field_( | 2168 bit_field_( |
| 2182 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | | 2169 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | |
| 2183 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), | 2170 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), |
| 2184 type_(NULL), | 2171 type_(NULL), |
| 2185 expression_(expr) {} | 2172 expression_(expr) {} |
| 2186 | 2173 |
| 2187 static int parent_num_ids() { return Expression::num_ids(); } | 2174 static int parent_num_ids() { return Expression::num_ids(); } |
| 2188 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2175 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2189 | 2176 |
| 2190 class IsPrefixField : public BitField16<bool, 0, 1> {}; | 2177 class IsPrefixField : public BitField16<bool, 0, 1> {}; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2221 void set_combined_type(Type* type) { combined_type_ = type; } | 2208 void set_combined_type(Type* type) { combined_type_ = type; } |
| 2222 | 2209 |
| 2223 // Match special cases. | 2210 // Match special cases. |
| 2224 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 2211 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
| 2225 bool IsLiteralCompareUndefined(Expression** expr); | 2212 bool IsLiteralCompareUndefined(Expression** expr); |
| 2226 bool IsLiteralCompareNull(Expression** expr); | 2213 bool IsLiteralCompareNull(Expression** expr); |
| 2227 | 2214 |
| 2228 private: | 2215 private: |
| 2229 friend class AstNodeFactory; | 2216 friend class AstNodeFactory; |
| 2230 | 2217 |
| 2231 CompareOperation(Zone* zone, Token::Value op, Expression* left, | 2218 CompareOperation(Token::Value op, Expression* left, Expression* right, |
| 2232 Expression* right, int pos) | 2219 int pos) |
| 2233 : Expression(zone, pos, kCompareOperation), | 2220 : Expression(pos, kCompareOperation), |
| 2234 op_(op), | 2221 op_(op), |
| 2235 left_(left), | 2222 left_(left), |
| 2236 right_(right), | 2223 right_(right), |
| 2237 combined_type_(Type::None()) { | 2224 combined_type_(Type::None()) { |
| 2238 DCHECK(Token::IsCompareOp(op)); | 2225 DCHECK(Token::IsCompareOp(op)); |
| 2239 } | 2226 } |
| 2240 | 2227 |
| 2241 static int parent_num_ids() { return Expression::num_ids(); } | 2228 static int parent_num_ids() { return Expression::num_ids(); } |
| 2242 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2229 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2243 | 2230 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2254 Expression* expression() const { return expression_; } | 2241 Expression* expression() const { return expression_; } |
| 2255 void set_expression(Expression* e) { expression_ = e; } | 2242 void set_expression(Expression* e) { expression_ = e; } |
| 2256 | 2243 |
| 2257 int expression_position() const { return expr_pos_; } | 2244 int expression_position() const { return expr_pos_; } |
| 2258 | 2245 |
| 2259 static int num_ids() { return parent_num_ids(); } | 2246 static int num_ids() { return parent_num_ids(); } |
| 2260 | 2247 |
| 2261 private: | 2248 private: |
| 2262 friend class AstNodeFactory; | 2249 friend class AstNodeFactory; |
| 2263 | 2250 |
| 2264 Spread(Zone* zone, Expression* expression, int pos, int expr_pos) | 2251 Spread(Expression* expression, int pos, int expr_pos) |
| 2265 : Expression(zone, pos, kSpread), | 2252 : Expression(pos, kSpread), |
| 2266 expr_pos_(expr_pos), | 2253 expr_pos_(expr_pos), |
| 2267 expression_(expression) {} | 2254 expression_(expression) {} |
| 2268 | 2255 |
| 2269 static int parent_num_ids() { return Expression::num_ids(); } | 2256 static int parent_num_ids() { return Expression::num_ids(); } |
| 2270 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2257 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2271 | 2258 |
| 2272 int expr_pos_; | 2259 int expr_pos_; |
| 2273 Expression* expression_; | 2260 Expression* expression_; |
| 2274 }; | 2261 }; |
| 2275 | 2262 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2289 else_expression_->MarkTail(); | 2276 else_expression_->MarkTail(); |
| 2290 } | 2277 } |
| 2291 | 2278 |
| 2292 static int num_ids() { return parent_num_ids() + 2; } | 2279 static int num_ids() { return parent_num_ids() + 2; } |
| 2293 BailoutId ThenId() const { return BailoutId(local_id(0)); } | 2280 BailoutId ThenId() const { return BailoutId(local_id(0)); } |
| 2294 BailoutId ElseId() const { return BailoutId(local_id(1)); } | 2281 BailoutId ElseId() const { return BailoutId(local_id(1)); } |
| 2295 | 2282 |
| 2296 private: | 2283 private: |
| 2297 friend class AstNodeFactory; | 2284 friend class AstNodeFactory; |
| 2298 | 2285 |
| 2299 Conditional(Zone* zone, Expression* condition, Expression* then_expression, | 2286 Conditional(Expression* condition, Expression* then_expression, |
| 2300 Expression* else_expression, int position) | 2287 Expression* else_expression, int position) |
| 2301 : Expression(zone, position, kConditional), | 2288 : Expression(position, kConditional), |
| 2302 condition_(condition), | 2289 condition_(condition), |
| 2303 then_expression_(then_expression), | 2290 then_expression_(then_expression), |
| 2304 else_expression_(else_expression) {} | 2291 else_expression_(else_expression) {} |
| 2305 | 2292 |
| 2306 static int parent_num_ids() { return Expression::num_ids(); } | 2293 static int parent_num_ids() { return Expression::num_ids(); } |
| 2307 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2294 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2308 | 2295 |
| 2309 Expression* condition_; | 2296 Expression* condition_; |
| 2310 Expression* then_expression_; | 2297 Expression* then_expression_; |
| 2311 Expression* else_expression_; | 2298 Expression* else_expression_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 bit_field_ = StoreModeField::update(bit_field_, mode); | 2344 bit_field_ = StoreModeField::update(bit_field_, mode); |
| 2358 } | 2345 } |
| 2359 | 2346 |
| 2360 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 2347 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| 2361 FeedbackVectorSlotCache* cache); | 2348 FeedbackVectorSlotCache* cache); |
| 2362 FeedbackVectorSlot AssignmentSlot() const { return slot_; } | 2349 FeedbackVectorSlot AssignmentSlot() const { return slot_; } |
| 2363 | 2350 |
| 2364 private: | 2351 private: |
| 2365 friend class AstNodeFactory; | 2352 friend class AstNodeFactory; |
| 2366 | 2353 |
| 2367 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, | 2354 Assignment(Token::Value op, Expression* target, Expression* value, int pos); |
| 2368 int pos); | |
| 2369 | 2355 |
| 2370 static int parent_num_ids() { return Expression::num_ids(); } | 2356 static int parent_num_ids() { return Expression::num_ids(); } |
| 2371 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2357 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2372 | 2358 |
| 2373 class IsUninitializedField : public BitField16<bool, 0, 1> {}; | 2359 class IsUninitializedField : public BitField16<bool, 0, 1> {}; |
| 2374 class KeyTypeField | 2360 class KeyTypeField |
| 2375 : public BitField16<IcCheckType, IsUninitializedField::kNext, 1> {}; | 2361 : public BitField16<IcCheckType, IsUninitializedField::kNext, 1> {}; |
| 2376 class StoreModeField | 2362 class StoreModeField |
| 2377 : public BitField16<KeyedAccessStoreMode, KeyTypeField::kNext, 3> {}; | 2363 : public BitField16<KeyedAccessStoreMode, KeyTypeField::kNext, 3> {}; |
| 2378 class TokenField : public BitField16<Token::Value, StoreModeField::kNext, 8> { | 2364 class TokenField : public BitField16<Token::Value, StoreModeField::kNext, 8> { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 DCHECK(!new_expression->IsRewritableExpression()); | 2401 DCHECK(!new_expression->IsRewritableExpression()); |
| 2416 expr_ = new_expression; | 2402 expr_ = new_expression; |
| 2417 is_rewritten_ = true; | 2403 is_rewritten_ = true; |
| 2418 } | 2404 } |
| 2419 | 2405 |
| 2420 static int num_ids() { return parent_num_ids(); } | 2406 static int num_ids() { return parent_num_ids(); } |
| 2421 | 2407 |
| 2422 private: | 2408 private: |
| 2423 friend class AstNodeFactory; | 2409 friend class AstNodeFactory; |
| 2424 | 2410 |
| 2425 RewritableExpression(Zone* zone, Expression* expression) | 2411 explicit RewritableExpression(Expression* expression) |
| 2426 : Expression(zone, expression->position(), kRewritableExpression), | 2412 : Expression(expression->position(), kRewritableExpression), |
| 2427 is_rewritten_(false), | 2413 is_rewritten_(false), |
| 2428 expr_(expression) { | 2414 expr_(expression) { |
| 2429 DCHECK(!expression->IsRewritableExpression()); | 2415 DCHECK(!expression->IsRewritableExpression()); |
| 2430 } | 2416 } |
| 2431 | 2417 |
| 2432 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2418 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2433 | 2419 |
| 2434 bool is_rewritten_; | 2420 bool is_rewritten_; |
| 2435 Expression* expr_; | 2421 Expression* expr_; |
| 2436 }; | 2422 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2449 } | 2435 } |
| 2450 int yield_id() const { return yield_id_; } | 2436 int yield_id() const { return yield_id_; } |
| 2451 | 2437 |
| 2452 void set_generator_object(Expression* e) { generator_object_ = e; } | 2438 void set_generator_object(Expression* e) { generator_object_ = e; } |
| 2453 void set_expression(Expression* e) { expression_ = e; } | 2439 void set_expression(Expression* e) { expression_ = e; } |
| 2454 void set_yield_id(int yield_id) { yield_id_ = yield_id; } | 2440 void set_yield_id(int yield_id) { yield_id_ = yield_id; } |
| 2455 | 2441 |
| 2456 private: | 2442 private: |
| 2457 friend class AstNodeFactory; | 2443 friend class AstNodeFactory; |
| 2458 | 2444 |
| 2459 Yield(Zone* zone, Expression* generator_object, Expression* expression, | 2445 Yield(Expression* generator_object, Expression* expression, int pos, |
| 2460 int pos, OnException on_exception) | 2446 OnException on_exception) |
| 2461 : Expression(zone, pos, kYield), | 2447 : Expression(pos, kYield), |
| 2462 on_exception_(on_exception), | 2448 on_exception_(on_exception), |
| 2463 yield_id_(-1), | 2449 yield_id_(-1), |
| 2464 generator_object_(generator_object), | 2450 generator_object_(generator_object), |
| 2465 expression_(expression) {} | 2451 expression_(expression) {} |
| 2466 | 2452 |
| 2467 OnException on_exception_; | 2453 OnException on_exception_; |
| 2468 int yield_id_; | 2454 int yield_id_; |
| 2469 Expression* generator_object_; | 2455 Expression* generator_object_; |
| 2470 Expression* expression_; | 2456 Expression* expression_; |
| 2471 }; | 2457 }; |
| 2472 | 2458 |
| 2473 | 2459 |
| 2474 class Throw final : public Expression { | 2460 class Throw final : public Expression { |
| 2475 public: | 2461 public: |
| 2476 Expression* exception() const { return exception_; } | 2462 Expression* exception() const { return exception_; } |
| 2477 void set_exception(Expression* e) { exception_ = e; } | 2463 void set_exception(Expression* e) { exception_ = e; } |
| 2478 | 2464 |
| 2479 private: | 2465 private: |
| 2480 friend class AstNodeFactory; | 2466 friend class AstNodeFactory; |
| 2481 | 2467 |
| 2482 Throw(Zone* zone, Expression* exception, int pos) | 2468 Throw(Expression* exception, int pos) |
| 2483 : Expression(zone, pos, kThrow), exception_(exception) {} | 2469 : Expression(pos, kThrow), exception_(exception) {} |
| 2484 | 2470 |
| 2485 Expression* exception_; | 2471 Expression* exception_; |
| 2486 }; | 2472 }; |
| 2487 | 2473 |
| 2488 | 2474 |
| 2489 class FunctionLiteral final : public Expression { | 2475 class FunctionLiteral final : public Expression { |
| 2490 public: | 2476 public: |
| 2491 enum FunctionType { | 2477 enum FunctionType { |
| 2492 kAnonymousExpression, | 2478 kAnonymousExpression, |
| 2493 kNamedExpression, | 2479 kNamedExpression, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 friend class AstNodeFactory; | 2607 friend class AstNodeFactory; |
| 2622 | 2608 |
| 2623 FunctionLiteral(Zone* zone, const AstString* name, | 2609 FunctionLiteral(Zone* zone, const AstString* name, |
| 2624 AstValueFactory* ast_value_factory, DeclarationScope* scope, | 2610 AstValueFactory* ast_value_factory, DeclarationScope* scope, |
| 2625 ZoneList<Statement*>* body, int materialized_literal_count, | 2611 ZoneList<Statement*>* body, int materialized_literal_count, |
| 2626 int expected_property_count, int parameter_count, | 2612 int expected_property_count, int parameter_count, |
| 2627 FunctionType function_type, | 2613 FunctionType function_type, |
| 2628 ParameterFlag has_duplicate_parameters, | 2614 ParameterFlag has_duplicate_parameters, |
| 2629 EagerCompileHint eager_compile_hint, FunctionKind kind, | 2615 EagerCompileHint eager_compile_hint, FunctionKind kind, |
| 2630 int position, bool is_function) | 2616 int position, bool is_function) |
| 2631 : Expression(zone, position, kFunctionLiteral), | 2617 : Expression(position, kFunctionLiteral), |
| 2632 dont_optimize_reason_(kNoReason), | 2618 dont_optimize_reason_(kNoReason), |
| 2633 materialized_literal_count_(materialized_literal_count), | 2619 materialized_literal_count_(materialized_literal_count), |
| 2634 expected_property_count_(expected_property_count), | 2620 expected_property_count_(expected_property_count), |
| 2635 parameter_count_(parameter_count), | 2621 parameter_count_(parameter_count), |
| 2636 function_token_position_(kNoSourcePosition), | 2622 function_token_position_(kNoSourcePosition), |
| 2637 yield_count_(0), | 2623 yield_count_(0), |
| 2638 raw_name_(name), | 2624 raw_name_(name), |
| 2639 scope_(scope), | 2625 scope_(scope), |
| 2640 body_(body), | 2626 body_(body), |
| 2641 raw_inferred_name_(ast_value_factory->empty_string()), | 2627 raw_inferred_name_(ast_value_factory->empty_string()), |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 return class_variable_proxy() != nullptr && | 2697 return class_variable_proxy() != nullptr && |
| 2712 class_variable_proxy()->var()->IsUnallocated(); | 2698 class_variable_proxy()->var()->IsUnallocated(); |
| 2713 } | 2699 } |
| 2714 | 2700 |
| 2715 FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } | 2701 FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } |
| 2716 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } | 2702 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } |
| 2717 | 2703 |
| 2718 private: | 2704 private: |
| 2719 friend class AstNodeFactory; | 2705 friend class AstNodeFactory; |
| 2720 | 2706 |
| 2721 ClassLiteral(Zone* zone, VariableProxy* class_variable_proxy, | 2707 ClassLiteral(VariableProxy* class_variable_proxy, Expression* extends, |
| 2722 Expression* extends, FunctionLiteral* constructor, | 2708 FunctionLiteral* constructor, ZoneList<Property*>* properties, |
| 2723 ZoneList<Property*>* properties, int start_position, | 2709 int start_position, int end_position) |
| 2724 int end_position) | 2710 : Expression(start_position, kClassLiteral), |
| 2725 : Expression(zone, start_position, kClassLiteral), | |
| 2726 end_position_(end_position), | 2711 end_position_(end_position), |
| 2727 class_variable_proxy_(class_variable_proxy), | 2712 class_variable_proxy_(class_variable_proxy), |
| 2728 extends_(extends), | 2713 extends_(extends), |
| 2729 constructor_(constructor), | 2714 constructor_(constructor), |
| 2730 properties_(properties) {} | 2715 properties_(properties) {} |
| 2731 | 2716 |
| 2732 static int parent_num_ids() { return Expression::num_ids(); } | 2717 static int parent_num_ids() { return Expression::num_ids(); } |
| 2733 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2718 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 2734 | 2719 |
| 2735 int end_position_; | 2720 int end_position_; |
| 2736 FeedbackVectorSlot prototype_slot_; | 2721 FeedbackVectorSlot prototype_slot_; |
| 2737 FeedbackVectorSlot proxy_slot_; | 2722 FeedbackVectorSlot proxy_slot_; |
| 2738 VariableProxy* class_variable_proxy_; | 2723 VariableProxy* class_variable_proxy_; |
| 2739 Expression* extends_; | 2724 Expression* extends_; |
| 2740 FunctionLiteral* constructor_; | 2725 FunctionLiteral* constructor_; |
| 2741 ZoneList<Property*>* properties_; | 2726 ZoneList<Property*>* properties_; |
| 2742 }; | 2727 }; |
| 2743 | 2728 |
| 2744 | 2729 |
| 2745 class NativeFunctionLiteral final : public Expression { | 2730 class NativeFunctionLiteral final : public Expression { |
| 2746 public: | 2731 public: |
| 2747 Handle<String> name() const { return name_->string(); } | 2732 Handle<String> name() const { return name_->string(); } |
| 2748 v8::Extension* extension() const { return extension_; } | 2733 v8::Extension* extension() const { return extension_; } |
| 2749 | 2734 |
| 2750 private: | 2735 private: |
| 2751 friend class AstNodeFactory; | 2736 friend class AstNodeFactory; |
| 2752 | 2737 |
| 2753 NativeFunctionLiteral(Zone* zone, const AstRawString* name, | 2738 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, |
| 2754 v8::Extension* extension, int pos) | 2739 int pos) |
| 2755 : Expression(zone, pos, kNativeFunctionLiteral), | 2740 : Expression(pos, kNativeFunctionLiteral), |
| 2756 name_(name), | 2741 name_(name), |
| 2757 extension_(extension) {} | 2742 extension_(extension) {} |
| 2758 | 2743 |
| 2759 const AstRawString* name_; | 2744 const AstRawString* name_; |
| 2760 v8::Extension* extension_; | 2745 v8::Extension* extension_; |
| 2761 }; | 2746 }; |
| 2762 | 2747 |
| 2763 | 2748 |
| 2764 class ThisFunction final : public Expression { | 2749 class ThisFunction final : public Expression { |
| 2765 private: | 2750 private: |
| 2766 friend class AstNodeFactory; | 2751 friend class AstNodeFactory; |
| 2767 ThisFunction(Zone* zone, int pos) : Expression(zone, pos, kThisFunction) {} | 2752 explicit ThisFunction(int pos) : Expression(pos, kThisFunction) {} |
| 2768 }; | 2753 }; |
| 2769 | 2754 |
| 2770 | 2755 |
| 2771 class SuperPropertyReference final : public Expression { | 2756 class SuperPropertyReference final : public Expression { |
| 2772 public: | 2757 public: |
| 2773 VariableProxy* this_var() const { return this_var_; } | 2758 VariableProxy* this_var() const { return this_var_; } |
| 2774 void set_this_var(VariableProxy* v) { this_var_ = v; } | 2759 void set_this_var(VariableProxy* v) { this_var_ = v; } |
| 2775 Expression* home_object() const { return home_object_; } | 2760 Expression* home_object() const { return home_object_; } |
| 2776 void set_home_object(Expression* e) { home_object_ = e; } | 2761 void set_home_object(Expression* e) { home_object_ = e; } |
| 2777 | 2762 |
| 2778 private: | 2763 private: |
| 2779 friend class AstNodeFactory; | 2764 friend class AstNodeFactory; |
| 2780 | 2765 |
| 2781 SuperPropertyReference(Zone* zone, VariableProxy* this_var, | 2766 SuperPropertyReference(VariableProxy* this_var, Expression* home_object, |
| 2782 Expression* home_object, int pos) | 2767 int pos) |
| 2783 : Expression(zone, pos, kSuperPropertyReference), | 2768 : Expression(pos, kSuperPropertyReference), |
| 2784 this_var_(this_var), | 2769 this_var_(this_var), |
| 2785 home_object_(home_object) { | 2770 home_object_(home_object) { |
| 2786 DCHECK(this_var->is_this()); | 2771 DCHECK(this_var->is_this()); |
| 2787 DCHECK(home_object->IsProperty()); | 2772 DCHECK(home_object->IsProperty()); |
| 2788 } | 2773 } |
| 2789 | 2774 |
| 2790 VariableProxy* this_var_; | 2775 VariableProxy* this_var_; |
| 2791 Expression* home_object_; | 2776 Expression* home_object_; |
| 2792 }; | 2777 }; |
| 2793 | 2778 |
| 2794 | 2779 |
| 2795 class SuperCallReference final : public Expression { | 2780 class SuperCallReference final : public Expression { |
| 2796 public: | 2781 public: |
| 2797 VariableProxy* this_var() const { return this_var_; } | 2782 VariableProxy* this_var() const { return this_var_; } |
| 2798 void set_this_var(VariableProxy* v) { this_var_ = v; } | 2783 void set_this_var(VariableProxy* v) { this_var_ = v; } |
| 2799 VariableProxy* new_target_var() const { return new_target_var_; } | 2784 VariableProxy* new_target_var() const { return new_target_var_; } |
| 2800 void set_new_target_var(VariableProxy* v) { new_target_var_ = v; } | 2785 void set_new_target_var(VariableProxy* v) { new_target_var_ = v; } |
| 2801 VariableProxy* this_function_var() const { return this_function_var_; } | 2786 VariableProxy* this_function_var() const { return this_function_var_; } |
| 2802 void set_this_function_var(VariableProxy* v) { this_function_var_ = v; } | 2787 void set_this_function_var(VariableProxy* v) { this_function_var_ = v; } |
| 2803 | 2788 |
| 2804 private: | 2789 private: |
| 2805 friend class AstNodeFactory; | 2790 friend class AstNodeFactory; |
| 2806 | 2791 |
| 2807 SuperCallReference(Zone* zone, VariableProxy* this_var, | 2792 SuperCallReference(VariableProxy* this_var, VariableProxy* new_target_var, |
| 2808 VariableProxy* new_target_var, | |
| 2809 VariableProxy* this_function_var, int pos) | 2793 VariableProxy* this_function_var, int pos) |
| 2810 : Expression(zone, pos, kSuperCallReference), | 2794 : Expression(pos, kSuperCallReference), |
| 2811 this_var_(this_var), | 2795 this_var_(this_var), |
| 2812 new_target_var_(new_target_var), | 2796 new_target_var_(new_target_var), |
| 2813 this_function_var_(this_function_var) { | 2797 this_function_var_(this_function_var) { |
| 2814 DCHECK(this_var->is_this()); | 2798 DCHECK(this_var->is_this()); |
| 2815 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target")); | 2799 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo(".new.target")); |
| 2816 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); | 2800 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); |
| 2817 } | 2801 } |
| 2818 | 2802 |
| 2819 VariableProxy* this_var_; | 2803 VariableProxy* this_var_; |
| 2820 VariableProxy* new_target_var_; | 2804 VariableProxy* new_target_var_; |
| 2821 VariableProxy* this_function_var_; | 2805 VariableProxy* this_function_var_; |
| 2822 }; | 2806 }; |
| 2823 | 2807 |
| 2824 | 2808 |
| 2825 // This class is produced when parsing the () in arrow functions without any | 2809 // This class is produced when parsing the () in arrow functions without any |
| 2826 // arguments and is not actually a valid expression. | 2810 // arguments and is not actually a valid expression. |
| 2827 class EmptyParentheses final : public Expression { | 2811 class EmptyParentheses final : public Expression { |
| 2828 private: | 2812 private: |
| 2829 friend class AstNodeFactory; | 2813 friend class AstNodeFactory; |
| 2830 | 2814 |
| 2831 EmptyParentheses(Zone* zone, int pos) | 2815 explicit EmptyParentheses(int pos) : Expression(pos, kEmptyParentheses) {} |
| 2832 : Expression(zone, pos, kEmptyParentheses) {} | |
| 2833 }; | 2816 }; |
| 2834 | 2817 |
| 2835 | 2818 |
| 2836 | 2819 |
| 2837 // ---------------------------------------------------------------------------- | 2820 // ---------------------------------------------------------------------------- |
| 2838 // Basic visitor | 2821 // Basic visitor |
| 2839 // Sub-class should parametrize AstVisitor with itself, e.g.: | 2822 // Sub-class should parametrize AstVisitor with itself, e.g.: |
| 2840 // class SpecificVisitor : public AstVisitor<SpecificVisitor> { ... } | 2823 // class SpecificVisitor : public AstVisitor<SpecificVisitor> { ... } |
| 2841 | 2824 |
| 2842 template <class Subclass> | 2825 template <class Subclass> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3015 } | 2998 } |
| 3016 | 2999 |
| 3017 Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, | 3000 Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, |
| 3018 bool ignore_completion_value, int pos) { | 3001 bool ignore_completion_value, int pos) { |
| 3019 return new (zone_) | 3002 return new (zone_) |
| 3020 Block(zone_, labels, capacity, ignore_completion_value, pos); | 3003 Block(zone_, labels, capacity, ignore_completion_value, pos); |
| 3021 } | 3004 } |
| 3022 | 3005 |
| 3023 #define STATEMENT_WITH_LABELS(NodeType) \ | 3006 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 3024 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ | 3007 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ |
| 3025 return new (zone_) NodeType(zone_, labels, pos); \ | 3008 return new (zone_) NodeType(labels, pos); \ |
| 3026 } | 3009 } |
| 3027 STATEMENT_WITH_LABELS(DoWhileStatement) | 3010 STATEMENT_WITH_LABELS(DoWhileStatement) |
| 3028 STATEMENT_WITH_LABELS(WhileStatement) | 3011 STATEMENT_WITH_LABELS(WhileStatement) |
| 3029 STATEMENT_WITH_LABELS(ForStatement) | 3012 STATEMENT_WITH_LABELS(ForStatement) |
| 3030 STATEMENT_WITH_LABELS(SwitchStatement) | 3013 STATEMENT_WITH_LABELS(SwitchStatement) |
| 3031 #undef STATEMENT_WITH_LABELS | 3014 #undef STATEMENT_WITH_LABELS |
| 3032 | 3015 |
| 3033 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, | 3016 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, |
| 3034 ZoneList<const AstRawString*>* labels, | 3017 ZoneList<const AstRawString*>* labels, |
| 3035 int pos) { | 3018 int pos) { |
| 3036 switch (visit_mode) { | 3019 switch (visit_mode) { |
| 3037 case ForEachStatement::ENUMERATE: { | 3020 case ForEachStatement::ENUMERATE: { |
| 3038 return new (zone_) ForInStatement(zone_, labels, pos); | 3021 return new (zone_) ForInStatement(labels, pos); |
| 3039 } | 3022 } |
| 3040 case ForEachStatement::ITERATE: { | 3023 case ForEachStatement::ITERATE: { |
| 3041 return new (zone_) ForOfStatement(zone_, labels, pos); | 3024 return new (zone_) ForOfStatement(labels, pos); |
| 3042 } | 3025 } |
| 3043 } | 3026 } |
| 3044 UNREACHABLE(); | 3027 UNREACHABLE(); |
| 3045 return NULL; | 3028 return NULL; |
| 3046 } | 3029 } |
| 3047 | 3030 |
| 3048 ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) { | 3031 ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) { |
| 3049 return new (zone_) ExpressionStatement(zone_, expression, pos); | 3032 return new (zone_) ExpressionStatement(expression, pos); |
| 3050 } | 3033 } |
| 3051 | 3034 |
| 3052 ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) { | 3035 ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) { |
| 3053 return new (zone_) ContinueStatement(zone_, target, pos); | 3036 return new (zone_) ContinueStatement(target, pos); |
| 3054 } | 3037 } |
| 3055 | 3038 |
| 3056 BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) { | 3039 BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) { |
| 3057 return new (zone_) BreakStatement(zone_, target, pos); | 3040 return new (zone_) BreakStatement(target, pos); |
| 3058 } | 3041 } |
| 3059 | 3042 |
| 3060 ReturnStatement* NewReturnStatement(Expression* expression, int pos) { | 3043 ReturnStatement* NewReturnStatement(Expression* expression, int pos) { |
| 3061 return new (zone_) ReturnStatement(zone_, expression, pos); | 3044 return new (zone_) ReturnStatement(expression, pos); |
| 3062 } | 3045 } |
| 3063 | 3046 |
| 3064 WithStatement* NewWithStatement(Scope* scope, | 3047 WithStatement* NewWithStatement(Scope* scope, |
| 3065 Expression* expression, | 3048 Expression* expression, |
| 3066 Statement* statement, | 3049 Statement* statement, |
| 3067 int pos) { | 3050 int pos) { |
| 3068 return new (zone_) WithStatement(zone_, scope, expression, statement, pos); | 3051 return new (zone_) WithStatement(scope, expression, statement, pos); |
| 3069 } | 3052 } |
| 3070 | 3053 |
| 3071 IfStatement* NewIfStatement(Expression* condition, | 3054 IfStatement* NewIfStatement(Expression* condition, |
| 3072 Statement* then_statement, | 3055 Statement* then_statement, |
| 3073 Statement* else_statement, | 3056 Statement* else_statement, |
| 3074 int pos) { | 3057 int pos) { |
| 3075 return new (zone_) | 3058 return new (zone_) |
| 3076 IfStatement(zone_, condition, then_statement, else_statement, pos); | 3059 IfStatement(condition, then_statement, else_statement, pos); |
| 3077 } | 3060 } |
| 3078 | 3061 |
| 3079 TryCatchStatement* NewTryCatchStatement(Block* try_block, Scope* scope, | 3062 TryCatchStatement* NewTryCatchStatement(Block* try_block, Scope* scope, |
| 3080 Variable* variable, | 3063 Variable* variable, |
| 3081 Block* catch_block, int pos) { | 3064 Block* catch_block, int pos) { |
| 3082 return new (zone_) | 3065 return new (zone_) TryCatchStatement( |
| 3083 TryCatchStatement(zone_, try_block, scope, variable, catch_block, | 3066 try_block, scope, variable, catch_block, HandlerTable::CAUGHT, pos); |
| 3084 HandlerTable::CAUGHT, pos); | |
| 3085 } | 3067 } |
| 3086 | 3068 |
| 3087 TryCatchStatement* NewTryCatchStatementForReThrow(Block* try_block, | 3069 TryCatchStatement* NewTryCatchStatementForReThrow(Block* try_block, |
| 3088 Scope* scope, | 3070 Scope* scope, |
| 3089 Variable* variable, | 3071 Variable* variable, |
| 3090 Block* catch_block, | 3072 Block* catch_block, |
| 3091 int pos) { | 3073 int pos) { |
| 3092 return new (zone_) | 3074 return new (zone_) TryCatchStatement( |
| 3093 TryCatchStatement(zone_, try_block, scope, variable, catch_block, | 3075 try_block, scope, variable, catch_block, HandlerTable::UNCAUGHT, pos); |
| 3094 HandlerTable::UNCAUGHT, pos); | |
| 3095 } | 3076 } |
| 3096 | 3077 |
| 3097 TryCatchStatement* NewTryCatchStatementForPromiseReject(Block* try_block, | 3078 TryCatchStatement* NewTryCatchStatementForPromiseReject(Block* try_block, |
| 3098 Scope* scope, | 3079 Scope* scope, |
| 3099 Variable* variable, | 3080 Variable* variable, |
| 3100 Block* catch_block, | 3081 Block* catch_block, |
| 3101 int pos) { | 3082 int pos) { |
| 3102 return new (zone_) | 3083 return new (zone_) TryCatchStatement( |
| 3103 TryCatchStatement(zone_, try_block, scope, variable, catch_block, | 3084 try_block, scope, variable, catch_block, HandlerTable::PROMISE, pos); |
| 3104 HandlerTable::PROMISE, pos); | |
| 3105 } | 3085 } |
| 3106 | 3086 |
| 3107 TryCatchStatement* NewTryCatchStatementForDesugaring(Block* try_block, | 3087 TryCatchStatement* NewTryCatchStatementForDesugaring(Block* try_block, |
| 3108 Scope* scope, | 3088 Scope* scope, |
| 3109 Variable* variable, | 3089 Variable* variable, |
| 3110 Block* catch_block, | 3090 Block* catch_block, |
| 3111 int pos) { | 3091 int pos) { |
| 3112 return new (zone_) | 3092 return new (zone_) TryCatchStatement( |
| 3113 TryCatchStatement(zone_, try_block, scope, variable, catch_block, | 3093 try_block, scope, variable, catch_block, HandlerTable::DESUGARING, pos); |
| 3114 HandlerTable::DESUGARING, pos); | |
| 3115 } | 3094 } |
| 3116 | 3095 |
| 3117 TryFinallyStatement* NewTryFinallyStatement(Block* try_block, | 3096 TryFinallyStatement* NewTryFinallyStatement(Block* try_block, |
| 3118 Block* finally_block, int pos) { | 3097 Block* finally_block, int pos) { |
| 3119 return new (zone_) | 3098 return new (zone_) TryFinallyStatement(try_block, finally_block, pos); |
| 3120 TryFinallyStatement(zone_, try_block, finally_block, pos); | |
| 3121 } | 3099 } |
| 3122 | 3100 |
| 3123 DebuggerStatement* NewDebuggerStatement(int pos) { | 3101 DebuggerStatement* NewDebuggerStatement(int pos) { |
| 3124 return new (zone_) DebuggerStatement(zone_, pos); | 3102 return new (zone_) DebuggerStatement(pos); |
| 3125 } | 3103 } |
| 3126 | 3104 |
| 3127 EmptyStatement* NewEmptyStatement(int pos) { | 3105 EmptyStatement* NewEmptyStatement(int pos) { |
| 3128 return new (zone_) EmptyStatement(zone_, pos); | 3106 return new (zone_) EmptyStatement(pos); |
| 3129 } | 3107 } |
| 3130 | 3108 |
| 3131 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement( | 3109 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement( |
| 3132 Statement* statement, Scope* scope) { | 3110 Statement* statement, Scope* scope) { |
| 3133 return new (zone_) SloppyBlockFunctionStatement(zone_, statement, scope); | 3111 return new (zone_) SloppyBlockFunctionStatement(statement, scope); |
| 3134 } | 3112 } |
| 3135 | 3113 |
| 3136 CaseClause* NewCaseClause( | 3114 CaseClause* NewCaseClause( |
| 3137 Expression* label, ZoneList<Statement*>* statements, int pos) { | 3115 Expression* label, ZoneList<Statement*>* statements, int pos) { |
| 3138 return new (zone_) CaseClause(zone_, label, statements, pos); | 3116 return new (zone_) CaseClause(label, statements, pos); |
| 3139 } | 3117 } |
| 3140 | 3118 |
| 3141 Literal* NewStringLiteral(const AstRawString* string, int pos) { | 3119 Literal* NewStringLiteral(const AstRawString* string, int pos) { |
| 3142 return new (zone_) | 3120 return new (zone_) Literal(ast_value_factory_->NewString(string), pos); |
| 3143 Literal(zone_, ast_value_factory_->NewString(string), pos); | |
| 3144 } | 3121 } |
| 3145 | 3122 |
| 3146 // A JavaScript symbol (ECMA-262 edition 6). | 3123 // A JavaScript symbol (ECMA-262 edition 6). |
| 3147 Literal* NewSymbolLiteral(const char* name, int pos) { | 3124 Literal* NewSymbolLiteral(const char* name, int pos) { |
| 3148 return new (zone_) Literal(zone_, ast_value_factory_->NewSymbol(name), pos); | 3125 return new (zone_) Literal(ast_value_factory_->NewSymbol(name), pos); |
| 3149 } | 3126 } |
| 3150 | 3127 |
| 3151 Literal* NewNumberLiteral(double number, int pos, bool with_dot = false) { | 3128 Literal* NewNumberLiteral(double number, int pos, bool with_dot = false) { |
| 3152 return new (zone_) | 3129 return new (zone_) |
| 3153 Literal(zone_, ast_value_factory_->NewNumber(number, with_dot), pos); | 3130 Literal(ast_value_factory_->NewNumber(number, with_dot), pos); |
| 3154 } | 3131 } |
| 3155 | 3132 |
| 3156 Literal* NewSmiLiteral(int number, int pos) { | 3133 Literal* NewSmiLiteral(int number, int pos) { |
| 3157 return new (zone_) Literal(zone_, ast_value_factory_->NewSmi(number), pos); | 3134 return new (zone_) Literal(ast_value_factory_->NewSmi(number), pos); |
| 3158 } | 3135 } |
| 3159 | 3136 |
| 3160 Literal* NewBooleanLiteral(bool b, int pos) { | 3137 Literal* NewBooleanLiteral(bool b, int pos) { |
| 3161 return new (zone_) Literal(zone_, ast_value_factory_->NewBoolean(b), pos); | 3138 return new (zone_) Literal(ast_value_factory_->NewBoolean(b), pos); |
| 3162 } | 3139 } |
| 3163 | 3140 |
| 3164 Literal* NewNullLiteral(int pos) { | 3141 Literal* NewNullLiteral(int pos) { |
| 3165 return new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos); | 3142 return new (zone_) Literal(ast_value_factory_->NewNull(), pos); |
| 3166 } | 3143 } |
| 3167 | 3144 |
| 3168 Literal* NewUndefinedLiteral(int pos) { | 3145 Literal* NewUndefinedLiteral(int pos) { |
| 3169 return new (zone_) Literal(zone_, ast_value_factory_->NewUndefined(), pos); | 3146 return new (zone_) Literal(ast_value_factory_->NewUndefined(), pos); |
| 3170 } | 3147 } |
| 3171 | 3148 |
| 3172 Literal* NewTheHoleLiteral(int pos) { | 3149 Literal* NewTheHoleLiteral(int pos) { |
| 3173 return new (zone_) Literal(zone_, ast_value_factory_->NewTheHole(), pos); | 3150 return new (zone_) Literal(ast_value_factory_->NewTheHole(), pos); |
| 3174 } | 3151 } |
| 3175 | 3152 |
| 3176 ObjectLiteral* NewObjectLiteral( | 3153 ObjectLiteral* NewObjectLiteral( |
| 3177 ZoneList<ObjectLiteral::Property*>* properties, int literal_index, | 3154 ZoneList<ObjectLiteral::Property*>* properties, int literal_index, |
| 3178 uint32_t boilerplate_properties, int pos) { | 3155 uint32_t boilerplate_properties, int pos) { |
| 3179 return new (zone_) ObjectLiteral(zone_, properties, literal_index, | 3156 return new (zone_) |
| 3180 boilerplate_properties, pos); | 3157 ObjectLiteral(properties, literal_index, boilerplate_properties, pos); |
| 3181 } | 3158 } |
| 3182 | 3159 |
| 3183 ObjectLiteral::Property* NewObjectLiteralProperty( | 3160 ObjectLiteral::Property* NewObjectLiteralProperty( |
| 3184 Expression* key, Expression* value, ObjectLiteralProperty::Kind kind, | 3161 Expression* key, Expression* value, ObjectLiteralProperty::Kind kind, |
| 3185 bool is_static, bool is_computed_name) { | 3162 bool is_static, bool is_computed_name) { |
| 3186 return new (zone_) | 3163 return new (zone_) |
| 3187 ObjectLiteral::Property(key, value, kind, is_static, is_computed_name); | 3164 ObjectLiteral::Property(key, value, kind, is_static, is_computed_name); |
| 3188 } | 3165 } |
| 3189 | 3166 |
| 3190 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key, | 3167 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key, |
| 3191 Expression* value, | 3168 Expression* value, |
| 3192 bool is_static, | 3169 bool is_static, |
| 3193 bool is_computed_name) { | 3170 bool is_computed_name) { |
| 3194 return new (zone_) ObjectLiteral::Property(ast_value_factory_, key, value, | 3171 return new (zone_) ObjectLiteral::Property(ast_value_factory_, key, value, |
| 3195 is_static, is_computed_name); | 3172 is_static, is_computed_name); |
| 3196 } | 3173 } |
| 3197 | 3174 |
| 3198 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, int flags, | 3175 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, int flags, |
| 3199 int literal_index, int pos) { | 3176 int literal_index, int pos) { |
| 3200 return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); | 3177 return new (zone_) RegExpLiteral(pattern, flags, literal_index, pos); |
| 3201 } | 3178 } |
| 3202 | 3179 |
| 3203 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3180 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3204 int literal_index, | 3181 int literal_index, |
| 3205 int pos) { | 3182 int pos) { |
| 3206 return new (zone_) ArrayLiteral(zone_, values, -1, literal_index, pos); | 3183 return new (zone_) ArrayLiteral(values, -1, literal_index, pos); |
| 3207 } | 3184 } |
| 3208 | 3185 |
| 3209 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3186 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3210 int first_spread_index, int literal_index, | 3187 int first_spread_index, int literal_index, |
| 3211 int pos) { | 3188 int pos) { |
| 3212 return new (zone_) | 3189 return new (zone_) |
| 3213 ArrayLiteral(zone_, values, first_spread_index, literal_index, pos); | 3190 ArrayLiteral(values, first_spread_index, literal_index, pos); |
| 3214 } | 3191 } |
| 3215 | 3192 |
| 3216 VariableProxy* NewVariableProxy(Variable* var, | 3193 VariableProxy* NewVariableProxy(Variable* var, |
| 3217 int start_position = kNoSourcePosition, | 3194 int start_position = kNoSourcePosition, |
| 3218 int end_position = kNoSourcePosition) { | 3195 int end_position = kNoSourcePosition) { |
| 3219 return new (zone_) VariableProxy(zone_, var, start_position, end_position); | 3196 return new (zone_) VariableProxy(var, start_position, end_position); |
| 3220 } | 3197 } |
| 3221 | 3198 |
| 3222 VariableProxy* NewVariableProxy(const AstRawString* name, | 3199 VariableProxy* NewVariableProxy(const AstRawString* name, |
| 3223 Variable::Kind variable_kind, | 3200 Variable::Kind variable_kind, |
| 3224 int start_position = kNoSourcePosition, | 3201 int start_position = kNoSourcePosition, |
| 3225 int end_position = kNoSourcePosition) { | 3202 int end_position = kNoSourcePosition) { |
| 3226 DCHECK_NOT_NULL(name); | 3203 DCHECK_NOT_NULL(name); |
| 3227 return new (zone_) | 3204 return new (zone_) |
| 3228 VariableProxy(zone_, name, variable_kind, start_position, end_position); | 3205 VariableProxy(name, variable_kind, start_position, end_position); |
| 3229 } | 3206 } |
| 3230 | 3207 |
| 3231 // Recreates the VariableProxy in this Zone. | 3208 // Recreates the VariableProxy in this Zone. |
| 3232 VariableProxy* CopyVariableProxy(VariableProxy* proxy) { | 3209 VariableProxy* CopyVariableProxy(VariableProxy* proxy) { |
| 3233 return new (zone_) VariableProxy(zone_, proxy); | 3210 return new (zone_) VariableProxy(proxy); |
| 3234 } | 3211 } |
| 3235 | 3212 |
| 3236 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3213 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
| 3237 return new (zone_) Property(zone_, obj, key, pos); | 3214 return new (zone_) Property(obj, key, pos); |
| 3238 } | 3215 } |
| 3239 | 3216 |
| 3240 Call* NewCall(Expression* expression, ZoneList<Expression*>* arguments, | 3217 Call* NewCall(Expression* expression, ZoneList<Expression*>* arguments, |
| 3241 int pos, Call::PossiblyEval possibly_eval = Call::NOT_EVAL) { | 3218 int pos, Call::PossiblyEval possibly_eval = Call::NOT_EVAL) { |
| 3242 return new (zone_) Call(zone_, expression, arguments, pos, possibly_eval); | 3219 return new (zone_) Call(expression, arguments, pos, possibly_eval); |
| 3243 } | 3220 } |
| 3244 | 3221 |
| 3245 CallNew* NewCallNew(Expression* expression, | 3222 CallNew* NewCallNew(Expression* expression, |
| 3246 ZoneList<Expression*>* arguments, | 3223 ZoneList<Expression*>* arguments, |
| 3247 int pos) { | 3224 int pos) { |
| 3248 return new (zone_) CallNew(zone_, expression, arguments, pos); | 3225 return new (zone_) CallNew(expression, arguments, pos); |
| 3249 } | 3226 } |
| 3250 | 3227 |
| 3251 CallRuntime* NewCallRuntime(Runtime::FunctionId id, | 3228 CallRuntime* NewCallRuntime(Runtime::FunctionId id, |
| 3252 ZoneList<Expression*>* arguments, int pos) { | 3229 ZoneList<Expression*>* arguments, int pos) { |
| 3253 return new (zone_) | 3230 return new (zone_) CallRuntime(Runtime::FunctionForId(id), arguments, pos); |
| 3254 CallRuntime(zone_, Runtime::FunctionForId(id), arguments, pos); | |
| 3255 } | 3231 } |
| 3256 | 3232 |
| 3257 CallRuntime* NewCallRuntime(const Runtime::Function* function, | 3233 CallRuntime* NewCallRuntime(const Runtime::Function* function, |
| 3258 ZoneList<Expression*>* arguments, int pos) { | 3234 ZoneList<Expression*>* arguments, int pos) { |
| 3259 return new (zone_) CallRuntime(zone_, function, arguments, pos); | 3235 return new (zone_) CallRuntime(function, arguments, pos); |
| 3260 } | 3236 } |
| 3261 | 3237 |
| 3262 CallRuntime* NewCallRuntime(int context_index, | 3238 CallRuntime* NewCallRuntime(int context_index, |
| 3263 ZoneList<Expression*>* arguments, int pos) { | 3239 ZoneList<Expression*>* arguments, int pos) { |
| 3264 return new (zone_) CallRuntime(zone_, context_index, arguments, pos); | 3240 return new (zone_) CallRuntime(context_index, arguments, pos); |
| 3265 } | 3241 } |
| 3266 | 3242 |
| 3267 UnaryOperation* NewUnaryOperation(Token::Value op, | 3243 UnaryOperation* NewUnaryOperation(Token::Value op, |
| 3268 Expression* expression, | 3244 Expression* expression, |
| 3269 int pos) { | 3245 int pos) { |
| 3270 return new (zone_) UnaryOperation(zone_, op, expression, pos); | 3246 return new (zone_) UnaryOperation(op, expression, pos); |
| 3271 } | 3247 } |
| 3272 | 3248 |
| 3273 BinaryOperation* NewBinaryOperation(Token::Value op, | 3249 BinaryOperation* NewBinaryOperation(Token::Value op, |
| 3274 Expression* left, | 3250 Expression* left, |
| 3275 Expression* right, | 3251 Expression* right, |
| 3276 int pos) { | 3252 int pos) { |
| 3277 return new (zone_) BinaryOperation(zone_, op, left, right, pos); | 3253 return new (zone_) BinaryOperation(op, left, right, pos); |
| 3278 } | 3254 } |
| 3279 | 3255 |
| 3280 CountOperation* NewCountOperation(Token::Value op, | 3256 CountOperation* NewCountOperation(Token::Value op, |
| 3281 bool is_prefix, | 3257 bool is_prefix, |
| 3282 Expression* expr, | 3258 Expression* expr, |
| 3283 int pos) { | 3259 int pos) { |
| 3284 return new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); | 3260 return new (zone_) CountOperation(op, is_prefix, expr, pos); |
| 3285 } | 3261 } |
| 3286 | 3262 |
| 3287 CompareOperation* NewCompareOperation(Token::Value op, | 3263 CompareOperation* NewCompareOperation(Token::Value op, |
| 3288 Expression* left, | 3264 Expression* left, |
| 3289 Expression* right, | 3265 Expression* right, |
| 3290 int pos) { | 3266 int pos) { |
| 3291 return new (zone_) CompareOperation(zone_, op, left, right, pos); | 3267 return new (zone_) CompareOperation(op, left, right, pos); |
| 3292 } | 3268 } |
| 3293 | 3269 |
| 3294 Spread* NewSpread(Expression* expression, int pos, int expr_pos) { | 3270 Spread* NewSpread(Expression* expression, int pos, int expr_pos) { |
| 3295 return new (zone_) Spread(zone_, expression, pos, expr_pos); | 3271 return new (zone_) Spread(expression, pos, expr_pos); |
| 3296 } | 3272 } |
| 3297 | 3273 |
| 3298 Conditional* NewConditional(Expression* condition, | 3274 Conditional* NewConditional(Expression* condition, |
| 3299 Expression* then_expression, | 3275 Expression* then_expression, |
| 3300 Expression* else_expression, | 3276 Expression* else_expression, |
| 3301 int position) { | 3277 int position) { |
| 3302 return new (zone_) Conditional(zone_, condition, then_expression, | 3278 return new (zone_) |
| 3303 else_expression, position); | 3279 Conditional(condition, then_expression, else_expression, position); |
| 3304 } | 3280 } |
| 3305 | 3281 |
| 3306 RewritableExpression* NewRewritableExpression(Expression* expression) { | 3282 RewritableExpression* NewRewritableExpression(Expression* expression) { |
| 3307 DCHECK_NOT_NULL(expression); | 3283 DCHECK_NOT_NULL(expression); |
| 3308 return new (zone_) RewritableExpression(zone_, expression); | 3284 return new (zone_) RewritableExpression(expression); |
| 3309 } | 3285 } |
| 3310 | 3286 |
| 3311 Assignment* NewAssignment(Token::Value op, | 3287 Assignment* NewAssignment(Token::Value op, |
| 3312 Expression* target, | 3288 Expression* target, |
| 3313 Expression* value, | 3289 Expression* value, |
| 3314 int pos) { | 3290 int pos) { |
| 3315 DCHECK(Token::IsAssignmentOp(op)); | 3291 DCHECK(Token::IsAssignmentOp(op)); |
| 3316 Assignment* assign = new (zone_) Assignment(zone_, op, target, value, pos); | 3292 Assignment* assign = new (zone_) Assignment(op, target, value, pos); |
| 3317 if (assign->is_compound()) { | 3293 if (assign->is_compound()) { |
| 3318 DCHECK(Token::IsAssignmentOp(op)); | 3294 DCHECK(Token::IsAssignmentOp(op)); |
| 3319 assign->binary_operation_ = | 3295 assign->binary_operation_ = |
| 3320 NewBinaryOperation(assign->binary_op(), target, value, pos + 1); | 3296 NewBinaryOperation(assign->binary_op(), target, value, pos + 1); |
| 3321 } | 3297 } |
| 3322 return assign; | 3298 return assign; |
| 3323 } | 3299 } |
| 3324 | 3300 |
| 3325 Yield* NewYield(Expression* generator_object, Expression* expression, int pos, | 3301 Yield* NewYield(Expression* generator_object, Expression* expression, int pos, |
| 3326 Yield::OnException on_exception) { | 3302 Yield::OnException on_exception) { |
| 3327 if (!expression) expression = NewUndefinedLiteral(pos); | 3303 if (!expression) expression = NewUndefinedLiteral(pos); |
| 3328 return new (zone_) | 3304 return new (zone_) Yield(generator_object, expression, pos, on_exception); |
| 3329 Yield(zone_, generator_object, expression, pos, on_exception); | |
| 3330 } | 3305 } |
| 3331 | 3306 |
| 3332 Throw* NewThrow(Expression* exception, int pos) { | 3307 Throw* NewThrow(Expression* exception, int pos) { |
| 3333 return new (zone_) Throw(zone_, exception, pos); | 3308 return new (zone_) Throw(exception, pos); |
| 3334 } | 3309 } |
| 3335 | 3310 |
| 3336 FunctionLiteral* NewFunctionLiteral( | 3311 FunctionLiteral* NewFunctionLiteral( |
| 3337 const AstRawString* name, DeclarationScope* scope, | 3312 const AstRawString* name, DeclarationScope* scope, |
| 3338 ZoneList<Statement*>* body, int materialized_literal_count, | 3313 ZoneList<Statement*>* body, int materialized_literal_count, |
| 3339 int expected_property_count, int parameter_count, | 3314 int expected_property_count, int parameter_count, |
| 3340 FunctionLiteral::ParameterFlag has_duplicate_parameters, | 3315 FunctionLiteral::ParameterFlag has_duplicate_parameters, |
| 3341 FunctionLiteral::FunctionType function_type, | 3316 FunctionLiteral::FunctionType function_type, |
| 3342 FunctionLiteral::EagerCompileHint eager_compile_hint, FunctionKind kind, | 3317 FunctionLiteral::EagerCompileHint eager_compile_hint, FunctionKind kind, |
| 3343 int position) { | 3318 int position) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3360 FunctionLiteral::kAnonymousExpression, | 3335 FunctionLiteral::kAnonymousExpression, |
| 3361 FunctionLiteral::kNoDuplicateParameters, | 3336 FunctionLiteral::kNoDuplicateParameters, |
| 3362 FunctionLiteral::kShouldLazyCompile, FunctionKind::kNormalFunction, 0, | 3337 FunctionLiteral::kShouldLazyCompile, FunctionKind::kNormalFunction, 0, |
| 3363 false); | 3338 false); |
| 3364 } | 3339 } |
| 3365 | 3340 |
| 3366 ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends, | 3341 ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends, |
| 3367 FunctionLiteral* constructor, | 3342 FunctionLiteral* constructor, |
| 3368 ZoneList<ObjectLiteral::Property*>* properties, | 3343 ZoneList<ObjectLiteral::Property*>* properties, |
| 3369 int start_position, int end_position) { | 3344 int start_position, int end_position) { |
| 3370 return new (zone_) ClassLiteral(zone_, proxy, extends, constructor, | 3345 return new (zone_) ClassLiteral(proxy, extends, constructor, properties, |
| 3371 properties, start_position, end_position); | 3346 start_position, end_position); |
| 3372 } | 3347 } |
| 3373 | 3348 |
| 3374 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3349 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
| 3375 v8::Extension* extension, | 3350 v8::Extension* extension, |
| 3376 int pos) { | 3351 int pos) { |
| 3377 return new (zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3352 return new (zone_) NativeFunctionLiteral(name, extension, pos); |
| 3378 } | 3353 } |
| 3379 | 3354 |
| 3380 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) { | 3355 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) { |
| 3381 VariableProxy* result = NewVariableProxy(result_var, pos); | 3356 VariableProxy* result = NewVariableProxy(result_var, pos); |
| 3382 return new (zone_) DoExpression(zone_, block, result, pos); | 3357 return new (zone_) DoExpression(block, result, pos); |
| 3383 } | 3358 } |
| 3384 | 3359 |
| 3385 ThisFunction* NewThisFunction(int pos) { | 3360 ThisFunction* NewThisFunction(int pos) { |
| 3386 return new (zone_) ThisFunction(zone_, pos); | 3361 return new (zone_) ThisFunction(pos); |
| 3387 } | 3362 } |
| 3388 | 3363 |
| 3389 SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var, | 3364 SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var, |
| 3390 Expression* home_object, | 3365 Expression* home_object, |
| 3391 int pos) { | 3366 int pos) { |
| 3392 return new (zone_) | 3367 return new (zone_) SuperPropertyReference(this_var, home_object, pos); |
| 3393 SuperPropertyReference(zone_, this_var, home_object, pos); | |
| 3394 } | 3368 } |
| 3395 | 3369 |
| 3396 SuperCallReference* NewSuperCallReference(VariableProxy* this_var, | 3370 SuperCallReference* NewSuperCallReference(VariableProxy* this_var, |
| 3397 VariableProxy* new_target_var, | 3371 VariableProxy* new_target_var, |
| 3398 VariableProxy* this_function_var, | 3372 VariableProxy* this_function_var, |
| 3399 int pos) { | 3373 int pos) { |
| 3400 return new (zone_) SuperCallReference(zone_, this_var, new_target_var, | 3374 return new (zone_) |
| 3401 this_function_var, pos); | 3375 SuperCallReference(this_var, new_target_var, this_function_var, pos); |
| 3402 } | 3376 } |
| 3403 | 3377 |
| 3404 EmptyParentheses* NewEmptyParentheses(int pos) { | 3378 EmptyParentheses* NewEmptyParentheses(int pos) { |
| 3405 return new (zone_) EmptyParentheses(zone_, pos); | 3379 return new (zone_) EmptyParentheses(pos); |
| 3406 } | 3380 } |
| 3407 | 3381 |
| 3408 Zone* zone() const { return zone_; } | 3382 Zone* zone() const { return zone_; } |
| 3409 void set_zone(Zone* zone) { zone_ = zone; } | 3383 void set_zone(Zone* zone) { zone_ = zone; } |
| 3410 | 3384 |
| 3411 // Handles use of temporary zones when parsing inner function bodies. | 3385 // Handles use of temporary zones when parsing inner function bodies. |
| 3412 class BodyScope { | 3386 class BodyScope { |
| 3413 public: | 3387 public: |
| 3414 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) | 3388 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) |
| 3415 : factory_(factory), prev_zone_(factory->zone_) { | 3389 : factory_(factory), prev_zone_(factory->zone_) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3472 : NULL; \ | 3446 : NULL; \ |
| 3473 } | 3447 } |
| 3474 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3448 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3475 #undef DECLARE_NODE_FUNCTIONS | 3449 #undef DECLARE_NODE_FUNCTIONS |
| 3476 | 3450 |
| 3477 | 3451 |
| 3478 } // namespace internal | 3452 } // namespace internal |
| 3479 } // namespace v8 | 3453 } // namespace v8 |
| 3480 | 3454 |
| 3481 #endif // V8_AST_AST_H_ | 3455 #endif // V8_AST_AST_H_ |
| OLD | NEW |