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

Side by Side Diff: src/ast.h

Issue 652543006: Revert "Assign bailout and type feedback IDs in a post-pass" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « BUILD.gn ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 private: 192 private:
193 Flags flags_; 193 Flags flags_;
194 int node_count_; 194 int node_count_;
195 int feedback_slots_; 195 int feedback_slots_;
196 int ic_feedback_slots_; 196 int ic_feedback_slots_;
197 }; 197 };
198 198
199 199
200 class AstNode: public ZoneObject { 200 class AstNode: public ZoneObject {
201 public: 201 public:
202 // For generating IDs for AstNodes.
203 class IdGen {
204 public:
205 IdGen() : id_(BailoutId::FirstUsable().ToInt()) {}
206
207 int ReserveIdRange(int n) {
208 int tmp = id_;
209 id_ += n;
210 return tmp;
211 }
212
213 private:
214 int id_;
215
216 DISALLOW_COPY_AND_ASSIGN(IdGen);
217 };
218
202 #define DECLARE_TYPE_ENUM(type) k##type, 219 #define DECLARE_TYPE_ENUM(type) k##type,
203 enum NodeType { 220 enum NodeType {
204 AST_NODE_LIST(DECLARE_TYPE_ENUM) 221 AST_NODE_LIST(DECLARE_TYPE_ENUM)
205 kInvalid = -1 222 kInvalid = -1
206 }; 223 };
207 #undef DECLARE_TYPE_ENUM 224 #undef DECLARE_TYPE_ENUM
208 225
209 void* operator new(size_t size, Zone* zone) { 226 void* operator new(size_t size, Zone* zone) {
210 return zone->New(static_cast<int>(size)); 227 return zone->New(static_cast<int>(size));
211 } 228 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 398 }
382 virtual IcCheckType GetKeyType() { 399 virtual IcCheckType GetKeyType() {
383 UNREACHABLE(); 400 UNREACHABLE();
384 return ELEMENT; 401 return ELEMENT;
385 } 402 }
386 403
387 // TODO(rossberg): this should move to its own AST node eventually. 404 // TODO(rossberg): this should move to its own AST node eventually.
388 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 405 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
389 byte to_boolean_types() const { return to_boolean_types_; } 406 byte to_boolean_types() const { return to_boolean_types_; }
390 407
391 void set_base_id(int id) { base_id_ = id; } 408 BailoutId id() const { return BailoutId(base_id() + 0); }
392 static int num_ids() { return parent_num_ids() + 2; } 409 TypeFeedbackId test_id() const { return TypeFeedbackId(base_id() + 1); }
393 BailoutId id() const { return BailoutId(local_id(0)); }
394 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); }
395 410
396 protected: 411 protected:
397 Expression(Zone* zone, int pos) 412 Expression(Zone* zone, int pos, int num_ids_needed_by_subclass, IdGen* id_gen)
398 : AstNode(pos), 413 : AstNode(pos),
399 base_id_(BailoutId::None().ToInt()), 414 base_id_(
415 id_gen->ReserveIdRange(num_ids_needed_by_subclass + num_ids())),
400 bounds_(Bounds::Unbounded(zone)), 416 bounds_(Bounds::Unbounded(zone)),
401 is_parenthesized_(false), 417 is_parenthesized_(false),
402 is_multi_parenthesized_(false) {} 418 is_multi_parenthesized_(false) {}
403 static int parent_num_ids() { return 0; }
404 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } 419 void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
405 420
406 int base_id() const { 421 static int num_ids() { return 2; }
407 DCHECK(!BailoutId(base_id_).IsNone()); 422 int base_id() const { return base_id_; }
408 return base_id_;
409 }
410 423
411 private: 424 private:
412 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 425 const int base_id_;
413
414 int base_id_;
415 Bounds bounds_; 426 Bounds bounds_;
416 byte to_boolean_types_; 427 byte to_boolean_types_;
417 bool is_parenthesized_ : 1; 428 bool is_parenthesized_ : 1;
418 bool is_multi_parenthesized_ : 1; 429 bool is_multi_parenthesized_ : 1;
419 }; 430 };
420 431
421 432
422 class BreakableStatement : public Statement { 433 class BreakableStatement : public Statement {
423 public: 434 public:
424 enum BreakableType { 435 enum BreakableType {
(...skipping 11 matching lines...) Expand all
436 } 447 }
437 448
438 // Code generation 449 // Code generation
439 Label* break_target() { return &break_target_; } 450 Label* break_target() { return &break_target_; }
440 451
441 // Testers. 452 // Testers.
442 bool is_target_for_anonymous() const { 453 bool is_target_for_anonymous() const {
443 return breakable_type_ == TARGET_FOR_ANONYMOUS; 454 return breakable_type_ == TARGET_FOR_ANONYMOUS;
444 } 455 }
445 456
446 void set_base_id(int id) { base_id_ = id; } 457 BailoutId EntryId() const { return BailoutId(base_id() + 0); }
447 static int num_ids() { return parent_num_ids() + 2; } 458 BailoutId ExitId() const { return BailoutId(base_id() + 1); }
448 BailoutId EntryId() const { return BailoutId(local_id(0)); }
449 BailoutId ExitId() const { return BailoutId(local_id(1)); }
450 459
451 protected: 460 protected:
452 BreakableStatement(Zone* zone, ZoneList<const AstRawString*>* labels, 461 BreakableStatement(Zone* zone, ZoneList<const AstRawString*>* labels,
453 BreakableType breakable_type, int position) 462 BreakableType breakable_type, int position,
463 int num_ids_needed_by_subclass, IdGen* id_gen)
454 : Statement(zone, position), 464 : Statement(zone, position),
455 labels_(labels), 465 labels_(labels),
456 breakable_type_(breakable_type), 466 breakable_type_(breakable_type),
457 base_id_(BailoutId::None().ToInt()) { 467 base_id_(
468 id_gen->ReserveIdRange(num_ids_needed_by_subclass + num_ids())) {
458 DCHECK(labels == NULL || labels->length() > 0); 469 DCHECK(labels == NULL || labels->length() > 0);
459 } 470 }
460 static int parent_num_ids() { return 0; }
461 471
462 int base_id() const { 472 static int num_ids() { return 2; }
463 DCHECK(!BailoutId(base_id_).IsNone()); 473 int base_id() const { return base_id_; }
464 return base_id_;
465 }
466 474
467 private: 475 private:
468 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
469
470 ZoneList<const AstRawString*>* labels_; 476 ZoneList<const AstRawString*>* labels_;
471 BreakableType breakable_type_; 477 BreakableType breakable_type_;
472 Label break_target_; 478 Label break_target_;
473 int base_id_; 479 const int base_id_;
474 }; 480 };
475 481
476 482
477 class Block FINAL : public BreakableStatement { 483 class Block FINAL : public BreakableStatement {
478 public: 484 public:
479 DECLARE_NODE_TYPE(Block) 485 DECLARE_NODE_TYPE(Block)
480 486
481 void AddStatement(Statement* statement, Zone* zone) { 487 void AddStatement(Statement* statement, Zone* zone) {
482 statements_.Add(statement, zone); 488 statements_.Add(statement, zone);
483 } 489 }
484 490
485 ZoneList<Statement*>* statements() { return &statements_; } 491 ZoneList<Statement*>* statements() { return &statements_; }
486 bool is_initializer_block() const { return is_initializer_block_; } 492 bool is_initializer_block() const { return is_initializer_block_; }
487 493
488 static int num_ids() { return parent_num_ids() + 1; } 494 BailoutId DeclsId() const { return BailoutId(base_id() + 0); }
489 BailoutId DeclsId() const { return BailoutId(local_id(0)); }
490 495
491 virtual bool IsJump() const OVERRIDE { 496 virtual bool IsJump() const OVERRIDE {
492 return !statements_.is_empty() && statements_.last()->IsJump() 497 return !statements_.is_empty() && statements_.last()->IsJump()
493 && labels() == NULL; // Good enough as an approximation... 498 && labels() == NULL; // Good enough as an approximation...
494 } 499 }
495 500
496 Scope* scope() const { return scope_; } 501 Scope* scope() const { return scope_; }
497 void set_scope(Scope* scope) { scope_ = scope; } 502 void set_scope(Scope* scope) { scope_ = scope; }
498 503
499 protected: 504 protected:
500 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, 505 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
501 bool is_initializer_block, int pos) 506 bool is_initializer_block, int pos, IdGen* id_gen)
502 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), 507 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos, num_ids(),
508 id_gen),
503 statements_(capacity, zone), 509 statements_(capacity, zone),
504 is_initializer_block_(is_initializer_block), 510 is_initializer_block_(is_initializer_block),
505 scope_(NULL) {} 511 scope_(NULL) {}
506 static int parent_num_ids() { return BreakableStatement::num_ids(); } 512
513 static int num_ids() { return 1; }
514 int base_id() const {
515 return BreakableStatement::base_id() + BreakableStatement::num_ids();
516 }
507 517
508 private: 518 private:
509 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
510
511 ZoneList<Statement*> statements_; 519 ZoneList<Statement*> statements_;
512 bool is_initializer_block_; 520 bool is_initializer_block_;
513 Scope* scope_; 521 Scope* scope_;
514 }; 522 };
515 523
516 524
517 class Declaration : public AstNode { 525 class Declaration : public AstNode {
518 public: 526 public:
519 VariableProxy* proxy() const { return proxy_; } 527 VariableProxy* proxy() const { return proxy_; }
520 VariableMode mode() const { return mode_; } 528 VariableMode mode() const { return mode_; }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 756
749 class IterationStatement : public BreakableStatement { 757 class IterationStatement : public BreakableStatement {
750 public: 758 public:
751 // Type testing & conversion. 759 // Type testing & conversion.
752 virtual IterationStatement* AsIterationStatement() FINAL OVERRIDE { 760 virtual IterationStatement* AsIterationStatement() FINAL OVERRIDE {
753 return this; 761 return this;
754 } 762 }
755 763
756 Statement* body() const { return body_; } 764 Statement* body() const { return body_; }
757 765
758 static int num_ids() { return parent_num_ids() + 1; } 766 BailoutId OsrEntryId() const { return BailoutId(base_id() + 0); }
759 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); }
760 virtual BailoutId ContinueId() const = 0; 767 virtual BailoutId ContinueId() const = 0;
761 virtual BailoutId StackCheckId() const = 0; 768 virtual BailoutId StackCheckId() const = 0;
762 769
763 // Code generation 770 // Code generation
764 Label* continue_target() { return &continue_target_; } 771 Label* continue_target() { return &continue_target_; }
765 772
766 protected: 773 protected:
767 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 774 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
768 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), 775 int num_ids_needed_by_subclass, IdGen* id_gen)
776 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos,
777 num_ids_needed_by_subclass + num_ids(), id_gen),
769 body_(NULL) {} 778 body_(NULL) {}
770 static int parent_num_ids() { return BreakableStatement::num_ids(); } 779
771 void Initialize(Statement* body) { body_ = body; } 780 void Initialize(Statement* body) {
781 body_ = body;
782 }
783
784 static int num_ids() { return 1; }
785 int base_id() const {
786 return BreakableStatement::base_id() + BreakableStatement::num_ids();
787 }
772 788
773 private: 789 private:
774 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
775
776 Statement* body_; 790 Statement* body_;
777 Label continue_target_; 791 Label continue_target_;
778 }; 792 };
779 793
780 794
781 class DoWhileStatement FINAL : public IterationStatement { 795 class DoWhileStatement FINAL : public IterationStatement {
782 public: 796 public:
783 DECLARE_NODE_TYPE(DoWhileStatement) 797 DECLARE_NODE_TYPE(DoWhileStatement)
784 798
785 void Initialize(Expression* cond, Statement* body) { 799 void Initialize(Expression* cond, Statement* body) {
786 IterationStatement::Initialize(body); 800 IterationStatement::Initialize(body);
787 cond_ = cond; 801 cond_ = cond;
788 } 802 }
789 803
790 Expression* cond() const { return cond_; } 804 Expression* cond() const { return cond_; }
791 805
792 static int num_ids() { return parent_num_ids() + 2; }
793 virtual BailoutId ContinueId() const OVERRIDE { 806 virtual BailoutId ContinueId() const OVERRIDE {
794 return BailoutId(local_id(0)); 807 return BailoutId(base_id() + 0);
795 } 808 }
796 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } 809 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); }
797 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } 810 BailoutId BackEdgeId() const { return BailoutId(base_id() + 1); }
798 811
799 protected: 812 protected:
800 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 813 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
801 : IterationStatement(zone, labels, pos), cond_(NULL) {} 814 IdGen* id_gen)
802 static int parent_num_ids() { return IterationStatement::num_ids(); } 815 : IterationStatement(zone, labels, pos, num_ids(), id_gen), cond_(NULL) {}
816
817 static int num_ids() { return 2; }
818 int base_id() const {
819 return IterationStatement::base_id() + IterationStatement::num_ids();
820 }
803 821
804 private: 822 private:
805 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
806
807 Expression* cond_; 823 Expression* cond_;
808 }; 824 };
809 825
810 826
811 class WhileStatement FINAL : public IterationStatement { 827 class WhileStatement FINAL : public IterationStatement {
812 public: 828 public:
813 DECLARE_NODE_TYPE(WhileStatement) 829 DECLARE_NODE_TYPE(WhileStatement)
814 830
815 void Initialize(Expression* cond, Statement* body) { 831 void Initialize(Expression* cond, Statement* body) {
816 IterationStatement::Initialize(body); 832 IterationStatement::Initialize(body);
817 cond_ = cond; 833 cond_ = cond;
818 } 834 }
819 835
820 Expression* cond() const { return cond_; } 836 Expression* cond() const { return cond_; }
821 bool may_have_function_literal() const { 837 bool may_have_function_literal() const {
822 return may_have_function_literal_; 838 return may_have_function_literal_;
823 } 839 }
824 void set_may_have_function_literal(bool value) { 840 void set_may_have_function_literal(bool value) {
825 may_have_function_literal_ = value; 841 may_have_function_literal_ = value;
826 } 842 }
827 843
828 static int num_ids() { return parent_num_ids() + 1; }
829 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 844 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
830 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 845 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
831 BailoutId BodyId() const { return BailoutId(local_id(0)); } 846 BailoutId BodyId() const { return BailoutId(base_id() + 0); }
832 847
833 protected: 848 protected:
834 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 849 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
835 : IterationStatement(zone, labels, pos), 850 IdGen* id_gen)
851 : IterationStatement(zone, labels, pos, num_ids(), id_gen),
836 cond_(NULL), 852 cond_(NULL),
837 may_have_function_literal_(true) {} 853 may_have_function_literal_(true) {}
838 static int parent_num_ids() { return IterationStatement::num_ids(); } 854
855 static int num_ids() { return 1; }
856 int base_id() const {
857 return IterationStatement::base_id() + IterationStatement::num_ids();
858 }
839 859
840 private: 860 private:
841 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
842
843 Expression* cond_; 861 Expression* cond_;
844 862
845 // True if there is a function literal subexpression in the condition. 863 // True if there is a function literal subexpression in the condition.
846 bool may_have_function_literal_; 864 bool may_have_function_literal_;
847 }; 865 };
848 866
849 867
850 class ForStatement FINAL : public IterationStatement { 868 class ForStatement FINAL : public IterationStatement {
851 public: 869 public:
852 DECLARE_NODE_TYPE(ForStatement) 870 DECLARE_NODE_TYPE(ForStatement)
(...skipping 12 matching lines...) Expand all
865 Expression* cond() const { return cond_; } 883 Expression* cond() const { return cond_; }
866 Statement* next() const { return next_; } 884 Statement* next() const { return next_; }
867 885
868 bool may_have_function_literal() const { 886 bool may_have_function_literal() const {
869 return may_have_function_literal_; 887 return may_have_function_literal_;
870 } 888 }
871 void set_may_have_function_literal(bool value) { 889 void set_may_have_function_literal(bool value) {
872 may_have_function_literal_ = value; 890 may_have_function_literal_ = value;
873 } 891 }
874 892
875 static int num_ids() { return parent_num_ids() + 2; }
876 virtual BailoutId ContinueId() const OVERRIDE { 893 virtual BailoutId ContinueId() const OVERRIDE {
877 return BailoutId(local_id(0)); 894 return BailoutId(base_id() + 0);
878 } 895 }
879 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 896 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
880 BailoutId BodyId() const { return BailoutId(local_id(1)); } 897 BailoutId BodyId() const { return BailoutId(base_id() + 1); }
881 898
882 bool is_fast_smi_loop() { return loop_variable_ != NULL; } 899 bool is_fast_smi_loop() { return loop_variable_ != NULL; }
883 Variable* loop_variable() { return loop_variable_; } 900 Variable* loop_variable() { return loop_variable_; }
884 void set_loop_variable(Variable* var) { loop_variable_ = var; } 901 void set_loop_variable(Variable* var) { loop_variable_ = var; }
885 902
886 protected: 903 protected:
887 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 904 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
888 : IterationStatement(zone, labels, pos), 905 IdGen* id_gen)
906 : IterationStatement(zone, labels, pos, num_ids(), id_gen),
889 init_(NULL), 907 init_(NULL),
890 cond_(NULL), 908 cond_(NULL),
891 next_(NULL), 909 next_(NULL),
892 may_have_function_literal_(true), 910 may_have_function_literal_(true),
893 loop_variable_(NULL) {} 911 loop_variable_(NULL) {}
894 static int parent_num_ids() { return IterationStatement::num_ids(); } 912
913 static int num_ids() { return 2; }
914 int base_id() const {
915 return IterationStatement::base_id() + IterationStatement::num_ids();
916 }
895 917
896 private: 918 private:
897 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
898
899 Statement* init_; 919 Statement* init_;
900 Expression* cond_; 920 Expression* cond_;
901 Statement* next_; 921 Statement* next_;
902 922
903 // True if there is a function literal subexpression in the condition. 923 // True if there is a function literal subexpression in the condition.
904 bool may_have_function_literal_; 924 bool may_have_function_literal_;
905 Variable* loop_variable_; 925 Variable* loop_variable_;
906 }; 926 };
907 927
908 928
909 class ForEachStatement : public IterationStatement { 929 class ForEachStatement : public IterationStatement {
910 public: 930 public:
911 enum VisitMode { 931 enum VisitMode {
912 ENUMERATE, // for (each in subject) body; 932 ENUMERATE, // for (each in subject) body;
913 ITERATE // for (each of subject) body; 933 ITERATE // for (each of subject) body;
914 }; 934 };
915 935
916 void Initialize(Expression* each, Expression* subject, Statement* body) { 936 void Initialize(Expression* each, Expression* subject, Statement* body) {
917 IterationStatement::Initialize(body); 937 IterationStatement::Initialize(body);
918 each_ = each; 938 each_ = each;
919 subject_ = subject; 939 subject_ = subject;
920 } 940 }
921 941
922 Expression* each() const { return each_; } 942 Expression* each() const { return each_; }
923 Expression* subject() const { return subject_; } 943 Expression* subject() const { return subject_; }
924 944
925 protected: 945 protected:
926 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 946 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
927 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} 947 int num_ids_needed_by_subclass, IdGen* id_gen)
948 : IterationStatement(zone, labels, pos, num_ids_needed_by_subclass,
949 id_gen),
950 each_(NULL),
951 subject_(NULL) {}
928 952
929 private: 953 private:
930 Expression* each_; 954 Expression* each_;
931 Expression* subject_; 955 Expression* subject_;
932 }; 956 };
933 957
934 958
935 class ForInStatement FINAL : public ForEachStatement { 959 class ForInStatement FINAL : public ForEachStatement {
936 public: 960 public:
937 DECLARE_NODE_TYPE(ForInStatement) 961 DECLARE_NODE_TYPE(ForInStatement)
(...skipping 12 matching lines...) Expand all
950 974
951 FeedbackVectorSlot ForInFeedbackSlot() { 975 FeedbackVectorSlot ForInFeedbackSlot() {
952 DCHECK(!for_in_feedback_slot_.IsInvalid()); 976 DCHECK(!for_in_feedback_slot_.IsInvalid());
953 return for_in_feedback_slot_; 977 return for_in_feedback_slot_;
954 } 978 }
955 979
956 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 980 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
957 ForInType for_in_type() const { return for_in_type_; } 981 ForInType for_in_type() const { return for_in_type_; }
958 void set_for_in_type(ForInType type) { for_in_type_ = type; } 982 void set_for_in_type(ForInType type) { for_in_type_ = type; }
959 983
960 static int num_ids() { return parent_num_ids() + 2; } 984 BailoutId BodyId() const { return BailoutId(base_id() + 0); }
961 BailoutId BodyId() const { return BailoutId(local_id(0)); } 985 BailoutId PrepareId() const { return BailoutId(base_id() + 1); }
962 BailoutId PrepareId() const { return BailoutId(local_id(1)); }
963 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 986 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
964 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 987 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
965 988
966 protected: 989 protected:
967 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 990 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
968 : ForEachStatement(zone, labels, pos), 991 IdGen* id_gen)
992 : ForEachStatement(zone, labels, pos, num_ids(), id_gen),
969 for_in_type_(SLOW_FOR_IN), 993 for_in_type_(SLOW_FOR_IN),
970 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {} 994 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {}
971 static int parent_num_ids() { return ForEachStatement::num_ids(); } 995
996 static int num_ids() { return 2; }
997 int base_id() const {
998 return ForEachStatement::base_id() + ForEachStatement::num_ids();
999 }
972 1000
973 private: 1001 private:
974 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
975
976 ForInType for_in_type_; 1002 ForInType for_in_type_;
977 FeedbackVectorSlot for_in_feedback_slot_; 1003 FeedbackVectorSlot for_in_feedback_slot_;
978 }; 1004 };
979 1005
980 1006
981 class ForOfStatement FINAL : public ForEachStatement { 1007 class ForOfStatement FINAL : public ForEachStatement {
982 public: 1008 public:
983 DECLARE_NODE_TYPE(ForOfStatement) 1009 DECLARE_NODE_TYPE(ForOfStatement)
984 1010
985 void Initialize(Expression* each, 1011 void Initialize(Expression* each,
(...skipping 30 matching lines...) Expand all
1016 } 1042 }
1017 1043
1018 // each = result.value 1044 // each = result.value
1019 Expression* assign_each() const { 1045 Expression* assign_each() const {
1020 return assign_each_; 1046 return assign_each_;
1021 } 1047 }
1022 1048
1023 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 1049 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
1024 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } 1050 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); }
1025 1051
1026 static int num_ids() { return parent_num_ids() + 1; } 1052 BailoutId BackEdgeId() const { return BailoutId(base_id() + 0); }
1027 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); }
1028 1053
1029 protected: 1054 protected:
1030 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 1055 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
1031 : ForEachStatement(zone, labels, pos), 1056 IdGen* id_gen)
1057 : ForEachStatement(zone, labels, pos, num_ids(), id_gen),
1032 assign_iterator_(NULL), 1058 assign_iterator_(NULL),
1033 next_result_(NULL), 1059 next_result_(NULL),
1034 result_done_(NULL), 1060 result_done_(NULL),
1035 assign_each_(NULL) {} 1061 assign_each_(NULL) {}
1036 static int parent_num_ids() { return ForEachStatement::num_ids(); } 1062
1063 static int num_ids() { return 1; }
1064 int base_id() const {
1065 return ForEachStatement::base_id() + ForEachStatement::num_ids();
1066 }
1037 1067
1038 private: 1068 private:
1039 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1040
1041 Expression* assign_iterator_; 1069 Expression* assign_iterator_;
1042 Expression* next_result_; 1070 Expression* next_result_;
1043 Expression* result_done_; 1071 Expression* result_done_;
1044 Expression* assign_each_; 1072 Expression* assign_each_;
1045 }; 1073 };
1046 1074
1047 1075
1048 class ExpressionStatement FINAL : public Statement { 1076 class ExpressionStatement FINAL : public Statement {
1049 public: 1077 public:
1050 DECLARE_NODE_TYPE(ExpressionStatement) 1078 DECLARE_NODE_TYPE(ExpressionStatement)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 DECLARE_NODE_TYPE(CaseClause) 1173 DECLARE_NODE_TYPE(CaseClause)
1146 1174
1147 bool is_default() const { return label_ == NULL; } 1175 bool is_default() const { return label_ == NULL; }
1148 Expression* label() const { 1176 Expression* label() const {
1149 CHECK(!is_default()); 1177 CHECK(!is_default());
1150 return label_; 1178 return label_;
1151 } 1179 }
1152 Label* body_target() { return &body_target_; } 1180 Label* body_target() { return &body_target_; }
1153 ZoneList<Statement*>* statements() const { return statements_; } 1181 ZoneList<Statement*>* statements() const { return statements_; }
1154 1182
1155 static int num_ids() { return parent_num_ids() + 2; } 1183 BailoutId EntryId() const { return BailoutId(base_id() + 0); }
1156 BailoutId EntryId() const { return BailoutId(local_id(0)); } 1184 TypeFeedbackId CompareId() { return TypeFeedbackId(base_id() + 1); }
1157 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); }
1158 1185
1159 Type* compare_type() { return compare_type_; } 1186 Type* compare_type() { return compare_type_; }
1160 void set_compare_type(Type* type) { compare_type_ = type; } 1187 void set_compare_type(Type* type) { compare_type_ = type; }
1161 1188
1162 protected:
1163 static int parent_num_ids() { return Expression::num_ids(); }
1164
1165 private: 1189 private:
1166 CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements, 1190 CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements,
1167 int pos); 1191 int pos, IdGen* id_gen);
1168 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1192
1193 static int num_ids() { return 2; }
1194 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
1169 1195
1170 Expression* label_; 1196 Expression* label_;
1171 Label body_target_; 1197 Label body_target_;
1172 ZoneList<Statement*>* statements_; 1198 ZoneList<Statement*>* statements_;
1173 Type* compare_type_; 1199 Type* compare_type_;
1174 }; 1200 };
1175 1201
1176 1202
1177 class SwitchStatement FINAL : public BreakableStatement { 1203 class SwitchStatement FINAL : public BreakableStatement {
1178 public: 1204 public:
1179 DECLARE_NODE_TYPE(SwitchStatement) 1205 DECLARE_NODE_TYPE(SwitchStatement)
1180 1206
1181 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1207 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1182 tag_ = tag; 1208 tag_ = tag;
1183 cases_ = cases; 1209 cases_ = cases;
1184 } 1210 }
1185 1211
1186 Expression* tag() const { return tag_; } 1212 Expression* tag() const { return tag_; }
1187 ZoneList<CaseClause*>* cases() const { return cases_; } 1213 ZoneList<CaseClause*>* cases() const { return cases_; }
1188 1214
1189 protected: 1215 protected:
1190 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 1216 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
1191 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), 1217 IdGen* id_gen)
1218 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, 0, id_gen),
1192 tag_(NULL), 1219 tag_(NULL),
1193 cases_(NULL) {} 1220 cases_(NULL) {}
1194 1221
1195 private: 1222 private:
1196 Expression* tag_; 1223 Expression* tag_;
1197 ZoneList<CaseClause*>* cases_; 1224 ZoneList<CaseClause*>* cases_;
1198 }; 1225 };
1199 1226
1200 1227
1201 // If-statements always have non-null references to their then- and 1228 // If-statements always have non-null references to their then- and
(...skipping 10 matching lines...) Expand all
1212 1239
1213 Expression* condition() const { return condition_; } 1240 Expression* condition() const { return condition_; }
1214 Statement* then_statement() const { return then_statement_; } 1241 Statement* then_statement() const { return then_statement_; }
1215 Statement* else_statement() const { return else_statement_; } 1242 Statement* else_statement() const { return else_statement_; }
1216 1243
1217 virtual bool IsJump() const OVERRIDE { 1244 virtual bool IsJump() const OVERRIDE {
1218 return HasThenStatement() && then_statement()->IsJump() 1245 return HasThenStatement() && then_statement()->IsJump()
1219 && HasElseStatement() && else_statement()->IsJump(); 1246 && HasElseStatement() && else_statement()->IsJump();
1220 } 1247 }
1221 1248
1222 void set_base_id(int id) { base_id_ = id; } 1249 BailoutId IfId() const { return BailoutId(base_id() + 0); }
1223 static int num_ids() { return parent_num_ids() + 3; } 1250 BailoutId ThenId() const { return BailoutId(base_id() + 1); }
1224 BailoutId IfId() const { return BailoutId(local_id(0)); } 1251 BailoutId ElseId() const { return BailoutId(base_id() + 2); }
1225 BailoutId ThenId() const { return BailoutId(local_id(1)); }
1226 BailoutId ElseId() const { return BailoutId(local_id(2)); }
1227 1252
1228 protected: 1253 protected:
1229 IfStatement(Zone* zone, Expression* condition, Statement* then_statement, 1254 IfStatement(Zone* zone, Expression* condition, Statement* then_statement,
1230 Statement* else_statement, int pos) 1255 Statement* else_statement, int pos, IdGen* id_gen)
1231 : Statement(zone, pos), 1256 : Statement(zone, pos),
1232 condition_(condition), 1257 condition_(condition),
1233 then_statement_(then_statement), 1258 then_statement_(then_statement),
1234 else_statement_(else_statement), 1259 else_statement_(else_statement),
1235 base_id_(BailoutId::None().ToInt()) {} 1260 base_id_(id_gen->ReserveIdRange(num_ids())) {}
1236 static int parent_num_ids() { return 0; }
1237 1261
1238 int base_id() const { 1262 static int num_ids() { return 3; }
1239 DCHECK(!BailoutId(base_id_).IsNone()); 1263 int base_id() const { return base_id_; }
1240 return base_id_;
1241 }
1242 1264
1243 private: 1265 private:
1244 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1245
1246 Expression* condition_; 1266 Expression* condition_;
1247 Statement* then_statement_; 1267 Statement* then_statement_;
1248 Statement* else_statement_; 1268 Statement* else_statement_;
1249 int base_id_; 1269 const int base_id_;
1250 }; 1270 };
1251 1271
1252 1272
1253 // NOTE: TargetCollectors are represented as nodes to fit in the target 1273 // NOTE: TargetCollectors are represented as nodes to fit in the target
1254 // stack in the compiler; this should probably be reworked. 1274 // stack in the compiler; this should probably be reworked.
1255 class TargetCollector FINAL : public AstNode { 1275 class TargetCollector FINAL : public AstNode {
1256 public: 1276 public:
1257 explicit TargetCollector(Zone* zone) 1277 explicit TargetCollector(Zone* zone)
1258 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { } 1278 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { }
1259 1279
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 1363
1344 private: 1364 private:
1345 Block* finally_block_; 1365 Block* finally_block_;
1346 }; 1366 };
1347 1367
1348 1368
1349 class DebuggerStatement FINAL : public Statement { 1369 class DebuggerStatement FINAL : public Statement {
1350 public: 1370 public:
1351 DECLARE_NODE_TYPE(DebuggerStatement) 1371 DECLARE_NODE_TYPE(DebuggerStatement)
1352 1372
1353 void set_base_id(int id) { base_id_ = id; } 1373 BailoutId DebugBreakId() const { return BailoutId(base_id() + 0); }
1354 static int num_ids() { return parent_num_ids() + 1; }
1355 BailoutId DebugBreakId() const { return BailoutId(local_id(0)); }
1356 1374
1357 protected: 1375 protected:
1358 explicit DebuggerStatement(Zone* zone, int pos) 1376 explicit DebuggerStatement(Zone* zone, int pos, IdGen* id_gen)
1359 : Statement(zone, pos), base_id_(BailoutId::None().ToInt()) {} 1377 : Statement(zone, pos), base_id_(id_gen->ReserveIdRange(num_ids())) {}
1360 static int parent_num_ids() { return 0; }
1361 1378
1362 int base_id() const { 1379 static int num_ids() { return 1; }
1363 DCHECK(!BailoutId(base_id_).IsNone()); 1380 int base_id() const { return base_id_; }
1364 return base_id_;
1365 }
1366 1381
1367 private: 1382 private:
1368 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1383 const int base_id_;
1369
1370 int base_id_;
1371 }; 1384 };
1372 1385
1373 1386
1374 class EmptyStatement FINAL : public Statement { 1387 class EmptyStatement FINAL : public Statement {
1375 public: 1388 public:
1376 DECLARE_NODE_TYPE(EmptyStatement) 1389 DECLARE_NODE_TYPE(EmptyStatement)
1377 1390
1378 protected: 1391 protected:
1379 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} 1392 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {}
1380 }; 1393 };
(...skipping 25 matching lines...) Expand all
1406 } 1419 }
1407 1420
1408 Handle<Object> value() const { return value_->value(); } 1421 Handle<Object> value() const { return value_->value(); }
1409 const AstValue* raw_value() const { return value_; } 1422 const AstValue* raw_value() const { return value_; }
1410 1423
1411 // Support for using Literal as a HashMap key. NOTE: Currently, this works 1424 // Support for using Literal as a HashMap key. NOTE: Currently, this works
1412 // only for string and number literals! 1425 // only for string and number literals!
1413 uint32_t Hash(); 1426 uint32_t Hash();
1414 static bool Match(void* literal1, void* literal2); 1427 static bool Match(void* literal1, void* literal2);
1415 1428
1416 static int num_ids() { return parent_num_ids() + 1; }
1417 TypeFeedbackId LiteralFeedbackId() const { 1429 TypeFeedbackId LiteralFeedbackId() const {
1418 return TypeFeedbackId(local_id(0)); 1430 return TypeFeedbackId(base_id() + 0);
1419 } 1431 }
1420 1432
1421 protected: 1433 protected:
1422 Literal(Zone* zone, const AstValue* value, int position) 1434 Literal(Zone* zone, const AstValue* value, int position, IdGen* id_gen)
1423 : Expression(zone, position), value_(value) {} 1435 : Expression(zone, position, num_ids(), id_gen), value_(value) {}
1424 static int parent_num_ids() { return Expression::num_ids(); } 1436
1437 static int num_ids() { return 1; }
1438 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
1425 1439
1426 private: 1440 private:
1427 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1428
1429 const AstValue* value_; 1441 const AstValue* value_;
1430 }; 1442 };
1431 1443
1432 1444
1433 // Base class for literals that needs space in the corresponding JSFunction. 1445 // Base class for literals that needs space in the corresponding JSFunction.
1434 class MaterializedLiteral : public Expression { 1446 class MaterializedLiteral : public Expression {
1435 public: 1447 public:
1436 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } 1448 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; }
1437 1449
1438 int literal_index() { return literal_index_; } 1450 int literal_index() { return literal_index_; }
1439 1451
1440 int depth() const { 1452 int depth() const {
1441 // only callable after initialization. 1453 // only callable after initialization.
1442 DCHECK(depth_ >= 1); 1454 DCHECK(depth_ >= 1);
1443 return depth_; 1455 return depth_;
1444 } 1456 }
1445 1457
1446 protected: 1458 protected:
1447 MaterializedLiteral(Zone* zone, int literal_index, int pos) 1459 MaterializedLiteral(Zone* zone, int literal_index, int pos,
1448 : Expression(zone, pos), 1460 int num_ids_needed_by_subclass, IdGen* id_gen)
1461 : Expression(zone, pos, num_ids_needed_by_subclass, id_gen),
1449 literal_index_(literal_index), 1462 literal_index_(literal_index),
1450 is_simple_(false), 1463 is_simple_(false),
1451 depth_(0) {} 1464 depth_(0) {}
1452 1465
1453 // A materialized literal is simple if the values consist of only 1466 // A materialized literal is simple if the values consist of only
1454 // constants and simple object and array literals. 1467 // constants and simple object and array literals.
1455 bool is_simple() const { return is_simple_; } 1468 bool is_simple() const { return is_simple_; }
1456 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } 1469 void set_is_simple(bool is_simple) { is_simple_ = is_simple; }
1457 friend class CompileTimeValue; 1470 friend class CompileTimeValue;
1458 1471
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 }; 1581 };
1569 1582
1570 struct Accessors: public ZoneObject { 1583 struct Accessors: public ZoneObject {
1571 Accessors() : getter(NULL), setter(NULL) { } 1584 Accessors() : getter(NULL), setter(NULL) { }
1572 Expression* getter; 1585 Expression* getter;
1573 Expression* setter; 1586 Expression* setter;
1574 }; 1587 };
1575 1588
1576 protected: 1589 protected:
1577 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, 1590 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
1578 int boilerplate_properties, bool has_function, int pos) 1591 int boilerplate_properties, bool has_function, int pos,
1579 : MaterializedLiteral(zone, literal_index, pos), 1592 IdGen* id_gen)
1593 : MaterializedLiteral(zone, literal_index, pos, 0, id_gen),
1580 properties_(properties), 1594 properties_(properties),
1581 boilerplate_properties_(boilerplate_properties), 1595 boilerplate_properties_(boilerplate_properties),
1582 fast_elements_(false), 1596 fast_elements_(false),
1583 may_store_doubles_(false), 1597 may_store_doubles_(false),
1584 has_function_(has_function) {} 1598 has_function_(has_function) {}
1585 1599
1586 private: 1600 private:
1587 Handle<FixedArray> constant_properties_; 1601 Handle<FixedArray> constant_properties_;
1588 ZoneList<Property*>* properties_; 1602 ZoneList<Property*>* properties_;
1589 int boilerplate_properties_; 1603 int boilerplate_properties_;
1590 bool fast_elements_; 1604 bool fast_elements_;
1591 bool may_store_doubles_; 1605 bool may_store_doubles_;
1592 bool has_function_; 1606 bool has_function_;
1593 }; 1607 };
1594 1608
1595 1609
1596 // Node for capturing a regexp literal. 1610 // Node for capturing a regexp literal.
1597 class RegExpLiteral FINAL : public MaterializedLiteral { 1611 class RegExpLiteral FINAL : public MaterializedLiteral {
1598 public: 1612 public:
1599 DECLARE_NODE_TYPE(RegExpLiteral) 1613 DECLARE_NODE_TYPE(RegExpLiteral)
1600 1614
1601 Handle<String> pattern() const { return pattern_->string(); } 1615 Handle<String> pattern() const { return pattern_->string(); }
1602 Handle<String> flags() const { return flags_->string(); } 1616 Handle<String> flags() const { return flags_->string(); }
1603 1617
1604 protected: 1618 protected:
1605 RegExpLiteral(Zone* zone, const AstRawString* pattern, 1619 RegExpLiteral(Zone* zone, const AstRawString* pattern,
1606 const AstRawString* flags, int literal_index, int pos) 1620 const AstRawString* flags, int literal_index, int pos,
1607 : MaterializedLiteral(zone, literal_index, pos), 1621 IdGen* id_gen)
1622 : MaterializedLiteral(zone, literal_index, pos, 0, id_gen),
1608 pattern_(pattern), 1623 pattern_(pattern),
1609 flags_(flags) { 1624 flags_(flags) {
1610 set_depth(1); 1625 set_depth(1);
1611 } 1626 }
1612 1627
1613 private: 1628 private:
1614 const AstRawString* pattern_; 1629 const AstRawString* pattern_;
1615 const AstRawString* flags_; 1630 const AstRawString* flags_;
1616 }; 1631 };
1617 1632
1618 1633
1619 // An array literal has a literals object that is used 1634 // An array literal has a literals object that is used
1620 // for minimizing the work when constructing it at runtime. 1635 // for minimizing the work when constructing it at runtime.
1621 class ArrayLiteral FINAL : public MaterializedLiteral { 1636 class ArrayLiteral FINAL : public MaterializedLiteral {
1622 public: 1637 public:
1623 DECLARE_NODE_TYPE(ArrayLiteral) 1638 DECLARE_NODE_TYPE(ArrayLiteral)
1624 1639
1625 Handle<FixedArray> constant_elements() const { return constant_elements_; } 1640 Handle<FixedArray> constant_elements() const { return constant_elements_; }
1626 ZoneList<Expression*>* values() const { return values_; } 1641 ZoneList<Expression*>* values() const { return values_; }
1627 1642
1628 // Unlike other AST nodes, this number of bailout IDs allocated for an
1629 // ArrayLiteral can vary, so num_ids() is not a static method.
1630 int num_ids() const { return parent_num_ids() + values()->length(); }
1631
1632 // Return an AST id for an element that is used in simulate instructions. 1643 // Return an AST id for an element that is used in simulate instructions.
1633 BailoutId GetIdForElement(int i) { return BailoutId(local_id(i)); } 1644 BailoutId GetIdForElement(int i) { return BailoutId(base_id() + i); }
1634 1645
1635 // Populate the constant elements fixed array. 1646 // Populate the constant elements fixed array.
1636 void BuildConstantElements(Isolate* isolate); 1647 void BuildConstantElements(Isolate* isolate);
1637 1648
1638 // Assemble bitfield of flags for the CreateArrayLiteral helper. 1649 // Assemble bitfield of flags for the CreateArrayLiteral helper.
1639 int ComputeFlags() const { 1650 int ComputeFlags() const {
1640 int flags = depth() == 1 ? kShallowElements : kNoFlags; 1651 int flags = depth() == 1 ? kShallowElements : kNoFlags;
1641 flags |= ArrayLiteral::kDisableMementos; 1652 flags |= ArrayLiteral::kDisableMementos;
1642 return flags; 1653 return flags;
1643 } 1654 }
1644 1655
1645 enum Flags { 1656 enum Flags {
1646 kNoFlags = 0, 1657 kNoFlags = 0,
1647 kShallowElements = 1, 1658 kShallowElements = 1,
1648 kDisableMementos = 1 << 1 1659 kDisableMementos = 1 << 1
1649 }; 1660 };
1650 1661
1651 protected: 1662 protected:
1652 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index, 1663 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index,
1653 int pos) 1664 int pos, IdGen* id_gen)
1654 : MaterializedLiteral(zone, literal_index, pos), values_(values) {} 1665 : MaterializedLiteral(zone, literal_index, pos, num_ids(values), id_gen),
1655 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } 1666 values_(values) {}
1667
1668 static int num_ids(ZoneList<Expression*>* values) { return values->length(); }
1669 int base_id() const {
1670 return MaterializedLiteral::base_id() + MaterializedLiteral::num_ids();
1671 }
1656 1672
1657 private: 1673 private:
1658 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1659
1660 Handle<FixedArray> constant_elements_; 1674 Handle<FixedArray> constant_elements_;
1661 ZoneList<Expression*>* values_; 1675 ZoneList<Expression*>* values_;
1662 }; 1676 };
1663 1677
1664 1678
1665 class VariableProxy FINAL : public Expression { 1679 class VariableProxy FINAL : public Expression {
1666 public: 1680 public:
1667 DECLARE_NODE_TYPE(VariableProxy) 1681 DECLARE_NODE_TYPE(VariableProxy)
1668 1682
1669 virtual bool IsValidReferenceExpression() const OVERRIDE { 1683 virtual bool IsValidReferenceExpression() const OVERRIDE {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 } 1719 }
1706 virtual void SetFirstICFeedbackSlot(FeedbackVectorICSlot slot) { 1720 virtual void SetFirstICFeedbackSlot(FeedbackVectorICSlot slot) {
1707 variable_feedback_slot_ = slot; 1721 variable_feedback_slot_ = slot;
1708 } 1722 }
1709 1723
1710 FeedbackVectorICSlot VariableFeedbackSlot() { 1724 FeedbackVectorICSlot VariableFeedbackSlot() {
1711 return variable_feedback_slot_; 1725 return variable_feedback_slot_;
1712 } 1726 }
1713 1727
1714 protected: 1728 protected:
1715 VariableProxy(Zone* zone, Variable* var, int position); 1729 VariableProxy(Zone* zone, Variable* var, int position, IdGen* id_gen);
1716 1730
1717 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 1731 VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
1718 Interface* interface, int position); 1732 Interface* interface, int position, IdGen* id_gen);
1719 1733
1720 bool is_this_ : 1; 1734 bool is_this_ : 1;
1721 bool is_assigned_ : 1; 1735 bool is_assigned_ : 1;
1722 bool is_resolved_ : 1; 1736 bool is_resolved_ : 1;
1723 FeedbackVectorICSlot variable_feedback_slot_; 1737 FeedbackVectorICSlot variable_feedback_slot_;
1724 union { 1738 union {
1725 const AstRawString* raw_name_; // if !is_resolved_ 1739 const AstRawString* raw_name_; // if !is_resolved_
1726 Variable* var_; // if is_resolved_ 1740 Variable* var_; // if is_resolved_
1727 }; 1741 };
1728 Interface* interface_; 1742 Interface* interface_;
1729 }; 1743 };
1730 1744
1731 1745
1732 class Property FINAL : public Expression { 1746 class Property FINAL : public Expression {
1733 public: 1747 public:
1734 DECLARE_NODE_TYPE(Property) 1748 DECLARE_NODE_TYPE(Property)
1735 1749
1736 virtual bool IsValidReferenceExpression() const OVERRIDE { return true; } 1750 virtual bool IsValidReferenceExpression() const OVERRIDE { return true; }
1737 1751
1738 Expression* obj() const { return obj_; } 1752 Expression* obj() const { return obj_; }
1739 Expression* key() const { return key_; } 1753 Expression* key() const { return key_; }
1740 1754
1741 static int num_ids() { return parent_num_ids() + 2; } 1755 BailoutId LoadId() const { return BailoutId(base_id() + 0); }
1742 BailoutId LoadId() const { return BailoutId(local_id(0)); } 1756 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(base_id() + 1); }
1743 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); } 1757
1744 1758
1745 bool IsStringAccess() const { return is_string_access_; } 1759 bool IsStringAccess() const { return is_string_access_; }
1746 1760
1747 // Type feedback information. 1761 // Type feedback information.
1748 virtual bool IsMonomorphic() OVERRIDE { 1762 virtual bool IsMonomorphic() OVERRIDE {
1749 return receiver_types_.length() == 1; 1763 return receiver_types_.length() == 1;
1750 } 1764 }
1751 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 1765 virtual SmallMapList* GetReceiverTypes() OVERRIDE {
1752 return &receiver_types_; 1766 return &receiver_types_;
1753 } 1767 }
(...skipping 22 matching lines...) Expand all
1776 } 1790 }
1777 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { 1791 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) {
1778 property_feedback_slot_ = slot; 1792 property_feedback_slot_ = slot;
1779 } 1793 }
1780 1794
1781 FeedbackVectorICSlot PropertyFeedbackSlot() const { 1795 FeedbackVectorICSlot PropertyFeedbackSlot() const {
1782 return property_feedback_slot_; 1796 return property_feedback_slot_;
1783 } 1797 }
1784 1798
1785 protected: 1799 protected:
1786 Property(Zone* zone, Expression* obj, Expression* key, int pos) 1800 Property(Zone* zone, Expression* obj, Expression* key, int pos, IdGen* id_gen)
1787 : Expression(zone, pos), 1801 : Expression(zone, pos, num_ids(), id_gen),
1788 is_for_call_(false), 1802 is_for_call_(false),
1789 is_uninitialized_(false), 1803 is_uninitialized_(false),
1790 is_string_access_(false), 1804 is_string_access_(false),
1791 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), 1805 property_feedback_slot_(FeedbackVectorICSlot::Invalid()),
1792 obj_(obj), 1806 obj_(obj),
1793 key_(key) {} 1807 key_(key) {}
1794 static int parent_num_ids() { return Expression::num_ids(); } 1808
1809 static int num_ids() { return 2; }
1810 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
1795 1811
1796 private: 1812 private:
1797 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1798
1799 bool is_for_call_ : 1; 1813 bool is_for_call_ : 1;
1800 bool is_uninitialized_ : 1; 1814 bool is_uninitialized_ : 1;
1801 bool is_string_access_ : 1; 1815 bool is_string_access_ : 1;
1802 FeedbackVectorICSlot property_feedback_slot_; 1816 FeedbackVectorICSlot property_feedback_slot_;
1803 Expression* obj_; 1817 Expression* obj_;
1804 Expression* key_; 1818 Expression* key_;
1805 SmallMapList receiver_types_; 1819 SmallMapList receiver_types_;
1806 }; 1820 };
1807 1821
1808 1822
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 Handle<Cell> cell() { return cell_; } 1866 Handle<Cell> cell() { return cell_; }
1853 1867
1854 Handle<AllocationSite> allocation_site() { return allocation_site_; } 1868 Handle<AllocationSite> allocation_site() { return allocation_site_; }
1855 1869
1856 void set_target(Handle<JSFunction> target) { target_ = target; } 1870 void set_target(Handle<JSFunction> target) { target_ = target; }
1857 void set_allocation_site(Handle<AllocationSite> site) { 1871 void set_allocation_site(Handle<AllocationSite> site) {
1858 allocation_site_ = site; 1872 allocation_site_ = site;
1859 } 1873 }
1860 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it); 1874 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it);
1861 1875
1862 static int num_ids() { return parent_num_ids() + 2; } 1876 BailoutId ReturnId() const { return BailoutId(base_id() + 0); }
1863 BailoutId ReturnId() const { return BailoutId(local_id(0)); } 1877 BailoutId EvalOrLookupId() const { return BailoutId(base_id() + 1); }
1864 BailoutId EvalOrLookupId() const { return BailoutId(local_id(1)); }
1865 1878
1866 enum CallType { 1879 enum CallType {
1867 POSSIBLY_EVAL_CALL, 1880 POSSIBLY_EVAL_CALL,
1868 GLOBAL_CALL, 1881 GLOBAL_CALL,
1869 LOOKUP_SLOT_CALL, 1882 LOOKUP_SLOT_CALL,
1870 PROPERTY_CALL, 1883 PROPERTY_CALL,
1871 SUPER_CALL, 1884 SUPER_CALL,
1872 OTHER_CALL 1885 OTHER_CALL
1873 }; 1886 };
1874 1887
1875 // Helpers to determine how to handle the call. 1888 // Helpers to determine how to handle the call.
1876 CallType GetCallType(Isolate* isolate) const; 1889 CallType GetCallType(Isolate* isolate) const;
1877 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; 1890 bool IsUsingCallFeedbackSlot(Isolate* isolate) const;
1878 1891
1879 #ifdef DEBUG 1892 #ifdef DEBUG
1880 // Used to assert that the FullCodeGenerator records the return site. 1893 // Used to assert that the FullCodeGenerator records the return site.
1881 bool return_is_recorded_; 1894 bool return_is_recorded_;
1882 #endif 1895 #endif
1883 1896
1884 protected: 1897 protected:
1885 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, 1898 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
1886 int pos) 1899 int pos, IdGen* id_gen)
1887 : Expression(zone, pos), 1900 : Expression(zone, pos, num_ids(), id_gen),
1888 call_feedback_slot_(FeedbackVectorICSlot::Invalid()), 1901 call_feedback_slot_(FeedbackVectorICSlot::Invalid()),
1889 expression_(expression), 1902 expression_(expression),
1890 arguments_(arguments) { 1903 arguments_(arguments) {
1891 if (expression->IsProperty()) { 1904 if (expression->IsProperty()) {
1892 expression->AsProperty()->mark_for_call(); 1905 expression->AsProperty()->mark_for_call();
1893 } 1906 }
1894 } 1907 }
1895 static int parent_num_ids() { return Expression::num_ids(); } 1908
1909 static int num_ids() { return 2; }
1910 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
1896 1911
1897 private: 1912 private:
1898 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1899
1900 FeedbackVectorICSlot call_feedback_slot_; 1913 FeedbackVectorICSlot call_feedback_slot_;
1901 Expression* expression_; 1914 Expression* expression_;
1902 ZoneList<Expression*>* arguments_; 1915 ZoneList<Expression*>* arguments_;
1903 Handle<JSFunction> target_; 1916 Handle<JSFunction> target_;
1904 Handle<Cell> cell_; 1917 Handle<Cell> cell_;
1905 Handle<AllocationSite> allocation_site_; 1918 Handle<AllocationSite> allocation_site_;
1906 }; 1919 };
1907 1920
1908 1921
1909 class CallNew FINAL : public Expression { 1922 class CallNew FINAL : public Expression {
(...skipping 17 matching lines...) Expand all
1927 return CallNewFeedbackSlot().next(); 1940 return CallNewFeedbackSlot().next();
1928 } 1941 }
1929 1942
1930 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1943 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1931 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } 1944 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
1932 Handle<JSFunction> target() const { return target_; } 1945 Handle<JSFunction> target() const { return target_; }
1933 Handle<AllocationSite> allocation_site() const { 1946 Handle<AllocationSite> allocation_site() const {
1934 return allocation_site_; 1947 return allocation_site_;
1935 } 1948 }
1936 1949
1937 static int num_ids() { return parent_num_ids() + 1; }
1938 static int feedback_slots() { return 1; } 1950 static int feedback_slots() { return 1; }
1939 BailoutId ReturnId() const { return BailoutId(local_id(0)); } 1951
1952 BailoutId ReturnId() const { return BailoutId(base_id() + 0); }
1940 1953
1941 protected: 1954 protected:
1942 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, 1955 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
1943 int pos) 1956 int pos, IdGen* id_gen)
1944 : Expression(zone, pos), 1957 : Expression(zone, pos, num_ids(), id_gen),
1945 expression_(expression), 1958 expression_(expression),
1946 arguments_(arguments), 1959 arguments_(arguments),
1947 is_monomorphic_(false), 1960 is_monomorphic_(false),
1948 callnew_feedback_slot_(FeedbackVectorSlot::Invalid()) {} 1961 callnew_feedback_slot_(FeedbackVectorSlot::Invalid()) {}
1949 1962
1950 static int parent_num_ids() { return Expression::num_ids(); } 1963 static int num_ids() { return 1; }
1964 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
1951 1965
1952 private: 1966 private:
1953 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1954
1955 Expression* expression_; 1967 Expression* expression_;
1956 ZoneList<Expression*>* arguments_; 1968 ZoneList<Expression*>* arguments_;
1957 bool is_monomorphic_; 1969 bool is_monomorphic_;
1958 Handle<JSFunction> target_; 1970 Handle<JSFunction> target_;
1959 Handle<AllocationSite> allocation_site_; 1971 Handle<AllocationSite> allocation_site_;
1960 FeedbackVectorSlot callnew_feedback_slot_; 1972 FeedbackVectorSlot callnew_feedback_slot_;
1961 }; 1973 };
1962 1974
1963 1975
1964 // The CallRuntime class does not represent any official JavaScript 1976 // The CallRuntime class does not represent any official JavaScript
(...skipping 16 matching lines...) Expand all
1981 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0); 1993 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0);
1982 } 1994 }
1983 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { 1995 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) {
1984 callruntime_feedback_slot_ = slot; 1996 callruntime_feedback_slot_ = slot;
1985 } 1997 }
1986 1998
1987 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 1999 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
1988 return callruntime_feedback_slot_; 2000 return callruntime_feedback_slot_;
1989 } 2001 }
1990 2002
1991 static int num_ids() { return parent_num_ids() + 1; }
1992 TypeFeedbackId CallRuntimeFeedbackId() const { 2003 TypeFeedbackId CallRuntimeFeedbackId() const {
1993 return TypeFeedbackId(local_id(0)); 2004 return TypeFeedbackId(base_id() + 0);
1994 } 2005 }
1995 2006
1996 protected: 2007 protected:
1997 CallRuntime(Zone* zone, const AstRawString* name, 2008 CallRuntime(Zone* zone, const AstRawString* name,
1998 const Runtime::Function* function, 2009 const Runtime::Function* function,
1999 ZoneList<Expression*>* arguments, int pos) 2010 ZoneList<Expression*>* arguments, int pos, IdGen* id_gen)
2000 : Expression(zone, pos), 2011 : Expression(zone, pos, num_ids(), id_gen),
2001 raw_name_(name), 2012 raw_name_(name),
2002 function_(function), 2013 function_(function),
2003 arguments_(arguments), 2014 arguments_(arguments),
2004 callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()) {} 2015 callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()) {}
2005 static int parent_num_ids() { return Expression::num_ids(); } 2016
2017 static int num_ids() { return 1; }
2018 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2006 2019
2007 private: 2020 private:
2008 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2009
2010 const AstRawString* raw_name_; 2021 const AstRawString* raw_name_;
2011 const Runtime::Function* function_; 2022 const Runtime::Function* function_;
2012 ZoneList<Expression*>* arguments_; 2023 ZoneList<Expression*>* arguments_;
2013 FeedbackVectorICSlot callruntime_feedback_slot_; 2024 FeedbackVectorICSlot callruntime_feedback_slot_;
2014 }; 2025 };
2015 2026
2016 2027
2017 class UnaryOperation FINAL : public Expression { 2028 class UnaryOperation FINAL : public Expression {
2018 public: 2029 public:
2019 DECLARE_NODE_TYPE(UnaryOperation) 2030 DECLARE_NODE_TYPE(UnaryOperation)
2020 2031
2021 Token::Value op() const { return op_; } 2032 Token::Value op() const { return op_; }
2022 Expression* expression() const { return expression_; } 2033 Expression* expression() const { return expression_; }
2023 2034
2024 // For unary not (Token::NOT), the AST ids where true and false will 2035 // For unary not (Token::NOT), the AST ids where true and false will
2025 // actually be materialized, respectively. 2036 // actually be materialized, respectively.
2026 static int num_ids() { return parent_num_ids() + 2; } 2037 BailoutId MaterializeTrueId() const { return BailoutId(base_id() + 0); }
2027 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } 2038 BailoutId MaterializeFalseId() const { return BailoutId(base_id() + 1); }
2028 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); }
2029 2039
2030 virtual void RecordToBooleanTypeFeedback( 2040 virtual void RecordToBooleanTypeFeedback(
2031 TypeFeedbackOracle* oracle) OVERRIDE; 2041 TypeFeedbackOracle* oracle) OVERRIDE;
2032 2042
2033 protected: 2043 protected:
2034 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos) 2044 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos,
2035 : Expression(zone, pos), op_(op), expression_(expression) { 2045 IdGen* id_gen)
2046 : Expression(zone, pos, num_ids(), id_gen),
2047 op_(op),
2048 expression_(expression) {
2036 DCHECK(Token::IsUnaryOp(op)); 2049 DCHECK(Token::IsUnaryOp(op));
2037 } 2050 }
2038 static int parent_num_ids() { return Expression::num_ids(); } 2051
2052 static int num_ids() { return 2; }
2053 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2039 2054
2040 private: 2055 private:
2041 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2042
2043 Token::Value op_; 2056 Token::Value op_;
2044 Expression* expression_; 2057 Expression* expression_;
2045 }; 2058 };
2046 2059
2047 2060
2048 class BinaryOperation FINAL : public Expression { 2061 class BinaryOperation FINAL : public Expression {
2049 public: 2062 public:
2050 DECLARE_NODE_TYPE(BinaryOperation) 2063 DECLARE_NODE_TYPE(BinaryOperation)
2051 2064
2052 virtual bool ResultOverwriteAllowed() const OVERRIDE; 2065 virtual bool ResultOverwriteAllowed() const OVERRIDE;
2053 2066
2054 Token::Value op() const { return static_cast<Token::Value>(op_); } 2067 Token::Value op() const { return static_cast<Token::Value>(op_); }
2055 Expression* left() const { return left_; } 2068 Expression* left() const { return left_; }
2056 Expression* right() const { return right_; } 2069 Expression* right() const { return right_; }
2057 Handle<AllocationSite> allocation_site() const { return allocation_site_; } 2070 Handle<AllocationSite> allocation_site() const { return allocation_site_; }
2058 void set_allocation_site(Handle<AllocationSite> allocation_site) { 2071 void set_allocation_site(Handle<AllocationSite> allocation_site) {
2059 allocation_site_ = allocation_site; 2072 allocation_site_ = allocation_site;
2060 } 2073 }
2061 2074
2062 // The short-circuit logical operations need an AST ID for their 2075 // The short-circuit logical operations need an AST ID for their
2063 // right-hand subexpression. 2076 // right-hand subexpression.
2064 static int num_ids() { return parent_num_ids() + 2; } 2077 BailoutId RightId() const { return BailoutId(base_id() + 0); }
2065 BailoutId RightId() const { return BailoutId(local_id(0)); }
2066 2078
2067 TypeFeedbackId BinaryOperationFeedbackId() const { 2079 TypeFeedbackId BinaryOperationFeedbackId() const {
2068 return TypeFeedbackId(local_id(1)); 2080 return TypeFeedbackId(base_id() + 1);
2069 } 2081 }
2070 Maybe<int> fixed_right_arg() const { 2082 Maybe<int> fixed_right_arg() const {
2071 return has_fixed_right_arg_ ? Maybe<int>(fixed_right_arg_value_) 2083 return has_fixed_right_arg_ ? Maybe<int>(fixed_right_arg_value_)
2072 : Maybe<int>(); 2084 : Maybe<int>();
2073 } 2085 }
2074 void set_fixed_right_arg(Maybe<int> arg) { 2086 void set_fixed_right_arg(Maybe<int> arg) {
2075 has_fixed_right_arg_ = arg.has_value; 2087 has_fixed_right_arg_ = arg.has_value;
2076 if (arg.has_value) fixed_right_arg_value_ = arg.value; 2088 if (arg.has_value) fixed_right_arg_value_ = arg.value;
2077 } 2089 }
2078 2090
2079 virtual void RecordToBooleanTypeFeedback( 2091 virtual void RecordToBooleanTypeFeedback(
2080 TypeFeedbackOracle* oracle) OVERRIDE; 2092 TypeFeedbackOracle* oracle) OVERRIDE;
2081 2093
2082 protected: 2094 protected:
2083 BinaryOperation(Zone* zone, Token::Value op, Expression* left, 2095 BinaryOperation(Zone* zone, Token::Value op, Expression* left,
2084 Expression* right, int pos) 2096 Expression* right, int pos, IdGen* id_gen)
2085 : Expression(zone, pos), 2097 : Expression(zone, pos, num_ids(), id_gen),
2086 op_(static_cast<byte>(op)), 2098 op_(static_cast<byte>(op)),
2087 left_(left), 2099 left_(left),
2088 right_(right) { 2100 right_(right) {
2089 DCHECK(Token::IsBinaryOp(op)); 2101 DCHECK(Token::IsBinaryOp(op));
2090 } 2102 }
2091 static int parent_num_ids() { return Expression::num_ids(); } 2103
2104 static int num_ids() { return 2; }
2105 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2092 2106
2093 private: 2107 private:
2094 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2095
2096 const byte op_; // actually Token::Value 2108 const byte op_; // actually Token::Value
2097 // TODO(rossberg): the fixed arg should probably be represented as a Constant 2109 // TODO(rossberg): the fixed arg should probably be represented as a Constant
2098 // type for the RHS. Currenty it's actually a Maybe<int> 2110 // type for the RHS. Currenty it's actually a Maybe<int>
2099 bool has_fixed_right_arg_; 2111 bool has_fixed_right_arg_;
2100 int fixed_right_arg_value_; 2112 int fixed_right_arg_value_;
2101 Expression* left_; 2113 Expression* left_;
2102 Expression* right_; 2114 Expression* right_;
2103 Handle<AllocationSite> allocation_site_; 2115 Handle<AllocationSite> allocation_site_;
2104 }; 2116 };
2105 2117
(...skipping 20 matching lines...) Expand all
2126 } 2138 }
2127 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; } 2139 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; }
2128 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { 2140 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE {
2129 return store_mode_; 2141 return store_mode_;
2130 } 2142 }
2131 Type* type() const { return type_; } 2143 Type* type() const { return type_; }
2132 void set_key_type(IcCheckType type) { key_type_ = type; } 2144 void set_key_type(IcCheckType type) { key_type_ = type; }
2133 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2145 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2134 void set_type(Type* type) { type_ = type; } 2146 void set_type(Type* type) { type_ = type; }
2135 2147
2136 static int num_ids() { return parent_num_ids() + 3; } 2148 BailoutId AssignmentId() const { return BailoutId(base_id() + 0); }
2137 BailoutId AssignmentId() const { return BailoutId(local_id(0)); }
2138 TypeFeedbackId CountBinOpFeedbackId() const { 2149 TypeFeedbackId CountBinOpFeedbackId() const {
2139 return TypeFeedbackId(local_id(1)); 2150 return TypeFeedbackId(base_id() + 1);
2140 } 2151 }
2141 TypeFeedbackId CountStoreFeedbackId() const { 2152 TypeFeedbackId CountStoreFeedbackId() const {
2142 return TypeFeedbackId(local_id(2)); 2153 return TypeFeedbackId(base_id() + 2);
2143 } 2154 }
2144 2155
2145 protected: 2156 protected:
2146 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, 2157 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr,
2147 int pos) 2158 int pos, IdGen* id_gen)
2148 : Expression(zone, pos), 2159 : Expression(zone, pos, num_ids(), id_gen),
2149 op_(op), 2160 op_(op),
2150 is_prefix_(is_prefix), 2161 is_prefix_(is_prefix),
2151 key_type_(ELEMENT), 2162 key_type_(ELEMENT),
2152 store_mode_(STANDARD_STORE), 2163 store_mode_(STANDARD_STORE),
2153 expression_(expr) {} 2164 expression_(expr) {}
2154 static int parent_num_ids() { return Expression::num_ids(); } 2165
2166 static int num_ids() { return 3; }
2167 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2155 2168
2156 private: 2169 private:
2157 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2158
2159 Token::Value op_; 2170 Token::Value op_;
2160 bool is_prefix_ : 1; 2171 bool is_prefix_ : 1;
2161 IcCheckType key_type_ : 1; 2172 IcCheckType key_type_ : 1;
2162 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2173 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2163 // must have extra bit. 2174 // must have extra bit.
2164 Type* type_; 2175 Type* type_;
2165 Expression* expression_; 2176 Expression* expression_;
2166 SmallMapList receiver_types_; 2177 SmallMapList receiver_types_;
2167 }; 2178 };
2168 2179
2169 2180
2170 class CompareOperation FINAL : public Expression { 2181 class CompareOperation FINAL : public Expression {
2171 public: 2182 public:
2172 DECLARE_NODE_TYPE(CompareOperation) 2183 DECLARE_NODE_TYPE(CompareOperation)
2173 2184
2174 Token::Value op() const { return op_; } 2185 Token::Value op() const { return op_; }
2175 Expression* left() const { return left_; } 2186 Expression* left() const { return left_; }
2176 Expression* right() const { return right_; } 2187 Expression* right() const { return right_; }
2177 2188
2178 // Type feedback information. 2189 // Type feedback information.
2179 static int num_ids() { return parent_num_ids() + 1; }
2180 TypeFeedbackId CompareOperationFeedbackId() const { 2190 TypeFeedbackId CompareOperationFeedbackId() const {
2181 return TypeFeedbackId(local_id(0)); 2191 return TypeFeedbackId(base_id() + 0);
2182 } 2192 }
2183 Type* combined_type() const { return combined_type_; } 2193 Type* combined_type() const { return combined_type_; }
2184 void set_combined_type(Type* type) { combined_type_ = type; } 2194 void set_combined_type(Type* type) { combined_type_ = type; }
2185 2195
2186 // Match special cases. 2196 // Match special cases.
2187 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); 2197 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
2188 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); 2198 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate);
2189 bool IsLiteralCompareNull(Expression** expr); 2199 bool IsLiteralCompareNull(Expression** expr);
2190 2200
2191 protected: 2201 protected:
2192 CompareOperation(Zone* zone, Token::Value op, Expression* left, 2202 CompareOperation(Zone* zone, Token::Value op, Expression* left,
2193 Expression* right, int pos) 2203 Expression* right, int pos, IdGen* id_gen)
2194 : Expression(zone, pos), 2204 : Expression(zone, pos, num_ids(), id_gen),
2195 op_(op), 2205 op_(op),
2196 left_(left), 2206 left_(left),
2197 right_(right), 2207 right_(right),
2198 combined_type_(Type::None(zone)) { 2208 combined_type_(Type::None(zone)) {
2199 DCHECK(Token::IsCompareOp(op)); 2209 DCHECK(Token::IsCompareOp(op));
2200 } 2210 }
2201 static int parent_num_ids() { return Expression::num_ids(); } 2211
2212 static int num_ids() { return 1; }
2213 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2202 2214
2203 private: 2215 private:
2204 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2205
2206 Token::Value op_; 2216 Token::Value op_;
2207 Expression* left_; 2217 Expression* left_;
2208 Expression* right_; 2218 Expression* right_;
2209 2219
2210 Type* combined_type_; 2220 Type* combined_type_;
2211 }; 2221 };
2212 2222
2213 2223
2214 class Conditional FINAL : public Expression { 2224 class Conditional FINAL : public Expression {
2215 public: 2225 public:
2216 DECLARE_NODE_TYPE(Conditional) 2226 DECLARE_NODE_TYPE(Conditional)
2217 2227
2218 Expression* condition() const { return condition_; } 2228 Expression* condition() const { return condition_; }
2219 Expression* then_expression() const { return then_expression_; } 2229 Expression* then_expression() const { return then_expression_; }
2220 Expression* else_expression() const { return else_expression_; } 2230 Expression* else_expression() const { return else_expression_; }
2221 2231
2222 static int num_ids() { return parent_num_ids() + 2; } 2232 BailoutId ThenId() const { return BailoutId(base_id() + 0); }
2223 BailoutId ThenId() const { return BailoutId(local_id(0)); } 2233 BailoutId ElseId() const { return BailoutId(base_id() + 1); }
2224 BailoutId ElseId() const { return BailoutId(local_id(1)); }
2225 2234
2226 protected: 2235 protected:
2227 Conditional(Zone* zone, Expression* condition, Expression* then_expression, 2236 Conditional(Zone* zone, Expression* condition, Expression* then_expression,
2228 Expression* else_expression, int position) 2237 Expression* else_expression, int position, IdGen* id_gen)
2229 : Expression(zone, position), 2238 : Expression(zone, position, num_ids(), id_gen),
2230 condition_(condition), 2239 condition_(condition),
2231 then_expression_(then_expression), 2240 then_expression_(then_expression),
2232 else_expression_(else_expression) {} 2241 else_expression_(else_expression) {}
2233 static int parent_num_ids() { return Expression::num_ids(); } 2242
2243 static int num_ids() { return 2; }
2244 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2234 2245
2235 private: 2246 private:
2236 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2237
2238 Expression* condition_; 2247 Expression* condition_;
2239 Expression* then_expression_; 2248 Expression* then_expression_;
2240 Expression* else_expression_; 2249 Expression* else_expression_;
2241 }; 2250 };
2242 2251
2243 2252
2244 class Assignment FINAL : public Expression { 2253 class Assignment FINAL : public Expression {
2245 public: 2254 public:
2246 DECLARE_NODE_TYPE(Assignment) 2255 DECLARE_NODE_TYPE(Assignment)
2247 2256
2248 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } 2257 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; }
2249 2258
2250 Token::Value binary_op() const; 2259 Token::Value binary_op() const;
2251 2260
2252 Token::Value op() const { return op_; } 2261 Token::Value op() const { return op_; }
2253 Expression* target() const { return target_; } 2262 Expression* target() const { return target_; }
2254 Expression* value() const { return value_; } 2263 Expression* value() const { return value_; }
2255 BinaryOperation* binary_operation() const { return binary_operation_; } 2264 BinaryOperation* binary_operation() const { return binary_operation_; }
2256 2265
2257 // This check relies on the definition order of token in token.h. 2266 // This check relies on the definition order of token in token.h.
2258 bool is_compound() const { return op() > Token::ASSIGN; } 2267 bool is_compound() const { return op() > Token::ASSIGN; }
2259 2268
2260 static int num_ids() { return parent_num_ids() + 2; } 2269 BailoutId AssignmentId() const { return BailoutId(base_id() + 0); }
2261 BailoutId AssignmentId() const { return BailoutId(local_id(0)); }
2262 2270
2263 // Type feedback information. 2271 // Type feedback information.
2264 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } 2272 TypeFeedbackId AssignmentFeedbackId() {
2273 return TypeFeedbackId(base_id() + 1);
2274 }
2265 virtual bool IsMonomorphic() OVERRIDE { 2275 virtual bool IsMonomorphic() OVERRIDE {
2266 return receiver_types_.length() == 1; 2276 return receiver_types_.length() == 1;
2267 } 2277 }
2268 bool IsUninitialized() { return is_uninitialized_; } 2278 bool IsUninitialized() { return is_uninitialized_; }
2269 bool HasNoTypeInformation() { 2279 bool HasNoTypeInformation() {
2270 return is_uninitialized_; 2280 return is_uninitialized_;
2271 } 2281 }
2272 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 2282 virtual SmallMapList* GetReceiverTypes() OVERRIDE {
2273 return &receiver_types_; 2283 return &receiver_types_;
2274 } 2284 }
2275 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; } 2285 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; }
2276 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { 2286 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE {
2277 return store_mode_; 2287 return store_mode_;
2278 } 2288 }
2279 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } 2289 void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
2280 void set_key_type(IcCheckType key_type) { key_type_ = key_type; } 2290 void set_key_type(IcCheckType key_type) { key_type_ = key_type; }
2281 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2291 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2282 2292
2283 protected: 2293 protected:
2284 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, 2294 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value,
2285 int pos); 2295 int pos, IdGen* id_gen);
2286 static int parent_num_ids() { return Expression::num_ids(); }
2287 2296
2288 template <class Visitor> 2297 static int num_ids() { return 2; }
2289 void Init(AstNodeFactory<Visitor>* factory) { 2298 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2299
2300 template<class Visitor>
2301 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) {
2290 DCHECK(Token::IsAssignmentOp(op_)); 2302 DCHECK(Token::IsAssignmentOp(op_));
2291 if (is_compound()) { 2303 if (is_compound()) {
2292 binary_operation_ = factory->NewBinaryOperation( 2304 binary_operation_ = factory->NewBinaryOperation(
2293 binary_op(), target_, value_, position() + 1); 2305 binary_op(), target_, value_, position() + 1);
2294 } 2306 }
2295 } 2307 }
2296 2308
2297 private: 2309 private:
2298 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2299
2300 bool is_uninitialized_ : 1; 2310 bool is_uninitialized_ : 1;
2301 IcCheckType key_type_ : 1; 2311 IcCheckType key_type_ : 1;
2302 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2312 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2303 // must have extra bit. 2313 // must have extra bit.
2304 Token::Value op_; 2314 Token::Value op_;
2305 Expression* target_; 2315 Expression* target_;
2306 Expression* value_; 2316 Expression* value_;
2307 BinaryOperation* binary_operation_; 2317 BinaryOperation* binary_operation_;
2308 SmallMapList receiver_types_; 2318 SmallMapList receiver_types_;
2309 }; 2319 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 } 2360 }
2351 2361
2352 FeedbackVectorICSlot DoneFeedbackSlot() { 2362 FeedbackVectorICSlot DoneFeedbackSlot() {
2353 return KeyedLoadFeedbackSlot().next(); 2363 return KeyedLoadFeedbackSlot().next();
2354 } 2364 }
2355 2365
2356 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); } 2366 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); }
2357 2367
2358 protected: 2368 protected:
2359 Yield(Zone* zone, Expression* generator_object, Expression* expression, 2369 Yield(Zone* zone, Expression* generator_object, Expression* expression,
2360 Kind yield_kind, int pos) 2370 Kind yield_kind, int pos, IdGen* id_gen)
2361 : Expression(zone, pos), 2371 : Expression(zone, pos, 0, id_gen),
2362 generator_object_(generator_object), 2372 generator_object_(generator_object),
2363 expression_(expression), 2373 expression_(expression),
2364 yield_kind_(yield_kind), 2374 yield_kind_(yield_kind),
2365 index_(-1), 2375 index_(-1),
2366 yield_first_feedback_slot_(FeedbackVectorICSlot::Invalid()) {} 2376 yield_first_feedback_slot_(FeedbackVectorICSlot::Invalid()) {}
2367 2377
2368 private: 2378 private:
2369 Expression* generator_object_; 2379 Expression* generator_object_;
2370 Expression* expression_; 2380 Expression* expression_;
2371 Kind yield_kind_; 2381 Kind yield_kind_;
2372 int index_; 2382 int index_;
2373 FeedbackVectorICSlot yield_first_feedback_slot_; 2383 FeedbackVectorICSlot yield_first_feedback_slot_;
2374 }; 2384 };
2375 2385
2376 2386
2377 class Throw FINAL : public Expression { 2387 class Throw FINAL : public Expression {
2378 public: 2388 public:
2379 DECLARE_NODE_TYPE(Throw) 2389 DECLARE_NODE_TYPE(Throw)
2380 2390
2381 Expression* exception() const { return exception_; } 2391 Expression* exception() const { return exception_; }
2382 2392
2383 protected: 2393 protected:
2384 Throw(Zone* zone, Expression* exception, int pos) 2394 Throw(Zone* zone, Expression* exception, int pos, IdGen* id_gen)
2385 : Expression(zone, pos), exception_(exception) {} 2395 : Expression(zone, pos, 0, id_gen), exception_(exception) {}
2386 2396
2387 private: 2397 private:
2388 Expression* exception_; 2398 Expression* exception_;
2389 }; 2399 };
2390 2400
2391 2401
2392 class FunctionLiteral FINAL : public Expression { 2402 class FunctionLiteral FINAL : public Expression {
2393 public: 2403 public:
2394 enum FunctionType { 2404 enum FunctionType {
2395 ANONYMOUS_EXPRESSION, 2405 ANONYMOUS_EXPRESSION,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2529 2539
2530 protected: 2540 protected:
2531 FunctionLiteral(Zone* zone, const AstRawString* name, 2541 FunctionLiteral(Zone* zone, const AstRawString* name,
2532 AstValueFactory* ast_value_factory, Scope* scope, 2542 AstValueFactory* ast_value_factory, Scope* scope,
2533 ZoneList<Statement*>* body, int materialized_literal_count, 2543 ZoneList<Statement*>* body, int materialized_literal_count,
2534 int expected_property_count, int handler_count, 2544 int expected_property_count, int handler_count,
2535 int parameter_count, FunctionType function_type, 2545 int parameter_count, FunctionType function_type,
2536 ParameterFlag has_duplicate_parameters, 2546 ParameterFlag has_duplicate_parameters,
2537 IsFunctionFlag is_function, 2547 IsFunctionFlag is_function,
2538 IsParenthesizedFlag is_parenthesized, FunctionKind kind, 2548 IsParenthesizedFlag is_parenthesized, FunctionKind kind,
2539 int position) 2549 int position, IdGen* id_gen)
2540 : Expression(zone, position), 2550 : Expression(zone, position, 0, id_gen),
2541 raw_name_(name), 2551 raw_name_(name),
2542 scope_(scope), 2552 scope_(scope),
2543 body_(body), 2553 body_(body),
2544 raw_inferred_name_(ast_value_factory->empty_string()), 2554 raw_inferred_name_(ast_value_factory->empty_string()),
2545 dont_optimize_reason_(kNoReason), 2555 dont_optimize_reason_(kNoReason),
2546 materialized_literal_count_(materialized_literal_count), 2556 materialized_literal_count_(materialized_literal_count),
2547 expected_property_count_(expected_property_count), 2557 expected_property_count_(expected_property_count),
2548 handler_count_(handler_count), 2558 handler_count_(handler_count),
2549 parameter_count_(parameter_count), 2559 parameter_count_(parameter_count),
2550 function_token_position_(RelocInfo::kNoPosition) { 2560 function_token_position_(RelocInfo::kNoPosition) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 const AstRawString* raw_name() const { return raw_name_; } 2606 const AstRawString* raw_name() const { return raw_name_; }
2597 Expression* extends() const { return extends_; } 2607 Expression* extends() const { return extends_; }
2598 Expression* constructor() const { return constructor_; } 2608 Expression* constructor() const { return constructor_; }
2599 ZoneList<Property*>* properties() const { return properties_; } 2609 ZoneList<Property*>* properties() const { return properties_; }
2600 int start_position() const { return position(); } 2610 int start_position() const { return position(); }
2601 int end_position() const { return end_position_; } 2611 int end_position() const { return end_position_; }
2602 2612
2603 protected: 2613 protected:
2604 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends, 2614 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends,
2605 Expression* constructor, ZoneList<Property*>* properties, 2615 Expression* constructor, ZoneList<Property*>* properties,
2606 int start_position, int end_position) 2616 int start_position, int end_position, IdGen* id_gen)
2607 : Expression(zone, start_position), 2617 : Expression(zone, start_position, 0, id_gen),
2608 raw_name_(name), 2618 raw_name_(name),
2609 extends_(extends), 2619 extends_(extends),
2610 constructor_(constructor), 2620 constructor_(constructor),
2611 properties_(properties), 2621 properties_(properties),
2612 end_position_(end_position) {} 2622 end_position_(end_position) {}
2613 2623
2614 private: 2624 private:
2615 const AstRawString* raw_name_; 2625 const AstRawString* raw_name_;
2616 Expression* extends_; 2626 Expression* extends_;
2617 Expression* constructor_; 2627 Expression* constructor_;
2618 ZoneList<Property*>* properties_; 2628 ZoneList<Property*>* properties_;
2619 int end_position_; 2629 int end_position_;
2620 }; 2630 };
2621 2631
2622 2632
2623 class NativeFunctionLiteral FINAL : public Expression { 2633 class NativeFunctionLiteral FINAL : public Expression {
2624 public: 2634 public:
2625 DECLARE_NODE_TYPE(NativeFunctionLiteral) 2635 DECLARE_NODE_TYPE(NativeFunctionLiteral)
2626 2636
2627 Handle<String> name() const { return name_->string(); } 2637 Handle<String> name() const { return name_->string(); }
2628 v8::Extension* extension() const { return extension_; } 2638 v8::Extension* extension() const { return extension_; }
2629 2639
2630 protected: 2640 protected:
2631 NativeFunctionLiteral(Zone* zone, const AstRawString* name, 2641 NativeFunctionLiteral(Zone* zone, const AstRawString* name,
2632 v8::Extension* extension, int pos) 2642 v8::Extension* extension, int pos, IdGen* id_gen)
2633 : Expression(zone, pos), name_(name), extension_(extension) {} 2643 : Expression(zone, pos, 0, id_gen), name_(name), extension_(extension) {}
2634 2644
2635 private: 2645 private:
2636 const AstRawString* name_; 2646 const AstRawString* name_;
2637 v8::Extension* extension_; 2647 v8::Extension* extension_;
2638 }; 2648 };
2639 2649
2640 2650
2641 class ThisFunction FINAL : public Expression { 2651 class ThisFunction FINAL : public Expression {
2642 public: 2652 public:
2643 DECLARE_NODE_TYPE(ThisFunction) 2653 DECLARE_NODE_TYPE(ThisFunction)
2644 2654
2645 protected: 2655 protected:
2646 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {} 2656 ThisFunction(Zone* zone, int pos, IdGen* id_gen)
2657 : Expression(zone, pos, 0, id_gen) {}
2647 }; 2658 };
2648 2659
2649 2660
2650 class SuperReference FINAL : public Expression { 2661 class SuperReference FINAL : public Expression {
2651 public: 2662 public:
2652 DECLARE_NODE_TYPE(SuperReference) 2663 DECLARE_NODE_TYPE(SuperReference)
2653 2664
2654 VariableProxy* this_var() const { return this_var_; } 2665 VariableProxy* this_var() const { return this_var_; }
2655 2666
2656 static int num_ids() { return parent_num_ids() + 1; } 2667 TypeFeedbackId HomeObjectFeedbackId() {
2657 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } 2668 return TypeFeedbackId(base_id() + 0);
2669 }
2658 2670
2659 // Type feedback information. 2671 // Type feedback information.
2660 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { 2672 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() {
2661 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 2673 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
2662 } 2674 }
2663 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { 2675 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) {
2664 homeobject_feedback_slot_ = slot; 2676 homeobject_feedback_slot_ = slot;
2665 } 2677 }
2666 2678
2667 FeedbackVectorICSlot HomeObjectFeedbackSlot() { 2679 FeedbackVectorICSlot HomeObjectFeedbackSlot() {
2668 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); 2680 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid());
2669 return homeobject_feedback_slot_; 2681 return homeobject_feedback_slot_;
2670 } 2682 }
2671 2683
2672 protected: 2684 protected:
2673 SuperReference(Zone* zone, VariableProxy* this_var, int pos) 2685 SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen)
2674 : Expression(zone, pos), 2686 : Expression(zone, pos, num_ids(), id_gen),
2675 this_var_(this_var), 2687 this_var_(this_var),
2676 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { 2688 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) {
2677 DCHECK(this_var->is_this()); 2689 DCHECK(this_var->is_this());
2678 } 2690 }
2679 static int parent_num_ids() { return Expression::num_ids(); } 2691
2692 static int num_ids() { return 1; }
2693 int base_id() const { return Expression::base_id() + Expression::num_ids(); }
2680 2694
2681 private: 2695 private:
2682 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2683
2684 VariableProxy* this_var_; 2696 VariableProxy* this_var_;
2685 FeedbackVectorICSlot homeobject_feedback_slot_; 2697 FeedbackVectorICSlot homeobject_feedback_slot_;
2686 }; 2698 };
2687 2699
2688 2700
2689 #undef DECLARE_NODE_TYPE 2701 #undef DECLARE_NODE_TYPE
2690 2702
2691 2703
2692 // ---------------------------------------------------------------------------- 2704 // ----------------------------------------------------------------------------
2693 // Regular expressions 2705 // Regular expressions
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 }; 3187 };
3176 3188
3177 3189
3178 3190
3179 // ---------------------------------------------------------------------------- 3191 // ----------------------------------------------------------------------------
3180 // AstNode factory 3192 // AstNode factory
3181 3193
3182 template<class Visitor> 3194 template<class Visitor>
3183 class AstNodeFactory FINAL BASE_EMBEDDED { 3195 class AstNodeFactory FINAL BASE_EMBEDDED {
3184 public: 3196 public:
3185 explicit AstNodeFactory(AstValueFactory* ast_value_factory) 3197 AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory,
3186 : zone_(ast_value_factory->zone()), 3198 AstNode::IdGen* id_gen)
3187 ast_value_factory_(ast_value_factory) {} 3199 : zone_(zone), ast_value_factory_(ast_value_factory), id_gen_(id_gen) {}
3188 3200
3189 Visitor* visitor() { return &visitor_; } 3201 Visitor* visitor() { return &visitor_; }
3190 3202
3191 #define VISIT_AND_RETURN(NodeType, node) \ 3203 #define VISIT_AND_RETURN(NodeType, node) \
3192 visitor_.Visit##NodeType((node)); \ 3204 visitor_.Visit##NodeType((node)); \
3193 return node; 3205 return node;
3194 3206
3195 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, 3207 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
3196 VariableMode mode, 3208 VariableMode mode,
3197 Scope* scope, 3209 Scope* scope,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 3267
3256 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { 3268 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
3257 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); 3269 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos);
3258 VISIT_AND_RETURN(ModuleUrl, module) 3270 VISIT_AND_RETURN(ModuleUrl, module)
3259 } 3271 }
3260 3272
3261 Block* NewBlock(ZoneList<const AstRawString*>* labels, 3273 Block* NewBlock(ZoneList<const AstRawString*>* labels,
3262 int capacity, 3274 int capacity,
3263 bool is_initializer_block, 3275 bool is_initializer_block,
3264 int pos) { 3276 int pos) {
3265 Block* block = 3277 Block* block = new (zone_)
3266 new (zone_) Block(zone_, labels, capacity, is_initializer_block, pos); 3278 Block(zone_, labels, capacity, is_initializer_block, pos, id_gen_);
3267 VISIT_AND_RETURN(Block, block) 3279 VISIT_AND_RETURN(Block, block)
3268 } 3280 }
3269 3281
3270 #define STATEMENT_WITH_LABELS(NodeType) \ 3282 #define STATEMENT_WITH_LABELS(NodeType) \
3271 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ 3283 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \
3272 NodeType* stmt = new (zone_) NodeType(zone_, labels, pos); \ 3284 NodeType* stmt = new (zone_) NodeType(zone_, labels, pos, id_gen_); \
3273 VISIT_AND_RETURN(NodeType, stmt); \ 3285 VISIT_AND_RETURN(NodeType, stmt); \
3274 } 3286 }
3275 STATEMENT_WITH_LABELS(DoWhileStatement) 3287 STATEMENT_WITH_LABELS(DoWhileStatement)
3276 STATEMENT_WITH_LABELS(WhileStatement) 3288 STATEMENT_WITH_LABELS(WhileStatement)
3277 STATEMENT_WITH_LABELS(ForStatement) 3289 STATEMENT_WITH_LABELS(ForStatement)
3278 STATEMENT_WITH_LABELS(SwitchStatement) 3290 STATEMENT_WITH_LABELS(SwitchStatement)
3279 #undef STATEMENT_WITH_LABELS 3291 #undef STATEMENT_WITH_LABELS
3280 3292
3281 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, 3293 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode,
3282 ZoneList<const AstRawString*>* labels, 3294 ZoneList<const AstRawString*>* labels,
3283 int pos) { 3295 int pos) {
3284 switch (visit_mode) { 3296 switch (visit_mode) {
3285 case ForEachStatement::ENUMERATE: { 3297 case ForEachStatement::ENUMERATE: {
3286 ForInStatement* stmt = new (zone_) ForInStatement(zone_, labels, pos); 3298 ForInStatement* stmt =
3299 new (zone_) ForInStatement(zone_, labels, pos, id_gen_);
3287 VISIT_AND_RETURN(ForInStatement, stmt); 3300 VISIT_AND_RETURN(ForInStatement, stmt);
3288 } 3301 }
3289 case ForEachStatement::ITERATE: { 3302 case ForEachStatement::ITERATE: {
3290 ForOfStatement* stmt = new (zone_) ForOfStatement(zone_, labels, pos); 3303 ForOfStatement* stmt =
3304 new (zone_) ForOfStatement(zone_, labels, pos, id_gen_);
3291 VISIT_AND_RETURN(ForOfStatement, stmt); 3305 VISIT_AND_RETURN(ForOfStatement, stmt);
3292 } 3306 }
3293 } 3307 }
3294 UNREACHABLE(); 3308 UNREACHABLE();
3295 return NULL; 3309 return NULL;
3296 } 3310 }
3297 3311
3298 ModuleStatement* NewModuleStatement( 3312 ModuleStatement* NewModuleStatement(
3299 VariableProxy* proxy, Block* body, int pos) { 3313 VariableProxy* proxy, Block* body, int pos) {
3300 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos); 3314 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos);
(...skipping 27 matching lines...) Expand all
3328 int pos) { 3342 int pos) {
3329 WithStatement* stmt = new(zone_) WithStatement( 3343 WithStatement* stmt = new(zone_) WithStatement(
3330 zone_, scope, expression, statement, pos); 3344 zone_, scope, expression, statement, pos);
3331 VISIT_AND_RETURN(WithStatement, stmt) 3345 VISIT_AND_RETURN(WithStatement, stmt)
3332 } 3346 }
3333 3347
3334 IfStatement* NewIfStatement(Expression* condition, 3348 IfStatement* NewIfStatement(Expression* condition,
3335 Statement* then_statement, 3349 Statement* then_statement,
3336 Statement* else_statement, 3350 Statement* else_statement,
3337 int pos) { 3351 int pos) {
3338 IfStatement* stmt = new (zone_) 3352 IfStatement* stmt = new (zone_) IfStatement(
3339 IfStatement(zone_, condition, then_statement, else_statement, pos); 3353 zone_, condition, then_statement, else_statement, pos, id_gen_);
3340 VISIT_AND_RETURN(IfStatement, stmt) 3354 VISIT_AND_RETURN(IfStatement, stmt)
3341 } 3355 }
3342 3356
3343 TryCatchStatement* NewTryCatchStatement(int index, 3357 TryCatchStatement* NewTryCatchStatement(int index,
3344 Block* try_block, 3358 Block* try_block,
3345 Scope* scope, 3359 Scope* scope,
3346 Variable* variable, 3360 Variable* variable,
3347 Block* catch_block, 3361 Block* catch_block,
3348 int pos) { 3362 int pos) {
3349 TryCatchStatement* stmt = new(zone_) TryCatchStatement( 3363 TryCatchStatement* stmt = new(zone_) TryCatchStatement(
3350 zone_, index, try_block, scope, variable, catch_block, pos); 3364 zone_, index, try_block, scope, variable, catch_block, pos);
3351 VISIT_AND_RETURN(TryCatchStatement, stmt) 3365 VISIT_AND_RETURN(TryCatchStatement, stmt)
3352 } 3366 }
3353 3367
3354 TryFinallyStatement* NewTryFinallyStatement(int index, 3368 TryFinallyStatement* NewTryFinallyStatement(int index,
3355 Block* try_block, 3369 Block* try_block,
3356 Block* finally_block, 3370 Block* finally_block,
3357 int pos) { 3371 int pos) {
3358 TryFinallyStatement* stmt = new(zone_) TryFinallyStatement( 3372 TryFinallyStatement* stmt = new(zone_) TryFinallyStatement(
3359 zone_, index, try_block, finally_block, pos); 3373 zone_, index, try_block, finally_block, pos);
3360 VISIT_AND_RETURN(TryFinallyStatement, stmt) 3374 VISIT_AND_RETURN(TryFinallyStatement, stmt)
3361 } 3375 }
3362 3376
3363 DebuggerStatement* NewDebuggerStatement(int pos) { 3377 DebuggerStatement* NewDebuggerStatement(int pos) {
3364 DebuggerStatement* stmt = new (zone_) DebuggerStatement(zone_, pos); 3378 DebuggerStatement* stmt =
3379 new (zone_) DebuggerStatement(zone_, pos, id_gen_);
3365 VISIT_AND_RETURN(DebuggerStatement, stmt) 3380 VISIT_AND_RETURN(DebuggerStatement, stmt)
3366 } 3381 }
3367 3382
3368 EmptyStatement* NewEmptyStatement(int pos) { 3383 EmptyStatement* NewEmptyStatement(int pos) {
3369 return new(zone_) EmptyStatement(zone_, pos); 3384 return new(zone_) EmptyStatement(zone_, pos);
3370 } 3385 }
3371 3386
3372 CaseClause* NewCaseClause( 3387 CaseClause* NewCaseClause(
3373 Expression* label, ZoneList<Statement*>* statements, int pos) { 3388 Expression* label, ZoneList<Statement*>* statements, int pos) {
3374 CaseClause* clause = new (zone_) CaseClause(zone_, label, statements, pos); 3389 CaseClause* clause =
3390 new (zone_) CaseClause(zone_, label, statements, pos, id_gen_);
3375 VISIT_AND_RETURN(CaseClause, clause) 3391 VISIT_AND_RETURN(CaseClause, clause)
3376 } 3392 }
3377 3393
3378 Literal* NewStringLiteral(const AstRawString* string, int pos) { 3394 Literal* NewStringLiteral(const AstRawString* string, int pos) {
3379 Literal* lit = 3395 Literal* lit = new (zone_)
3380 new (zone_) Literal(zone_, ast_value_factory_->NewString(string), pos); 3396 Literal(zone_, ast_value_factory_->NewString(string), pos, id_gen_);
3381 VISIT_AND_RETURN(Literal, lit) 3397 VISIT_AND_RETURN(Literal, lit)
3382 } 3398 }
3383 3399
3384 // A JavaScript symbol (ECMA-262 edition 6). 3400 // A JavaScript symbol (ECMA-262 edition 6).
3385 Literal* NewSymbolLiteral(const char* name, int pos) { 3401 Literal* NewSymbolLiteral(const char* name, int pos) {
3386 Literal* lit = 3402 Literal* lit = new (zone_)
3387 new (zone_) Literal(zone_, ast_value_factory_->NewSymbol(name), pos); 3403 Literal(zone_, ast_value_factory_->NewSymbol(name), pos, id_gen_);
3388 VISIT_AND_RETURN(Literal, lit) 3404 VISIT_AND_RETURN(Literal, lit)
3389 } 3405 }
3390 3406
3391 Literal* NewNumberLiteral(double number, int pos) { 3407 Literal* NewNumberLiteral(double number, int pos) {
3392 Literal* lit = 3408 Literal* lit = new (zone_)
3393 new (zone_) Literal(zone_, ast_value_factory_->NewNumber(number), pos); 3409 Literal(zone_, ast_value_factory_->NewNumber(number), pos, id_gen_);
3394 VISIT_AND_RETURN(Literal, lit) 3410 VISIT_AND_RETURN(Literal, lit)
3395 } 3411 }
3396 3412
3397 Literal* NewSmiLiteral(int number, int pos) { 3413 Literal* NewSmiLiteral(int number, int pos) {
3398 Literal* lit = 3414 Literal* lit = new (zone_)
3399 new (zone_) Literal(zone_, ast_value_factory_->NewSmi(number), pos); 3415 Literal(zone_, ast_value_factory_->NewSmi(number), pos, id_gen_);
3400 VISIT_AND_RETURN(Literal, lit) 3416 VISIT_AND_RETURN(Literal, lit)
3401 } 3417 }
3402 3418
3403 Literal* NewBooleanLiteral(bool b, int pos) { 3419 Literal* NewBooleanLiteral(bool b, int pos) {
3404 Literal* lit = 3420 Literal* lit = new (zone_)
3405 new (zone_) Literal(zone_, ast_value_factory_->NewBoolean(b), pos); 3421 Literal(zone_, ast_value_factory_->NewBoolean(b), pos, id_gen_);
3406 VISIT_AND_RETURN(Literal, lit) 3422 VISIT_AND_RETURN(Literal, lit)
3407 } 3423 }
3408 3424
3409 Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings, 3425 Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings,
3410 int pos) { 3426 int pos) {
3411 Literal* lit = new (zone_) 3427 Literal* lit = new (zone_) Literal(
3412 Literal(zone_, ast_value_factory_->NewStringList(strings), pos); 3428 zone_, ast_value_factory_->NewStringList(strings), pos, id_gen_);
3413 VISIT_AND_RETURN(Literal, lit) 3429 VISIT_AND_RETURN(Literal, lit)
3414 } 3430 }
3415 3431
3416 Literal* NewNullLiteral(int pos) { 3432 Literal* NewNullLiteral(int pos) {
3417 Literal* lit = 3433 Literal* lit =
3418 new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos); 3434 new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos, id_gen_);
3419 VISIT_AND_RETURN(Literal, lit) 3435 VISIT_AND_RETURN(Literal, lit)
3420 } 3436 }
3421 3437
3422 Literal* NewUndefinedLiteral(int pos) { 3438 Literal* NewUndefinedLiteral(int pos) {
3423 Literal* lit = 3439 Literal* lit = new (zone_)
3424 new (zone_) Literal(zone_, ast_value_factory_->NewUndefined(), pos); 3440 Literal(zone_, ast_value_factory_->NewUndefined(), pos, id_gen_);
3425 VISIT_AND_RETURN(Literal, lit) 3441 VISIT_AND_RETURN(Literal, lit)
3426 } 3442 }
3427 3443
3428 Literal* NewTheHoleLiteral(int pos) { 3444 Literal* NewTheHoleLiteral(int pos) {
3429 Literal* lit = 3445 Literal* lit = new (zone_)
3430 new (zone_) Literal(zone_, ast_value_factory_->NewTheHole(), pos); 3446 Literal(zone_, ast_value_factory_->NewTheHole(), pos, id_gen_);
3431 VISIT_AND_RETURN(Literal, lit) 3447 VISIT_AND_RETURN(Literal, lit)
3432 } 3448 }
3433 3449
3434 ObjectLiteral* NewObjectLiteral( 3450 ObjectLiteral* NewObjectLiteral(
3435 ZoneList<ObjectLiteral::Property*>* properties, 3451 ZoneList<ObjectLiteral::Property*>* properties,
3436 int literal_index, 3452 int literal_index,
3437 int boilerplate_properties, 3453 int boilerplate_properties,
3438 bool has_function, 3454 bool has_function,
3439 int pos) { 3455 int pos) {
3440 ObjectLiteral* lit = 3456 ObjectLiteral* lit = new (zone_)
3441 new (zone_) ObjectLiteral(zone_, properties, literal_index, 3457 ObjectLiteral(zone_, properties, literal_index, boilerplate_properties,
3442 boilerplate_properties, has_function, pos); 3458 has_function, pos, id_gen_);
3443 VISIT_AND_RETURN(ObjectLiteral, lit) 3459 VISIT_AND_RETURN(ObjectLiteral, lit)
3444 } 3460 }
3445 3461
3446 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, 3462 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
3447 Expression* value, 3463 Expression* value,
3448 bool is_static) { 3464 bool is_static) {
3449 return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key, 3465 return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key,
3450 value, is_static); 3466 value, is_static);
3451 } 3467 }
3452 3468
3453 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, 3469 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
3454 FunctionLiteral* value, 3470 FunctionLiteral* value,
3455 int pos, bool is_static) { 3471 int pos, bool is_static) {
3456 ObjectLiteral::Property* prop = 3472 ObjectLiteral::Property* prop =
3457 new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static); 3473 new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static);
3458 prop->set_key(NewStringLiteral(value->raw_name(), pos)); 3474 prop->set_key(NewStringLiteral(value->raw_name(), pos));
3459 return prop; // Not an AST node, will not be visited. 3475 return prop; // Not an AST node, will not be visited.
3460 } 3476 }
3461 3477
3462 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, 3478 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern,
3463 const AstRawString* flags, 3479 const AstRawString* flags,
3464 int literal_index, 3480 int literal_index,
3465 int pos) { 3481 int pos) {
3466 RegExpLiteral* lit = 3482 RegExpLiteral* lit = new (zone_)
3467 new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); 3483 RegExpLiteral(zone_, pattern, flags, literal_index, pos, id_gen_);
3468 VISIT_AND_RETURN(RegExpLiteral, lit); 3484 VISIT_AND_RETURN(RegExpLiteral, lit);
3469 } 3485 }
3470 3486
3471 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, 3487 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
3472 int literal_index, 3488 int literal_index,
3473 int pos) { 3489 int pos) {
3474 ArrayLiteral* lit = 3490 ArrayLiteral* lit =
3475 new (zone_) ArrayLiteral(zone_, values, literal_index, pos); 3491 new (zone_) ArrayLiteral(zone_, values, literal_index, pos, id_gen_);
3476 VISIT_AND_RETURN(ArrayLiteral, lit) 3492 VISIT_AND_RETURN(ArrayLiteral, lit)
3477 } 3493 }
3478 3494
3479 VariableProxy* NewVariableProxy(Variable* var, 3495 VariableProxy* NewVariableProxy(Variable* var,
3480 int pos = RelocInfo::kNoPosition) { 3496 int pos = RelocInfo::kNoPosition) {
3481 VariableProxy* proxy = new (zone_) VariableProxy(zone_, var, pos); 3497 VariableProxy* proxy = new (zone_) VariableProxy(zone_, var, pos, id_gen_);
3482 VISIT_AND_RETURN(VariableProxy, proxy) 3498 VISIT_AND_RETURN(VariableProxy, proxy)
3483 } 3499 }
3484 3500
3485 VariableProxy* NewVariableProxy(const AstRawString* name, 3501 VariableProxy* NewVariableProxy(const AstRawString* name,
3486 bool is_this, 3502 bool is_this,
3487 Interface* interface = Interface::NewValue(), 3503 Interface* interface = Interface::NewValue(),
3488 int position = RelocInfo::kNoPosition) { 3504 int position = RelocInfo::kNoPosition) {
3489 VariableProxy* proxy = 3505 VariableProxy* proxy = new (zone_)
3490 new (zone_) VariableProxy(zone_, name, is_this, interface, position); 3506 VariableProxy(zone_, name, is_this, interface, position, id_gen_);
3491 VISIT_AND_RETURN(VariableProxy, proxy) 3507 VISIT_AND_RETURN(VariableProxy, proxy)
3492 } 3508 }
3493 3509
3494 Property* NewProperty(Expression* obj, Expression* key, int pos) { 3510 Property* NewProperty(Expression* obj, Expression* key, int pos) {
3495 Property* prop = new (zone_) Property(zone_, obj, key, pos); 3511 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_);
3496 VISIT_AND_RETURN(Property, prop) 3512 VISIT_AND_RETURN(Property, prop)
3497 } 3513 }
3498 3514
3499 Call* NewCall(Expression* expression, 3515 Call* NewCall(Expression* expression,
3500 ZoneList<Expression*>* arguments, 3516 ZoneList<Expression*>* arguments,
3501 int pos) { 3517 int pos) {
3502 Call* call = new (zone_) Call(zone_, expression, arguments, pos); 3518 Call* call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_);
3503 VISIT_AND_RETURN(Call, call) 3519 VISIT_AND_RETURN(Call, call)
3504 } 3520 }
3505 3521
3506 CallNew* NewCallNew(Expression* expression, 3522 CallNew* NewCallNew(Expression* expression,
3507 ZoneList<Expression*>* arguments, 3523 ZoneList<Expression*>* arguments,
3508 int pos) { 3524 int pos) {
3509 CallNew* call = new (zone_) CallNew(zone_, expression, arguments, pos); 3525 CallNew* call =
3526 new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_);
3510 VISIT_AND_RETURN(CallNew, call) 3527 VISIT_AND_RETURN(CallNew, call)
3511 } 3528 }
3512 3529
3513 CallRuntime* NewCallRuntime(const AstRawString* name, 3530 CallRuntime* NewCallRuntime(const AstRawString* name,
3514 const Runtime::Function* function, 3531 const Runtime::Function* function,
3515 ZoneList<Expression*>* arguments, 3532 ZoneList<Expression*>* arguments,
3516 int pos) { 3533 int pos) {
3517 CallRuntime* call = 3534 CallRuntime* call =
3518 new (zone_) CallRuntime(zone_, name, function, arguments, pos); 3535 new (zone_) CallRuntime(zone_, name, function, arguments, pos, id_gen_);
3519 VISIT_AND_RETURN(CallRuntime, call) 3536 VISIT_AND_RETURN(CallRuntime, call)
3520 } 3537 }
3521 3538
3522 UnaryOperation* NewUnaryOperation(Token::Value op, 3539 UnaryOperation* NewUnaryOperation(Token::Value op,
3523 Expression* expression, 3540 Expression* expression,
3524 int pos) { 3541 int pos) {
3525 UnaryOperation* node = 3542 UnaryOperation* node =
3526 new (zone_) UnaryOperation(zone_, op, expression, pos); 3543 new (zone_) UnaryOperation(zone_, op, expression, pos, id_gen_);
3527 VISIT_AND_RETURN(UnaryOperation, node) 3544 VISIT_AND_RETURN(UnaryOperation, node)
3528 } 3545 }
3529 3546
3530 BinaryOperation* NewBinaryOperation(Token::Value op, 3547 BinaryOperation* NewBinaryOperation(Token::Value op,
3531 Expression* left, 3548 Expression* left,
3532 Expression* right, 3549 Expression* right,
3533 int pos) { 3550 int pos) {
3534 BinaryOperation* node = 3551 BinaryOperation* node =
3535 new (zone_) BinaryOperation(zone_, op, left, right, pos); 3552 new (zone_) BinaryOperation(zone_, op, left, right, pos, id_gen_);
3536 VISIT_AND_RETURN(BinaryOperation, node) 3553 VISIT_AND_RETURN(BinaryOperation, node)
3537 } 3554 }
3538 3555
3539 CountOperation* NewCountOperation(Token::Value op, 3556 CountOperation* NewCountOperation(Token::Value op,
3540 bool is_prefix, 3557 bool is_prefix,
3541 Expression* expr, 3558 Expression* expr,
3542 int pos) { 3559 int pos) {
3543 CountOperation* node = 3560 CountOperation* node =
3544 new (zone_) CountOperation(zone_, op, is_prefix, expr, pos); 3561 new (zone_) CountOperation(zone_, op, is_prefix, expr, pos, id_gen_);
3545 VISIT_AND_RETURN(CountOperation, node) 3562 VISIT_AND_RETURN(CountOperation, node)
3546 } 3563 }
3547 3564
3548 CompareOperation* NewCompareOperation(Token::Value op, 3565 CompareOperation* NewCompareOperation(Token::Value op,
3549 Expression* left, 3566 Expression* left,
3550 Expression* right, 3567 Expression* right,
3551 int pos) { 3568 int pos) {
3552 CompareOperation* node = 3569 CompareOperation* node =
3553 new (zone_) CompareOperation(zone_, op, left, right, pos); 3570 new (zone_) CompareOperation(zone_, op, left, right, pos, id_gen_);
3554 VISIT_AND_RETURN(CompareOperation, node) 3571 VISIT_AND_RETURN(CompareOperation, node)
3555 } 3572 }
3556 3573
3557 Conditional* NewConditional(Expression* condition, 3574 Conditional* NewConditional(Expression* condition,
3558 Expression* then_expression, 3575 Expression* then_expression,
3559 Expression* else_expression, 3576 Expression* else_expression,
3560 int position) { 3577 int position) {
3561 Conditional* cond = new (zone_) Conditional( 3578 Conditional* cond = new (zone_) Conditional(
3562 zone_, condition, then_expression, else_expression, position); 3579 zone_, condition, then_expression, else_expression, position, id_gen_);
3563 VISIT_AND_RETURN(Conditional, cond) 3580 VISIT_AND_RETURN(Conditional, cond)
3564 } 3581 }
3565 3582
3566 Assignment* NewAssignment(Token::Value op, 3583 Assignment* NewAssignment(Token::Value op,
3567 Expression* target, 3584 Expression* target,
3568 Expression* value, 3585 Expression* value,
3569 int pos) { 3586 int pos) {
3570 Assignment* assign = new (zone_) Assignment(zone_, op, target, value, pos); 3587 Assignment* assign =
3571 assign->Init(this); 3588 new (zone_) Assignment(zone_, op, target, value, pos, id_gen_);
3589 assign->Init(zone_, this);
3572 VISIT_AND_RETURN(Assignment, assign) 3590 VISIT_AND_RETURN(Assignment, assign)
3573 } 3591 }
3574 3592
3575 Yield* NewYield(Expression *generator_object, 3593 Yield* NewYield(Expression *generator_object,
3576 Expression* expression, 3594 Expression* expression,
3577 Yield::Kind yield_kind, 3595 Yield::Kind yield_kind,
3578 int pos) { 3596 int pos) {
3579 if (!expression) expression = NewUndefinedLiteral(pos); 3597 if (!expression) expression = NewUndefinedLiteral(pos);
3580 Yield* yield = 3598 Yield* yield = new (zone_)
3581 new (zone_) Yield(zone_, generator_object, expression, yield_kind, pos); 3599 Yield(zone_, generator_object, expression, yield_kind, pos, id_gen_);
3582 VISIT_AND_RETURN(Yield, yield) 3600 VISIT_AND_RETURN(Yield, yield)
3583 } 3601 }
3584 3602
3585 Throw* NewThrow(Expression* exception, int pos) { 3603 Throw* NewThrow(Expression* exception, int pos) {
3586 Throw* t = new (zone_) Throw(zone_, exception, pos); 3604 Throw* t = new (zone_) Throw(zone_, exception, pos, id_gen_);
3587 VISIT_AND_RETURN(Throw, t) 3605 VISIT_AND_RETURN(Throw, t)
3588 } 3606 }
3589 3607
3590 FunctionLiteral* NewFunctionLiteral( 3608 FunctionLiteral* NewFunctionLiteral(
3591 const AstRawString* name, AstValueFactory* ast_value_factory, 3609 const AstRawString* name, AstValueFactory* ast_value_factory,
3592 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, 3610 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count,
3593 int expected_property_count, int handler_count, int parameter_count, 3611 int expected_property_count, int handler_count, int parameter_count,
3594 FunctionLiteral::ParameterFlag has_duplicate_parameters, 3612 FunctionLiteral::ParameterFlag has_duplicate_parameters,
3595 FunctionLiteral::FunctionType function_type, 3613 FunctionLiteral::FunctionType function_type,
3596 FunctionLiteral::IsFunctionFlag is_function, 3614 FunctionLiteral::IsFunctionFlag is_function,
3597 FunctionLiteral::IsParenthesizedFlag is_parenthesized, FunctionKind kind, 3615 FunctionLiteral::IsParenthesizedFlag is_parenthesized, FunctionKind kind,
3598 int position) { 3616 int position) {
3599 FunctionLiteral* lit = new (zone_) FunctionLiteral( 3617 FunctionLiteral* lit = new (zone_) FunctionLiteral(
3600 zone_, name, ast_value_factory, scope, body, materialized_literal_count, 3618 zone_, name, ast_value_factory, scope, body, materialized_literal_count,
3601 expected_property_count, handler_count, parameter_count, function_type, 3619 expected_property_count, handler_count, parameter_count, function_type,
3602 has_duplicate_parameters, is_function, is_parenthesized, kind, 3620 has_duplicate_parameters, is_function, is_parenthesized, kind, position,
3603 position); 3621 id_gen_);
3604 // Top-level literal doesn't count for the AST's properties. 3622 // Top-level literal doesn't count for the AST's properties.
3605 if (is_function == FunctionLiteral::kIsFunction) { 3623 if (is_function == FunctionLiteral::kIsFunction) {
3606 visitor_.VisitFunctionLiteral(lit); 3624 visitor_.VisitFunctionLiteral(lit);
3607 } 3625 }
3608 return lit; 3626 return lit;
3609 } 3627 }
3610 3628
3611 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends, 3629 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends,
3612 Expression* constructor, 3630 Expression* constructor,
3613 ZoneList<ObjectLiteral::Property*>* properties, 3631 ZoneList<ObjectLiteral::Property*>* properties,
3614 int start_position, int end_position) { 3632 int start_position, int end_position) {
3615 ClassLiteral* lit = 3633 ClassLiteral* lit =
3616 new (zone_) ClassLiteral(zone_, name, extends, constructor, properties, 3634 new (zone_) ClassLiteral(zone_, name, extends, constructor, properties,
3617 start_position, end_position); 3635 start_position, end_position, id_gen_);
3618 VISIT_AND_RETURN(ClassLiteral, lit) 3636 VISIT_AND_RETURN(ClassLiteral, lit)
3619 } 3637 }
3620 3638
3621 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, 3639 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
3622 v8::Extension* extension, 3640 v8::Extension* extension,
3623 int pos) { 3641 int pos) {
3624 NativeFunctionLiteral* lit = 3642 NativeFunctionLiteral* lit =
3625 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos); 3643 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_);
3626 VISIT_AND_RETURN(NativeFunctionLiteral, lit) 3644 VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3627 } 3645 }
3628 3646
3629 ThisFunction* NewThisFunction(int pos) { 3647 ThisFunction* NewThisFunction(int pos) {
3630 ThisFunction* fun = new (zone_) ThisFunction(zone_, pos); 3648 ThisFunction* fun = new (zone_) ThisFunction(zone_, pos, id_gen_);
3631 VISIT_AND_RETURN(ThisFunction, fun) 3649 VISIT_AND_RETURN(ThisFunction, fun)
3632 } 3650 }
3633 3651
3634 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) { 3652 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) {
3635 SuperReference* super = new (zone_) SuperReference(zone_, this_var, pos); 3653 SuperReference* super =
3654 new (zone_) SuperReference(zone_, this_var, pos, id_gen_);
3636 VISIT_AND_RETURN(SuperReference, super); 3655 VISIT_AND_RETURN(SuperReference, super);
3637 } 3656 }
3638 3657
3639 #undef VISIT_AND_RETURN 3658 #undef VISIT_AND_RETURN
3640 3659
3641 private: 3660 private:
3642 Zone* zone_; 3661 Zone* zone_;
3643 Visitor visitor_; 3662 Visitor visitor_;
3644 AstValueFactory* ast_value_factory_; 3663 AstValueFactory* ast_value_factory_;
3664 AstNode::IdGen* id_gen_;
3645 }; 3665 };
3646 3666
3647 3667
3648 } } // namespace v8::internal 3668 } } // namespace v8::internal
3649 3669
3650 #endif // V8_AST_H_ 3670 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698