| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 #undef DEF_FORWARD_DECLARATION | 136 #undef DEF_FORWARD_DECLARATION |
| 137 | 137 |
| 138 | 138 |
| 139 // Typedef only introduced to avoid unreadable code. | 139 // Typedef only introduced to avoid unreadable code. |
| 140 // Please do appreciate the required space in "> >". | 140 // Please do appreciate the required space in "> >". |
| 141 typedef ZoneList<Handle<String> > ZoneStringList; | 141 typedef ZoneList<Handle<String> > ZoneStringList; |
| 142 typedef ZoneList<Handle<Object> > ZoneObjectList; | 142 typedef ZoneList<Handle<Object> > ZoneObjectList; |
| 143 | 143 |
| 144 | 144 |
| 145 #define DECLARE_NODE_TYPE(type) \ | 145 #define DECLARE_NODE_TYPE(type) \ |
| 146 virtual void Accept(AstVisitor* v) V8_OVERRIDE; \ | 146 virtual void Accept(AstVisitor* v) OVERRIDE; \ |
| 147 virtual AstNode::NodeType node_type() const V8_FINAL V8_OVERRIDE { \ | 147 virtual AstNode::NodeType node_type() const FINAL OVERRIDE { \ |
| 148 return AstNode::k##type; \ | 148 return AstNode::k##type; \ |
| 149 } \ | 149 } \ |
| 150 template<class> friend class AstNodeFactory; | 150 template<class> friend class AstNodeFactory; |
| 151 | 151 |
| 152 | 152 |
| 153 enum AstPropertiesFlag { | 153 enum AstPropertiesFlag { |
| 154 kDontSelfOptimize, | 154 kDontSelfOptimize, |
| 155 kDontSoftInline, | 155 kDontSoftInline, |
| 156 kDontCache | 156 kDontCache |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 | 159 |
| 160 class AstProperties V8_FINAL BASE_EMBEDDED { | 160 class AstProperties FINAL BASE_EMBEDDED { |
| 161 public: | 161 public: |
| 162 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 162 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 163 | 163 |
| 164 AstProperties() : node_count_(0), feedback_slots_(0) {} | 164 AstProperties() : node_count_(0), feedback_slots_(0) {} |
| 165 | 165 |
| 166 Flags* flags() { return &flags_; } | 166 Flags* flags() { return &flags_; } |
| 167 int node_count() { return node_count_; } | 167 int node_count() { return node_count_; } |
| 168 void add_node_count(int count) { node_count_ += count; } | 168 void add_node_count(int count) { node_count_ += count; } |
| 169 | 169 |
| 170 int feedback_slots() const { return feedback_slots_; } | 170 int feedback_slots() const { return feedback_slots_; } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 class Statement : public AstNode { | 253 class Statement : public AstNode { |
| 254 public: | 254 public: |
| 255 explicit Statement(Zone* zone, int position) : AstNode(position) {} | 255 explicit Statement(Zone* zone, int position) : AstNode(position) {} |
| 256 | 256 |
| 257 bool IsEmpty() { return AsEmptyStatement() != NULL; } | 257 bool IsEmpty() { return AsEmptyStatement() != NULL; } |
| 258 virtual bool IsJump() const { return false; } | 258 virtual bool IsJump() const { return false; } |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 | 261 |
| 262 class SmallMapList V8_FINAL { | 262 class SmallMapList FINAL { |
| 263 public: | 263 public: |
| 264 SmallMapList() {} | 264 SmallMapList() {} |
| 265 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} | 265 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
| 266 | 266 |
| 267 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } | 267 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } |
| 268 void Clear() { list_.Clear(); } | 268 void Clear() { list_.Clear(); } |
| 269 void Sort() { list_.Sort(); } | 269 void Sort() { list_.Sort(); } |
| 270 | 270 |
| 271 bool is_empty() const { return list_.is_empty(); } | 271 bool is_empty() const { return list_.is_empty(); } |
| 272 int length() const { return list_.length(); } | 272 int length() const { return list_.length(); } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 enum BreakableType { | 401 enum BreakableType { |
| 402 TARGET_FOR_ANONYMOUS, | 402 TARGET_FOR_ANONYMOUS, |
| 403 TARGET_FOR_NAMED_ONLY | 403 TARGET_FOR_NAMED_ONLY |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 // The labels associated with this statement. May be NULL; | 406 // The labels associated with this statement. May be NULL; |
| 407 // if it is != NULL, guaranteed to contain at least one entry. | 407 // if it is != NULL, guaranteed to contain at least one entry. |
| 408 ZoneList<const AstRawString*>* labels() const { return labels_; } | 408 ZoneList<const AstRawString*>* labels() const { return labels_; } |
| 409 | 409 |
| 410 // Type testing & conversion. | 410 // Type testing & conversion. |
| 411 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE { | 411 virtual BreakableStatement* AsBreakableStatement() FINAL OVERRIDE { |
| 412 return this; | 412 return this; |
| 413 } | 413 } |
| 414 | 414 |
| 415 // Code generation | 415 // Code generation |
| 416 Label* break_target() { return &break_target_; } | 416 Label* break_target() { return &break_target_; } |
| 417 | 417 |
| 418 // Testers. | 418 // Testers. |
| 419 bool is_target_for_anonymous() const { | 419 bool is_target_for_anonymous() const { |
| 420 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 420 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
| 421 } | 421 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 437 | 437 |
| 438 private: | 438 private: |
| 439 ZoneList<const AstRawString*>* labels_; | 439 ZoneList<const AstRawString*>* labels_; |
| 440 BreakableType breakable_type_; | 440 BreakableType breakable_type_; |
| 441 Label break_target_; | 441 Label break_target_; |
| 442 const BailoutId entry_id_; | 442 const BailoutId entry_id_; |
| 443 const BailoutId exit_id_; | 443 const BailoutId exit_id_; |
| 444 }; | 444 }; |
| 445 | 445 |
| 446 | 446 |
| 447 class Block V8_FINAL : public BreakableStatement { | 447 class Block FINAL : public BreakableStatement { |
| 448 public: | 448 public: |
| 449 DECLARE_NODE_TYPE(Block) | 449 DECLARE_NODE_TYPE(Block) |
| 450 | 450 |
| 451 void AddStatement(Statement* statement, Zone* zone) { | 451 void AddStatement(Statement* statement, Zone* zone) { |
| 452 statements_.Add(statement, zone); | 452 statements_.Add(statement, zone); |
| 453 } | 453 } |
| 454 | 454 |
| 455 ZoneList<Statement*>* statements() { return &statements_; } | 455 ZoneList<Statement*>* statements() { return &statements_; } |
| 456 bool is_initializer_block() const { return is_initializer_block_; } | 456 bool is_initializer_block() const { return is_initializer_block_; } |
| 457 | 457 |
| 458 BailoutId DeclsId() const { return decls_id_; } | 458 BailoutId DeclsId() const { return decls_id_; } |
| 459 | 459 |
| 460 virtual bool IsJump() const V8_OVERRIDE { | 460 virtual bool IsJump() const OVERRIDE { |
| 461 return !statements_.is_empty() && statements_.last()->IsJump() | 461 return !statements_.is_empty() && statements_.last()->IsJump() |
| 462 && labels() == NULL; // Good enough as an approximation... | 462 && labels() == NULL; // Good enough as an approximation... |
| 463 } | 463 } |
| 464 | 464 |
| 465 Scope* scope() const { return scope_; } | 465 Scope* scope() const { return scope_; } |
| 466 void set_scope(Scope* scope) { scope_ = scope; } | 466 void set_scope(Scope* scope) { scope_ = scope; } |
| 467 | 467 |
| 468 protected: | 468 protected: |
| 469 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, | 469 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, |
| 470 bool is_initializer_block, int pos, IdGen* id_gen) | 470 bool is_initializer_block, int pos, IdGen* id_gen) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 private: | 506 private: |
| 507 VariableProxy* proxy_; | 507 VariableProxy* proxy_; |
| 508 VariableMode mode_; | 508 VariableMode mode_; |
| 509 | 509 |
| 510 // Nested scope from which the declaration originated. | 510 // Nested scope from which the declaration originated. |
| 511 Scope* scope_; | 511 Scope* scope_; |
| 512 }; | 512 }; |
| 513 | 513 |
| 514 | 514 |
| 515 class VariableDeclaration V8_FINAL : public Declaration { | 515 class VariableDeclaration FINAL : public Declaration { |
| 516 public: | 516 public: |
| 517 DECLARE_NODE_TYPE(VariableDeclaration) | 517 DECLARE_NODE_TYPE(VariableDeclaration) |
| 518 | 518 |
| 519 virtual InitializationFlag initialization() const V8_OVERRIDE { | 519 virtual InitializationFlag initialization() const OVERRIDE { |
| 520 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; | 520 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; |
| 521 } | 521 } |
| 522 | 522 |
| 523 protected: | 523 protected: |
| 524 VariableDeclaration(Zone* zone, | 524 VariableDeclaration(Zone* zone, |
| 525 VariableProxy* proxy, | 525 VariableProxy* proxy, |
| 526 VariableMode mode, | 526 VariableMode mode, |
| 527 Scope* scope, | 527 Scope* scope, |
| 528 int pos) | 528 int pos) |
| 529 : Declaration(zone, proxy, mode, scope, pos) { | 529 : Declaration(zone, proxy, mode, scope, pos) { |
| 530 } | 530 } |
| 531 }; | 531 }; |
| 532 | 532 |
| 533 | 533 |
| 534 class FunctionDeclaration V8_FINAL : public Declaration { | 534 class FunctionDeclaration FINAL : public Declaration { |
| 535 public: | 535 public: |
| 536 DECLARE_NODE_TYPE(FunctionDeclaration) | 536 DECLARE_NODE_TYPE(FunctionDeclaration) |
| 537 | 537 |
| 538 FunctionLiteral* fun() const { return fun_; } | 538 FunctionLiteral* fun() const { return fun_; } |
| 539 virtual InitializationFlag initialization() const V8_OVERRIDE { | 539 virtual InitializationFlag initialization() const OVERRIDE { |
| 540 return kCreatedInitialized; | 540 return kCreatedInitialized; |
| 541 } | 541 } |
| 542 virtual bool IsInlineable() const V8_OVERRIDE; | 542 virtual bool IsInlineable() const OVERRIDE; |
| 543 | 543 |
| 544 protected: | 544 protected: |
| 545 FunctionDeclaration(Zone* zone, | 545 FunctionDeclaration(Zone* zone, |
| 546 VariableProxy* proxy, | 546 VariableProxy* proxy, |
| 547 VariableMode mode, | 547 VariableMode mode, |
| 548 FunctionLiteral* fun, | 548 FunctionLiteral* fun, |
| 549 Scope* scope, | 549 Scope* scope, |
| 550 int pos) | 550 int pos) |
| 551 : Declaration(zone, proxy, mode, scope, pos), | 551 : Declaration(zone, proxy, mode, scope, pos), |
| 552 fun_(fun) { | 552 fun_(fun) { |
| 553 // At the moment there are no "const functions" in JavaScript... | 553 // At the moment there are no "const functions" in JavaScript... |
| 554 DCHECK(mode == VAR || mode == LET); | 554 DCHECK(mode == VAR || mode == LET); |
| 555 DCHECK(fun != NULL); | 555 DCHECK(fun != NULL); |
| 556 } | 556 } |
| 557 | 557 |
| 558 private: | 558 private: |
| 559 FunctionLiteral* fun_; | 559 FunctionLiteral* fun_; |
| 560 }; | 560 }; |
| 561 | 561 |
| 562 | 562 |
| 563 class ModuleDeclaration V8_FINAL : public Declaration { | 563 class ModuleDeclaration FINAL : public Declaration { |
| 564 public: | 564 public: |
| 565 DECLARE_NODE_TYPE(ModuleDeclaration) | 565 DECLARE_NODE_TYPE(ModuleDeclaration) |
| 566 | 566 |
| 567 Module* module() const { return module_; } | 567 Module* module() const { return module_; } |
| 568 virtual InitializationFlag initialization() const V8_OVERRIDE { | 568 virtual InitializationFlag initialization() const OVERRIDE { |
| 569 return kCreatedInitialized; | 569 return kCreatedInitialized; |
| 570 } | 570 } |
| 571 | 571 |
| 572 protected: | 572 protected: |
| 573 ModuleDeclaration(Zone* zone, | 573 ModuleDeclaration(Zone* zone, |
| 574 VariableProxy* proxy, | 574 VariableProxy* proxy, |
| 575 Module* module, | 575 Module* module, |
| 576 Scope* scope, | 576 Scope* scope, |
| 577 int pos) | 577 int pos) |
| 578 : Declaration(zone, proxy, MODULE, scope, pos), | 578 : Declaration(zone, proxy, MODULE, scope, pos), |
| 579 module_(module) { | 579 module_(module) { |
| 580 } | 580 } |
| 581 | 581 |
| 582 private: | 582 private: |
| 583 Module* module_; | 583 Module* module_; |
| 584 }; | 584 }; |
| 585 | 585 |
| 586 | 586 |
| 587 class ImportDeclaration V8_FINAL : public Declaration { | 587 class ImportDeclaration FINAL : public Declaration { |
| 588 public: | 588 public: |
| 589 DECLARE_NODE_TYPE(ImportDeclaration) | 589 DECLARE_NODE_TYPE(ImportDeclaration) |
| 590 | 590 |
| 591 Module* module() const { return module_; } | 591 Module* module() const { return module_; } |
| 592 virtual InitializationFlag initialization() const V8_OVERRIDE { | 592 virtual InitializationFlag initialization() const OVERRIDE { |
| 593 return kCreatedInitialized; | 593 return kCreatedInitialized; |
| 594 } | 594 } |
| 595 | 595 |
| 596 protected: | 596 protected: |
| 597 ImportDeclaration(Zone* zone, | 597 ImportDeclaration(Zone* zone, |
| 598 VariableProxy* proxy, | 598 VariableProxy* proxy, |
| 599 Module* module, | 599 Module* module, |
| 600 Scope* scope, | 600 Scope* scope, |
| 601 int pos) | 601 int pos) |
| 602 : Declaration(zone, proxy, LET, scope, pos), | 602 : Declaration(zone, proxy, LET, scope, pos), |
| 603 module_(module) { | 603 module_(module) { |
| 604 } | 604 } |
| 605 | 605 |
| 606 private: | 606 private: |
| 607 Module* module_; | 607 Module* module_; |
| 608 }; | 608 }; |
| 609 | 609 |
| 610 | 610 |
| 611 class ExportDeclaration V8_FINAL : public Declaration { | 611 class ExportDeclaration FINAL : public Declaration { |
| 612 public: | 612 public: |
| 613 DECLARE_NODE_TYPE(ExportDeclaration) | 613 DECLARE_NODE_TYPE(ExportDeclaration) |
| 614 | 614 |
| 615 virtual InitializationFlag initialization() const V8_OVERRIDE { | 615 virtual InitializationFlag initialization() const OVERRIDE { |
| 616 return kCreatedInitialized; | 616 return kCreatedInitialized; |
| 617 } | 617 } |
| 618 | 618 |
| 619 protected: | 619 protected: |
| 620 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) | 620 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) |
| 621 : Declaration(zone, proxy, LET, scope, pos) {} | 621 : Declaration(zone, proxy, LET, scope, pos) {} |
| 622 }; | 622 }; |
| 623 | 623 |
| 624 | 624 |
| 625 class Module : public AstNode { | 625 class Module : public AstNode { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 636 : AstNode(pos), | 636 : AstNode(pos), |
| 637 interface_(interface), | 637 interface_(interface), |
| 638 body_(body) {} | 638 body_(body) {} |
| 639 | 639 |
| 640 private: | 640 private: |
| 641 Interface* interface_; | 641 Interface* interface_; |
| 642 Block* body_; | 642 Block* body_; |
| 643 }; | 643 }; |
| 644 | 644 |
| 645 | 645 |
| 646 class ModuleLiteral V8_FINAL : public Module { | 646 class ModuleLiteral FINAL : public Module { |
| 647 public: | 647 public: |
| 648 DECLARE_NODE_TYPE(ModuleLiteral) | 648 DECLARE_NODE_TYPE(ModuleLiteral) |
| 649 | 649 |
| 650 protected: | 650 protected: |
| 651 ModuleLiteral(Zone* zone, Block* body, Interface* interface, int pos) | 651 ModuleLiteral(Zone* zone, Block* body, Interface* interface, int pos) |
| 652 : Module(zone, interface, pos, body) {} | 652 : Module(zone, interface, pos, body) {} |
| 653 }; | 653 }; |
| 654 | 654 |
| 655 | 655 |
| 656 class ModuleVariable V8_FINAL : public Module { | 656 class ModuleVariable FINAL : public Module { |
| 657 public: | 657 public: |
| 658 DECLARE_NODE_TYPE(ModuleVariable) | 658 DECLARE_NODE_TYPE(ModuleVariable) |
| 659 | 659 |
| 660 VariableProxy* proxy() const { return proxy_; } | 660 VariableProxy* proxy() const { return proxy_; } |
| 661 | 661 |
| 662 protected: | 662 protected: |
| 663 inline ModuleVariable(Zone* zone, VariableProxy* proxy, int pos); | 663 inline ModuleVariable(Zone* zone, VariableProxy* proxy, int pos); |
| 664 | 664 |
| 665 private: | 665 private: |
| 666 VariableProxy* proxy_; | 666 VariableProxy* proxy_; |
| 667 }; | 667 }; |
| 668 | 668 |
| 669 | 669 |
| 670 class ModulePath V8_FINAL : public Module { | 670 class ModulePath FINAL : public Module { |
| 671 public: | 671 public: |
| 672 DECLARE_NODE_TYPE(ModulePath) | 672 DECLARE_NODE_TYPE(ModulePath) |
| 673 | 673 |
| 674 Module* module() const { return module_; } | 674 Module* module() const { return module_; } |
| 675 Handle<String> name() const { return name_->string(); } | 675 Handle<String> name() const { return name_->string(); } |
| 676 | 676 |
| 677 protected: | 677 protected: |
| 678 ModulePath(Zone* zone, Module* module, const AstRawString* name, int pos) | 678 ModulePath(Zone* zone, Module* module, const AstRawString* name, int pos) |
| 679 : Module(zone, pos), module_(module), name_(name) {} | 679 : Module(zone, pos), module_(module), name_(name) {} |
| 680 | 680 |
| 681 private: | 681 private: |
| 682 Module* module_; | 682 Module* module_; |
| 683 const AstRawString* name_; | 683 const AstRawString* name_; |
| 684 }; | 684 }; |
| 685 | 685 |
| 686 | 686 |
| 687 class ModuleUrl V8_FINAL : public Module { | 687 class ModuleUrl FINAL : public Module { |
| 688 public: | 688 public: |
| 689 DECLARE_NODE_TYPE(ModuleUrl) | 689 DECLARE_NODE_TYPE(ModuleUrl) |
| 690 | 690 |
| 691 Handle<String> url() const { return url_; } | 691 Handle<String> url() const { return url_; } |
| 692 | 692 |
| 693 protected: | 693 protected: |
| 694 ModuleUrl(Zone* zone, Handle<String> url, int pos) | 694 ModuleUrl(Zone* zone, Handle<String> url, int pos) |
| 695 : Module(zone, pos), url_(url) { | 695 : Module(zone, pos), url_(url) { |
| 696 } | 696 } |
| 697 | 697 |
| 698 private: | 698 private: |
| 699 Handle<String> url_; | 699 Handle<String> url_; |
| 700 }; | 700 }; |
| 701 | 701 |
| 702 | 702 |
| 703 class ModuleStatement V8_FINAL : public Statement { | 703 class ModuleStatement FINAL : public Statement { |
| 704 public: | 704 public: |
| 705 DECLARE_NODE_TYPE(ModuleStatement) | 705 DECLARE_NODE_TYPE(ModuleStatement) |
| 706 | 706 |
| 707 VariableProxy* proxy() const { return proxy_; } | 707 VariableProxy* proxy() const { return proxy_; } |
| 708 Block* body() const { return body_; } | 708 Block* body() const { return body_; } |
| 709 | 709 |
| 710 protected: | 710 protected: |
| 711 ModuleStatement(Zone* zone, VariableProxy* proxy, Block* body, int pos) | 711 ModuleStatement(Zone* zone, VariableProxy* proxy, Block* body, int pos) |
| 712 : Statement(zone, pos), | 712 : Statement(zone, pos), |
| 713 proxy_(proxy), | 713 proxy_(proxy), |
| 714 body_(body) { | 714 body_(body) { |
| 715 } | 715 } |
| 716 | 716 |
| 717 private: | 717 private: |
| 718 VariableProxy* proxy_; | 718 VariableProxy* proxy_; |
| 719 Block* body_; | 719 Block* body_; |
| 720 }; | 720 }; |
| 721 | 721 |
| 722 | 722 |
| 723 class IterationStatement : public BreakableStatement { | 723 class IterationStatement : public BreakableStatement { |
| 724 public: | 724 public: |
| 725 // Type testing & conversion. | 725 // Type testing & conversion. |
| 726 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE { | 726 virtual IterationStatement* AsIterationStatement() FINAL OVERRIDE { |
| 727 return this; | 727 return this; |
| 728 } | 728 } |
| 729 | 729 |
| 730 Statement* body() const { return body_; } | 730 Statement* body() const { return body_; } |
| 731 | 731 |
| 732 BailoutId OsrEntryId() const { return osr_entry_id_; } | 732 BailoutId OsrEntryId() const { return osr_entry_id_; } |
| 733 virtual BailoutId ContinueId() const = 0; | 733 virtual BailoutId ContinueId() const = 0; |
| 734 virtual BailoutId StackCheckId() const = 0; | 734 virtual BailoutId StackCheckId() const = 0; |
| 735 | 735 |
| 736 // Code generation | 736 // Code generation |
| (...skipping 11 matching lines...) Expand all Loading... |
| 748 } | 748 } |
| 749 | 749 |
| 750 private: | 750 private: |
| 751 Statement* body_; | 751 Statement* body_; |
| 752 Label continue_target_; | 752 Label continue_target_; |
| 753 | 753 |
| 754 const BailoutId osr_entry_id_; | 754 const BailoutId osr_entry_id_; |
| 755 }; | 755 }; |
| 756 | 756 |
| 757 | 757 |
| 758 class DoWhileStatement V8_FINAL : public IterationStatement { | 758 class DoWhileStatement FINAL : public IterationStatement { |
| 759 public: | 759 public: |
| 760 DECLARE_NODE_TYPE(DoWhileStatement) | 760 DECLARE_NODE_TYPE(DoWhileStatement) |
| 761 | 761 |
| 762 void Initialize(Expression* cond, Statement* body) { | 762 void Initialize(Expression* cond, Statement* body) { |
| 763 IterationStatement::Initialize(body); | 763 IterationStatement::Initialize(body); |
| 764 cond_ = cond; | 764 cond_ = cond; |
| 765 } | 765 } |
| 766 | 766 |
| 767 Expression* cond() const { return cond_; } | 767 Expression* cond() const { return cond_; } |
| 768 | 768 |
| 769 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 769 virtual BailoutId ContinueId() const OVERRIDE { return continue_id_; } |
| 770 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } | 770 virtual BailoutId StackCheckId() const OVERRIDE { return back_edge_id_; } |
| 771 BailoutId BackEdgeId() const { return back_edge_id_; } | 771 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 772 | 772 |
| 773 protected: | 773 protected: |
| 774 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 774 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 775 IdGen* id_gen) | 775 IdGen* id_gen) |
| 776 : IterationStatement(zone, labels, pos, id_gen), | 776 : IterationStatement(zone, labels, pos, id_gen), |
| 777 cond_(NULL), | 777 cond_(NULL), |
| 778 continue_id_(id_gen->GetNextId()), | 778 continue_id_(id_gen->GetNextId()), |
| 779 back_edge_id_(id_gen->GetNextId()) {} | 779 back_edge_id_(id_gen->GetNextId()) {} |
| 780 | 780 |
| 781 private: | 781 private: |
| 782 Expression* cond_; | 782 Expression* cond_; |
| 783 | 783 |
| 784 const BailoutId continue_id_; | 784 const BailoutId continue_id_; |
| 785 const BailoutId back_edge_id_; | 785 const BailoutId back_edge_id_; |
| 786 }; | 786 }; |
| 787 | 787 |
| 788 | 788 |
| 789 class WhileStatement V8_FINAL : public IterationStatement { | 789 class WhileStatement FINAL : public IterationStatement { |
| 790 public: | 790 public: |
| 791 DECLARE_NODE_TYPE(WhileStatement) | 791 DECLARE_NODE_TYPE(WhileStatement) |
| 792 | 792 |
| 793 void Initialize(Expression* cond, Statement* body) { | 793 void Initialize(Expression* cond, Statement* body) { |
| 794 IterationStatement::Initialize(body); | 794 IterationStatement::Initialize(body); |
| 795 cond_ = cond; | 795 cond_ = cond; |
| 796 } | 796 } |
| 797 | 797 |
| 798 Expression* cond() const { return cond_; } | 798 Expression* cond() const { return cond_; } |
| 799 bool may_have_function_literal() const { | 799 bool may_have_function_literal() const { |
| 800 return may_have_function_literal_; | 800 return may_have_function_literal_; |
| 801 } | 801 } |
| 802 void set_may_have_function_literal(bool value) { | 802 void set_may_have_function_literal(bool value) { |
| 803 may_have_function_literal_ = value; | 803 may_have_function_literal_ = value; |
| 804 } | 804 } |
| 805 | 805 |
| 806 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 806 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } |
| 807 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 807 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } |
| 808 BailoutId BodyId() const { return body_id_; } | 808 BailoutId BodyId() const { return body_id_; } |
| 809 | 809 |
| 810 protected: | 810 protected: |
| 811 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 811 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 812 IdGen* id_gen) | 812 IdGen* id_gen) |
| 813 : IterationStatement(zone, labels, pos, id_gen), | 813 : IterationStatement(zone, labels, pos, id_gen), |
| 814 cond_(NULL), | 814 cond_(NULL), |
| 815 may_have_function_literal_(true), | 815 may_have_function_literal_(true), |
| 816 body_id_(id_gen->GetNextId()) {} | 816 body_id_(id_gen->GetNextId()) {} |
| 817 | 817 |
| 818 private: | 818 private: |
| 819 Expression* cond_; | 819 Expression* cond_; |
| 820 | 820 |
| 821 // True if there is a function literal subexpression in the condition. | 821 // True if there is a function literal subexpression in the condition. |
| 822 bool may_have_function_literal_; | 822 bool may_have_function_literal_; |
| 823 | 823 |
| 824 const BailoutId body_id_; | 824 const BailoutId body_id_; |
| 825 }; | 825 }; |
| 826 | 826 |
| 827 | 827 |
| 828 class ForStatement V8_FINAL : public IterationStatement { | 828 class ForStatement FINAL : public IterationStatement { |
| 829 public: | 829 public: |
| 830 DECLARE_NODE_TYPE(ForStatement) | 830 DECLARE_NODE_TYPE(ForStatement) |
| 831 | 831 |
| 832 void Initialize(Statement* init, | 832 void Initialize(Statement* init, |
| 833 Expression* cond, | 833 Expression* cond, |
| 834 Statement* next, | 834 Statement* next, |
| 835 Statement* body) { | 835 Statement* body) { |
| 836 IterationStatement::Initialize(body); | 836 IterationStatement::Initialize(body); |
| 837 init_ = init; | 837 init_ = init; |
| 838 cond_ = cond; | 838 cond_ = cond; |
| 839 next_ = next; | 839 next_ = next; |
| 840 } | 840 } |
| 841 | 841 |
| 842 Statement* init() const { return init_; } | 842 Statement* init() const { return init_; } |
| 843 Expression* cond() const { return cond_; } | 843 Expression* cond() const { return cond_; } |
| 844 Statement* next() const { return next_; } | 844 Statement* next() const { return next_; } |
| 845 | 845 |
| 846 bool may_have_function_literal() const { | 846 bool may_have_function_literal() const { |
| 847 return may_have_function_literal_; | 847 return may_have_function_literal_; |
| 848 } | 848 } |
| 849 void set_may_have_function_literal(bool value) { | 849 void set_may_have_function_literal(bool value) { |
| 850 may_have_function_literal_ = value; | 850 may_have_function_literal_ = value; |
| 851 } | 851 } |
| 852 | 852 |
| 853 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 853 virtual BailoutId ContinueId() const OVERRIDE { return continue_id_; } |
| 854 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 854 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } |
| 855 BailoutId BodyId() const { return body_id_; } | 855 BailoutId BodyId() const { return body_id_; } |
| 856 | 856 |
| 857 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 857 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
| 858 Variable* loop_variable() { return loop_variable_; } | 858 Variable* loop_variable() { return loop_variable_; } |
| 859 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 859 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
| 860 | 860 |
| 861 protected: | 861 protected: |
| 862 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 862 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 863 IdGen* id_gen) | 863 IdGen* id_gen) |
| 864 : IterationStatement(zone, labels, pos, id_gen), | 864 : IterationStatement(zone, labels, pos, id_gen), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 : IterationStatement(zone, labels, pos, id_gen), | 906 : IterationStatement(zone, labels, pos, id_gen), |
| 907 each_(NULL), | 907 each_(NULL), |
| 908 subject_(NULL) {} | 908 subject_(NULL) {} |
| 909 | 909 |
| 910 private: | 910 private: |
| 911 Expression* each_; | 911 Expression* each_; |
| 912 Expression* subject_; | 912 Expression* subject_; |
| 913 }; | 913 }; |
| 914 | 914 |
| 915 | 915 |
| 916 class ForInStatement V8_FINAL : public ForEachStatement, | 916 class ForInStatement FINAL : public ForEachStatement, |
| 917 public FeedbackSlotInterface { | 917 public FeedbackSlotInterface { |
| 918 public: | 918 public: |
| 919 DECLARE_NODE_TYPE(ForInStatement) | 919 DECLARE_NODE_TYPE(ForInStatement) |
| 920 | 920 |
| 921 Expression* enumerable() const { | 921 Expression* enumerable() const { |
| 922 return subject(); | 922 return subject(); |
| 923 } | 923 } |
| 924 | 924 |
| 925 // Type feedback information. | 925 // Type feedback information. |
| 926 virtual int ComputeFeedbackSlotCount() { return 1; } | 926 virtual int ComputeFeedbackSlotCount() { return 1; } |
| 927 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } | 927 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } |
| 928 | 928 |
| 929 int ForInFeedbackSlot() { | 929 int ForInFeedbackSlot() { |
| 930 DCHECK(for_in_feedback_slot_ != kInvalidFeedbackSlot); | 930 DCHECK(for_in_feedback_slot_ != kInvalidFeedbackSlot); |
| 931 return for_in_feedback_slot_; | 931 return for_in_feedback_slot_; |
| 932 } | 932 } |
| 933 | 933 |
| 934 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 934 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 935 ForInType for_in_type() const { return for_in_type_; } | 935 ForInType for_in_type() const { return for_in_type_; } |
| 936 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 936 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 937 | 937 |
| 938 BailoutId BodyId() const { return body_id_; } | 938 BailoutId BodyId() const { return body_id_; } |
| 939 BailoutId PrepareId() const { return prepare_id_; } | 939 BailoutId PrepareId() const { return prepare_id_; } |
| 940 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 940 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } |
| 941 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 941 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } |
| 942 | 942 |
| 943 protected: | 943 protected: |
| 944 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 944 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 945 IdGen* id_gen) | 945 IdGen* id_gen) |
| 946 : ForEachStatement(zone, labels, pos, id_gen), | 946 : ForEachStatement(zone, labels, pos, id_gen), |
| 947 for_in_type_(SLOW_FOR_IN), | 947 for_in_type_(SLOW_FOR_IN), |
| 948 for_in_feedback_slot_(kInvalidFeedbackSlot), | 948 for_in_feedback_slot_(kInvalidFeedbackSlot), |
| 949 body_id_(id_gen->GetNextId()), | 949 body_id_(id_gen->GetNextId()), |
| 950 prepare_id_(id_gen->GetNextId()) {} | 950 prepare_id_(id_gen->GetNextId()) {} |
| 951 | 951 |
| 952 ForInType for_in_type_; | 952 ForInType for_in_type_; |
| 953 int for_in_feedback_slot_; | 953 int for_in_feedback_slot_; |
| 954 const BailoutId body_id_; | 954 const BailoutId body_id_; |
| 955 const BailoutId prepare_id_; | 955 const BailoutId prepare_id_; |
| 956 }; | 956 }; |
| 957 | 957 |
| 958 | 958 |
| 959 class ForOfStatement V8_FINAL : public ForEachStatement { | 959 class ForOfStatement FINAL : public ForEachStatement { |
| 960 public: | 960 public: |
| 961 DECLARE_NODE_TYPE(ForOfStatement) | 961 DECLARE_NODE_TYPE(ForOfStatement) |
| 962 | 962 |
| 963 void Initialize(Expression* each, | 963 void Initialize(Expression* each, |
| 964 Expression* subject, | 964 Expression* subject, |
| 965 Statement* body, | 965 Statement* body, |
| 966 Expression* assign_iterator, | 966 Expression* assign_iterator, |
| 967 Expression* next_result, | 967 Expression* next_result, |
| 968 Expression* result_done, | 968 Expression* result_done, |
| 969 Expression* assign_each) { | 969 Expression* assign_each) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 991 // result.done | 991 // result.done |
| 992 Expression* result_done() const { | 992 Expression* result_done() const { |
| 993 return result_done_; | 993 return result_done_; |
| 994 } | 994 } |
| 995 | 995 |
| 996 // each = result.value | 996 // each = result.value |
| 997 Expression* assign_each() const { | 997 Expression* assign_each() const { |
| 998 return assign_each_; | 998 return assign_each_; |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 1001 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } |
| 1002 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } | 1002 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } |
| 1003 | 1003 |
| 1004 BailoutId BackEdgeId() const { return back_edge_id_; } | 1004 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 1005 | 1005 |
| 1006 protected: | 1006 protected: |
| 1007 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 1007 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 1008 IdGen* id_gen) | 1008 IdGen* id_gen) |
| 1009 : ForEachStatement(zone, labels, pos, id_gen), | 1009 : ForEachStatement(zone, labels, pos, id_gen), |
| 1010 assign_iterator_(NULL), | 1010 assign_iterator_(NULL), |
| 1011 next_result_(NULL), | 1011 next_result_(NULL), |
| 1012 result_done_(NULL), | 1012 result_done_(NULL), |
| 1013 assign_each_(NULL), | 1013 assign_each_(NULL), |
| 1014 back_edge_id_(id_gen->GetNextId()) {} | 1014 back_edge_id_(id_gen->GetNextId()) {} |
| 1015 | 1015 |
| 1016 Expression* assign_iterator_; | 1016 Expression* assign_iterator_; |
| 1017 Expression* next_result_; | 1017 Expression* next_result_; |
| 1018 Expression* result_done_; | 1018 Expression* result_done_; |
| 1019 Expression* assign_each_; | 1019 Expression* assign_each_; |
| 1020 const BailoutId back_edge_id_; | 1020 const BailoutId back_edge_id_; |
| 1021 }; | 1021 }; |
| 1022 | 1022 |
| 1023 | 1023 |
| 1024 class ExpressionStatement V8_FINAL : public Statement { | 1024 class ExpressionStatement FINAL : public Statement { |
| 1025 public: | 1025 public: |
| 1026 DECLARE_NODE_TYPE(ExpressionStatement) | 1026 DECLARE_NODE_TYPE(ExpressionStatement) |
| 1027 | 1027 |
| 1028 void set_expression(Expression* e) { expression_ = e; } | 1028 void set_expression(Expression* e) { expression_ = e; } |
| 1029 Expression* expression() const { return expression_; } | 1029 Expression* expression() const { return expression_; } |
| 1030 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); } | 1030 virtual bool IsJump() const OVERRIDE { return expression_->IsThrow(); } |
| 1031 | 1031 |
| 1032 protected: | 1032 protected: |
| 1033 ExpressionStatement(Zone* zone, Expression* expression, int pos) | 1033 ExpressionStatement(Zone* zone, Expression* expression, int pos) |
| 1034 : Statement(zone, pos), expression_(expression) { } | 1034 : Statement(zone, pos), expression_(expression) { } |
| 1035 | 1035 |
| 1036 private: | 1036 private: |
| 1037 Expression* expression_; | 1037 Expression* expression_; |
| 1038 }; | 1038 }; |
| 1039 | 1039 |
| 1040 | 1040 |
| 1041 class JumpStatement : public Statement { | 1041 class JumpStatement : public Statement { |
| 1042 public: | 1042 public: |
| 1043 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; } | 1043 virtual bool IsJump() const FINAL OVERRIDE { return true; } |
| 1044 | 1044 |
| 1045 protected: | 1045 protected: |
| 1046 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} | 1046 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} |
| 1047 }; | 1047 }; |
| 1048 | 1048 |
| 1049 | 1049 |
| 1050 class ContinueStatement V8_FINAL : public JumpStatement { | 1050 class ContinueStatement FINAL : public JumpStatement { |
| 1051 public: | 1051 public: |
| 1052 DECLARE_NODE_TYPE(ContinueStatement) | 1052 DECLARE_NODE_TYPE(ContinueStatement) |
| 1053 | 1053 |
| 1054 IterationStatement* target() const { return target_; } | 1054 IterationStatement* target() const { return target_; } |
| 1055 | 1055 |
| 1056 protected: | 1056 protected: |
| 1057 explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos) | 1057 explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos) |
| 1058 : JumpStatement(zone, pos), target_(target) { } | 1058 : JumpStatement(zone, pos), target_(target) { } |
| 1059 | 1059 |
| 1060 private: | 1060 private: |
| 1061 IterationStatement* target_; | 1061 IterationStatement* target_; |
| 1062 }; | 1062 }; |
| 1063 | 1063 |
| 1064 | 1064 |
| 1065 class BreakStatement V8_FINAL : public JumpStatement { | 1065 class BreakStatement FINAL : public JumpStatement { |
| 1066 public: | 1066 public: |
| 1067 DECLARE_NODE_TYPE(BreakStatement) | 1067 DECLARE_NODE_TYPE(BreakStatement) |
| 1068 | 1068 |
| 1069 BreakableStatement* target() const { return target_; } | 1069 BreakableStatement* target() const { return target_; } |
| 1070 | 1070 |
| 1071 protected: | 1071 protected: |
| 1072 explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos) | 1072 explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos) |
| 1073 : JumpStatement(zone, pos), target_(target) { } | 1073 : JumpStatement(zone, pos), target_(target) { } |
| 1074 | 1074 |
| 1075 private: | 1075 private: |
| 1076 BreakableStatement* target_; | 1076 BreakableStatement* target_; |
| 1077 }; | 1077 }; |
| 1078 | 1078 |
| 1079 | 1079 |
| 1080 class ReturnStatement V8_FINAL : public JumpStatement { | 1080 class ReturnStatement FINAL : public JumpStatement { |
| 1081 public: | 1081 public: |
| 1082 DECLARE_NODE_TYPE(ReturnStatement) | 1082 DECLARE_NODE_TYPE(ReturnStatement) |
| 1083 | 1083 |
| 1084 Expression* expression() const { return expression_; } | 1084 Expression* expression() const { return expression_; } |
| 1085 | 1085 |
| 1086 protected: | 1086 protected: |
| 1087 explicit ReturnStatement(Zone* zone, Expression* expression, int pos) | 1087 explicit ReturnStatement(Zone* zone, Expression* expression, int pos) |
| 1088 : JumpStatement(zone, pos), expression_(expression) { } | 1088 : JumpStatement(zone, pos), expression_(expression) { } |
| 1089 | 1089 |
| 1090 private: | 1090 private: |
| 1091 Expression* expression_; | 1091 Expression* expression_; |
| 1092 }; | 1092 }; |
| 1093 | 1093 |
| 1094 | 1094 |
| 1095 class WithStatement V8_FINAL : public Statement { | 1095 class WithStatement FINAL : public Statement { |
| 1096 public: | 1096 public: |
| 1097 DECLARE_NODE_TYPE(WithStatement) | 1097 DECLARE_NODE_TYPE(WithStatement) |
| 1098 | 1098 |
| 1099 Scope* scope() { return scope_; } | 1099 Scope* scope() { return scope_; } |
| 1100 Expression* expression() const { return expression_; } | 1100 Expression* expression() const { return expression_; } |
| 1101 Statement* statement() const { return statement_; } | 1101 Statement* statement() const { return statement_; } |
| 1102 | 1102 |
| 1103 protected: | 1103 protected: |
| 1104 WithStatement( | 1104 WithStatement( |
| 1105 Zone* zone, Scope* scope, | 1105 Zone* zone, Scope* scope, |
| 1106 Expression* expression, Statement* statement, int pos) | 1106 Expression* expression, Statement* statement, int pos) |
| 1107 : Statement(zone, pos), | 1107 : Statement(zone, pos), |
| 1108 scope_(scope), | 1108 scope_(scope), |
| 1109 expression_(expression), | 1109 expression_(expression), |
| 1110 statement_(statement) { } | 1110 statement_(statement) { } |
| 1111 | 1111 |
| 1112 private: | 1112 private: |
| 1113 Scope* scope_; | 1113 Scope* scope_; |
| 1114 Expression* expression_; | 1114 Expression* expression_; |
| 1115 Statement* statement_; | 1115 Statement* statement_; |
| 1116 }; | 1116 }; |
| 1117 | 1117 |
| 1118 | 1118 |
| 1119 class CaseClause V8_FINAL : public Expression { | 1119 class CaseClause FINAL : public Expression { |
| 1120 public: | 1120 public: |
| 1121 DECLARE_NODE_TYPE(CaseClause) | 1121 DECLARE_NODE_TYPE(CaseClause) |
| 1122 | 1122 |
| 1123 bool is_default() const { return label_ == NULL; } | 1123 bool is_default() const { return label_ == NULL; } |
| 1124 Expression* label() const { | 1124 Expression* label() const { |
| 1125 CHECK(!is_default()); | 1125 CHECK(!is_default()); |
| 1126 return label_; | 1126 return label_; |
| 1127 } | 1127 } |
| 1128 Label* body_target() { return &body_target_; } | 1128 Label* body_target() { return &body_target_; } |
| 1129 ZoneList<Statement*>* statements() const { return statements_; } | 1129 ZoneList<Statement*>* statements() const { return statements_; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1142 Expression* label_; | 1142 Expression* label_; |
| 1143 Label body_target_; | 1143 Label body_target_; |
| 1144 ZoneList<Statement*>* statements_; | 1144 ZoneList<Statement*>* statements_; |
| 1145 Type* compare_type_; | 1145 Type* compare_type_; |
| 1146 | 1146 |
| 1147 const TypeFeedbackId compare_id_; | 1147 const TypeFeedbackId compare_id_; |
| 1148 const BailoutId entry_id_; | 1148 const BailoutId entry_id_; |
| 1149 }; | 1149 }; |
| 1150 | 1150 |
| 1151 | 1151 |
| 1152 class SwitchStatement V8_FINAL : public BreakableStatement { | 1152 class SwitchStatement FINAL : public BreakableStatement { |
| 1153 public: | 1153 public: |
| 1154 DECLARE_NODE_TYPE(SwitchStatement) | 1154 DECLARE_NODE_TYPE(SwitchStatement) |
| 1155 | 1155 |
| 1156 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 1156 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| 1157 tag_ = tag; | 1157 tag_ = tag; |
| 1158 cases_ = cases; | 1158 cases_ = cases; |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 Expression* tag() const { return tag_; } | 1161 Expression* tag() const { return tag_; } |
| 1162 ZoneList<CaseClause*>* cases() const { return cases_; } | 1162 ZoneList<CaseClause*>* cases() const { return cases_; } |
| 1163 | 1163 |
| 1164 protected: | 1164 protected: |
| 1165 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, | 1165 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 1166 IdGen* id_gen) | 1166 IdGen* id_gen) |
| 1167 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_gen), | 1167 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_gen), |
| 1168 tag_(NULL), | 1168 tag_(NULL), |
| 1169 cases_(NULL) {} | 1169 cases_(NULL) {} |
| 1170 | 1170 |
| 1171 private: | 1171 private: |
| 1172 Expression* tag_; | 1172 Expression* tag_; |
| 1173 ZoneList<CaseClause*>* cases_; | 1173 ZoneList<CaseClause*>* cases_; |
| 1174 }; | 1174 }; |
| 1175 | 1175 |
| 1176 | 1176 |
| 1177 // If-statements always have non-null references to their then- and | 1177 // If-statements always have non-null references to their then- and |
| 1178 // else-parts. When parsing if-statements with no explicit else-part, | 1178 // else-parts. When parsing if-statements with no explicit else-part, |
| 1179 // the parser implicitly creates an empty statement. Use the | 1179 // the parser implicitly creates an empty statement. Use the |
| 1180 // HasThenStatement() and HasElseStatement() functions to check if a | 1180 // HasThenStatement() and HasElseStatement() functions to check if a |
| 1181 // given if-statement has a then- or an else-part containing code. | 1181 // given if-statement has a then- or an else-part containing code. |
| 1182 class IfStatement V8_FINAL : public Statement { | 1182 class IfStatement FINAL : public Statement { |
| 1183 public: | 1183 public: |
| 1184 DECLARE_NODE_TYPE(IfStatement) | 1184 DECLARE_NODE_TYPE(IfStatement) |
| 1185 | 1185 |
| 1186 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 1186 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } |
| 1187 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 1187 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } |
| 1188 | 1188 |
| 1189 Expression* condition() const { return condition_; } | 1189 Expression* condition() const { return condition_; } |
| 1190 Statement* then_statement() const { return then_statement_; } | 1190 Statement* then_statement() const { return then_statement_; } |
| 1191 Statement* else_statement() const { return else_statement_; } | 1191 Statement* else_statement() const { return else_statement_; } |
| 1192 | 1192 |
| 1193 virtual bool IsJump() const V8_OVERRIDE { | 1193 virtual bool IsJump() const OVERRIDE { |
| 1194 return HasThenStatement() && then_statement()->IsJump() | 1194 return HasThenStatement() && then_statement()->IsJump() |
| 1195 && HasElseStatement() && else_statement()->IsJump(); | 1195 && HasElseStatement() && else_statement()->IsJump(); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 BailoutId IfId() const { return if_id_; } | 1198 BailoutId IfId() const { return if_id_; } |
| 1199 BailoutId ThenId() const { return then_id_; } | 1199 BailoutId ThenId() const { return then_id_; } |
| 1200 BailoutId ElseId() const { return else_id_; } | 1200 BailoutId ElseId() const { return else_id_; } |
| 1201 | 1201 |
| 1202 protected: | 1202 protected: |
| 1203 IfStatement(Zone* zone, Expression* condition, Statement* then_statement, | 1203 IfStatement(Zone* zone, Expression* condition, Statement* then_statement, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1215 Statement* then_statement_; | 1215 Statement* then_statement_; |
| 1216 Statement* else_statement_; | 1216 Statement* else_statement_; |
| 1217 const BailoutId if_id_; | 1217 const BailoutId if_id_; |
| 1218 const BailoutId then_id_; | 1218 const BailoutId then_id_; |
| 1219 const BailoutId else_id_; | 1219 const BailoutId else_id_; |
| 1220 }; | 1220 }; |
| 1221 | 1221 |
| 1222 | 1222 |
| 1223 // NOTE: TargetCollectors are represented as nodes to fit in the target | 1223 // NOTE: TargetCollectors are represented as nodes to fit in the target |
| 1224 // stack in the compiler; this should probably be reworked. | 1224 // stack in the compiler; this should probably be reworked. |
| 1225 class TargetCollector V8_FINAL : public AstNode { | 1225 class TargetCollector FINAL : public AstNode { |
| 1226 public: | 1226 public: |
| 1227 explicit TargetCollector(Zone* zone) | 1227 explicit TargetCollector(Zone* zone) |
| 1228 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { } | 1228 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { } |
| 1229 | 1229 |
| 1230 // Adds a jump target to the collector. The collector stores a pointer not | 1230 // Adds a jump target to the collector. The collector stores a pointer not |
| 1231 // a copy of the target to make binding work, so make sure not to pass in | 1231 // a copy of the target to make binding work, so make sure not to pass in |
| 1232 // references to something on the stack. | 1232 // references to something on the stack. |
| 1233 void AddTarget(Label* target, Zone* zone); | 1233 void AddTarget(Label* target, Zone* zone); |
| 1234 | 1234 |
| 1235 // Virtual behaviour. TargetCollectors are never part of the AST. | 1235 // Virtual behaviour. TargetCollectors are never part of the AST. |
| 1236 virtual void Accept(AstVisitor* v) V8_OVERRIDE { UNREACHABLE(); } | 1236 virtual void Accept(AstVisitor* v) OVERRIDE { UNREACHABLE(); } |
| 1237 virtual NodeType node_type() const V8_OVERRIDE { return kInvalid; } | 1237 virtual NodeType node_type() const OVERRIDE { return kInvalid; } |
| 1238 virtual TargetCollector* AsTargetCollector() V8_OVERRIDE { return this; } | 1238 virtual TargetCollector* AsTargetCollector() OVERRIDE { return this; } |
| 1239 | 1239 |
| 1240 ZoneList<Label*>* targets() { return &targets_; } | 1240 ZoneList<Label*>* targets() { return &targets_; } |
| 1241 | 1241 |
| 1242 private: | 1242 private: |
| 1243 ZoneList<Label*> targets_; | 1243 ZoneList<Label*> targets_; |
| 1244 }; | 1244 }; |
| 1245 | 1245 |
| 1246 | 1246 |
| 1247 class TryStatement : public Statement { | 1247 class TryStatement : public Statement { |
| 1248 public: | 1248 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1263 | 1263 |
| 1264 private: | 1264 private: |
| 1265 // Unique (per-function) index of this handler. This is not an AST ID. | 1265 // Unique (per-function) index of this handler. This is not an AST ID. |
| 1266 int index_; | 1266 int index_; |
| 1267 | 1267 |
| 1268 Block* try_block_; | 1268 Block* try_block_; |
| 1269 ZoneList<Label*>* escaping_targets_; | 1269 ZoneList<Label*>* escaping_targets_; |
| 1270 }; | 1270 }; |
| 1271 | 1271 |
| 1272 | 1272 |
| 1273 class TryCatchStatement V8_FINAL : public TryStatement { | 1273 class TryCatchStatement FINAL : public TryStatement { |
| 1274 public: | 1274 public: |
| 1275 DECLARE_NODE_TYPE(TryCatchStatement) | 1275 DECLARE_NODE_TYPE(TryCatchStatement) |
| 1276 | 1276 |
| 1277 Scope* scope() { return scope_; } | 1277 Scope* scope() { return scope_; } |
| 1278 Variable* variable() { return variable_; } | 1278 Variable* variable() { return variable_; } |
| 1279 Block* catch_block() const { return catch_block_; } | 1279 Block* catch_block() const { return catch_block_; } |
| 1280 | 1280 |
| 1281 protected: | 1281 protected: |
| 1282 TryCatchStatement(Zone* zone, | 1282 TryCatchStatement(Zone* zone, |
| 1283 int index, | 1283 int index, |
| 1284 Block* try_block, | 1284 Block* try_block, |
| 1285 Scope* scope, | 1285 Scope* scope, |
| 1286 Variable* variable, | 1286 Variable* variable, |
| 1287 Block* catch_block, | 1287 Block* catch_block, |
| 1288 int pos) | 1288 int pos) |
| 1289 : TryStatement(zone, index, try_block, pos), | 1289 : TryStatement(zone, index, try_block, pos), |
| 1290 scope_(scope), | 1290 scope_(scope), |
| 1291 variable_(variable), | 1291 variable_(variable), |
| 1292 catch_block_(catch_block) { | 1292 catch_block_(catch_block) { |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 private: | 1295 private: |
| 1296 Scope* scope_; | 1296 Scope* scope_; |
| 1297 Variable* variable_; | 1297 Variable* variable_; |
| 1298 Block* catch_block_; | 1298 Block* catch_block_; |
| 1299 }; | 1299 }; |
| 1300 | 1300 |
| 1301 | 1301 |
| 1302 class TryFinallyStatement V8_FINAL : public TryStatement { | 1302 class TryFinallyStatement FINAL : public TryStatement { |
| 1303 public: | 1303 public: |
| 1304 DECLARE_NODE_TYPE(TryFinallyStatement) | 1304 DECLARE_NODE_TYPE(TryFinallyStatement) |
| 1305 | 1305 |
| 1306 Block* finally_block() const { return finally_block_; } | 1306 Block* finally_block() const { return finally_block_; } |
| 1307 | 1307 |
| 1308 protected: | 1308 protected: |
| 1309 TryFinallyStatement( | 1309 TryFinallyStatement( |
| 1310 Zone* zone, int index, Block* try_block, Block* finally_block, int pos) | 1310 Zone* zone, int index, Block* try_block, Block* finally_block, int pos) |
| 1311 : TryStatement(zone, index, try_block, pos), | 1311 : TryStatement(zone, index, try_block, pos), |
| 1312 finally_block_(finally_block) { } | 1312 finally_block_(finally_block) { } |
| 1313 | 1313 |
| 1314 private: | 1314 private: |
| 1315 Block* finally_block_; | 1315 Block* finally_block_; |
| 1316 }; | 1316 }; |
| 1317 | 1317 |
| 1318 | 1318 |
| 1319 class DebuggerStatement V8_FINAL : public Statement { | 1319 class DebuggerStatement FINAL : public Statement { |
| 1320 public: | 1320 public: |
| 1321 DECLARE_NODE_TYPE(DebuggerStatement) | 1321 DECLARE_NODE_TYPE(DebuggerStatement) |
| 1322 | 1322 |
| 1323 BailoutId DebugBreakId() const { return debugger_id_; } | 1323 BailoutId DebugBreakId() const { return debugger_id_; } |
| 1324 | 1324 |
| 1325 protected: | 1325 protected: |
| 1326 explicit DebuggerStatement(Zone* zone, int pos, IdGen* id_gen) | 1326 explicit DebuggerStatement(Zone* zone, int pos, IdGen* id_gen) |
| 1327 : Statement(zone, pos), debugger_id_(id_gen->GetNextId()) {} | 1327 : Statement(zone, pos), debugger_id_(id_gen->GetNextId()) {} |
| 1328 | 1328 |
| 1329 private: | 1329 private: |
| 1330 const BailoutId debugger_id_; | 1330 const BailoutId debugger_id_; |
| 1331 }; | 1331 }; |
| 1332 | 1332 |
| 1333 | 1333 |
| 1334 class EmptyStatement V8_FINAL : public Statement { | 1334 class EmptyStatement FINAL : public Statement { |
| 1335 public: | 1335 public: |
| 1336 DECLARE_NODE_TYPE(EmptyStatement) | 1336 DECLARE_NODE_TYPE(EmptyStatement) |
| 1337 | 1337 |
| 1338 protected: | 1338 protected: |
| 1339 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} | 1339 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} |
| 1340 }; | 1340 }; |
| 1341 | 1341 |
| 1342 | 1342 |
| 1343 class Literal V8_FINAL : public Expression { | 1343 class Literal FINAL : public Expression { |
| 1344 public: | 1344 public: |
| 1345 DECLARE_NODE_TYPE(Literal) | 1345 DECLARE_NODE_TYPE(Literal) |
| 1346 | 1346 |
| 1347 virtual bool IsPropertyName() const V8_OVERRIDE { | 1347 virtual bool IsPropertyName() const OVERRIDE { |
| 1348 return value_->IsPropertyName(); | 1348 return value_->IsPropertyName(); |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 Handle<String> AsPropertyName() { | 1351 Handle<String> AsPropertyName() { |
| 1352 DCHECK(IsPropertyName()); | 1352 DCHECK(IsPropertyName()); |
| 1353 return Handle<String>::cast(value()); | 1353 return Handle<String>::cast(value()); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 const AstRawString* AsRawPropertyName() { | 1356 const AstRawString* AsRawPropertyName() { |
| 1357 DCHECK(IsPropertyName()); | 1357 DCHECK(IsPropertyName()); |
| 1358 return value_->AsString(); | 1358 return value_->AsString(); |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { | 1361 virtual bool ToBooleanIsTrue() const OVERRIDE { |
| 1362 return value()->BooleanValue(); | 1362 return value()->BooleanValue(); |
| 1363 } | 1363 } |
| 1364 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { | 1364 virtual bool ToBooleanIsFalse() const OVERRIDE { |
| 1365 return !value()->BooleanValue(); | 1365 return !value()->BooleanValue(); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 Handle<Object> value() const { return value_->value(); } | 1368 Handle<Object> value() const { return value_->value(); } |
| 1369 const AstValue* raw_value() const { return value_; } | 1369 const AstValue* raw_value() const { return value_; } |
| 1370 | 1370 |
| 1371 // Support for using Literal as a HashMap key. NOTE: Currently, this works | 1371 // Support for using Literal as a HashMap key. NOTE: Currently, this works |
| 1372 // only for string and number literals! | 1372 // only for string and number literals! |
| 1373 uint32_t Hash() { return ToString()->Hash(); } | 1373 uint32_t Hash() { return ToString()->Hash(); } |
| 1374 | 1374 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 private: | 1441 private: |
| 1442 int literal_index_; | 1442 int literal_index_; |
| 1443 bool is_simple_; | 1443 bool is_simple_; |
| 1444 int depth_; | 1444 int depth_; |
| 1445 }; | 1445 }; |
| 1446 | 1446 |
| 1447 | 1447 |
| 1448 // Property is used for passing information | 1448 // Property is used for passing information |
| 1449 // about an object literal's properties from the parser | 1449 // about an object literal's properties from the parser |
| 1450 // to the code generator. | 1450 // to the code generator. |
| 1451 class ObjectLiteralProperty V8_FINAL : public ZoneObject { | 1451 class ObjectLiteralProperty FINAL : public ZoneObject { |
| 1452 public: | 1452 public: |
| 1453 enum Kind { | 1453 enum Kind { |
| 1454 CONSTANT, // Property with constant value (compile time). | 1454 CONSTANT, // Property with constant value (compile time). |
| 1455 COMPUTED, // Property with computed value (execution time). | 1455 COMPUTED, // Property with computed value (execution time). |
| 1456 MATERIALIZED_LITERAL, // Property value is a materialized literal. | 1456 MATERIALIZED_LITERAL, // Property value is a materialized literal. |
| 1457 GETTER, SETTER, // Property is an accessor function. | 1457 GETTER, SETTER, // Property is an accessor function. |
| 1458 PROTOTYPE // Property is __proto__. | 1458 PROTOTYPE // Property is __proto__. |
| 1459 }; | 1459 }; |
| 1460 | 1460 |
| 1461 ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory, | 1461 ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1485 Literal* key_; | 1485 Literal* key_; |
| 1486 Expression* value_; | 1486 Expression* value_; |
| 1487 Kind kind_; | 1487 Kind kind_; |
| 1488 bool emit_store_; | 1488 bool emit_store_; |
| 1489 Handle<Map> receiver_type_; | 1489 Handle<Map> receiver_type_; |
| 1490 }; | 1490 }; |
| 1491 | 1491 |
| 1492 | 1492 |
| 1493 // An object literal has a boilerplate object that is used | 1493 // An object literal has a boilerplate object that is used |
| 1494 // for minimizing the work when constructing it at runtime. | 1494 // for minimizing the work when constructing it at runtime. |
| 1495 class ObjectLiteral V8_FINAL : public MaterializedLiteral { | 1495 class ObjectLiteral FINAL : public MaterializedLiteral { |
| 1496 public: | 1496 public: |
| 1497 typedef ObjectLiteralProperty Property; | 1497 typedef ObjectLiteralProperty Property; |
| 1498 | 1498 |
| 1499 DECLARE_NODE_TYPE(ObjectLiteral) | 1499 DECLARE_NODE_TYPE(ObjectLiteral) |
| 1500 | 1500 |
| 1501 Handle<FixedArray> constant_properties() const { | 1501 Handle<FixedArray> constant_properties() const { |
| 1502 return constant_properties_; | 1502 return constant_properties_; |
| 1503 } | 1503 } |
| 1504 ZoneList<Property*>* properties() const { return properties_; } | 1504 ZoneList<Property*>* properties() const { return properties_; } |
| 1505 bool fast_elements() const { return fast_elements_; } | 1505 bool fast_elements() const { return fast_elements_; } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 Handle<FixedArray> constant_properties_; | 1551 Handle<FixedArray> constant_properties_; |
| 1552 ZoneList<Property*>* properties_; | 1552 ZoneList<Property*>* properties_; |
| 1553 int boilerplate_properties_; | 1553 int boilerplate_properties_; |
| 1554 bool fast_elements_; | 1554 bool fast_elements_; |
| 1555 bool may_store_doubles_; | 1555 bool may_store_doubles_; |
| 1556 bool has_function_; | 1556 bool has_function_; |
| 1557 }; | 1557 }; |
| 1558 | 1558 |
| 1559 | 1559 |
| 1560 // Node for capturing a regexp literal. | 1560 // Node for capturing a regexp literal. |
| 1561 class RegExpLiteral V8_FINAL : public MaterializedLiteral { | 1561 class RegExpLiteral FINAL : public MaterializedLiteral { |
| 1562 public: | 1562 public: |
| 1563 DECLARE_NODE_TYPE(RegExpLiteral) | 1563 DECLARE_NODE_TYPE(RegExpLiteral) |
| 1564 | 1564 |
| 1565 Handle<String> pattern() const { return pattern_->string(); } | 1565 Handle<String> pattern() const { return pattern_->string(); } |
| 1566 Handle<String> flags() const { return flags_->string(); } | 1566 Handle<String> flags() const { return flags_->string(); } |
| 1567 | 1567 |
| 1568 protected: | 1568 protected: |
| 1569 RegExpLiteral(Zone* zone, const AstRawString* pattern, | 1569 RegExpLiteral(Zone* zone, const AstRawString* pattern, |
| 1570 const AstRawString* flags, int literal_index, int pos, | 1570 const AstRawString* flags, int literal_index, int pos, |
| 1571 IdGen* id_gen) | 1571 IdGen* id_gen) |
| 1572 : MaterializedLiteral(zone, literal_index, pos, id_gen), | 1572 : MaterializedLiteral(zone, literal_index, pos, id_gen), |
| 1573 pattern_(pattern), | 1573 pattern_(pattern), |
| 1574 flags_(flags) { | 1574 flags_(flags) { |
| 1575 set_depth(1); | 1575 set_depth(1); |
| 1576 } | 1576 } |
| 1577 | 1577 |
| 1578 private: | 1578 private: |
| 1579 const AstRawString* pattern_; | 1579 const AstRawString* pattern_; |
| 1580 const AstRawString* flags_; | 1580 const AstRawString* flags_; |
| 1581 }; | 1581 }; |
| 1582 | 1582 |
| 1583 | 1583 |
| 1584 // An array literal has a literals object that is used | 1584 // An array literal has a literals object that is used |
| 1585 // for minimizing the work when constructing it at runtime. | 1585 // for minimizing the work when constructing it at runtime. |
| 1586 class ArrayLiteral V8_FINAL : public MaterializedLiteral { | 1586 class ArrayLiteral FINAL : public MaterializedLiteral { |
| 1587 public: | 1587 public: |
| 1588 DECLARE_NODE_TYPE(ArrayLiteral) | 1588 DECLARE_NODE_TYPE(ArrayLiteral) |
| 1589 | 1589 |
| 1590 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1590 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
| 1591 ZoneList<Expression*>* values() const { return values_; } | 1591 ZoneList<Expression*>* values() const { return values_; } |
| 1592 | 1592 |
| 1593 // Return an AST id for an element that is used in simulate instructions. | 1593 // Return an AST id for an element that is used in simulate instructions. |
| 1594 BailoutId GetIdForElement(int i) { | 1594 BailoutId GetIdForElement(int i) { |
| 1595 return BailoutId(first_element_id_.ToInt() + i); | 1595 return BailoutId(first_element_id_.ToInt() + i); |
| 1596 } | 1596 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1618 values_(values), | 1618 values_(values), |
| 1619 first_element_id_(id_gen->ReserveIdRange(values->length())) {} | 1619 first_element_id_(id_gen->ReserveIdRange(values->length())) {} |
| 1620 | 1620 |
| 1621 private: | 1621 private: |
| 1622 Handle<FixedArray> constant_elements_; | 1622 Handle<FixedArray> constant_elements_; |
| 1623 ZoneList<Expression*>* values_; | 1623 ZoneList<Expression*>* values_; |
| 1624 const BailoutId first_element_id_; | 1624 const BailoutId first_element_id_; |
| 1625 }; | 1625 }; |
| 1626 | 1626 |
| 1627 | 1627 |
| 1628 class VariableProxy V8_FINAL : public Expression, public FeedbackSlotInterface { | 1628 class VariableProxy FINAL : public Expression, public FeedbackSlotInterface { |
| 1629 public: | 1629 public: |
| 1630 DECLARE_NODE_TYPE(VariableProxy) | 1630 DECLARE_NODE_TYPE(VariableProxy) |
| 1631 | 1631 |
| 1632 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { | 1632 virtual bool IsValidReferenceExpression() const OVERRIDE { |
| 1633 return var_ == NULL ? true : var_->IsValidReference(); | 1633 return var_ == NULL ? true : var_->IsValidReference(); |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } | 1636 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } |
| 1637 | 1637 |
| 1638 Handle<String> name() const { return name_->string(); } | 1638 Handle<String> name() const { return name_->string(); } |
| 1639 const AstRawString* raw_name() const { return name_; } | 1639 const AstRawString* raw_name() const { return name_; } |
| 1640 Variable* var() const { return var_; } | 1640 Variable* var() const { return var_; } |
| 1641 bool is_this() const { return is_this_; } | 1641 bool is_this() const { return is_this_; } |
| 1642 Interface* interface() const { return interface_; } | 1642 Interface* interface() const { return interface_; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1662 | 1662 |
| 1663 const AstRawString* name_; | 1663 const AstRawString* name_; |
| 1664 Variable* var_; // resolved variable, or NULL | 1664 Variable* var_; // resolved variable, or NULL |
| 1665 bool is_this_; | 1665 bool is_this_; |
| 1666 bool is_assigned_; | 1666 bool is_assigned_; |
| 1667 Interface* interface_; | 1667 Interface* interface_; |
| 1668 int variable_feedback_slot_; | 1668 int variable_feedback_slot_; |
| 1669 }; | 1669 }; |
| 1670 | 1670 |
| 1671 | 1671 |
| 1672 class Property V8_FINAL : public Expression, public FeedbackSlotInterface { | 1672 class Property FINAL : public Expression, public FeedbackSlotInterface { |
| 1673 public: | 1673 public: |
| 1674 DECLARE_NODE_TYPE(Property) | 1674 DECLARE_NODE_TYPE(Property) |
| 1675 | 1675 |
| 1676 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { return true; } | 1676 virtual bool IsValidReferenceExpression() const OVERRIDE { return true; } |
| 1677 | 1677 |
| 1678 Expression* obj() const { return obj_; } | 1678 Expression* obj() const { return obj_; } |
| 1679 Expression* key() const { return key_; } | 1679 Expression* key() const { return key_; } |
| 1680 | 1680 |
| 1681 BailoutId LoadId() const { return load_id_; } | 1681 BailoutId LoadId() const { return load_id_; } |
| 1682 | 1682 |
| 1683 bool IsStringAccess() const { return is_string_access_; } | 1683 bool IsStringAccess() const { return is_string_access_; } |
| 1684 | 1684 |
| 1685 // Type feedback information. | 1685 // Type feedback information. |
| 1686 virtual bool IsMonomorphic() V8_OVERRIDE { | 1686 virtual bool IsMonomorphic() OVERRIDE { |
| 1687 return receiver_types_.length() == 1; | 1687 return receiver_types_.length() == 1; |
| 1688 } | 1688 } |
| 1689 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 1689 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
| 1690 return &receiver_types_; | 1690 return &receiver_types_; |
| 1691 } | 1691 } |
| 1692 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 1692 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { |
| 1693 return STANDARD_STORE; | 1693 return STANDARD_STORE; |
| 1694 } | 1694 } |
| 1695 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } | 1695 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } |
| 1696 bool HasNoTypeInformation() { | 1696 bool HasNoTypeInformation() { |
| 1697 return is_uninitialized_; | 1697 return is_uninitialized_; |
| 1698 } | 1698 } |
| 1699 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 1699 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 1700 void set_is_string_access(bool b) { is_string_access_ = b; } | 1700 void set_is_string_access(bool b) { is_string_access_ = b; } |
| 1701 void mark_for_call() { is_for_call_ = true; } | 1701 void mark_for_call() { is_for_call_ = true; } |
| 1702 bool IsForCall() { return is_for_call_; } | 1702 bool IsForCall() { return is_for_call_; } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1731 const BailoutId load_id_; | 1731 const BailoutId load_id_; |
| 1732 int property_feedback_slot_; | 1732 int property_feedback_slot_; |
| 1733 | 1733 |
| 1734 SmallMapList receiver_types_; | 1734 SmallMapList receiver_types_; |
| 1735 bool is_for_call_ : 1; | 1735 bool is_for_call_ : 1; |
| 1736 bool is_uninitialized_ : 1; | 1736 bool is_uninitialized_ : 1; |
| 1737 bool is_string_access_ : 1; | 1737 bool is_string_access_ : 1; |
| 1738 }; | 1738 }; |
| 1739 | 1739 |
| 1740 | 1740 |
| 1741 class Call V8_FINAL : public Expression, public FeedbackSlotInterface { | 1741 class Call FINAL : public Expression, public FeedbackSlotInterface { |
| 1742 public: | 1742 public: |
| 1743 DECLARE_NODE_TYPE(Call) | 1743 DECLARE_NODE_TYPE(Call) |
| 1744 | 1744 |
| 1745 Expression* expression() const { return expression_; } | 1745 Expression* expression() const { return expression_; } |
| 1746 ZoneList<Expression*>* arguments() const { return arguments_; } | 1746 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1747 | 1747 |
| 1748 // Type feedback information. | 1748 // Type feedback information. |
| 1749 virtual int ComputeFeedbackSlotCount() { return 1; } | 1749 virtual int ComputeFeedbackSlotCount() { return 1; } |
| 1750 virtual void SetFirstFeedbackSlot(int slot) { | 1750 virtual void SetFirstFeedbackSlot(int slot) { |
| 1751 call_feedback_slot_ = slot; | 1751 call_feedback_slot_ = slot; |
| 1752 } | 1752 } |
| 1753 | 1753 |
| 1754 bool HasCallFeedbackSlot() const { | 1754 bool HasCallFeedbackSlot() const { |
| 1755 return call_feedback_slot_ != kInvalidFeedbackSlot; | 1755 return call_feedback_slot_ != kInvalidFeedbackSlot; |
| 1756 } | 1756 } |
| 1757 int CallFeedbackSlot() const { return call_feedback_slot_; } | 1757 int CallFeedbackSlot() const { return call_feedback_slot_; } |
| 1758 | 1758 |
| 1759 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 1759 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
| 1760 if (expression()->IsProperty()) { | 1760 if (expression()->IsProperty()) { |
| 1761 return expression()->AsProperty()->GetReceiverTypes(); | 1761 return expression()->AsProperty()->GetReceiverTypes(); |
| 1762 } | 1762 } |
| 1763 return NULL; | 1763 return NULL; |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 virtual bool IsMonomorphic() V8_OVERRIDE { | 1766 virtual bool IsMonomorphic() OVERRIDE { |
| 1767 if (expression()->IsProperty()) { | 1767 if (expression()->IsProperty()) { |
| 1768 return expression()->AsProperty()->IsMonomorphic(); | 1768 return expression()->AsProperty()->IsMonomorphic(); |
| 1769 } | 1769 } |
| 1770 return !target_.is_null(); | 1770 return !target_.is_null(); |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 bool global_call() const { | 1773 bool global_call() const { |
| 1774 VariableProxy* proxy = expression_->AsVariableProxy(); | 1774 VariableProxy* proxy = expression_->AsVariableProxy(); |
| 1775 return proxy != NULL && proxy->var()->IsUnallocated(); | 1775 return proxy != NULL && proxy->var()->IsUnallocated(); |
| 1776 } | 1776 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 | 1829 |
| 1830 Handle<JSFunction> target_; | 1830 Handle<JSFunction> target_; |
| 1831 Handle<Cell> cell_; | 1831 Handle<Cell> cell_; |
| 1832 Handle<AllocationSite> allocation_site_; | 1832 Handle<AllocationSite> allocation_site_; |
| 1833 int call_feedback_slot_; | 1833 int call_feedback_slot_; |
| 1834 | 1834 |
| 1835 const BailoutId return_id_; | 1835 const BailoutId return_id_; |
| 1836 }; | 1836 }; |
| 1837 | 1837 |
| 1838 | 1838 |
| 1839 class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface { | 1839 class CallNew FINAL : public Expression, public FeedbackSlotInterface { |
| 1840 public: | 1840 public: |
| 1841 DECLARE_NODE_TYPE(CallNew) | 1841 DECLARE_NODE_TYPE(CallNew) |
| 1842 | 1842 |
| 1843 Expression* expression() const { return expression_; } | 1843 Expression* expression() const { return expression_; } |
| 1844 ZoneList<Expression*>* arguments() const { return arguments_; } | 1844 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1845 | 1845 |
| 1846 // Type feedback information. | 1846 // Type feedback information. |
| 1847 virtual int ComputeFeedbackSlotCount() { | 1847 virtual int ComputeFeedbackSlotCount() { |
| 1848 return FLAG_pretenuring_call_new ? 2 : 1; | 1848 return FLAG_pretenuring_call_new ? 2 : 1; |
| 1849 } | 1849 } |
| 1850 virtual void SetFirstFeedbackSlot(int slot) { | 1850 virtual void SetFirstFeedbackSlot(int slot) { |
| 1851 callnew_feedback_slot_ = slot; | 1851 callnew_feedback_slot_ = slot; |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 int CallNewFeedbackSlot() { | 1854 int CallNewFeedbackSlot() { |
| 1855 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); | 1855 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); |
| 1856 return callnew_feedback_slot_; | 1856 return callnew_feedback_slot_; |
| 1857 } | 1857 } |
| 1858 int AllocationSiteFeedbackSlot() { | 1858 int AllocationSiteFeedbackSlot() { |
| 1859 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); | 1859 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); |
| 1860 DCHECK(FLAG_pretenuring_call_new); | 1860 DCHECK(FLAG_pretenuring_call_new); |
| 1861 return callnew_feedback_slot_ + 1; | 1861 return callnew_feedback_slot_ + 1; |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1864 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1865 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1865 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } |
| 1866 Handle<JSFunction> target() const { return target_; } | 1866 Handle<JSFunction> target() const { return target_; } |
| 1867 ElementsKind elements_kind() const { return elements_kind_; } | 1867 ElementsKind elements_kind() const { return elements_kind_; } |
| 1868 Handle<AllocationSite> allocation_site() const { | 1868 Handle<AllocationSite> allocation_site() const { |
| 1869 return allocation_site_; | 1869 return allocation_site_; |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 static int feedback_slots() { return 1; } | 1872 static int feedback_slots() { return 1; } |
| 1873 | 1873 |
| 1874 BailoutId ReturnId() const { return return_id_; } | 1874 BailoutId ReturnId() const { return return_id_; } |
| 1875 | 1875 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1895 int callnew_feedback_slot_; | 1895 int callnew_feedback_slot_; |
| 1896 | 1896 |
| 1897 const BailoutId return_id_; | 1897 const BailoutId return_id_; |
| 1898 }; | 1898 }; |
| 1899 | 1899 |
| 1900 | 1900 |
| 1901 // The CallRuntime class does not represent any official JavaScript | 1901 // The CallRuntime class does not represent any official JavaScript |
| 1902 // language construct. Instead it is used to call a C or JS function | 1902 // language construct. Instead it is used to call a C or JS function |
| 1903 // with a set of arguments. This is used from the builtins that are | 1903 // with a set of arguments. This is used from the builtins that are |
| 1904 // implemented in JavaScript (see "v8natives.js"). | 1904 // implemented in JavaScript (see "v8natives.js"). |
| 1905 class CallRuntime V8_FINAL : public Expression, public FeedbackSlotInterface { | 1905 class CallRuntime FINAL : public Expression, public FeedbackSlotInterface { |
| 1906 public: | 1906 public: |
| 1907 DECLARE_NODE_TYPE(CallRuntime) | 1907 DECLARE_NODE_TYPE(CallRuntime) |
| 1908 | 1908 |
| 1909 Handle<String> name() const { return raw_name_->string(); } | 1909 Handle<String> name() const { return raw_name_->string(); } |
| 1910 const AstRawString* raw_name() const { return raw_name_; } | 1910 const AstRawString* raw_name() const { return raw_name_; } |
| 1911 const Runtime::Function* function() const { return function_; } | 1911 const Runtime::Function* function() const { return function_; } |
| 1912 ZoneList<Expression*>* arguments() const { return arguments_; } | 1912 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1913 bool is_jsruntime() const { return function_ == NULL; } | 1913 bool is_jsruntime() const { return function_ == NULL; } |
| 1914 | 1914 |
| 1915 // Type feedback information. | 1915 // Type feedback information. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1938 arguments_(arguments) {} | 1938 arguments_(arguments) {} |
| 1939 | 1939 |
| 1940 private: | 1940 private: |
| 1941 const AstRawString* raw_name_; | 1941 const AstRawString* raw_name_; |
| 1942 const Runtime::Function* function_; | 1942 const Runtime::Function* function_; |
| 1943 ZoneList<Expression*>* arguments_; | 1943 ZoneList<Expression*>* arguments_; |
| 1944 int callruntime_feedback_slot_; | 1944 int callruntime_feedback_slot_; |
| 1945 }; | 1945 }; |
| 1946 | 1946 |
| 1947 | 1947 |
| 1948 class UnaryOperation V8_FINAL : public Expression { | 1948 class UnaryOperation FINAL : public Expression { |
| 1949 public: | 1949 public: |
| 1950 DECLARE_NODE_TYPE(UnaryOperation) | 1950 DECLARE_NODE_TYPE(UnaryOperation) |
| 1951 | 1951 |
| 1952 Token::Value op() const { return op_; } | 1952 Token::Value op() const { return op_; } |
| 1953 Expression* expression() const { return expression_; } | 1953 Expression* expression() const { return expression_; } |
| 1954 | 1954 |
| 1955 BailoutId MaterializeTrueId() { return materialize_true_id_; } | 1955 BailoutId MaterializeTrueId() { return materialize_true_id_; } |
| 1956 BailoutId MaterializeFalseId() { return materialize_false_id_; } | 1956 BailoutId MaterializeFalseId() { return materialize_false_id_; } |
| 1957 | 1957 |
| 1958 virtual void RecordToBooleanTypeFeedback( | 1958 virtual void RecordToBooleanTypeFeedback( |
| 1959 TypeFeedbackOracle* oracle) V8_OVERRIDE; | 1959 TypeFeedbackOracle* oracle) OVERRIDE; |
| 1960 | 1960 |
| 1961 protected: | 1961 protected: |
| 1962 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos, | 1962 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos, |
| 1963 IdGen* id_gen) | 1963 IdGen* id_gen) |
| 1964 : Expression(zone, pos, id_gen), | 1964 : Expression(zone, pos, id_gen), |
| 1965 op_(op), | 1965 op_(op), |
| 1966 expression_(expression), | 1966 expression_(expression), |
| 1967 materialize_true_id_(id_gen->GetNextId()), | 1967 materialize_true_id_(id_gen->GetNextId()), |
| 1968 materialize_false_id_(id_gen->GetNextId()) { | 1968 materialize_false_id_(id_gen->GetNextId()) { |
| 1969 DCHECK(Token::IsUnaryOp(op)); | 1969 DCHECK(Token::IsUnaryOp(op)); |
| 1970 } | 1970 } |
| 1971 | 1971 |
| 1972 private: | 1972 private: |
| 1973 Token::Value op_; | 1973 Token::Value op_; |
| 1974 Expression* expression_; | 1974 Expression* expression_; |
| 1975 | 1975 |
| 1976 // For unary not (Token::NOT), the AST ids where true and false will | 1976 // For unary not (Token::NOT), the AST ids where true and false will |
| 1977 // actually be materialized, respectively. | 1977 // actually be materialized, respectively. |
| 1978 const BailoutId materialize_true_id_; | 1978 const BailoutId materialize_true_id_; |
| 1979 const BailoutId materialize_false_id_; | 1979 const BailoutId materialize_false_id_; |
| 1980 }; | 1980 }; |
| 1981 | 1981 |
| 1982 | 1982 |
| 1983 class BinaryOperation V8_FINAL : public Expression { | 1983 class BinaryOperation FINAL : public Expression { |
| 1984 public: | 1984 public: |
| 1985 DECLARE_NODE_TYPE(BinaryOperation) | 1985 DECLARE_NODE_TYPE(BinaryOperation) |
| 1986 | 1986 |
| 1987 virtual bool ResultOverwriteAllowed() const V8_OVERRIDE; | 1987 virtual bool ResultOverwriteAllowed() const OVERRIDE; |
| 1988 | 1988 |
| 1989 Token::Value op() const { return op_; } | 1989 Token::Value op() const { return op_; } |
| 1990 Expression* left() const { return left_; } | 1990 Expression* left() const { return left_; } |
| 1991 Expression* right() const { return right_; } | 1991 Expression* right() const { return right_; } |
| 1992 Handle<AllocationSite> allocation_site() const { return allocation_site_; } | 1992 Handle<AllocationSite> allocation_site() const { return allocation_site_; } |
| 1993 void set_allocation_site(Handle<AllocationSite> allocation_site) { | 1993 void set_allocation_site(Handle<AllocationSite> allocation_site) { |
| 1994 allocation_site_ = allocation_site; | 1994 allocation_site_ = allocation_site; |
| 1995 } | 1995 } |
| 1996 | 1996 |
| 1997 BailoutId RightId() const { return right_id_; } | 1997 BailoutId RightId() const { return right_id_; } |
| 1998 | 1998 |
| 1999 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } | 1999 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } |
| 2000 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 2000 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| 2001 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } | 2001 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } |
| 2002 | 2002 |
| 2003 virtual void RecordToBooleanTypeFeedback( | 2003 virtual void RecordToBooleanTypeFeedback( |
| 2004 TypeFeedbackOracle* oracle) V8_OVERRIDE; | 2004 TypeFeedbackOracle* oracle) OVERRIDE; |
| 2005 | 2005 |
| 2006 protected: | 2006 protected: |
| 2007 BinaryOperation(Zone* zone, Token::Value op, Expression* left, | 2007 BinaryOperation(Zone* zone, Token::Value op, Expression* left, |
| 2008 Expression* right, int pos, IdGen* id_gen) | 2008 Expression* right, int pos, IdGen* id_gen) |
| 2009 : Expression(zone, pos, id_gen), | 2009 : Expression(zone, pos, id_gen), |
| 2010 op_(op), | 2010 op_(op), |
| 2011 left_(left), | 2011 left_(left), |
| 2012 right_(right), | 2012 right_(right), |
| 2013 right_id_(id_gen->GetNextId()) { | 2013 right_id_(id_gen->GetNextId()) { |
| 2014 DCHECK(Token::IsBinaryOp(op)); | 2014 DCHECK(Token::IsBinaryOp(op)); |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 private: | 2017 private: |
| 2018 Token::Value op_; | 2018 Token::Value op_; |
| 2019 Expression* left_; | 2019 Expression* left_; |
| 2020 Expression* right_; | 2020 Expression* right_; |
| 2021 Handle<AllocationSite> allocation_site_; | 2021 Handle<AllocationSite> allocation_site_; |
| 2022 | 2022 |
| 2023 // TODO(rossberg): the fixed arg should probably be represented as a Constant | 2023 // TODO(rossberg): the fixed arg should probably be represented as a Constant |
| 2024 // type for the RHS. | 2024 // type for the RHS. |
| 2025 Maybe<int> fixed_right_arg_; | 2025 Maybe<int> fixed_right_arg_; |
| 2026 | 2026 |
| 2027 // The short-circuit logical operations need an AST ID for their | 2027 // The short-circuit logical operations need an AST ID for their |
| 2028 // right-hand subexpression. | 2028 // right-hand subexpression. |
| 2029 const BailoutId right_id_; | 2029 const BailoutId right_id_; |
| 2030 }; | 2030 }; |
| 2031 | 2031 |
| 2032 | 2032 |
| 2033 class CountOperation V8_FINAL : public Expression { | 2033 class CountOperation FINAL : public Expression { |
| 2034 public: | 2034 public: |
| 2035 DECLARE_NODE_TYPE(CountOperation) | 2035 DECLARE_NODE_TYPE(CountOperation) |
| 2036 | 2036 |
| 2037 bool is_prefix() const { return is_prefix_; } | 2037 bool is_prefix() const { return is_prefix_; } |
| 2038 bool is_postfix() const { return !is_prefix_; } | 2038 bool is_postfix() const { return !is_prefix_; } |
| 2039 | 2039 |
| 2040 Token::Value op() const { return op_; } | 2040 Token::Value op() const { return op_; } |
| 2041 Token::Value binary_op() { | 2041 Token::Value binary_op() { |
| 2042 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 2042 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
| 2043 } | 2043 } |
| 2044 | 2044 |
| 2045 Expression* expression() const { return expression_; } | 2045 Expression* expression() const { return expression_; } |
| 2046 | 2046 |
| 2047 virtual bool IsMonomorphic() V8_OVERRIDE { | 2047 virtual bool IsMonomorphic() OVERRIDE { |
| 2048 return receiver_types_.length() == 1; | 2048 return receiver_types_.length() == 1; |
| 2049 } | 2049 } |
| 2050 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 2050 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
| 2051 return &receiver_types_; | 2051 return &receiver_types_; |
| 2052 } | 2052 } |
| 2053 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2053 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { |
| 2054 return store_mode_; | 2054 return store_mode_; |
| 2055 } | 2055 } |
| 2056 Type* type() const { return type_; } | 2056 Type* type() const { return type_; } |
| 2057 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2057 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2058 void set_type(Type* type) { type_ = type; } | 2058 void set_type(Type* type) { type_ = type; } |
| 2059 | 2059 |
| 2060 BailoutId AssignmentId() const { return assignment_id_; } | 2060 BailoutId AssignmentId() const { return assignment_id_; } |
| 2061 | 2061 |
| 2062 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 2062 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
| 2063 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 2063 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2080 // must have extra bit. | 2080 // must have extra bit. |
| 2081 Type* type_; | 2081 Type* type_; |
| 2082 | 2082 |
| 2083 Expression* expression_; | 2083 Expression* expression_; |
| 2084 const BailoutId assignment_id_; | 2084 const BailoutId assignment_id_; |
| 2085 const TypeFeedbackId count_id_; | 2085 const TypeFeedbackId count_id_; |
| 2086 SmallMapList receiver_types_; | 2086 SmallMapList receiver_types_; |
| 2087 }; | 2087 }; |
| 2088 | 2088 |
| 2089 | 2089 |
| 2090 class CompareOperation V8_FINAL : public Expression { | 2090 class CompareOperation FINAL : public Expression { |
| 2091 public: | 2091 public: |
| 2092 DECLARE_NODE_TYPE(CompareOperation) | 2092 DECLARE_NODE_TYPE(CompareOperation) |
| 2093 | 2093 |
| 2094 Token::Value op() const { return op_; } | 2094 Token::Value op() const { return op_; } |
| 2095 Expression* left() const { return left_; } | 2095 Expression* left() const { return left_; } |
| 2096 Expression* right() const { return right_; } | 2096 Expression* right() const { return right_; } |
| 2097 | 2097 |
| 2098 // Type feedback information. | 2098 // Type feedback information. |
| 2099 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } | 2099 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } |
| 2100 Type* combined_type() const { return combined_type_; } | 2100 Type* combined_type() const { return combined_type_; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2118 | 2118 |
| 2119 private: | 2119 private: |
| 2120 Token::Value op_; | 2120 Token::Value op_; |
| 2121 Expression* left_; | 2121 Expression* left_; |
| 2122 Expression* right_; | 2122 Expression* right_; |
| 2123 | 2123 |
| 2124 Type* combined_type_; | 2124 Type* combined_type_; |
| 2125 }; | 2125 }; |
| 2126 | 2126 |
| 2127 | 2127 |
| 2128 class Conditional V8_FINAL : public Expression { | 2128 class Conditional FINAL : public Expression { |
| 2129 public: | 2129 public: |
| 2130 DECLARE_NODE_TYPE(Conditional) | 2130 DECLARE_NODE_TYPE(Conditional) |
| 2131 | 2131 |
| 2132 Expression* condition() const { return condition_; } | 2132 Expression* condition() const { return condition_; } |
| 2133 Expression* then_expression() const { return then_expression_; } | 2133 Expression* then_expression() const { return then_expression_; } |
| 2134 Expression* else_expression() const { return else_expression_; } | 2134 Expression* else_expression() const { return else_expression_; } |
| 2135 | 2135 |
| 2136 BailoutId ThenId() const { return then_id_; } | 2136 BailoutId ThenId() const { return then_id_; } |
| 2137 BailoutId ElseId() const { return else_id_; } | 2137 BailoutId ElseId() const { return else_id_; } |
| 2138 | 2138 |
| 2139 protected: | 2139 protected: |
| 2140 Conditional(Zone* zone, Expression* condition, Expression* then_expression, | 2140 Conditional(Zone* zone, Expression* condition, Expression* then_expression, |
| 2141 Expression* else_expression, int position, IdGen* id_gen) | 2141 Expression* else_expression, int position, IdGen* id_gen) |
| 2142 : Expression(zone, position, id_gen), | 2142 : Expression(zone, position, id_gen), |
| 2143 condition_(condition), | 2143 condition_(condition), |
| 2144 then_expression_(then_expression), | 2144 then_expression_(then_expression), |
| 2145 else_expression_(else_expression), | 2145 else_expression_(else_expression), |
| 2146 then_id_(id_gen->GetNextId()), | 2146 then_id_(id_gen->GetNextId()), |
| 2147 else_id_(id_gen->GetNextId()) {} | 2147 else_id_(id_gen->GetNextId()) {} |
| 2148 | 2148 |
| 2149 private: | 2149 private: |
| 2150 Expression* condition_; | 2150 Expression* condition_; |
| 2151 Expression* then_expression_; | 2151 Expression* then_expression_; |
| 2152 Expression* else_expression_; | 2152 Expression* else_expression_; |
| 2153 const BailoutId then_id_; | 2153 const BailoutId then_id_; |
| 2154 const BailoutId else_id_; | 2154 const BailoutId else_id_; |
| 2155 }; | 2155 }; |
| 2156 | 2156 |
| 2157 | 2157 |
| 2158 class Assignment V8_FINAL : public Expression { | 2158 class Assignment FINAL : public Expression { |
| 2159 public: | 2159 public: |
| 2160 DECLARE_NODE_TYPE(Assignment) | 2160 DECLARE_NODE_TYPE(Assignment) |
| 2161 | 2161 |
| 2162 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } | 2162 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } |
| 2163 | 2163 |
| 2164 Token::Value binary_op() const; | 2164 Token::Value binary_op() const; |
| 2165 | 2165 |
| 2166 Token::Value op() const { return op_; } | 2166 Token::Value op() const { return op_; } |
| 2167 Expression* target() const { return target_; } | 2167 Expression* target() const { return target_; } |
| 2168 Expression* value() const { return value_; } | 2168 Expression* value() const { return value_; } |
| 2169 BinaryOperation* binary_operation() const { return binary_operation_; } | 2169 BinaryOperation* binary_operation() const { return binary_operation_; } |
| 2170 | 2170 |
| 2171 // This check relies on the definition order of token in token.h. | 2171 // This check relies on the definition order of token in token.h. |
| 2172 bool is_compound() const { return op() > Token::ASSIGN; } | 2172 bool is_compound() const { return op() > Token::ASSIGN; } |
| 2173 | 2173 |
| 2174 BailoutId AssignmentId() const { return assignment_id_; } | 2174 BailoutId AssignmentId() const { return assignment_id_; } |
| 2175 | 2175 |
| 2176 // Type feedback information. | 2176 // Type feedback information. |
| 2177 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } | 2177 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } |
| 2178 virtual bool IsMonomorphic() V8_OVERRIDE { | 2178 virtual bool IsMonomorphic() OVERRIDE { |
| 2179 return receiver_types_.length() == 1; | 2179 return receiver_types_.length() == 1; |
| 2180 } | 2180 } |
| 2181 bool IsUninitialized() { return is_uninitialized_; } | 2181 bool IsUninitialized() { return is_uninitialized_; } |
| 2182 bool HasNoTypeInformation() { | 2182 bool HasNoTypeInformation() { |
| 2183 return is_uninitialized_; | 2183 return is_uninitialized_; |
| 2184 } | 2184 } |
| 2185 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 2185 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
| 2186 return &receiver_types_; | 2186 return &receiver_types_; |
| 2187 } | 2187 } |
| 2188 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2188 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { |
| 2189 return store_mode_; | 2189 return store_mode_; |
| 2190 } | 2190 } |
| 2191 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 2191 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 2192 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2192 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2193 | 2193 |
| 2194 protected: | 2194 protected: |
| 2195 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, | 2195 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, |
| 2196 int pos, IdGen* id_gen); | 2196 int pos, IdGen* id_gen); |
| 2197 | 2197 |
| 2198 template<class Visitor> | 2198 template<class Visitor> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2211 BinaryOperation* binary_operation_; | 2211 BinaryOperation* binary_operation_; |
| 2212 const BailoutId assignment_id_; | 2212 const BailoutId assignment_id_; |
| 2213 | 2213 |
| 2214 bool is_uninitialized_ : 1; | 2214 bool is_uninitialized_ : 1; |
| 2215 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2215 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
| 2216 // must have extra bit. | 2216 // must have extra bit. |
| 2217 SmallMapList receiver_types_; | 2217 SmallMapList receiver_types_; |
| 2218 }; | 2218 }; |
| 2219 | 2219 |
| 2220 | 2220 |
| 2221 class Yield V8_FINAL : public Expression, public FeedbackSlotInterface { | 2221 class Yield FINAL : public Expression, public FeedbackSlotInterface { |
| 2222 public: | 2222 public: |
| 2223 DECLARE_NODE_TYPE(Yield) | 2223 DECLARE_NODE_TYPE(Yield) |
| 2224 | 2224 |
| 2225 enum Kind { | 2225 enum Kind { |
| 2226 INITIAL, // The initial yield that returns the unboxed generator object. | 2226 kInitial, // The initial yield that returns the unboxed generator object. |
| 2227 SUSPEND, // A normal yield: { value: EXPRESSION, done: false } | 2227 kSuspend, // A normal yield: { value: EXPRESSION, done: false } |
| 2228 DELEGATING, // A yield*. | 2228 kDelegating, // A yield*. |
| 2229 FINAL // A return: { value: EXPRESSION, done: true } | 2229 kFinal // A return: { value: EXPRESSION, done: true } |
| 2230 }; | 2230 }; |
| 2231 | 2231 |
| 2232 Expression* generator_object() const { return generator_object_; } | 2232 Expression* generator_object() const { return generator_object_; } |
| 2233 Expression* expression() const { return expression_; } | 2233 Expression* expression() const { return expression_; } |
| 2234 Kind yield_kind() const { return yield_kind_; } | 2234 Kind yield_kind() const { return yield_kind_; } |
| 2235 | 2235 |
| 2236 // Delegating yield surrounds the "yield" in a "try/catch". This index | 2236 // Delegating yield surrounds the "yield" in a "try/catch". This index |
| 2237 // locates the catch handler in the handler table, and is equivalent to | 2237 // locates the catch handler in the handler table, and is equivalent to |
| 2238 // TryCatchStatement::index(). | 2238 // TryCatchStatement::index(). |
| 2239 int index() const { | 2239 int index() const { |
| 2240 DCHECK(yield_kind() == DELEGATING); | 2240 DCHECK_EQ(kDelegating, yield_kind()); |
| 2241 return index_; | 2241 return index_; |
| 2242 } | 2242 } |
| 2243 void set_index(int index) { | 2243 void set_index(int index) { |
| 2244 DCHECK(yield_kind() == DELEGATING); | 2244 DCHECK_EQ(kDelegating, yield_kind()); |
| 2245 index_ = index; | 2245 index_ = index; |
| 2246 } | 2246 } |
| 2247 | 2247 |
| 2248 // Type feedback information. | 2248 // Type feedback information. |
| 2249 virtual int ComputeFeedbackSlotCount() { | 2249 virtual int ComputeFeedbackSlotCount() { |
| 2250 return (FLAG_vector_ics && yield_kind() == DELEGATING) ? 3 : 0; | 2250 return (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0; |
| 2251 } | 2251 } |
| 2252 virtual void SetFirstFeedbackSlot(int slot) { | 2252 virtual void SetFirstFeedbackSlot(int slot) { |
| 2253 yield_first_feedback_slot_ = slot; | 2253 yield_first_feedback_slot_ = slot; |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 int KeyedLoadFeedbackSlot() { | 2256 int KeyedLoadFeedbackSlot() { |
| 2257 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); | 2257 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); |
| 2258 return yield_first_feedback_slot_; | 2258 return yield_first_feedback_slot_; |
| 2259 } | 2259 } |
| 2260 | 2260 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2280 | 2280 |
| 2281 private: | 2281 private: |
| 2282 Expression* generator_object_; | 2282 Expression* generator_object_; |
| 2283 Expression* expression_; | 2283 Expression* expression_; |
| 2284 Kind yield_kind_; | 2284 Kind yield_kind_; |
| 2285 int index_; | 2285 int index_; |
| 2286 int yield_first_feedback_slot_; | 2286 int yield_first_feedback_slot_; |
| 2287 }; | 2287 }; |
| 2288 | 2288 |
| 2289 | 2289 |
| 2290 class Throw V8_FINAL : public Expression { | 2290 class Throw FINAL : public Expression { |
| 2291 public: | 2291 public: |
| 2292 DECLARE_NODE_TYPE(Throw) | 2292 DECLARE_NODE_TYPE(Throw) |
| 2293 | 2293 |
| 2294 Expression* exception() const { return exception_; } | 2294 Expression* exception() const { return exception_; } |
| 2295 | 2295 |
| 2296 protected: | 2296 protected: |
| 2297 Throw(Zone* zone, Expression* exception, int pos, IdGen* id_gen) | 2297 Throw(Zone* zone, Expression* exception, int pos, IdGen* id_gen) |
| 2298 : Expression(zone, pos, id_gen), exception_(exception) {} | 2298 : Expression(zone, pos, id_gen), exception_(exception) {} |
| 2299 | 2299 |
| 2300 private: | 2300 private: |
| 2301 Expression* exception_; | 2301 Expression* exception_; |
| 2302 }; | 2302 }; |
| 2303 | 2303 |
| 2304 | 2304 |
| 2305 class FunctionLiteral V8_FINAL : public Expression { | 2305 class FunctionLiteral FINAL : public Expression { |
| 2306 public: | 2306 public: |
| 2307 enum FunctionType { | 2307 enum FunctionType { |
| 2308 ANONYMOUS_EXPRESSION, | 2308 ANONYMOUS_EXPRESSION, |
| 2309 NAMED_EXPRESSION, | 2309 NAMED_EXPRESSION, |
| 2310 DECLARATION | 2310 DECLARATION |
| 2311 }; | 2311 }; |
| 2312 | 2312 |
| 2313 enum ParameterFlag { | 2313 enum ParameterFlag { |
| 2314 kNoDuplicateParameters = 0, | 2314 kNoDuplicateParameters = 0, |
| 2315 kHasDuplicateParameters = 1 | 2315 kHasDuplicateParameters = 1 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 class IsAnonymous: public BitField<bool, 1, 1> {}; | 2490 class IsAnonymous: public BitField<bool, 1, 1> {}; |
| 2491 class Pretenure: public BitField<bool, 2, 1> {}; | 2491 class Pretenure: public BitField<bool, 2, 1> {}; |
| 2492 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; | 2492 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; |
| 2493 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; | 2493 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; |
| 2494 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; | 2494 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; |
| 2495 class IsGenerator : public BitField<bool, 6, 1> {}; | 2495 class IsGenerator : public BitField<bool, 6, 1> {}; |
| 2496 class IsArrow : public BitField<bool, 7, 1> {}; | 2496 class IsArrow : public BitField<bool, 7, 1> {}; |
| 2497 }; | 2497 }; |
| 2498 | 2498 |
| 2499 | 2499 |
| 2500 class NativeFunctionLiteral V8_FINAL : public Expression { | 2500 class NativeFunctionLiteral FINAL : public Expression { |
| 2501 public: | 2501 public: |
| 2502 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2502 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
| 2503 | 2503 |
| 2504 Handle<String> name() const { return name_->string(); } | 2504 Handle<String> name() const { return name_->string(); } |
| 2505 v8::Extension* extension() const { return extension_; } | 2505 v8::Extension* extension() const { return extension_; } |
| 2506 | 2506 |
| 2507 protected: | 2507 protected: |
| 2508 NativeFunctionLiteral(Zone* zone, const AstRawString* name, | 2508 NativeFunctionLiteral(Zone* zone, const AstRawString* name, |
| 2509 v8::Extension* extension, int pos, IdGen* id_gen) | 2509 v8::Extension* extension, int pos, IdGen* id_gen) |
| 2510 : Expression(zone, pos, id_gen), name_(name), extension_(extension) {} | 2510 : Expression(zone, pos, id_gen), name_(name), extension_(extension) {} |
| 2511 | 2511 |
| 2512 private: | 2512 private: |
| 2513 const AstRawString* name_; | 2513 const AstRawString* name_; |
| 2514 v8::Extension* extension_; | 2514 v8::Extension* extension_; |
| 2515 }; | 2515 }; |
| 2516 | 2516 |
| 2517 | 2517 |
| 2518 class ThisFunction V8_FINAL : public Expression { | 2518 class ThisFunction FINAL : public Expression { |
| 2519 public: | 2519 public: |
| 2520 DECLARE_NODE_TYPE(ThisFunction) | 2520 DECLARE_NODE_TYPE(ThisFunction) |
| 2521 | 2521 |
| 2522 protected: | 2522 protected: |
| 2523 ThisFunction(Zone* zone, int pos, IdGen* id_gen) | 2523 ThisFunction(Zone* zone, int pos, IdGen* id_gen) |
| 2524 : Expression(zone, pos, id_gen) {} | 2524 : Expression(zone, pos, id_gen) {} |
| 2525 }; | 2525 }; |
| 2526 | 2526 |
| 2527 | 2527 |
| 2528 class SuperReference V8_FINAL : public Expression { | 2528 class SuperReference FINAL : public Expression { |
| 2529 public: | 2529 public: |
| 2530 DECLARE_NODE_TYPE(SuperReference) | 2530 DECLARE_NODE_TYPE(SuperReference) |
| 2531 | 2531 |
| 2532 VariableProxy* this_var() const { return this_var_; } | 2532 VariableProxy* this_var() const { return this_var_; } |
| 2533 | 2533 |
| 2534 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } | 2534 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } |
| 2535 | 2535 |
| 2536 protected: | 2536 protected: |
| 2537 SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen) | 2537 SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen) |
| 2538 : Expression(zone, pos, id_gen), this_var_(this_var) { | 2538 : Expression(zone, pos, id_gen), this_var_(this_var) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 virtual void AppendToText(RegExpText* text, Zone* zone); | 2578 virtual void AppendToText(RegExpText* text, Zone* zone); |
| 2579 OStream& Print(OStream& os, Zone* zone); // NOLINT | 2579 OStream& Print(OStream& os, Zone* zone); // NOLINT |
| 2580 #define MAKE_ASTYPE(Name) \ | 2580 #define MAKE_ASTYPE(Name) \ |
| 2581 virtual RegExp##Name* As##Name(); \ | 2581 virtual RegExp##Name* As##Name(); \ |
| 2582 virtual bool Is##Name(); | 2582 virtual bool Is##Name(); |
| 2583 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) | 2583 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) |
| 2584 #undef MAKE_ASTYPE | 2584 #undef MAKE_ASTYPE |
| 2585 }; | 2585 }; |
| 2586 | 2586 |
| 2587 | 2587 |
| 2588 class RegExpDisjunction V8_FINAL : public RegExpTree { | 2588 class RegExpDisjunction FINAL : public RegExpTree { |
| 2589 public: | 2589 public: |
| 2590 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); | 2590 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); |
| 2591 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2591 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2592 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2592 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2593 RegExpNode* on_success) V8_OVERRIDE; | 2593 RegExpNode* on_success) OVERRIDE; |
| 2594 virtual RegExpDisjunction* AsDisjunction() V8_OVERRIDE; | 2594 virtual RegExpDisjunction* AsDisjunction() OVERRIDE; |
| 2595 virtual Interval CaptureRegisters() V8_OVERRIDE; | 2595 virtual Interval CaptureRegisters() OVERRIDE; |
| 2596 virtual bool IsDisjunction() V8_OVERRIDE; | 2596 virtual bool IsDisjunction() OVERRIDE; |
| 2597 virtual bool IsAnchoredAtStart() V8_OVERRIDE; | 2597 virtual bool IsAnchoredAtStart() OVERRIDE; |
| 2598 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; | 2598 virtual bool IsAnchoredAtEnd() OVERRIDE; |
| 2599 virtual int min_match() V8_OVERRIDE { return min_match_; } | 2599 virtual int min_match() OVERRIDE { return min_match_; } |
| 2600 virtual int max_match() V8_OVERRIDE { return max_match_; } | 2600 virtual int max_match() OVERRIDE { return max_match_; } |
| 2601 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } | 2601 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } |
| 2602 private: | 2602 private: |
| 2603 ZoneList<RegExpTree*>* alternatives_; | 2603 ZoneList<RegExpTree*>* alternatives_; |
| 2604 int min_match_; | 2604 int min_match_; |
| 2605 int max_match_; | 2605 int max_match_; |
| 2606 }; | 2606 }; |
| 2607 | 2607 |
| 2608 | 2608 |
| 2609 class RegExpAlternative V8_FINAL : public RegExpTree { | 2609 class RegExpAlternative FINAL : public RegExpTree { |
| 2610 public: | 2610 public: |
| 2611 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); | 2611 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); |
| 2612 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2612 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2613 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2613 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2614 RegExpNode* on_success) V8_OVERRIDE; | 2614 RegExpNode* on_success) OVERRIDE; |
| 2615 virtual RegExpAlternative* AsAlternative() V8_OVERRIDE; | 2615 virtual RegExpAlternative* AsAlternative() OVERRIDE; |
| 2616 virtual Interval CaptureRegisters() V8_OVERRIDE; | 2616 virtual Interval CaptureRegisters() OVERRIDE; |
| 2617 virtual bool IsAlternative() V8_OVERRIDE; | 2617 virtual bool IsAlternative() OVERRIDE; |
| 2618 virtual bool IsAnchoredAtStart() V8_OVERRIDE; | 2618 virtual bool IsAnchoredAtStart() OVERRIDE; |
| 2619 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; | 2619 virtual bool IsAnchoredAtEnd() OVERRIDE; |
| 2620 virtual int min_match() V8_OVERRIDE { return min_match_; } | 2620 virtual int min_match() OVERRIDE { return min_match_; } |
| 2621 virtual int max_match() V8_OVERRIDE { return max_match_; } | 2621 virtual int max_match() OVERRIDE { return max_match_; } |
| 2622 ZoneList<RegExpTree*>* nodes() { return nodes_; } | 2622 ZoneList<RegExpTree*>* nodes() { return nodes_; } |
| 2623 private: | 2623 private: |
| 2624 ZoneList<RegExpTree*>* nodes_; | 2624 ZoneList<RegExpTree*>* nodes_; |
| 2625 int min_match_; | 2625 int min_match_; |
| 2626 int max_match_; | 2626 int max_match_; |
| 2627 }; | 2627 }; |
| 2628 | 2628 |
| 2629 | 2629 |
| 2630 class RegExpAssertion V8_FINAL : public RegExpTree { | 2630 class RegExpAssertion FINAL : public RegExpTree { |
| 2631 public: | 2631 public: |
| 2632 enum AssertionType { | 2632 enum AssertionType { |
| 2633 START_OF_LINE, | 2633 START_OF_LINE, |
| 2634 START_OF_INPUT, | 2634 START_OF_INPUT, |
| 2635 END_OF_LINE, | 2635 END_OF_LINE, |
| 2636 END_OF_INPUT, | 2636 END_OF_INPUT, |
| 2637 BOUNDARY, | 2637 BOUNDARY, |
| 2638 NON_BOUNDARY | 2638 NON_BOUNDARY |
| 2639 }; | 2639 }; |
| 2640 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } | 2640 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } |
| 2641 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2641 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2642 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2642 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2643 RegExpNode* on_success) V8_OVERRIDE; | 2643 RegExpNode* on_success) OVERRIDE; |
| 2644 virtual RegExpAssertion* AsAssertion() V8_OVERRIDE; | 2644 virtual RegExpAssertion* AsAssertion() OVERRIDE; |
| 2645 virtual bool IsAssertion() V8_OVERRIDE; | 2645 virtual bool IsAssertion() OVERRIDE; |
| 2646 virtual bool IsAnchoredAtStart() V8_OVERRIDE; | 2646 virtual bool IsAnchoredAtStart() OVERRIDE; |
| 2647 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; | 2647 virtual bool IsAnchoredAtEnd() OVERRIDE; |
| 2648 virtual int min_match() V8_OVERRIDE { return 0; } | 2648 virtual int min_match() OVERRIDE { return 0; } |
| 2649 virtual int max_match() V8_OVERRIDE { return 0; } | 2649 virtual int max_match() OVERRIDE { return 0; } |
| 2650 AssertionType assertion_type() { return assertion_type_; } | 2650 AssertionType assertion_type() { return assertion_type_; } |
| 2651 private: | 2651 private: |
| 2652 AssertionType assertion_type_; | 2652 AssertionType assertion_type_; |
| 2653 }; | 2653 }; |
| 2654 | 2654 |
| 2655 | 2655 |
| 2656 class CharacterSet V8_FINAL BASE_EMBEDDED { | 2656 class CharacterSet FINAL BASE_EMBEDDED { |
| 2657 public: | 2657 public: |
| 2658 explicit CharacterSet(uc16 standard_set_type) | 2658 explicit CharacterSet(uc16 standard_set_type) |
| 2659 : ranges_(NULL), | 2659 : ranges_(NULL), |
| 2660 standard_set_type_(standard_set_type) {} | 2660 standard_set_type_(standard_set_type) {} |
| 2661 explicit CharacterSet(ZoneList<CharacterRange>* ranges) | 2661 explicit CharacterSet(ZoneList<CharacterRange>* ranges) |
| 2662 : ranges_(ranges), | 2662 : ranges_(ranges), |
| 2663 standard_set_type_(0) {} | 2663 standard_set_type_(0) {} |
| 2664 ZoneList<CharacterRange>* ranges(Zone* zone); | 2664 ZoneList<CharacterRange>* ranges(Zone* zone); |
| 2665 uc16 standard_set_type() { return standard_set_type_; } | 2665 uc16 standard_set_type() { return standard_set_type_; } |
| 2666 void set_standard_set_type(uc16 special_set_type) { | 2666 void set_standard_set_type(uc16 special_set_type) { |
| 2667 standard_set_type_ = special_set_type; | 2667 standard_set_type_ = special_set_type; |
| 2668 } | 2668 } |
| 2669 bool is_standard() { return standard_set_type_ != 0; } | 2669 bool is_standard() { return standard_set_type_ != 0; } |
| 2670 void Canonicalize(); | 2670 void Canonicalize(); |
| 2671 private: | 2671 private: |
| 2672 ZoneList<CharacterRange>* ranges_; | 2672 ZoneList<CharacterRange>* ranges_; |
| 2673 // If non-zero, the value represents a standard set (e.g., all whitespace | 2673 // If non-zero, the value represents a standard set (e.g., all whitespace |
| 2674 // characters) without having to expand the ranges. | 2674 // characters) without having to expand the ranges. |
| 2675 uc16 standard_set_type_; | 2675 uc16 standard_set_type_; |
| 2676 }; | 2676 }; |
| 2677 | 2677 |
| 2678 | 2678 |
| 2679 class RegExpCharacterClass V8_FINAL : public RegExpTree { | 2679 class RegExpCharacterClass FINAL : public RegExpTree { |
| 2680 public: | 2680 public: |
| 2681 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) | 2681 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) |
| 2682 : set_(ranges), | 2682 : set_(ranges), |
| 2683 is_negated_(is_negated) { } | 2683 is_negated_(is_negated) { } |
| 2684 explicit RegExpCharacterClass(uc16 type) | 2684 explicit RegExpCharacterClass(uc16 type) |
| 2685 : set_(type), | 2685 : set_(type), |
| 2686 is_negated_(false) { } | 2686 is_negated_(false) { } |
| 2687 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2687 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2688 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2688 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2689 RegExpNode* on_success) V8_OVERRIDE; | 2689 RegExpNode* on_success) OVERRIDE; |
| 2690 virtual RegExpCharacterClass* AsCharacterClass() V8_OVERRIDE; | 2690 virtual RegExpCharacterClass* AsCharacterClass() OVERRIDE; |
| 2691 virtual bool IsCharacterClass() V8_OVERRIDE; | 2691 virtual bool IsCharacterClass() OVERRIDE; |
| 2692 virtual bool IsTextElement() V8_OVERRIDE { return true; } | 2692 virtual bool IsTextElement() OVERRIDE { return true; } |
| 2693 virtual int min_match() V8_OVERRIDE { return 1; } | 2693 virtual int min_match() OVERRIDE { return 1; } |
| 2694 virtual int max_match() V8_OVERRIDE { return 1; } | 2694 virtual int max_match() OVERRIDE { return 1; } |
| 2695 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE; | 2695 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; |
| 2696 CharacterSet character_set() { return set_; } | 2696 CharacterSet character_set() { return set_; } |
| 2697 // TODO(lrn): Remove need for complex version if is_standard that | 2697 // TODO(lrn): Remove need for complex version if is_standard that |
| 2698 // recognizes a mangled standard set and just do { return set_.is_special(); } | 2698 // recognizes a mangled standard set and just do { return set_.is_special(); } |
| 2699 bool is_standard(Zone* zone); | 2699 bool is_standard(Zone* zone); |
| 2700 // Returns a value representing the standard character set if is_standard() | 2700 // Returns a value representing the standard character set if is_standard() |
| 2701 // returns true. | 2701 // returns true. |
| 2702 // Currently used values are: | 2702 // Currently used values are: |
| 2703 // s : unicode whitespace | 2703 // s : unicode whitespace |
| 2704 // S : unicode non-whitespace | 2704 // S : unicode non-whitespace |
| 2705 // w : ASCII word character (digit, letter, underscore) | 2705 // w : ASCII word character (digit, letter, underscore) |
| 2706 // W : non-ASCII word character | 2706 // W : non-ASCII word character |
| 2707 // d : ASCII digit | 2707 // d : ASCII digit |
| 2708 // D : non-ASCII digit | 2708 // D : non-ASCII digit |
| 2709 // . : non-unicode non-newline | 2709 // . : non-unicode non-newline |
| 2710 // * : All characters | 2710 // * : All characters |
| 2711 uc16 standard_type() { return set_.standard_set_type(); } | 2711 uc16 standard_type() { return set_.standard_set_type(); } |
| 2712 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } | 2712 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } |
| 2713 bool is_negated() { return is_negated_; } | 2713 bool is_negated() { return is_negated_; } |
| 2714 | 2714 |
| 2715 private: | 2715 private: |
| 2716 CharacterSet set_; | 2716 CharacterSet set_; |
| 2717 bool is_negated_; | 2717 bool is_negated_; |
| 2718 }; | 2718 }; |
| 2719 | 2719 |
| 2720 | 2720 |
| 2721 class RegExpAtom V8_FINAL : public RegExpTree { | 2721 class RegExpAtom FINAL : public RegExpTree { |
| 2722 public: | 2722 public: |
| 2723 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } | 2723 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } |
| 2724 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2724 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2725 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2725 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2726 RegExpNode* on_success) V8_OVERRIDE; | 2726 RegExpNode* on_success) OVERRIDE; |
| 2727 virtual RegExpAtom* AsAtom() V8_OVERRIDE; | 2727 virtual RegExpAtom* AsAtom() OVERRIDE; |
| 2728 virtual bool IsAtom() V8_OVERRIDE; | 2728 virtual bool IsAtom() OVERRIDE; |
| 2729 virtual bool IsTextElement() V8_OVERRIDE { return true; } | 2729 virtual bool IsTextElement() OVERRIDE { return true; } |
| 2730 virtual int min_match() V8_OVERRIDE { return data_.length(); } | 2730 virtual int min_match() OVERRIDE { return data_.length(); } |
| 2731 virtual int max_match() V8_OVERRIDE { return data_.length(); } | 2731 virtual int max_match() OVERRIDE { return data_.length(); } |
| 2732 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE; | 2732 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; |
| 2733 Vector<const uc16> data() { return data_; } | 2733 Vector<const uc16> data() { return data_; } |
| 2734 int length() { return data_.length(); } | 2734 int length() { return data_.length(); } |
| 2735 private: | 2735 private: |
| 2736 Vector<const uc16> data_; | 2736 Vector<const uc16> data_; |
| 2737 }; | 2737 }; |
| 2738 | 2738 |
| 2739 | 2739 |
| 2740 class RegExpText V8_FINAL : public RegExpTree { | 2740 class RegExpText FINAL : public RegExpTree { |
| 2741 public: | 2741 public: |
| 2742 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} | 2742 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} |
| 2743 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2743 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2744 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2744 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2745 RegExpNode* on_success) V8_OVERRIDE; | 2745 RegExpNode* on_success) OVERRIDE; |
| 2746 virtual RegExpText* AsText() V8_OVERRIDE; | 2746 virtual RegExpText* AsText() OVERRIDE; |
| 2747 virtual bool IsText() V8_OVERRIDE; | 2747 virtual bool IsText() OVERRIDE; |
| 2748 virtual bool IsTextElement() V8_OVERRIDE { return true; } | 2748 virtual bool IsTextElement() OVERRIDE { return true; } |
| 2749 virtual int min_match() V8_OVERRIDE { return length_; } | 2749 virtual int min_match() OVERRIDE { return length_; } |
| 2750 virtual int max_match() V8_OVERRIDE { return length_; } | 2750 virtual int max_match() OVERRIDE { return length_; } |
| 2751 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE; | 2751 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; |
| 2752 void AddElement(TextElement elm, Zone* zone) { | 2752 void AddElement(TextElement elm, Zone* zone) { |
| 2753 elements_.Add(elm, zone); | 2753 elements_.Add(elm, zone); |
| 2754 length_ += elm.length(); | 2754 length_ += elm.length(); |
| 2755 } | 2755 } |
| 2756 ZoneList<TextElement>* elements() { return &elements_; } | 2756 ZoneList<TextElement>* elements() { return &elements_; } |
| 2757 private: | 2757 private: |
| 2758 ZoneList<TextElement> elements_; | 2758 ZoneList<TextElement> elements_; |
| 2759 int length_; | 2759 int length_; |
| 2760 }; | 2760 }; |
| 2761 | 2761 |
| 2762 | 2762 |
| 2763 class RegExpQuantifier V8_FINAL : public RegExpTree { | 2763 class RegExpQuantifier FINAL : public RegExpTree { |
| 2764 public: | 2764 public: |
| 2765 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; | 2765 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; |
| 2766 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) | 2766 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) |
| 2767 : body_(body), | 2767 : body_(body), |
| 2768 min_(min), | 2768 min_(min), |
| 2769 max_(max), | 2769 max_(max), |
| 2770 min_match_(min * body->min_match()), | 2770 min_match_(min * body->min_match()), |
| 2771 quantifier_type_(type) { | 2771 quantifier_type_(type) { |
| 2772 if (max > 0 && body->max_match() > kInfinity / max) { | 2772 if (max > 0 && body->max_match() > kInfinity / max) { |
| 2773 max_match_ = kInfinity; | 2773 max_match_ = kInfinity; |
| 2774 } else { | 2774 } else { |
| 2775 max_match_ = max * body->max_match(); | 2775 max_match_ = max * body->max_match(); |
| 2776 } | 2776 } |
| 2777 } | 2777 } |
| 2778 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2778 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2779 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2779 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2780 RegExpNode* on_success) V8_OVERRIDE; | 2780 RegExpNode* on_success) OVERRIDE; |
| 2781 static RegExpNode* ToNode(int min, | 2781 static RegExpNode* ToNode(int min, |
| 2782 int max, | 2782 int max, |
| 2783 bool is_greedy, | 2783 bool is_greedy, |
| 2784 RegExpTree* body, | 2784 RegExpTree* body, |
| 2785 RegExpCompiler* compiler, | 2785 RegExpCompiler* compiler, |
| 2786 RegExpNode* on_success, | 2786 RegExpNode* on_success, |
| 2787 bool not_at_start = false); | 2787 bool not_at_start = false); |
| 2788 virtual RegExpQuantifier* AsQuantifier() V8_OVERRIDE; | 2788 virtual RegExpQuantifier* AsQuantifier() OVERRIDE; |
| 2789 virtual Interval CaptureRegisters() V8_OVERRIDE; | 2789 virtual Interval CaptureRegisters() OVERRIDE; |
| 2790 virtual bool IsQuantifier() V8_OVERRIDE; | 2790 virtual bool IsQuantifier() OVERRIDE; |
| 2791 virtual int min_match() V8_OVERRIDE { return min_match_; } | 2791 virtual int min_match() OVERRIDE { return min_match_; } |
| 2792 virtual int max_match() V8_OVERRIDE { return max_match_; } | 2792 virtual int max_match() OVERRIDE { return max_match_; } |
| 2793 int min() { return min_; } | 2793 int min() { return min_; } |
| 2794 int max() { return max_; } | 2794 int max() { return max_; } |
| 2795 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } | 2795 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } |
| 2796 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } | 2796 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } |
| 2797 bool is_greedy() { return quantifier_type_ == GREEDY; } | 2797 bool is_greedy() { return quantifier_type_ == GREEDY; } |
| 2798 RegExpTree* body() { return body_; } | 2798 RegExpTree* body() { return body_; } |
| 2799 | 2799 |
| 2800 private: | 2800 private: |
| 2801 RegExpTree* body_; | 2801 RegExpTree* body_; |
| 2802 int min_; | 2802 int min_; |
| 2803 int max_; | 2803 int max_; |
| 2804 int min_match_; | 2804 int min_match_; |
| 2805 int max_match_; | 2805 int max_match_; |
| 2806 QuantifierType quantifier_type_; | 2806 QuantifierType quantifier_type_; |
| 2807 }; | 2807 }; |
| 2808 | 2808 |
| 2809 | 2809 |
| 2810 class RegExpCapture V8_FINAL : public RegExpTree { | 2810 class RegExpCapture FINAL : public RegExpTree { |
| 2811 public: | 2811 public: |
| 2812 explicit RegExpCapture(RegExpTree* body, int index) | 2812 explicit RegExpCapture(RegExpTree* body, int index) |
| 2813 : body_(body), index_(index) { } | 2813 : body_(body), index_(index) { } |
| 2814 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2814 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2815 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2815 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2816 RegExpNode* on_success) V8_OVERRIDE; | 2816 RegExpNode* on_success) OVERRIDE; |
| 2817 static RegExpNode* ToNode(RegExpTree* body, | 2817 static RegExpNode* ToNode(RegExpTree* body, |
| 2818 int index, | 2818 int index, |
| 2819 RegExpCompiler* compiler, | 2819 RegExpCompiler* compiler, |
| 2820 RegExpNode* on_success); | 2820 RegExpNode* on_success); |
| 2821 virtual RegExpCapture* AsCapture() V8_OVERRIDE; | 2821 virtual RegExpCapture* AsCapture() OVERRIDE; |
| 2822 virtual bool IsAnchoredAtStart() V8_OVERRIDE; | 2822 virtual bool IsAnchoredAtStart() OVERRIDE; |
| 2823 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; | 2823 virtual bool IsAnchoredAtEnd() OVERRIDE; |
| 2824 virtual Interval CaptureRegisters() V8_OVERRIDE; | 2824 virtual Interval CaptureRegisters() OVERRIDE; |
| 2825 virtual bool IsCapture() V8_OVERRIDE; | 2825 virtual bool IsCapture() OVERRIDE; |
| 2826 virtual int min_match() V8_OVERRIDE { return body_->min_match(); } | 2826 virtual int min_match() OVERRIDE { return body_->min_match(); } |
| 2827 virtual int max_match() V8_OVERRIDE { return body_->max_match(); } | 2827 virtual int max_match() OVERRIDE { return body_->max_match(); } |
| 2828 RegExpTree* body() { return body_; } | 2828 RegExpTree* body() { return body_; } |
| 2829 int index() { return index_; } | 2829 int index() { return index_; } |
| 2830 static int StartRegister(int index) { return index * 2; } | 2830 static int StartRegister(int index) { return index * 2; } |
| 2831 static int EndRegister(int index) { return index * 2 + 1; } | 2831 static int EndRegister(int index) { return index * 2 + 1; } |
| 2832 | 2832 |
| 2833 private: | 2833 private: |
| 2834 RegExpTree* body_; | 2834 RegExpTree* body_; |
| 2835 int index_; | 2835 int index_; |
| 2836 }; | 2836 }; |
| 2837 | 2837 |
| 2838 | 2838 |
| 2839 class RegExpLookahead V8_FINAL : public RegExpTree { | 2839 class RegExpLookahead FINAL : public RegExpTree { |
| 2840 public: | 2840 public: |
| 2841 RegExpLookahead(RegExpTree* body, | 2841 RegExpLookahead(RegExpTree* body, |
| 2842 bool is_positive, | 2842 bool is_positive, |
| 2843 int capture_count, | 2843 int capture_count, |
| 2844 int capture_from) | 2844 int capture_from) |
| 2845 : body_(body), | 2845 : body_(body), |
| 2846 is_positive_(is_positive), | 2846 is_positive_(is_positive), |
| 2847 capture_count_(capture_count), | 2847 capture_count_(capture_count), |
| 2848 capture_from_(capture_from) { } | 2848 capture_from_(capture_from) { } |
| 2849 | 2849 |
| 2850 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2850 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2851 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2851 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2852 RegExpNode* on_success) V8_OVERRIDE; | 2852 RegExpNode* on_success) OVERRIDE; |
| 2853 virtual RegExpLookahead* AsLookahead() V8_OVERRIDE; | 2853 virtual RegExpLookahead* AsLookahead() OVERRIDE; |
| 2854 virtual Interval CaptureRegisters() V8_OVERRIDE; | 2854 virtual Interval CaptureRegisters() OVERRIDE; |
| 2855 virtual bool IsLookahead() V8_OVERRIDE; | 2855 virtual bool IsLookahead() OVERRIDE; |
| 2856 virtual bool IsAnchoredAtStart() V8_OVERRIDE; | 2856 virtual bool IsAnchoredAtStart() OVERRIDE; |
| 2857 virtual int min_match() V8_OVERRIDE { return 0; } | 2857 virtual int min_match() OVERRIDE { return 0; } |
| 2858 virtual int max_match() V8_OVERRIDE { return 0; } | 2858 virtual int max_match() OVERRIDE { return 0; } |
| 2859 RegExpTree* body() { return body_; } | 2859 RegExpTree* body() { return body_; } |
| 2860 bool is_positive() { return is_positive_; } | 2860 bool is_positive() { return is_positive_; } |
| 2861 int capture_count() { return capture_count_; } | 2861 int capture_count() { return capture_count_; } |
| 2862 int capture_from() { return capture_from_; } | 2862 int capture_from() { return capture_from_; } |
| 2863 | 2863 |
| 2864 private: | 2864 private: |
| 2865 RegExpTree* body_; | 2865 RegExpTree* body_; |
| 2866 bool is_positive_; | 2866 bool is_positive_; |
| 2867 int capture_count_; | 2867 int capture_count_; |
| 2868 int capture_from_; | 2868 int capture_from_; |
| 2869 }; | 2869 }; |
| 2870 | 2870 |
| 2871 | 2871 |
| 2872 class RegExpBackReference V8_FINAL : public RegExpTree { | 2872 class RegExpBackReference FINAL : public RegExpTree { |
| 2873 public: | 2873 public: |
| 2874 explicit RegExpBackReference(RegExpCapture* capture) | 2874 explicit RegExpBackReference(RegExpCapture* capture) |
| 2875 : capture_(capture) { } | 2875 : capture_(capture) { } |
| 2876 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2876 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2877 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2877 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2878 RegExpNode* on_success) V8_OVERRIDE; | 2878 RegExpNode* on_success) OVERRIDE; |
| 2879 virtual RegExpBackReference* AsBackReference() V8_OVERRIDE; | 2879 virtual RegExpBackReference* AsBackReference() OVERRIDE; |
| 2880 virtual bool IsBackReference() V8_OVERRIDE; | 2880 virtual bool IsBackReference() OVERRIDE; |
| 2881 virtual int min_match() V8_OVERRIDE { return 0; } | 2881 virtual int min_match() OVERRIDE { return 0; } |
| 2882 virtual int max_match() V8_OVERRIDE { return capture_->max_match(); } | 2882 virtual int max_match() OVERRIDE { return capture_->max_match(); } |
| 2883 int index() { return capture_->index(); } | 2883 int index() { return capture_->index(); } |
| 2884 RegExpCapture* capture() { return capture_; } | 2884 RegExpCapture* capture() { return capture_; } |
| 2885 private: | 2885 private: |
| 2886 RegExpCapture* capture_; | 2886 RegExpCapture* capture_; |
| 2887 }; | 2887 }; |
| 2888 | 2888 |
| 2889 | 2889 |
| 2890 class RegExpEmpty V8_FINAL : public RegExpTree { | 2890 class RegExpEmpty FINAL : public RegExpTree { |
| 2891 public: | 2891 public: |
| 2892 RegExpEmpty() { } | 2892 RegExpEmpty() { } |
| 2893 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; | 2893 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; |
| 2894 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2894 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
| 2895 RegExpNode* on_success) V8_OVERRIDE; | 2895 RegExpNode* on_success) OVERRIDE; |
| 2896 virtual RegExpEmpty* AsEmpty() V8_OVERRIDE; | 2896 virtual RegExpEmpty* AsEmpty() OVERRIDE; |
| 2897 virtual bool IsEmpty() V8_OVERRIDE; | 2897 virtual bool IsEmpty() OVERRIDE; |
| 2898 virtual int min_match() V8_OVERRIDE { return 0; } | 2898 virtual int min_match() OVERRIDE { return 0; } |
| 2899 virtual int max_match() V8_OVERRIDE { return 0; } | 2899 virtual int max_match() OVERRIDE { return 0; } |
| 2900 static RegExpEmpty* GetInstance() { | 2900 static RegExpEmpty* GetInstance() { |
| 2901 static RegExpEmpty* instance = ::new RegExpEmpty(); | 2901 static RegExpEmpty* instance = ::new RegExpEmpty(); |
| 2902 return instance; | 2902 return instance; |
| 2903 } | 2903 } |
| 2904 }; | 2904 }; |
| 2905 | 2905 |
| 2906 | 2906 |
| 2907 // ---------------------------------------------------------------------------- | 2907 // ---------------------------------------------------------------------------- |
| 2908 // Out-of-line inline constructors (to side-step cyclic dependencies). | 2908 // Out-of-line inline constructors (to side-step cyclic dependencies). |
| 2909 | 2909 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2933 // Individual AST nodes. | 2933 // Individual AST nodes. |
| 2934 #define DEF_VISIT(type) \ | 2934 #define DEF_VISIT(type) \ |
| 2935 virtual void Visit##type(type* node) = 0; | 2935 virtual void Visit##type(type* node) = 0; |
| 2936 AST_NODE_LIST(DEF_VISIT) | 2936 AST_NODE_LIST(DEF_VISIT) |
| 2937 #undef DEF_VISIT | 2937 #undef DEF_VISIT |
| 2938 }; | 2938 }; |
| 2939 | 2939 |
| 2940 | 2940 |
| 2941 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ | 2941 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ |
| 2942 public: \ | 2942 public: \ |
| 2943 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \ | 2943 virtual void Visit(AstNode* node) FINAL OVERRIDE { \ |
| 2944 if (!CheckStackOverflow()) node->Accept(this); \ | 2944 if (!CheckStackOverflow()) node->Accept(this); \ |
| 2945 } \ | 2945 } \ |
| 2946 \ | 2946 \ |
| 2947 void SetStackOverflow() { stack_overflow_ = true; } \ | 2947 void SetStackOverflow() { stack_overflow_ = true; } \ |
| 2948 void ClearStackOverflow() { stack_overflow_ = false; } \ | 2948 void ClearStackOverflow() { stack_overflow_ = false; } \ |
| 2949 bool HasStackOverflow() const { return stack_overflow_; } \ | 2949 bool HasStackOverflow() const { return stack_overflow_; } \ |
| 2950 \ | 2950 \ |
| 2951 bool CheckStackOverflow() { \ | 2951 bool CheckStackOverflow() { \ |
| 2952 if (stack_overflow_) return true; \ | 2952 if (stack_overflow_) return true; \ |
| 2953 StackLimitCheck check(zone_->isolate()); \ | 2953 StackLimitCheck check(zone_->isolate()); \ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3013 AST_NODE_LIST(DEF_VISIT) | 3013 AST_NODE_LIST(DEF_VISIT) |
| 3014 #undef DEF_VISIT | 3014 #undef DEF_VISIT |
| 3015 }; | 3015 }; |
| 3016 | 3016 |
| 3017 | 3017 |
| 3018 | 3018 |
| 3019 // ---------------------------------------------------------------------------- | 3019 // ---------------------------------------------------------------------------- |
| 3020 // AstNode factory | 3020 // AstNode factory |
| 3021 | 3021 |
| 3022 template<class Visitor> | 3022 template<class Visitor> |
| 3023 class AstNodeFactory V8_FINAL BASE_EMBEDDED { | 3023 class AstNodeFactory FINAL BASE_EMBEDDED { |
| 3024 public: | 3024 public: |
| 3025 AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory, | 3025 AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory, |
| 3026 AstNode::IdGen* id_gen) | 3026 AstNode::IdGen* id_gen) |
| 3027 : zone_(zone), ast_value_factory_(ast_value_factory), id_gen_(id_gen) {} | 3027 : zone_(zone), ast_value_factory_(ast_value_factory), id_gen_(id_gen) {} |
| 3028 | 3028 |
| 3029 Visitor* visitor() { return &visitor_; } | 3029 Visitor* visitor() { return &visitor_; } |
| 3030 | 3030 |
| 3031 #define VISIT_AND_RETURN(NodeType, node) \ | 3031 #define VISIT_AND_RETURN(NodeType, node) \ |
| 3032 visitor_.Visit##NodeType((node)); \ | 3032 visitor_.Visit##NodeType((node)); \ |
| 3033 return node; | 3033 return node; |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3478 Zone* zone_; | 3478 Zone* zone_; |
| 3479 Visitor visitor_; | 3479 Visitor visitor_; |
| 3480 AstValueFactory* ast_value_factory_; | 3480 AstValueFactory* ast_value_factory_; |
| 3481 AstNode::IdGen* id_gen_; | 3481 AstNode::IdGen* id_gen_; |
| 3482 }; | 3482 }; |
| 3483 | 3483 |
| 3484 | 3484 |
| 3485 } } // namespace v8::internal | 3485 } } // namespace v8::internal |
| 3486 | 3486 |
| 3487 #endif // V8_AST_H_ | 3487 #endif // V8_AST_H_ |
| OLD | NEW |