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

Side by Side Diff: src/ast.h

Issue 490173002: Take ast node id counting away from Isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Copy AstNode::IdGen over another? Created 6 years, 4 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 | « no previous file | src/ast.cc » ('j') | src/parser.h » ('J')
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 private: 175 private:
176 Flags flags_; 176 Flags flags_;
177 int node_count_; 177 int node_count_;
178 int feedback_slots_; 178 int feedback_slots_;
179 }; 179 };
180 180
181 181
182 class AstNode: public ZoneObject { 182 class AstNode: public ZoneObject {
183 public: 183 public:
184 // For generating IDs for AstNodes.
185 class IdGen {
186 public:
187 IdGen() : id_(0) {}
188 explicit IdGen(int id) : id_(id) {}
189 IdGen(const IdGen& other) : id_(other.id_) {}
190 IdGen& operator=(const IdGen& other) {
rossberg 2014/08/21 13:43:35 I don't think copy and assignment operators need e
marja 2014/08/22 07:59:07 Done.
191 id_ = other.id_;
192 return *this;
193 }
194
195 int GetNextId() { return ReserveIdRange(1); }
196 int ReserveIdRange(int n) {
197 int tmp = id_;
198 id_ += n;
199 return tmp;
200 }
201
202 private:
203 int id_;
204 };
205
184 #define DECLARE_TYPE_ENUM(type) k##type, 206 #define DECLARE_TYPE_ENUM(type) k##type,
185 enum NodeType { 207 enum NodeType {
186 AST_NODE_LIST(DECLARE_TYPE_ENUM) 208 AST_NODE_LIST(DECLARE_TYPE_ENUM)
187 kInvalid = -1 209 kInvalid = -1
188 }; 210 };
189 #undef DECLARE_TYPE_ENUM 211 #undef DECLARE_TYPE_ENUM
190 212
191 void* operator new(size_t size, Zone* zone) { 213 void* operator new(size_t size, Zone* zone) {
192 return zone->New(static_cast<int>(size)); 214 return zone->New(static_cast<int>(size));
193 } 215 }
(...skipping 16 matching lines...) Expand all
210 } 232 }
211 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 233 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
212 #undef DECLARE_NODE_FUNCTIONS 234 #undef DECLARE_NODE_FUNCTIONS
213 235
214 virtual TargetCollector* AsTargetCollector() { return NULL; } 236 virtual TargetCollector* AsTargetCollector() { return NULL; }
215 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 237 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
216 virtual IterationStatement* AsIterationStatement() { return NULL; } 238 virtual IterationStatement* AsIterationStatement() { return NULL; }
217 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 239 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
218 240
219 protected: 241 protected:
220 static int GetNextId(Zone* zone) {
221 return ReserveIdRange(zone, 1);
222 }
223
224 static int ReserveIdRange(Zone* zone, int n) {
225 int tmp = zone->isolate()->ast_node_id();
226 zone->isolate()->set_ast_node_id(tmp + n);
227 return tmp;
228 }
229
230 // Some nodes re-use bailout IDs for type feedback. 242 // Some nodes re-use bailout IDs for type feedback.
231 static TypeFeedbackId reuse(BailoutId id) { 243 static TypeFeedbackId reuse(BailoutId id) {
232 return TypeFeedbackId(id.ToInt()); 244 return TypeFeedbackId(id.ToInt());
233 } 245 }
234 246
235 247
236 private: 248 private:
237 // Hidden to prevent accidental usage. It would have to load the 249 // Hidden to prevent accidental usage. It would have to load the
238 // current zone from the TLS. 250 // current zone from the TLS.
239 void* operator new(size_t size); 251 void* operator new(size_t size);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 377 }
366 378
367 // TODO(rossberg): this should move to its own AST node eventually. 379 // TODO(rossberg): this should move to its own AST node eventually.
368 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 380 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
369 byte to_boolean_types() const { return to_boolean_types_; } 381 byte to_boolean_types() const { return to_boolean_types_; }
370 382
371 BailoutId id() const { return id_; } 383 BailoutId id() const { return id_; }
372 TypeFeedbackId test_id() const { return test_id_; } 384 TypeFeedbackId test_id() const { return test_id_; }
373 385
374 protected: 386 protected:
375 Expression(Zone* zone, int pos) 387 Expression(Zone* zone, int pos, IdGen* id_gen)
376 : AstNode(pos), 388 : AstNode(pos),
377 zone_(zone),
378 bounds_(Bounds::Unbounded(zone)), 389 bounds_(Bounds::Unbounded(zone)),
379 parenthesization_level_(0), 390 parenthesization_level_(0),
380 id_(GetNextId(zone)), 391 id_(id_gen->GetNextId()),
381 test_id_(GetNextId(zone)) {} 392 test_id_(id_gen->GetNextId()) {}
382 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } 393 void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
383 394
384 Zone* zone_;
385
386 private: 395 private:
387 Bounds bounds_; 396 Bounds bounds_;
388 byte to_boolean_types_; 397 byte to_boolean_types_;
389 unsigned parenthesization_level_; 398 unsigned parenthesization_level_;
390 399
391 const BailoutId id_; 400 const BailoutId id_;
392 const TypeFeedbackId test_id_; 401 const TypeFeedbackId test_id_;
393 }; 402 };
394 403
395 404
(...skipping 18 matching lines...) Expand all
414 423
415 // Testers. 424 // Testers.
416 bool is_target_for_anonymous() const { 425 bool is_target_for_anonymous() const {
417 return breakable_type_ == TARGET_FOR_ANONYMOUS; 426 return breakable_type_ == TARGET_FOR_ANONYMOUS;
418 } 427 }
419 428
420 BailoutId EntryId() const { return entry_id_; } 429 BailoutId EntryId() const { return entry_id_; }
421 BailoutId ExitId() const { return exit_id_; } 430 BailoutId ExitId() const { return exit_id_; }
422 431
423 protected: 432 protected:
424 BreakableStatement( 433 BreakableStatement(Zone* zone, ZoneList<const AstRawString*>* labels,
425 Zone* zone, ZoneList<const AstRawString*>* labels, 434 BreakableType breakable_type, int position, IdGen* id_gen)
426 BreakableType breakable_type, int position)
427 : Statement(zone, position), 435 : Statement(zone, position),
428 labels_(labels), 436 labels_(labels),
429 breakable_type_(breakable_type), 437 breakable_type_(breakable_type),
430 entry_id_(GetNextId(zone)), 438 entry_id_(id_gen->GetNextId()),
431 exit_id_(GetNextId(zone)) { 439 exit_id_(id_gen->GetNextId()) {
432 DCHECK(labels == NULL || labels->length() > 0); 440 DCHECK(labels == NULL || labels->length() > 0);
433 } 441 }
434 442
435 443
436 private: 444 private:
437 ZoneList<const AstRawString*>* labels_; 445 ZoneList<const AstRawString*>* labels_;
438 BreakableType breakable_type_; 446 BreakableType breakable_type_;
439 Label break_target_; 447 Label break_target_;
440 const BailoutId entry_id_; 448 const BailoutId entry_id_;
441 const BailoutId exit_id_; 449 const BailoutId exit_id_;
(...skipping 15 matching lines...) Expand all
457 465
458 virtual bool IsJump() const V8_OVERRIDE { 466 virtual bool IsJump() const V8_OVERRIDE {
459 return !statements_.is_empty() && statements_.last()->IsJump() 467 return !statements_.is_empty() && statements_.last()->IsJump()
460 && labels() == NULL; // Good enough as an approximation... 468 && labels() == NULL; // Good enough as an approximation...
461 } 469 }
462 470
463 Scope* scope() const { return scope_; } 471 Scope* scope() const { return scope_; }
464 void set_scope(Scope* scope) { scope_ = scope; } 472 void set_scope(Scope* scope) { scope_ = scope; }
465 473
466 protected: 474 protected:
467 Block(Zone* zone, 475 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
468 ZoneList<const AstRawString*>* labels, 476 bool is_initializer_block, int pos, IdGen* id_gen)
469 int capacity, 477 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos, id_gen),
470 bool is_initializer_block,
471 int pos)
472 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos),
473 statements_(capacity, zone), 478 statements_(capacity, zone),
474 is_initializer_block_(is_initializer_block), 479 is_initializer_block_(is_initializer_block),
475 decls_id_(GetNextId(zone)), 480 decls_id_(id_gen->GetNextId()),
476 scope_(NULL) { 481 scope_(NULL) {}
477 }
478 482
479 private: 483 private:
480 ZoneList<Statement*> statements_; 484 ZoneList<Statement*> statements_;
481 bool is_initializer_block_; 485 bool is_initializer_block_;
482 const BailoutId decls_id_; 486 const BailoutId decls_id_;
483 Scope* scope_; 487 Scope* scope_;
484 }; 488 };
485 489
486 490
487 class Declaration : public AstNode { 491 class Declaration : public AstNode {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 Statement* body() const { return body_; } 736 Statement* body() const { return body_; }
733 737
734 BailoutId OsrEntryId() const { return osr_entry_id_; } 738 BailoutId OsrEntryId() const { return osr_entry_id_; }
735 virtual BailoutId ContinueId() const = 0; 739 virtual BailoutId ContinueId() const = 0;
736 virtual BailoutId StackCheckId() const = 0; 740 virtual BailoutId StackCheckId() const = 0;
737 741
738 // Code generation 742 // Code generation
739 Label* continue_target() { return &continue_target_; } 743 Label* continue_target() { return &continue_target_; }
740 744
741 protected: 745 protected:
742 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 746 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
743 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), 747 IdGen* id_gen)
748 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_gen),
744 body_(NULL), 749 body_(NULL),
745 osr_entry_id_(GetNextId(zone)) { 750 osr_entry_id_(id_gen->GetNextId()) {}
746 }
747 751
748 void Initialize(Statement* body) { 752 void Initialize(Statement* body) {
749 body_ = body; 753 body_ = body;
750 } 754 }
751 755
752 private: 756 private:
753 Statement* body_; 757 Statement* body_;
754 Label continue_target_; 758 Label continue_target_;
755 759
756 const BailoutId osr_entry_id_; 760 const BailoutId osr_entry_id_;
757 }; 761 };
758 762
759 763
760 class DoWhileStatement V8_FINAL : public IterationStatement { 764 class DoWhileStatement V8_FINAL : public IterationStatement {
761 public: 765 public:
762 DECLARE_NODE_TYPE(DoWhileStatement) 766 DECLARE_NODE_TYPE(DoWhileStatement)
763 767
764 void Initialize(Expression* cond, Statement* body) { 768 void Initialize(Expression* cond, Statement* body) {
765 IterationStatement::Initialize(body); 769 IterationStatement::Initialize(body);
766 cond_ = cond; 770 cond_ = cond;
767 } 771 }
768 772
769 Expression* cond() const { return cond_; } 773 Expression* cond() const { return cond_; }
770 774
771 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } 775 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
772 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } 776 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; }
773 BailoutId BackEdgeId() const { return back_edge_id_; } 777 BailoutId BackEdgeId() const { return back_edge_id_; }
774 778
775 protected: 779 protected:
776 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 780 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
777 : IterationStatement(zone, labels, pos), 781 IdGen* id_gen)
782 : IterationStatement(zone, labels, pos, id_gen),
778 cond_(NULL), 783 cond_(NULL),
779 continue_id_(GetNextId(zone)), 784 continue_id_(id_gen->GetNextId()),
780 back_edge_id_(GetNextId(zone)) { 785 back_edge_id_(id_gen->GetNextId()) {}
781 }
782 786
783 private: 787 private:
784 Expression* cond_; 788 Expression* cond_;
785 789
786 const BailoutId continue_id_; 790 const BailoutId continue_id_;
787 const BailoutId back_edge_id_; 791 const BailoutId back_edge_id_;
788 }; 792 };
789 793
790 794
791 class WhileStatement V8_FINAL : public IterationStatement { 795 class WhileStatement V8_FINAL : public IterationStatement {
(...skipping 11 matching lines...) Expand all
803 } 807 }
804 void set_may_have_function_literal(bool value) { 808 void set_may_have_function_literal(bool value) {
805 may_have_function_literal_ = value; 809 may_have_function_literal_ = value;
806 } 810 }
807 811
808 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } 812 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
809 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } 813 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
810 BailoutId BodyId() const { return body_id_; } 814 BailoutId BodyId() const { return body_id_; }
811 815
812 protected: 816 protected:
813 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 817 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
814 : IterationStatement(zone, labels, pos), 818 IdGen* id_gen)
819 : IterationStatement(zone, labels, pos, id_gen),
815 cond_(NULL), 820 cond_(NULL),
816 may_have_function_literal_(true), 821 may_have_function_literal_(true),
817 body_id_(GetNextId(zone)) { 822 body_id_(id_gen->GetNextId()) {}
818 }
819 823
820 private: 824 private:
821 Expression* cond_; 825 Expression* cond_;
822 826
823 // True if there is a function literal subexpression in the condition. 827 // True if there is a function literal subexpression in the condition.
824 bool may_have_function_literal_; 828 bool may_have_function_literal_;
825 829
826 const BailoutId body_id_; 830 const BailoutId body_id_;
827 }; 831 };
828 832
(...skipping 25 matching lines...) Expand all
854 858
855 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } 859 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
856 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } 860 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
857 BailoutId BodyId() const { return body_id_; } 861 BailoutId BodyId() const { return body_id_; }
858 862
859 bool is_fast_smi_loop() { return loop_variable_ != NULL; } 863 bool is_fast_smi_loop() { return loop_variable_ != NULL; }
860 Variable* loop_variable() { return loop_variable_; } 864 Variable* loop_variable() { return loop_variable_; }
861 void set_loop_variable(Variable* var) { loop_variable_ = var; } 865 void set_loop_variable(Variable* var) { loop_variable_ = var; }
862 866
863 protected: 867 protected:
864 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 868 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
865 : IterationStatement(zone, labels, pos), 869 IdGen* id_gen)
870 : IterationStatement(zone, labels, pos, id_gen),
866 init_(NULL), 871 init_(NULL),
867 cond_(NULL), 872 cond_(NULL),
868 next_(NULL), 873 next_(NULL),
869 may_have_function_literal_(true), 874 may_have_function_literal_(true),
870 loop_variable_(NULL), 875 loop_variable_(NULL),
871 continue_id_(GetNextId(zone)), 876 continue_id_(id_gen->GetNextId()),
872 body_id_(GetNextId(zone)) { 877 body_id_(id_gen->GetNextId()) {}
873 }
874 878
875 private: 879 private:
876 Statement* init_; 880 Statement* init_;
877 Expression* cond_; 881 Expression* cond_;
878 Statement* next_; 882 Statement* next_;
879 883
880 // True if there is a function literal subexpression in the condition. 884 // True if there is a function literal subexpression in the condition.
881 bool may_have_function_literal_; 885 bool may_have_function_literal_;
882 Variable* loop_variable_; 886 Variable* loop_variable_;
883 887
(...skipping 12 matching lines...) Expand all
896 void Initialize(Expression* each, Expression* subject, Statement* body) { 900 void Initialize(Expression* each, Expression* subject, Statement* body) {
897 IterationStatement::Initialize(body); 901 IterationStatement::Initialize(body);
898 each_ = each; 902 each_ = each;
899 subject_ = subject; 903 subject_ = subject;
900 } 904 }
901 905
902 Expression* each() const { return each_; } 906 Expression* each() const { return each_; }
903 Expression* subject() const { return subject_; } 907 Expression* subject() const { return subject_; }
904 908
905 protected: 909 protected:
906 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 910 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
907 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} 911 IdGen* id_gen)
912 : IterationStatement(zone, labels, pos, id_gen),
913 each_(NULL),
914 subject_(NULL) {}
908 915
909 private: 916 private:
910 Expression* each_; 917 Expression* each_;
911 Expression* subject_; 918 Expression* subject_;
912 }; 919 };
913 920
914 921
915 class ForInStatement V8_FINAL : public ForEachStatement, 922 class ForInStatement V8_FINAL : public ForEachStatement,
916 public FeedbackSlotInterface { 923 public FeedbackSlotInterface {
917 public: 924 public:
(...skipping 15 matching lines...) Expand all
933 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 940 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
934 ForInType for_in_type() const { return for_in_type_; } 941 ForInType for_in_type() const { return for_in_type_; }
935 void set_for_in_type(ForInType type) { for_in_type_ = type; } 942 void set_for_in_type(ForInType type) { for_in_type_ = type; }
936 943
937 BailoutId BodyId() const { return body_id_; } 944 BailoutId BodyId() const { return body_id_; }
938 BailoutId PrepareId() const { return prepare_id_; } 945 BailoutId PrepareId() const { return prepare_id_; }
939 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } 946 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
940 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } 947 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
941 948
942 protected: 949 protected:
943 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 950 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
944 : ForEachStatement(zone, labels, pos), 951 IdGen* id_gen)
952 : ForEachStatement(zone, labels, pos, id_gen),
945 for_in_type_(SLOW_FOR_IN), 953 for_in_type_(SLOW_FOR_IN),
946 for_in_feedback_slot_(kInvalidFeedbackSlot), 954 for_in_feedback_slot_(kInvalidFeedbackSlot),
947 body_id_(GetNextId(zone)), 955 body_id_(id_gen->GetNextId()),
948 prepare_id_(GetNextId(zone)) { 956 prepare_id_(id_gen->GetNextId()) {}
949 }
950 957
951 ForInType for_in_type_; 958 ForInType for_in_type_;
952 int for_in_feedback_slot_; 959 int for_in_feedback_slot_;
953 const BailoutId body_id_; 960 const BailoutId body_id_;
954 const BailoutId prepare_id_; 961 const BailoutId prepare_id_;
955 }; 962 };
956 963
957 964
958 class ForOfStatement V8_FINAL : public ForEachStatement { 965 class ForOfStatement V8_FINAL : public ForEachStatement {
959 public: 966 public:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 Expression* assign_each() const { 1003 Expression* assign_each() const {
997 return assign_each_; 1004 return assign_each_;
998 } 1005 }
999 1006
1000 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } 1007 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
1001 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } 1008 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); }
1002 1009
1003 BailoutId BackEdgeId() const { return back_edge_id_; } 1010 BailoutId BackEdgeId() const { return back_edge_id_; }
1004 1011
1005 protected: 1012 protected:
1006 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 1013 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
1007 : ForEachStatement(zone, labels, pos), 1014 IdGen* id_gen)
1015 : ForEachStatement(zone, labels, pos, id_gen),
1008 assign_iterator_(NULL), 1016 assign_iterator_(NULL),
1009 next_result_(NULL), 1017 next_result_(NULL),
1010 result_done_(NULL), 1018 result_done_(NULL),
1011 assign_each_(NULL), 1019 assign_each_(NULL),
1012 back_edge_id_(GetNextId(zone)) { 1020 back_edge_id_(id_gen->GetNextId()) {}
1013 }
1014 1021
1015 Expression* assign_iterator_; 1022 Expression* assign_iterator_;
1016 Expression* next_result_; 1023 Expression* next_result_;
1017 Expression* result_done_; 1024 Expression* result_done_;
1018 Expression* assign_each_; 1025 Expression* assign_each_;
1019 const BailoutId back_edge_id_; 1026 const BailoutId back_edge_id_;
1020 }; 1027 };
1021 1028
1022 1029
1023 class ExpressionStatement V8_FINAL : public Statement { 1030 class ExpressionStatement V8_FINAL : public Statement {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 ZoneList<Statement*>* statements() const { return statements_; } 1135 ZoneList<Statement*>* statements() const { return statements_; }
1129 1136
1130 BailoutId EntryId() const { return entry_id_; } 1137 BailoutId EntryId() const { return entry_id_; }
1131 1138
1132 // Type feedback information. 1139 // Type feedback information.
1133 TypeFeedbackId CompareId() { return compare_id_; } 1140 TypeFeedbackId CompareId() { return compare_id_; }
1134 Type* compare_type() { return compare_type_; } 1141 Type* compare_type() { return compare_type_; }
1135 void set_compare_type(Type* type) { compare_type_ = type; } 1142 void set_compare_type(Type* type) { compare_type_ = type; }
1136 1143
1137 private: 1144 private:
1138 CaseClause(Zone* zone, 1145 CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements,
1139 Expression* label, 1146 int pos, IdGen* id_gen);
1140 ZoneList<Statement*>* statements,
1141 int pos);
1142 1147
1143 Expression* label_; 1148 Expression* label_;
1144 Label body_target_; 1149 Label body_target_;
1145 ZoneList<Statement*>* statements_; 1150 ZoneList<Statement*>* statements_;
1146 Type* compare_type_; 1151 Type* compare_type_;
1147 1152
1148 const TypeFeedbackId compare_id_; 1153 const TypeFeedbackId compare_id_;
1149 const BailoutId entry_id_; 1154 const BailoutId entry_id_;
1150 }; 1155 };
1151 1156
1152 1157
1153 class SwitchStatement V8_FINAL : public BreakableStatement { 1158 class SwitchStatement V8_FINAL : public BreakableStatement {
1154 public: 1159 public:
1155 DECLARE_NODE_TYPE(SwitchStatement) 1160 DECLARE_NODE_TYPE(SwitchStatement)
1156 1161
1157 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1162 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1158 tag_ = tag; 1163 tag_ = tag;
1159 cases_ = cases; 1164 cases_ = cases;
1160 } 1165 }
1161 1166
1162 Expression* tag() const { return tag_; } 1167 Expression* tag() const { return tag_; }
1163 ZoneList<CaseClause*>* cases() const { return cases_; } 1168 ZoneList<CaseClause*>* cases() const { return cases_; }
1164 1169
1165 protected: 1170 protected:
1166 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 1171 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
1167 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), 1172 IdGen* id_gen)
1173 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_gen),
1168 tag_(NULL), 1174 tag_(NULL),
1169 cases_(NULL) { } 1175 cases_(NULL) {}
1170 1176
1171 private: 1177 private:
1172 Expression* tag_; 1178 Expression* tag_;
1173 ZoneList<CaseClause*>* cases_; 1179 ZoneList<CaseClause*>* cases_;
1174 }; 1180 };
1175 1181
1176 1182
1177 // If-statements always have non-null references to their then- and 1183 // If-statements always have non-null references to their then- and
1178 // else-parts. When parsing if-statements with no explicit else-part, 1184 // else-parts. When parsing if-statements with no explicit else-part,
1179 // the parser implicitly creates an empty statement. Use the 1185 // the parser implicitly creates an empty statement. Use the
(...skipping 13 matching lines...) Expand all
1193 virtual bool IsJump() const V8_OVERRIDE { 1199 virtual bool IsJump() const V8_OVERRIDE {
1194 return HasThenStatement() && then_statement()->IsJump() 1200 return HasThenStatement() && then_statement()->IsJump()
1195 && HasElseStatement() && else_statement()->IsJump(); 1201 && HasElseStatement() && else_statement()->IsJump();
1196 } 1202 }
1197 1203
1198 BailoutId IfId() const { return if_id_; } 1204 BailoutId IfId() const { return if_id_; }
1199 BailoutId ThenId() const { return then_id_; } 1205 BailoutId ThenId() const { return then_id_; }
1200 BailoutId ElseId() const { return else_id_; } 1206 BailoutId ElseId() const { return else_id_; }
1201 1207
1202 protected: 1208 protected:
1203 IfStatement(Zone* zone, 1209 IfStatement(Zone* zone, Expression* condition, Statement* then_statement,
1204 Expression* condition, 1210 Statement* else_statement, int pos, IdGen* id_gen)
1205 Statement* then_statement,
1206 Statement* else_statement,
1207 int pos)
1208 : Statement(zone, pos), 1211 : Statement(zone, pos),
1209 condition_(condition), 1212 condition_(condition),
1210 then_statement_(then_statement), 1213 then_statement_(then_statement),
1211 else_statement_(else_statement), 1214 else_statement_(else_statement),
1212 if_id_(GetNextId(zone)), 1215 if_id_(id_gen->GetNextId()),
1213 then_id_(GetNextId(zone)), 1216 then_id_(id_gen->GetNextId()),
1214 else_id_(GetNextId(zone)) { 1217 else_id_(id_gen->GetNextId()) {}
1215 }
1216 1218
1217 private: 1219 private:
1218 Expression* condition_; 1220 Expression* condition_;
1219 Statement* then_statement_; 1221 Statement* then_statement_;
1220 Statement* else_statement_; 1222 Statement* else_statement_;
1221 const BailoutId if_id_; 1223 const BailoutId if_id_;
1222 const BailoutId then_id_; 1224 const BailoutId then_id_;
1223 const BailoutId else_id_; 1225 const BailoutId else_id_;
1224 }; 1226 };
1225 1227
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1374
1373 static bool Match(void* literal1, void* literal2) { 1375 static bool Match(void* literal1, void* literal2) {
1374 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); 1376 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString();
1375 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); 1377 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString();
1376 return String::Equals(s1, s2); 1378 return String::Equals(s1, s2);
1377 } 1379 }
1378 1380
1379 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } 1381 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
1380 1382
1381 protected: 1383 protected:
1382 Literal(Zone* zone, const AstValue* value, int position) 1384 Literal(Zone* zone, const AstValue* value, int position, IdGen* id_gen)
1383 : Expression(zone, position), 1385 : Expression(zone, position, id_gen),
1384 value_(value), 1386 value_(value),
1385 isolate_(zone->isolate()) { } 1387 isolate_(zone->isolate()) {}
1386 1388
1387 private: 1389 private:
1388 Handle<String> ToString(); 1390 Handle<String> ToString();
1389 1391
1390 const AstValue* value_; 1392 const AstValue* value_;
1391 // TODO(dcarney): remove. this is only needed for Match and Hash. 1393 // TODO(dcarney): remove. this is only needed for Match and Hash.
1392 Isolate* isolate_; 1394 Isolate* isolate_;
1393 }; 1395 };
1394 1396
1395 1397
1396 // Base class for literals that needs space in the corresponding JSFunction. 1398 // Base class for literals that needs space in the corresponding JSFunction.
1397 class MaterializedLiteral : public Expression { 1399 class MaterializedLiteral : public Expression {
1398 public: 1400 public:
1399 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } 1401 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; }
1400 1402
1401 int literal_index() { return literal_index_; } 1403 int literal_index() { return literal_index_; }
1402 1404
1403 int depth() const { 1405 int depth() const {
1404 // only callable after initialization. 1406 // only callable after initialization.
1405 DCHECK(depth_ >= 1); 1407 DCHECK(depth_ >= 1);
1406 return depth_; 1408 return depth_;
1407 } 1409 }
1408 1410
1409 protected: 1411 protected:
1410 MaterializedLiteral(Zone* zone, 1412 MaterializedLiteral(Zone* zone, int literal_index, int pos, IdGen* id_gen)
1411 int literal_index, 1413 : Expression(zone, pos, id_gen),
1412 int pos)
1413 : Expression(zone, pos),
1414 literal_index_(literal_index), 1414 literal_index_(literal_index),
1415 is_simple_(false), 1415 is_simple_(false),
1416 depth_(0) {} 1416 depth_(0) {}
1417 1417
1418 // A materialized literal is simple if the values consist of only 1418 // A materialized literal is simple if the values consist of only
1419 // constants and simple object and array literals. 1419 // constants and simple object and array literals.
1420 bool is_simple() const { return is_simple_; } 1420 bool is_simple() const { return is_simple_; }
1421 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } 1421 void set_is_simple(bool is_simple) { is_simple_ = is_simple; }
1422 friend class CompileTimeValue; 1422 friend class CompileTimeValue;
1423 1423
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 kHasFunction = 1 << 1 1530 kHasFunction = 1 << 1
1531 }; 1531 };
1532 1532
1533 struct Accessors: public ZoneObject { 1533 struct Accessors: public ZoneObject {
1534 Accessors() : getter(NULL), setter(NULL) { } 1534 Accessors() : getter(NULL), setter(NULL) { }
1535 Expression* getter; 1535 Expression* getter;
1536 Expression* setter; 1536 Expression* setter;
1537 }; 1537 };
1538 1538
1539 protected: 1539 protected:
1540 ObjectLiteral(Zone* zone, 1540 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
1541 ZoneList<Property*>* properties, 1541 int boilerplate_properties, bool has_function, int pos,
1542 int literal_index, 1542 IdGen* id_gen)
1543 int boilerplate_properties, 1543 : MaterializedLiteral(zone, literal_index, pos, id_gen),
1544 bool has_function,
1545 int pos)
1546 : MaterializedLiteral(zone, literal_index, pos),
1547 properties_(properties), 1544 properties_(properties),
1548 boilerplate_properties_(boilerplate_properties), 1545 boilerplate_properties_(boilerplate_properties),
1549 fast_elements_(false), 1546 fast_elements_(false),
1550 may_store_doubles_(false), 1547 may_store_doubles_(false),
1551 has_function_(has_function) {} 1548 has_function_(has_function) {}
1552 1549
1553 private: 1550 private:
1554 Handle<FixedArray> constant_properties_; 1551 Handle<FixedArray> constant_properties_;
1555 ZoneList<Property*>* properties_; 1552 ZoneList<Property*>* properties_;
1556 int boilerplate_properties_; 1553 int boilerplate_properties_;
1557 bool fast_elements_; 1554 bool fast_elements_;
1558 bool may_store_doubles_; 1555 bool may_store_doubles_;
1559 bool has_function_; 1556 bool has_function_;
1560 }; 1557 };
1561 1558
1562 1559
1563 // Node for capturing a regexp literal. 1560 // Node for capturing a regexp literal.
1564 class RegExpLiteral V8_FINAL : public MaterializedLiteral { 1561 class RegExpLiteral V8_FINAL : public MaterializedLiteral {
1565 public: 1562 public:
1566 DECLARE_NODE_TYPE(RegExpLiteral) 1563 DECLARE_NODE_TYPE(RegExpLiteral)
1567 1564
1568 Handle<String> pattern() const { return pattern_->string(); } 1565 Handle<String> pattern() const { return pattern_->string(); }
1569 Handle<String> flags() const { return flags_->string(); } 1566 Handle<String> flags() const { return flags_->string(); }
1570 1567
1571 protected: 1568 protected:
1572 RegExpLiteral(Zone* zone, 1569 RegExpLiteral(Zone* zone, const AstRawString* pattern,
1573 const AstRawString* pattern, 1570 const AstRawString* flags, int literal_index, int pos,
1574 const AstRawString* flags, 1571 IdGen* id_gen)
1575 int literal_index, 1572 : MaterializedLiteral(zone, literal_index, pos, id_gen),
1576 int pos)
1577 : MaterializedLiteral(zone, literal_index, pos),
1578 pattern_(pattern), 1573 pattern_(pattern),
1579 flags_(flags) { 1574 flags_(flags) {
1580 set_depth(1); 1575 set_depth(1);
1581 } 1576 }
1582 1577
1583 private: 1578 private:
1584 const AstRawString* pattern_; 1579 const AstRawString* pattern_;
1585 const AstRawString* flags_; 1580 const AstRawString* flags_;
1586 }; 1581 };
1587 1582
(...skipping 22 matching lines...) Expand all
1610 return flags; 1605 return flags;
1611 } 1606 }
1612 1607
1613 enum Flags { 1608 enum Flags {
1614 kNoFlags = 0, 1609 kNoFlags = 0,
1615 kShallowElements = 1, 1610 kShallowElements = 1,
1616 kDisableMementos = 1 << 1 1611 kDisableMementos = 1 << 1
1617 }; 1612 };
1618 1613
1619 protected: 1614 protected:
1620 ArrayLiteral(Zone* zone, 1615 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index,
1621 ZoneList<Expression*>* values, 1616 int pos, IdGen* id_gen)
1622 int literal_index, 1617 : MaterializedLiteral(zone, literal_index, pos, id_gen),
1623 int pos)
1624 : MaterializedLiteral(zone, literal_index, pos),
1625 values_(values), 1618 values_(values),
1626 first_element_id_(ReserveIdRange(zone, values->length())) {} 1619 first_element_id_(id_gen->ReserveIdRange(values->length())) {}
1627 1620
1628 private: 1621 private:
1629 Handle<FixedArray> constant_elements_; 1622 Handle<FixedArray> constant_elements_;
1630 ZoneList<Expression*>* values_; 1623 ZoneList<Expression*>* values_;
1631 const BailoutId first_element_id_; 1624 const BailoutId first_element_id_;
1632 }; 1625 };
1633 1626
1634 1627
1635 class VariableProxy V8_FINAL : public Expression, public FeedbackSlotInterface { 1628 class VariableProxy V8_FINAL : public Expression, public FeedbackSlotInterface {
1636 public: 1629 public:
(...skipping 18 matching lines...) Expand all
1655 void BindTo(Variable* var); 1648 void BindTo(Variable* var);
1656 1649
1657 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } 1650 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; }
1658 virtual void SetFirstFeedbackSlot(int slot) { 1651 virtual void SetFirstFeedbackSlot(int slot) {
1659 variable_feedback_slot_ = slot; 1652 variable_feedback_slot_ = slot;
1660 } 1653 }
1661 1654
1662 int VariableFeedbackSlot() { return variable_feedback_slot_; } 1655 int VariableFeedbackSlot() { return variable_feedback_slot_; }
1663 1656
1664 protected: 1657 protected:
1665 VariableProxy(Zone* zone, Variable* var, int position); 1658 VariableProxy(Zone* zone, Variable* var, int position, IdGen* id_gen);
1666 1659
1667 VariableProxy(Zone* zone, 1660 VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
1668 const AstRawString* name, 1661 Interface* interface, int position, IdGen* id_gen);
1669 bool is_this,
1670 Interface* interface,
1671 int position);
1672 1662
1673 const AstRawString* name_; 1663 const AstRawString* name_;
1674 Variable* var_; // resolved variable, or NULL 1664 Variable* var_; // resolved variable, or NULL
1675 bool is_this_; 1665 bool is_this_;
1676 bool is_assigned_; 1666 bool is_assigned_;
1677 Interface* interface_; 1667 Interface* interface_;
1678 int variable_feedback_slot_; 1668 int variable_feedback_slot_;
1679 }; 1669 };
1680 1670
1681 1671
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } 1708 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
1719 1709
1720 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } 1710 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; }
1721 virtual void SetFirstFeedbackSlot(int slot) { 1711 virtual void SetFirstFeedbackSlot(int slot) {
1722 property_feedback_slot_ = slot; 1712 property_feedback_slot_ = slot;
1723 } 1713 }
1724 1714
1725 int PropertyFeedbackSlot() const { return property_feedback_slot_; } 1715 int PropertyFeedbackSlot() const { return property_feedback_slot_; }
1726 1716
1727 protected: 1717 protected:
1728 Property(Zone* zone, Expression* obj, Expression* key, int pos) 1718 Property(Zone* zone, Expression* obj, Expression* key, int pos, IdGen* id_gen)
1729 : Expression(zone, pos), 1719 : Expression(zone, pos, id_gen),
1730 obj_(obj), 1720 obj_(obj),
1731 key_(key), 1721 key_(key),
1732 load_id_(GetNextId(zone)), 1722 load_id_(id_gen->GetNextId()),
1733 property_feedback_slot_(kInvalidFeedbackSlot), 1723 property_feedback_slot_(kInvalidFeedbackSlot),
1734 is_for_call_(false), 1724 is_for_call_(false),
1735 is_uninitialized_(false), 1725 is_uninitialized_(false),
1736 is_string_access_(false) {} 1726 is_string_access_(false) {}
1737 1727
1738 private: 1728 private:
1739 Expression* obj_; 1729 Expression* obj_;
1740 Expression* key_; 1730 Expression* key_;
1741 const BailoutId load_id_; 1731 const BailoutId load_id_;
1742 int property_feedback_slot_; 1732 int property_feedback_slot_;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 // Helpers to determine how to handle the call. 1804 // Helpers to determine how to handle the call.
1815 CallType GetCallType(Isolate* isolate) const; 1805 CallType GetCallType(Isolate* isolate) const;
1816 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; 1806 bool IsUsingCallFeedbackSlot(Isolate* isolate) const;
1817 1807
1818 #ifdef DEBUG 1808 #ifdef DEBUG
1819 // Used to assert that the FullCodeGenerator records the return site. 1809 // Used to assert that the FullCodeGenerator records the return site.
1820 bool return_is_recorded_; 1810 bool return_is_recorded_;
1821 #endif 1811 #endif
1822 1812
1823 protected: 1813 protected:
1824 Call(Zone* zone, 1814 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
1825 Expression* expression, 1815 int pos, IdGen* id_gen)
1826 ZoneList<Expression*>* arguments, 1816 : Expression(zone, pos, id_gen),
1827 int pos)
1828 : Expression(zone, pos),
1829 expression_(expression), 1817 expression_(expression),
1830 arguments_(arguments), 1818 arguments_(arguments),
1831 call_feedback_slot_(kInvalidFeedbackSlot), 1819 call_feedback_slot_(kInvalidFeedbackSlot),
1832 return_id_(GetNextId(zone)) { 1820 return_id_(id_gen->GetNextId()) {
1833 if (expression->IsProperty()) { 1821 if (expression->IsProperty()) {
1834 expression->AsProperty()->mark_for_call(); 1822 expression->AsProperty()->mark_for_call();
1835 } 1823 }
1836 } 1824 }
1837 1825
1838 private: 1826 private:
1839 Expression* expression_; 1827 Expression* expression_;
1840 ZoneList<Expression*>* arguments_; 1828 ZoneList<Expression*>* arguments_;
1841 1829
1842 Handle<JSFunction> target_; 1830 Handle<JSFunction> target_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 ElementsKind elements_kind() const { return elements_kind_; } 1867 ElementsKind elements_kind() const { return elements_kind_; }
1880 Handle<AllocationSite> allocation_site() const { 1868 Handle<AllocationSite> allocation_site() const {
1881 return allocation_site_; 1869 return allocation_site_;
1882 } 1870 }
1883 1871
1884 static int feedback_slots() { return 1; } 1872 static int feedback_slots() { return 1; }
1885 1873
1886 BailoutId ReturnId() const { return return_id_; } 1874 BailoutId ReturnId() const { return return_id_; }
1887 1875
1888 protected: 1876 protected:
1889 CallNew(Zone* zone, 1877 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
1890 Expression* expression, 1878 int pos, IdGen* id_gen)
1891 ZoneList<Expression*>* arguments, 1879 : Expression(zone, pos, id_gen),
1892 int pos)
1893 : Expression(zone, pos),
1894 expression_(expression), 1880 expression_(expression),
1895 arguments_(arguments), 1881 arguments_(arguments),
1896 is_monomorphic_(false), 1882 is_monomorphic_(false),
1897 elements_kind_(GetInitialFastElementsKind()), 1883 elements_kind_(GetInitialFastElementsKind()),
1898 callnew_feedback_slot_(kInvalidFeedbackSlot), 1884 callnew_feedback_slot_(kInvalidFeedbackSlot),
1899 return_id_(GetNextId(zone)) { } 1885 return_id_(id_gen->GetNextId()) {}
1900 1886
1901 private: 1887 private:
1902 Expression* expression_; 1888 Expression* expression_;
1903 ZoneList<Expression*>* arguments_; 1889 ZoneList<Expression*>* arguments_;
1904 1890
1905 bool is_monomorphic_; 1891 bool is_monomorphic_;
1906 Handle<JSFunction> target_; 1892 Handle<JSFunction> target_;
1907 ElementsKind elements_kind_; 1893 ElementsKind elements_kind_;
1908 Handle<AllocationSite> allocation_site_; 1894 Handle<AllocationSite> allocation_site_;
1909 int callnew_feedback_slot_; 1895 int callnew_feedback_slot_;
(...skipping 26 matching lines...) Expand all
1936 1922
1937 int CallRuntimeFeedbackSlot() { 1923 int CallRuntimeFeedbackSlot() {
1938 DCHECK(!is_jsruntime() || 1924 DCHECK(!is_jsruntime() ||
1939 callruntime_feedback_slot_ != kInvalidFeedbackSlot); 1925 callruntime_feedback_slot_ != kInvalidFeedbackSlot);
1940 return callruntime_feedback_slot_; 1926 return callruntime_feedback_slot_;
1941 } 1927 }
1942 1928
1943 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } 1929 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
1944 1930
1945 protected: 1931 protected:
1946 CallRuntime(Zone* zone, 1932 CallRuntime(Zone* zone, const AstRawString* name,
1947 const AstRawString* name,
1948 const Runtime::Function* function, 1933 const Runtime::Function* function,
1949 ZoneList<Expression*>* arguments, 1934 ZoneList<Expression*>* arguments, int pos, IdGen* id_gen)
1950 int pos) 1935 : Expression(zone, pos, id_gen),
1951 : Expression(zone, pos),
1952 raw_name_(name), 1936 raw_name_(name),
1953 function_(function), 1937 function_(function),
1954 arguments_(arguments) { } 1938 arguments_(arguments) {}
1955 1939
1956 private: 1940 private:
1957 const AstRawString* raw_name_; 1941 const AstRawString* raw_name_;
1958 const Runtime::Function* function_; 1942 const Runtime::Function* function_;
1959 ZoneList<Expression*>* arguments_; 1943 ZoneList<Expression*>* arguments_;
1960 int callruntime_feedback_slot_; 1944 int callruntime_feedback_slot_;
1961 }; 1945 };
1962 1946
1963 1947
1964 class UnaryOperation V8_FINAL : public Expression { 1948 class UnaryOperation V8_FINAL : public Expression {
1965 public: 1949 public:
1966 DECLARE_NODE_TYPE(UnaryOperation) 1950 DECLARE_NODE_TYPE(UnaryOperation)
1967 1951
1968 Token::Value op() const { return op_; } 1952 Token::Value op() const { return op_; }
1969 Expression* expression() const { return expression_; } 1953 Expression* expression() const { return expression_; }
1970 1954
1971 BailoutId MaterializeTrueId() { return materialize_true_id_; } 1955 BailoutId MaterializeTrueId() { return materialize_true_id_; }
1972 BailoutId MaterializeFalseId() { return materialize_false_id_; } 1956 BailoutId MaterializeFalseId() { return materialize_false_id_; }
1973 1957
1974 virtual void RecordToBooleanTypeFeedback( 1958 virtual void RecordToBooleanTypeFeedback(
1975 TypeFeedbackOracle* oracle) V8_OVERRIDE; 1959 TypeFeedbackOracle* oracle) V8_OVERRIDE;
1976 1960
1977 protected: 1961 protected:
1978 UnaryOperation(Zone* zone, 1962 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos,
1979 Token::Value op, 1963 IdGen* id_gen)
1980 Expression* expression, 1964 : Expression(zone, pos, id_gen),
1981 int pos)
1982 : Expression(zone, pos),
1983 op_(op), 1965 op_(op),
1984 expression_(expression), 1966 expression_(expression),
1985 materialize_true_id_(GetNextId(zone)), 1967 materialize_true_id_(id_gen->GetNextId()),
1986 materialize_false_id_(GetNextId(zone)) { 1968 materialize_false_id_(id_gen->GetNextId()) {
1987 DCHECK(Token::IsUnaryOp(op)); 1969 DCHECK(Token::IsUnaryOp(op));
1988 } 1970 }
1989 1971
1990 private: 1972 private:
1991 Token::Value op_; 1973 Token::Value op_;
1992 Expression* expression_; 1974 Expression* expression_;
1993 1975
1994 // For unary not (Token::NOT), the AST ids where true and false will 1976 // For unary not (Token::NOT), the AST ids where true and false will
1995 // actually be materialized, respectively. 1977 // actually be materialized, respectively.
1996 const BailoutId materialize_true_id_; 1978 const BailoutId materialize_true_id_;
(...skipping 18 matching lines...) Expand all
2015 BailoutId RightId() const { return right_id_; } 1997 BailoutId RightId() const { return right_id_; }
2016 1998
2017 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } 1999 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); }
2018 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } 2000 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
2019 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } 2001 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
2020 2002
2021 virtual void RecordToBooleanTypeFeedback( 2003 virtual void RecordToBooleanTypeFeedback(
2022 TypeFeedbackOracle* oracle) V8_OVERRIDE; 2004 TypeFeedbackOracle* oracle) V8_OVERRIDE;
2023 2005
2024 protected: 2006 protected:
2025 BinaryOperation(Zone* zone, 2007 BinaryOperation(Zone* zone, Token::Value op, Expression* left,
2026 Token::Value op, 2008 Expression* right, int pos, IdGen* id_gen)
2027 Expression* left, 2009 : Expression(zone, pos, id_gen),
2028 Expression* right,
2029 int pos)
2030 : Expression(zone, pos),
2031 op_(op), 2010 op_(op),
2032 left_(left), 2011 left_(left),
2033 right_(right), 2012 right_(right),
2034 right_id_(GetNextId(zone)) { 2013 right_id_(id_gen->GetNextId()) {
2035 DCHECK(Token::IsBinaryOp(op)); 2014 DCHECK(Token::IsBinaryOp(op));
2036 } 2015 }
2037 2016
2038 private: 2017 private:
2039 Token::Value op_; 2018 Token::Value op_;
2040 Expression* left_; 2019 Expression* left_;
2041 Expression* right_; 2020 Expression* right_;
2042 Handle<AllocationSite> allocation_site_; 2021 Handle<AllocationSite> allocation_site_;
2043 2022
2044 // TODO(rossberg): the fixed arg should probably be represented as a Constant 2023 // TODO(rossberg): the fixed arg should probably be represented as a Constant
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 Type* type() const { return type_; } 2056 Type* type() const { return type_; }
2078 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2057 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2079 void set_type(Type* type) { type_ = type; } 2058 void set_type(Type* type) { type_ = type; }
2080 2059
2081 BailoutId AssignmentId() const { return assignment_id_; } 2060 BailoutId AssignmentId() const { return assignment_id_; }
2082 2061
2083 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } 2062 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; }
2084 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } 2063 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
2085 2064
2086 protected: 2065 protected:
2087 CountOperation(Zone* zone, 2066 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr,
2088 Token::Value op, 2067 int pos, IdGen* id_gen)
2089 bool is_prefix, 2068 : Expression(zone, pos, id_gen),
2090 Expression* expr,
2091 int pos)
2092 : Expression(zone, pos),
2093 op_(op), 2069 op_(op),
2094 is_prefix_(is_prefix), 2070 is_prefix_(is_prefix),
2095 store_mode_(STANDARD_STORE), 2071 store_mode_(STANDARD_STORE),
2096 expression_(expr), 2072 expression_(expr),
2097 assignment_id_(GetNextId(zone)), 2073 assignment_id_(id_gen->GetNextId()),
2098 count_id_(GetNextId(zone)) {} 2074 count_id_(id_gen->GetNextId()) {}
2099 2075
2100 private: 2076 private:
2101 Token::Value op_; 2077 Token::Value op_;
2102 bool is_prefix_ : 1; 2078 bool is_prefix_ : 1;
2103 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2079 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2104 // must have extra bit. 2080 // must have extra bit.
2105 Type* type_; 2081 Type* type_;
2106 2082
2107 Expression* expression_; 2083 Expression* expression_;
2108 const BailoutId assignment_id_; 2084 const BailoutId assignment_id_;
(...skipping 14 matching lines...) Expand all
2123 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } 2099 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
2124 Type* combined_type() const { return combined_type_; } 2100 Type* combined_type() const { return combined_type_; }
2125 void set_combined_type(Type* type) { combined_type_ = type; } 2101 void set_combined_type(Type* type) { combined_type_ = type; }
2126 2102
2127 // Match special cases. 2103 // Match special cases.
2128 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); 2104 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
2129 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); 2105 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate);
2130 bool IsLiteralCompareNull(Expression** expr); 2106 bool IsLiteralCompareNull(Expression** expr);
2131 2107
2132 protected: 2108 protected:
2133 CompareOperation(Zone* zone, 2109 CompareOperation(Zone* zone, Token::Value op, Expression* left,
2134 Token::Value op, 2110 Expression* right, int pos, IdGen* id_gen)
2135 Expression* left, 2111 : Expression(zone, pos, id_gen),
2136 Expression* right,
2137 int pos)
2138 : Expression(zone, pos),
2139 op_(op), 2112 op_(op),
2140 left_(left), 2113 left_(left),
2141 right_(right), 2114 right_(right),
2142 combined_type_(Type::None(zone)) { 2115 combined_type_(Type::None(zone)) {
2143 DCHECK(Token::IsCompareOp(op)); 2116 DCHECK(Token::IsCompareOp(op));
2144 } 2117 }
2145 2118
2146 private: 2119 private:
2147 Token::Value op_; 2120 Token::Value op_;
2148 Expression* left_; 2121 Expression* left_;
2149 Expression* right_; 2122 Expression* right_;
2150 2123
2151 Type* combined_type_; 2124 Type* combined_type_;
2152 }; 2125 };
2153 2126
2154 2127
2155 class Conditional V8_FINAL : public Expression { 2128 class Conditional V8_FINAL : public Expression {
2156 public: 2129 public:
2157 DECLARE_NODE_TYPE(Conditional) 2130 DECLARE_NODE_TYPE(Conditional)
2158 2131
2159 Expression* condition() const { return condition_; } 2132 Expression* condition() const { return condition_; }
2160 Expression* then_expression() const { return then_expression_; } 2133 Expression* then_expression() const { return then_expression_; }
2161 Expression* else_expression() const { return else_expression_; } 2134 Expression* else_expression() const { return else_expression_; }
2162 2135
2163 BailoutId ThenId() const { return then_id_; } 2136 BailoutId ThenId() const { return then_id_; }
2164 BailoutId ElseId() const { return else_id_; } 2137 BailoutId ElseId() const { return else_id_; }
2165 2138
2166 protected: 2139 protected:
2167 Conditional(Zone* zone, 2140 Conditional(Zone* zone, Expression* condition, Expression* then_expression,
2168 Expression* condition, 2141 Expression* else_expression, int position, IdGen* id_gen)
2169 Expression* then_expression, 2142 : Expression(zone, position, id_gen),
2170 Expression* else_expression,
2171 int position)
2172 : Expression(zone, position),
2173 condition_(condition), 2143 condition_(condition),
2174 then_expression_(then_expression), 2144 then_expression_(then_expression),
2175 else_expression_(else_expression), 2145 else_expression_(else_expression),
2176 then_id_(GetNextId(zone)), 2146 then_id_(id_gen->GetNextId()),
2177 else_id_(GetNextId(zone)) { } 2147 else_id_(id_gen->GetNextId()) {}
2178 2148
2179 private: 2149 private:
2180 Expression* condition_; 2150 Expression* condition_;
2181 Expression* then_expression_; 2151 Expression* then_expression_;
2182 Expression* else_expression_; 2152 Expression* else_expression_;
2183 const BailoutId then_id_; 2153 const BailoutId then_id_;
2184 const BailoutId else_id_; 2154 const BailoutId else_id_;
2185 }; 2155 };
2186 2156
2187 2157
(...skipping 27 matching lines...) Expand all
2215 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { 2185 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
2216 return &receiver_types_; 2186 return &receiver_types_;
2217 } 2187 }
2218 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { 2188 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
2219 return store_mode_; 2189 return store_mode_;
2220 } 2190 }
2221 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } 2191 void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
2222 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2192 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2223 2193
2224 protected: 2194 protected:
2225 Assignment(Zone* zone, 2195 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value,
2226 Token::Value op, 2196 int pos, IdGen* id_gen);
2227 Expression* target,
2228 Expression* value,
2229 int pos);
2230 2197
2231 template<class Visitor> 2198 template<class Visitor>
2232 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { 2199 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) {
2233 DCHECK(Token::IsAssignmentOp(op_)); 2200 DCHECK(Token::IsAssignmentOp(op_));
2234 if (is_compound()) { 2201 if (is_compound()) {
2235 binary_operation_ = factory->NewBinaryOperation( 2202 binary_operation_ = factory->NewBinaryOperation(
2236 binary_op(), target_, value_, position() + 1); 2203 binary_op(), target_, value_, position() + 1);
2237 } 2204 }
2238 } 2205 }
2239 2206
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); 2262 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot);
2296 return yield_first_feedback_slot_ + 1; 2263 return yield_first_feedback_slot_ + 1;
2297 } 2264 }
2298 2265
2299 int ValueFeedbackSlot() { 2266 int ValueFeedbackSlot() {
2300 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); 2267 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot);
2301 return yield_first_feedback_slot_ + 2; 2268 return yield_first_feedback_slot_ + 2;
2302 } 2269 }
2303 2270
2304 protected: 2271 protected:
2305 Yield(Zone* zone, 2272 Yield(Zone* zone, Expression* generator_object, Expression* expression,
2306 Expression* generator_object, 2273 Kind yield_kind, int pos, IdGen* id_gen)
2307 Expression* expression, 2274 : Expression(zone, pos, id_gen),
2308 Kind yield_kind,
2309 int pos)
2310 : Expression(zone, pos),
2311 generator_object_(generator_object), 2275 generator_object_(generator_object),
2312 expression_(expression), 2276 expression_(expression),
2313 yield_kind_(yield_kind), 2277 yield_kind_(yield_kind),
2314 index_(-1), 2278 index_(-1),
2315 yield_first_feedback_slot_(kInvalidFeedbackSlot) { } 2279 yield_first_feedback_slot_(kInvalidFeedbackSlot) {}
2316 2280
2317 private: 2281 private:
2318 Expression* generator_object_; 2282 Expression* generator_object_;
2319 Expression* expression_; 2283 Expression* expression_;
2320 Kind yield_kind_; 2284 Kind yield_kind_;
2321 int index_; 2285 int index_;
2322 int yield_first_feedback_slot_; 2286 int yield_first_feedback_slot_;
2323 }; 2287 };
2324 2288
2325 2289
2326 class Throw V8_FINAL : public Expression { 2290 class Throw V8_FINAL : public Expression {
2327 public: 2291 public:
2328 DECLARE_NODE_TYPE(Throw) 2292 DECLARE_NODE_TYPE(Throw)
2329 2293
2330 Expression* exception() const { return exception_; } 2294 Expression* exception() const { return exception_; }
2331 2295
2332 protected: 2296 protected:
2333 Throw(Zone* zone, Expression* exception, int pos) 2297 Throw(Zone* zone, Expression* exception, int pos, IdGen* id_gen)
2334 : Expression(zone, pos), exception_(exception) {} 2298 : Expression(zone, pos, id_gen), exception_(exception) {}
2335 2299
2336 private: 2300 private:
2337 Expression* exception_; 2301 Expression* exception_;
2338 }; 2302 };
2339 2303
2340 2304
2341 class FunctionLiteral V8_FINAL : public Expression { 2305 class FunctionLiteral V8_FINAL : public Expression {
2342 public: 2306 public:
2343 enum FunctionType { 2307 enum FunctionType {
2344 ANONYMOUS_EXPRESSION, 2308 ANONYMOUS_EXPRESSION,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 2439
2476 protected: 2440 protected:
2477 FunctionLiteral(Zone* zone, const AstRawString* name, 2441 FunctionLiteral(Zone* zone, const AstRawString* name,
2478 AstValueFactory* ast_value_factory, Scope* scope, 2442 AstValueFactory* ast_value_factory, Scope* scope,
2479 ZoneList<Statement*>* body, int materialized_literal_count, 2443 ZoneList<Statement*>* body, int materialized_literal_count,
2480 int expected_property_count, int handler_count, 2444 int expected_property_count, int handler_count,
2481 int parameter_count, FunctionType function_type, 2445 int parameter_count, FunctionType function_type,
2482 ParameterFlag has_duplicate_parameters, 2446 ParameterFlag has_duplicate_parameters,
2483 IsFunctionFlag is_function, 2447 IsFunctionFlag is_function,
2484 IsParenthesizedFlag is_parenthesized, KindFlag kind, 2448 IsParenthesizedFlag is_parenthesized, KindFlag kind,
2485 int position) 2449 int position, IdGen* id_gen)
2486 : Expression(zone, position), 2450 : Expression(zone, position, id_gen),
2487 raw_name_(name), 2451 raw_name_(name),
2488 scope_(scope), 2452 scope_(scope),
2489 body_(body), 2453 body_(body),
2490 raw_inferred_name_(ast_value_factory->empty_string()), 2454 raw_inferred_name_(ast_value_factory->empty_string()),
2491 dont_optimize_reason_(kNoReason), 2455 dont_optimize_reason_(kNoReason),
2492 materialized_literal_count_(materialized_literal_count), 2456 materialized_literal_count_(materialized_literal_count),
2493 expected_property_count_(expected_property_count), 2457 expected_property_count_(expected_property_count),
2494 handler_count_(handler_count), 2458 handler_count_(handler_count),
2495 parameter_count_(parameter_count), 2459 parameter_count_(parameter_count),
2496 function_token_position_(RelocInfo::kNoPosition) { 2460 function_token_position_(RelocInfo::kNoPosition) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 2499
2536 class NativeFunctionLiteral V8_FINAL : public Expression { 2500 class NativeFunctionLiteral V8_FINAL : public Expression {
2537 public: 2501 public:
2538 DECLARE_NODE_TYPE(NativeFunctionLiteral) 2502 DECLARE_NODE_TYPE(NativeFunctionLiteral)
2539 2503
2540 Handle<String> name() const { return name_->string(); } 2504 Handle<String> name() const { return name_->string(); }
2541 v8::Extension* extension() const { return extension_; } 2505 v8::Extension* extension() const { return extension_; }
2542 2506
2543 protected: 2507 protected:
2544 NativeFunctionLiteral(Zone* zone, const AstRawString* name, 2508 NativeFunctionLiteral(Zone* zone, const AstRawString* name,
2545 v8::Extension* extension, int pos) 2509 v8::Extension* extension, int pos, IdGen* id_gen)
2546 : Expression(zone, pos), name_(name), extension_(extension) {} 2510 : Expression(zone, pos, id_gen), name_(name), extension_(extension) {}
2547 2511
2548 private: 2512 private:
2549 const AstRawString* name_; 2513 const AstRawString* name_;
2550 v8::Extension* extension_; 2514 v8::Extension* extension_;
2551 }; 2515 };
2552 2516
2553 2517
2554 class ThisFunction V8_FINAL : public Expression { 2518 class ThisFunction V8_FINAL : public Expression {
2555 public: 2519 public:
2556 DECLARE_NODE_TYPE(ThisFunction) 2520 DECLARE_NODE_TYPE(ThisFunction)
2557 2521
2558 protected: 2522 protected:
2559 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} 2523 ThisFunction(Zone* zone, int pos, IdGen* id_gen)
2524 : Expression(zone, pos, id_gen) {}
2560 }; 2525 };
2561 2526
2562 2527
2563 class SuperReference V8_FINAL : public Expression { 2528 class SuperReference V8_FINAL : public Expression {
2564 public: 2529 public:
2565 DECLARE_NODE_TYPE(SuperReference) 2530 DECLARE_NODE_TYPE(SuperReference)
2566 2531
2567 VariableProxy* this_var() const { return this_var_; } 2532 VariableProxy* this_var() const { return this_var_; }
2568 2533
2569 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } 2534 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); }
2570 2535
2571 protected: 2536 protected:
2572 explicit SuperReference(Zone* zone, VariableProxy* this_var, int pos) 2537 SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen)
2573 : Expression(zone, pos), this_var_(this_var) { 2538 : Expression(zone, pos, id_gen), this_var_(this_var) {
2574 DCHECK(this_var->is_this()); 2539 DCHECK(this_var->is_this());
2575 } 2540 }
2576 2541
2577 VariableProxy* this_var_; 2542 VariableProxy* this_var_;
2578 }; 2543 };
2579 2544
2580 2545
2581 #undef DECLARE_NODE_TYPE 2546 #undef DECLARE_NODE_TYPE
2582 2547
2583 2548
2584 // ---------------------------------------------------------------------------- 2549 // ----------------------------------------------------------------------------
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 }; 3015 };
3051 3016
3052 3017
3053 3018
3054 // ---------------------------------------------------------------------------- 3019 // ----------------------------------------------------------------------------
3055 // AstNode factory 3020 // AstNode factory
3056 3021
3057 template<class Visitor> 3022 template<class Visitor>
3058 class AstNodeFactory V8_FINAL BASE_EMBEDDED { 3023 class AstNodeFactory V8_FINAL BASE_EMBEDDED {
3059 public: 3024 public:
3060 explicit AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory) 3025 AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory,
3061 : zone_(zone), ast_value_factory_(ast_value_factory) {} 3026 AstNode::IdGen* id_gen)
3027 : zone_(zone), ast_value_factory_(ast_value_factory), id_gen_(id_gen) {}
3062 3028
3063 Visitor* visitor() { return &visitor_; } 3029 Visitor* visitor() { return &visitor_; }
3064 3030
3065 #define VISIT_AND_RETURN(NodeType, node) \ 3031 #define VISIT_AND_RETURN(NodeType, node) \
3066 visitor_.Visit##NodeType((node)); \ 3032 visitor_.Visit##NodeType((node)); \
3067 return node; 3033 return node;
3068 3034
3069 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, 3035 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
3070 VariableMode mode, 3036 VariableMode mode,
3071 Scope* scope, 3037 Scope* scope,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 3095
3130 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { 3096 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
3131 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); 3097 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos);
3132 VISIT_AND_RETURN(ModuleUrl, module) 3098 VISIT_AND_RETURN(ModuleUrl, module)
3133 } 3099 }
3134 3100
3135 Block* NewBlock(ZoneList<const AstRawString*>* labels, 3101 Block* NewBlock(ZoneList<const AstRawString*>* labels,
3136 int capacity, 3102 int capacity,
3137 bool is_initializer_block, 3103 bool is_initializer_block,
3138 int pos) { 3104 int pos) {
3139 Block* block = new(zone_) Block( 3105 Block* block = new (zone_)
3140 zone_, labels, capacity, is_initializer_block, pos); 3106 Block(zone_, labels, capacity, is_initializer_block, pos, id_gen_);
3141 VISIT_AND_RETURN(Block, block) 3107 VISIT_AND_RETURN(Block, block)
3142 } 3108 }
3143 3109
3144 #define STATEMENT_WITH_LABELS(NodeType) \ 3110 #define STATEMENT_WITH_LABELS(NodeType) \
3145 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ 3111 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \
3146 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ 3112 NodeType* stmt = new (zone_) NodeType(zone_, labels, pos, id_gen_); \
3147 VISIT_AND_RETURN(NodeType, stmt); \ 3113 VISIT_AND_RETURN(NodeType, stmt); \
3148 } 3114 }
3149 STATEMENT_WITH_LABELS(DoWhileStatement) 3115 STATEMENT_WITH_LABELS(DoWhileStatement)
3150 STATEMENT_WITH_LABELS(WhileStatement) 3116 STATEMENT_WITH_LABELS(WhileStatement)
3151 STATEMENT_WITH_LABELS(ForStatement) 3117 STATEMENT_WITH_LABELS(ForStatement)
3152 STATEMENT_WITH_LABELS(SwitchStatement) 3118 STATEMENT_WITH_LABELS(SwitchStatement)
3153 #undef STATEMENT_WITH_LABELS 3119 #undef STATEMENT_WITH_LABELS
3154 3120
3155 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, 3121 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode,
3156 ZoneList<const AstRawString*>* labels, 3122 ZoneList<const AstRawString*>* labels,
3157 int pos) { 3123 int pos) {
3158 switch (visit_mode) { 3124 switch (visit_mode) {
3159 case ForEachStatement::ENUMERATE: { 3125 case ForEachStatement::ENUMERATE: {
3160 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); 3126 ForInStatement* stmt =
3127 new (zone_) ForInStatement(zone_, labels, pos, id_gen_);
3161 VISIT_AND_RETURN(ForInStatement, stmt); 3128 VISIT_AND_RETURN(ForInStatement, stmt);
3162 } 3129 }
3163 case ForEachStatement::ITERATE: { 3130 case ForEachStatement::ITERATE: {
3164 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); 3131 ForOfStatement* stmt =
3132 new (zone_) ForOfStatement(zone_, labels, pos, id_gen_);
3165 VISIT_AND_RETURN(ForOfStatement, stmt); 3133 VISIT_AND_RETURN(ForOfStatement, stmt);
3166 } 3134 }
3167 } 3135 }
3168 UNREACHABLE(); 3136 UNREACHABLE();
3169 return NULL; 3137 return NULL;
3170 } 3138 }
3171 3139
3172 ModuleStatement* NewModuleStatement( 3140 ModuleStatement* NewModuleStatement(
3173 VariableProxy* proxy, Block* body, int pos) { 3141 VariableProxy* proxy, Block* body, int pos) {
3174 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos); 3142 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos);
(...skipping 27 matching lines...) Expand all
3202 int pos) { 3170 int pos) {
3203 WithStatement* stmt = new(zone_) WithStatement( 3171 WithStatement* stmt = new(zone_) WithStatement(
3204 zone_, scope, expression, statement, pos); 3172 zone_, scope, expression, statement, pos);
3205 VISIT_AND_RETURN(WithStatement, stmt) 3173 VISIT_AND_RETURN(WithStatement, stmt)
3206 } 3174 }
3207 3175
3208 IfStatement* NewIfStatement(Expression* condition, 3176 IfStatement* NewIfStatement(Expression* condition,
3209 Statement* then_statement, 3177 Statement* then_statement,
3210 Statement* else_statement, 3178 Statement* else_statement,
3211 int pos) { 3179 int pos) {
3212 IfStatement* stmt = new(zone_) IfStatement( 3180 IfStatement* stmt = new (zone_) IfStatement(
3213 zone_, condition, then_statement, else_statement, pos); 3181 zone_, condition, then_statement, else_statement, pos, id_gen_);
3214 VISIT_AND_RETURN(IfStatement, stmt) 3182 VISIT_AND_RETURN(IfStatement, stmt)
3215 } 3183 }
3216 3184
3217 TryCatchStatement* NewTryCatchStatement(int index, 3185 TryCatchStatement* NewTryCatchStatement(int index,
3218 Block* try_block, 3186 Block* try_block,
3219 Scope* scope, 3187 Scope* scope,
3220 Variable* variable, 3188 Variable* variable,
3221 Block* catch_block, 3189 Block* catch_block,
3222 int pos) { 3190 int pos) {
3223 TryCatchStatement* stmt = new(zone_) TryCatchStatement( 3191 TryCatchStatement* stmt = new(zone_) TryCatchStatement(
(...skipping 15 matching lines...) Expand all
3239 VISIT_AND_RETURN(DebuggerStatement, stmt) 3207 VISIT_AND_RETURN(DebuggerStatement, stmt)
3240 } 3208 }
3241 3209
3242 EmptyStatement* NewEmptyStatement(int pos) { 3210 EmptyStatement* NewEmptyStatement(int pos) {
3243 return new(zone_) EmptyStatement(zone_, pos); 3211 return new(zone_) EmptyStatement(zone_, pos);
3244 } 3212 }
3245 3213
3246 CaseClause* NewCaseClause( 3214 CaseClause* NewCaseClause(
3247 Expression* label, ZoneList<Statement*>* statements, int pos) { 3215 Expression* label, ZoneList<Statement*>* statements, int pos) {
3248 CaseClause* clause = 3216 CaseClause* clause =
3249 new(zone_) CaseClause(zone_, label, statements, pos); 3217 new (zone_) CaseClause(zone_, label, statements, pos, id_gen_);
3250 VISIT_AND_RETURN(CaseClause, clause) 3218 VISIT_AND_RETURN(CaseClause, clause)
3251 } 3219 }
3252 3220
3253 Literal* NewStringLiteral(const AstRawString* string, int pos) { 3221 Literal* NewStringLiteral(const AstRawString* string, int pos) {
3254 Literal* lit = 3222 Literal* lit = new (zone_)
3255 new (zone_) Literal(zone_, ast_value_factory_->NewString(string), pos); 3223 Literal(zone_, ast_value_factory_->NewString(string), pos, id_gen_);
3256 VISIT_AND_RETURN(Literal, lit) 3224 VISIT_AND_RETURN(Literal, lit)
3257 } 3225 }
3258 3226
3259 // A JavaScript symbol (ECMA-262 edition 6). 3227 // A JavaScript symbol (ECMA-262 edition 6).
3260 Literal* NewSymbolLiteral(const char* name, int pos) { 3228 Literal* NewSymbolLiteral(const char* name, int pos) {
3261 Literal* lit = 3229 Literal* lit = new (zone_)
3262 new (zone_) Literal(zone_, ast_value_factory_->NewSymbol(name), pos); 3230 Literal(zone_, ast_value_factory_->NewSymbol(name), pos, id_gen_);
3263 VISIT_AND_RETURN(Literal, lit) 3231 VISIT_AND_RETURN(Literal, lit)
3264 } 3232 }
3265 3233
3266 Literal* NewNumberLiteral(double number, int pos) { 3234 Literal* NewNumberLiteral(double number, int pos) {
3267 Literal* lit = new (zone_) 3235 Literal* lit = new (zone_)
3268 Literal(zone_, ast_value_factory_->NewNumber(number), pos); 3236 Literal(zone_, ast_value_factory_->NewNumber(number), pos, id_gen_);
3269 VISIT_AND_RETURN(Literal, lit) 3237 VISIT_AND_RETURN(Literal, lit)
3270 } 3238 }
3271 3239
3272 Literal* NewSmiLiteral(int number, int pos) { 3240 Literal* NewSmiLiteral(int number, int pos) {
3273 Literal* lit = 3241 Literal* lit = new (zone_)
3274 new (zone_) Literal(zone_, ast_value_factory_->NewSmi(number), pos); 3242 Literal(zone_, ast_value_factory_->NewSmi(number), pos, id_gen_);
3275 VISIT_AND_RETURN(Literal, lit) 3243 VISIT_AND_RETURN(Literal, lit)
3276 } 3244 }
3277 3245
3278 Literal* NewBooleanLiteral(bool b, int pos) { 3246 Literal* NewBooleanLiteral(bool b, int pos) {
3279 Literal* lit = 3247 Literal* lit = new (zone_)
3280 new (zone_) Literal(zone_, ast_value_factory_->NewBoolean(b), pos); 3248 Literal(zone_, ast_value_factory_->NewBoolean(b), pos, id_gen_);
3281 VISIT_AND_RETURN(Literal, lit) 3249 VISIT_AND_RETURN(Literal, lit)
3282 } 3250 }
3283 3251
3284 Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings, 3252 Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings,
3285 int pos) { 3253 int pos) {
3286 Literal* lit = new (zone_) 3254 Literal* lit = new (zone_) Literal(
3287 Literal(zone_, ast_value_factory_->NewStringList(strings), pos); 3255 zone_, ast_value_factory_->NewStringList(strings), pos, id_gen_);
3288 VISIT_AND_RETURN(Literal, lit) 3256 VISIT_AND_RETURN(Literal, lit)
3289 } 3257 }
3290 3258
3291 Literal* NewNullLiteral(int pos) { 3259 Literal* NewNullLiteral(int pos) {
3292 Literal* lit = 3260 Literal* lit =
3293 new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos); 3261 new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos, id_gen_);
3294 VISIT_AND_RETURN(Literal, lit) 3262 VISIT_AND_RETURN(Literal, lit)
3295 } 3263 }
3296 3264
3297 Literal* NewUndefinedLiteral(int pos) { 3265 Literal* NewUndefinedLiteral(int pos) {
3298 Literal* lit = 3266 Literal* lit = new (zone_)
3299 new (zone_) Literal(zone_, ast_value_factory_->NewUndefined(), pos); 3267 Literal(zone_, ast_value_factory_->NewUndefined(), pos, id_gen_);
3300 VISIT_AND_RETURN(Literal, lit) 3268 VISIT_AND_RETURN(Literal, lit)
3301 } 3269 }
3302 3270
3303 Literal* NewTheHoleLiteral(int pos) { 3271 Literal* NewTheHoleLiteral(int pos) {
3304 Literal* lit = 3272 Literal* lit = new (zone_)
3305 new (zone_) Literal(zone_, ast_value_factory_->NewTheHole(), pos); 3273 Literal(zone_, ast_value_factory_->NewTheHole(), pos, id_gen_);
3306 VISIT_AND_RETURN(Literal, lit) 3274 VISIT_AND_RETURN(Literal, lit)
3307 } 3275 }
3308 3276
3309 ObjectLiteral* NewObjectLiteral( 3277 ObjectLiteral* NewObjectLiteral(
3310 ZoneList<ObjectLiteral::Property*>* properties, 3278 ZoneList<ObjectLiteral::Property*>* properties,
3311 int literal_index, 3279 int literal_index,
3312 int boilerplate_properties, 3280 int boilerplate_properties,
3313 bool has_function, 3281 bool has_function,
3314 int pos) { 3282 int pos) {
3315 ObjectLiteral* lit = new(zone_) ObjectLiteral( 3283 ObjectLiteral* lit = new (zone_)
3316 zone_, properties, literal_index, boilerplate_properties, 3284 ObjectLiteral(zone_, properties, literal_index, boilerplate_properties,
3317 has_function, pos); 3285 has_function, pos, id_gen_);
3318 VISIT_AND_RETURN(ObjectLiteral, lit) 3286 VISIT_AND_RETURN(ObjectLiteral, lit)
3319 } 3287 }
3320 3288
3321 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, 3289 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
3322 Expression* value) { 3290 Expression* value) {
3323 return new (zone_) 3291 return new (zone_)
3324 ObjectLiteral::Property(zone_, ast_value_factory_, key, value); 3292 ObjectLiteral::Property(zone_, ast_value_factory_, key, value);
3325 } 3293 }
3326 3294
3327 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, 3295 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
3328 FunctionLiteral* value, 3296 FunctionLiteral* value,
3329 int pos) { 3297 int pos) {
3330 ObjectLiteral::Property* prop = 3298 ObjectLiteral::Property* prop =
3331 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); 3299 new(zone_) ObjectLiteral::Property(zone_, is_getter, value);
3332 prop->set_key(NewStringLiteral(value->raw_name(), pos)); 3300 prop->set_key(NewStringLiteral(value->raw_name(), pos));
3333 return prop; // Not an AST node, will not be visited. 3301 return prop; // Not an AST node, will not be visited.
3334 } 3302 }
3335 3303
3336 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, 3304 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern,
3337 const AstRawString* flags, 3305 const AstRawString* flags,
3338 int literal_index, 3306 int literal_index,
3339 int pos) { 3307 int pos) {
3340 RegExpLiteral* lit = 3308 RegExpLiteral* lit = new (zone_)
3341 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); 3309 RegExpLiteral(zone_, pattern, flags, literal_index, pos, id_gen_);
3342 VISIT_AND_RETURN(RegExpLiteral, lit); 3310 VISIT_AND_RETURN(RegExpLiteral, lit);
3343 } 3311 }
3344 3312
3345 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, 3313 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
3346 int literal_index, 3314 int literal_index,
3347 int pos) { 3315 int pos) {
3348 ArrayLiteral* lit = new(zone_) ArrayLiteral( 3316 ArrayLiteral* lit =
3349 zone_, values, literal_index, pos); 3317 new (zone_) ArrayLiteral(zone_, values, literal_index, pos, id_gen_);
3350 VISIT_AND_RETURN(ArrayLiteral, lit) 3318 VISIT_AND_RETURN(ArrayLiteral, lit)
3351 } 3319 }
3352 3320
3353 VariableProxy* NewVariableProxy(Variable* var, 3321 VariableProxy* NewVariableProxy(Variable* var,
3354 int pos = RelocInfo::kNoPosition) { 3322 int pos = RelocInfo::kNoPosition) {
3355 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); 3323 VariableProxy* proxy = new (zone_) VariableProxy(zone_, var, pos, id_gen_);
3356 VISIT_AND_RETURN(VariableProxy, proxy) 3324 VISIT_AND_RETURN(VariableProxy, proxy)
3357 } 3325 }
3358 3326
3359 VariableProxy* NewVariableProxy(const AstRawString* name, 3327 VariableProxy* NewVariableProxy(const AstRawString* name,
3360 bool is_this, 3328 bool is_this,
3361 Interface* interface = Interface::NewValue(), 3329 Interface* interface = Interface::NewValue(),
3362 int position = RelocInfo::kNoPosition) { 3330 int position = RelocInfo::kNoPosition) {
3363 VariableProxy* proxy = 3331 VariableProxy* proxy = new (zone_)
3364 new(zone_) VariableProxy(zone_, name, is_this, interface, position); 3332 VariableProxy(zone_, name, is_this, interface, position, id_gen_);
3365 VISIT_AND_RETURN(VariableProxy, proxy) 3333 VISIT_AND_RETURN(VariableProxy, proxy)
3366 } 3334 }
3367 3335
3368 Property* NewProperty(Expression* obj, Expression* key, int pos) { 3336 Property* NewProperty(Expression* obj, Expression* key, int pos) {
3369 Property* prop = new(zone_) Property(zone_, obj, key, pos); 3337 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_);
3370 VISIT_AND_RETURN(Property, prop) 3338 VISIT_AND_RETURN(Property, prop)
3371 } 3339 }
3372 3340
3373 Call* NewCall(Expression* expression, 3341 Call* NewCall(Expression* expression,
3374 ZoneList<Expression*>* arguments, 3342 ZoneList<Expression*>* arguments,
3375 int pos) { 3343 int pos) {
3376 Call* call = new(zone_) Call(zone_, expression, arguments, pos); 3344 Call* call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_);
3377 VISIT_AND_RETURN(Call, call) 3345 VISIT_AND_RETURN(Call, call)
3378 } 3346 }
3379 3347
3380 CallNew* NewCallNew(Expression* expression, 3348 CallNew* NewCallNew(Expression* expression,
3381 ZoneList<Expression*>* arguments, 3349 ZoneList<Expression*>* arguments,
3382 int pos) { 3350 int pos) {
3383 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); 3351 CallNew* call =
3352 new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_);
3384 VISIT_AND_RETURN(CallNew, call) 3353 VISIT_AND_RETURN(CallNew, call)
3385 } 3354 }
3386 3355
3387 CallRuntime* NewCallRuntime(const AstRawString* name, 3356 CallRuntime* NewCallRuntime(const AstRawString* name,
3388 const Runtime::Function* function, 3357 const Runtime::Function* function,
3389 ZoneList<Expression*>* arguments, 3358 ZoneList<Expression*>* arguments,
3390 int pos) { 3359 int pos) {
3391 CallRuntime* call = 3360 CallRuntime* call =
3392 new(zone_) CallRuntime(zone_, name, function, arguments, pos); 3361 new (zone_) CallRuntime(zone_, name, function, arguments, pos, id_gen_);
3393 VISIT_AND_RETURN(CallRuntime, call) 3362 VISIT_AND_RETURN(CallRuntime, call)
3394 } 3363 }
3395 3364
3396 UnaryOperation* NewUnaryOperation(Token::Value op, 3365 UnaryOperation* NewUnaryOperation(Token::Value op,
3397 Expression* expression, 3366 Expression* expression,
3398 int pos) { 3367 int pos) {
3399 UnaryOperation* node = 3368 UnaryOperation* node =
3400 new(zone_) UnaryOperation(zone_, op, expression, pos); 3369 new (zone_) UnaryOperation(zone_, op, expression, pos, id_gen_);
3401 VISIT_AND_RETURN(UnaryOperation, node) 3370 VISIT_AND_RETURN(UnaryOperation, node)
3402 } 3371 }
3403 3372
3404 BinaryOperation* NewBinaryOperation(Token::Value op, 3373 BinaryOperation* NewBinaryOperation(Token::Value op,
3405 Expression* left, 3374 Expression* left,
3406 Expression* right, 3375 Expression* right,
3407 int pos) { 3376 int pos) {
3408 BinaryOperation* node = 3377 BinaryOperation* node =
3409 new(zone_) BinaryOperation(zone_, op, left, right, pos); 3378 new (zone_) BinaryOperation(zone_, op, left, right, pos, id_gen_);
3410 VISIT_AND_RETURN(BinaryOperation, node) 3379 VISIT_AND_RETURN(BinaryOperation, node)
3411 } 3380 }
3412 3381
3413 CountOperation* NewCountOperation(Token::Value op, 3382 CountOperation* NewCountOperation(Token::Value op,
3414 bool is_prefix, 3383 bool is_prefix,
3415 Expression* expr, 3384 Expression* expr,
3416 int pos) { 3385 int pos) {
3417 CountOperation* node = 3386 CountOperation* node =
3418 new(zone_) CountOperation(zone_, op, is_prefix, expr, pos); 3387 new (zone_) CountOperation(zone_, op, is_prefix, expr, pos, id_gen_);
3419 VISIT_AND_RETURN(CountOperation, node) 3388 VISIT_AND_RETURN(CountOperation, node)
3420 } 3389 }
3421 3390
3422 CompareOperation* NewCompareOperation(Token::Value op, 3391 CompareOperation* NewCompareOperation(Token::Value op,
3423 Expression* left, 3392 Expression* left,
3424 Expression* right, 3393 Expression* right,
3425 int pos) { 3394 int pos) {
3426 CompareOperation* node = 3395 CompareOperation* node =
3427 new(zone_) CompareOperation(zone_, op, left, right, pos); 3396 new (zone_) CompareOperation(zone_, op, left, right, pos, id_gen_);
3428 VISIT_AND_RETURN(CompareOperation, node) 3397 VISIT_AND_RETURN(CompareOperation, node)
3429 } 3398 }
3430 3399
3431 Conditional* NewConditional(Expression* condition, 3400 Conditional* NewConditional(Expression* condition,
3432 Expression* then_expression, 3401 Expression* then_expression,
3433 Expression* else_expression, 3402 Expression* else_expression,
3434 int position) { 3403 int position) {
3435 Conditional* cond = new(zone_) Conditional( 3404 Conditional* cond = new (zone_) Conditional(
3436 zone_, condition, then_expression, else_expression, position); 3405 zone_, condition, then_expression, else_expression, position, id_gen_);
3437 VISIT_AND_RETURN(Conditional, cond) 3406 VISIT_AND_RETURN(Conditional, cond)
3438 } 3407 }
3439 3408
3440 Assignment* NewAssignment(Token::Value op, 3409 Assignment* NewAssignment(Token::Value op,
3441 Expression* target, 3410 Expression* target,
3442 Expression* value, 3411 Expression* value,
3443 int pos) { 3412 int pos) {
3444 Assignment* assign = 3413 Assignment* assign =
3445 new(zone_) Assignment(zone_, op, target, value, pos); 3414 new (zone_) Assignment(zone_, op, target, value, pos, id_gen_);
3446 assign->Init(zone_, this); 3415 assign->Init(zone_, this);
3447 VISIT_AND_RETURN(Assignment, assign) 3416 VISIT_AND_RETURN(Assignment, assign)
3448 } 3417 }
3449 3418
3450 Yield* NewYield(Expression *generator_object, 3419 Yield* NewYield(Expression *generator_object,
3451 Expression* expression, 3420 Expression* expression,
3452 Yield::Kind yield_kind, 3421 Yield::Kind yield_kind,
3453 int pos) { 3422 int pos) {
3454 if (!expression) expression = NewUndefinedLiteral(pos); 3423 if (!expression) expression = NewUndefinedLiteral(pos);
3455 Yield* yield = new(zone_) Yield( 3424 Yield* yield = new (zone_)
3456 zone_, generator_object, expression, yield_kind, pos); 3425 Yield(zone_, generator_object, expression, yield_kind, pos, id_gen_);
3457 VISIT_AND_RETURN(Yield, yield) 3426 VISIT_AND_RETURN(Yield, yield)
3458 } 3427 }
3459 3428
3460 Throw* NewThrow(Expression* exception, int pos) { 3429 Throw* NewThrow(Expression* exception, int pos) {
3461 Throw* t = new(zone_) Throw(zone_, exception, pos); 3430 Throw* t = new (zone_) Throw(zone_, exception, pos, id_gen_);
3462 VISIT_AND_RETURN(Throw, t) 3431 VISIT_AND_RETURN(Throw, t)
3463 } 3432 }
3464 3433
3465 FunctionLiteral* NewFunctionLiteral( 3434 FunctionLiteral* NewFunctionLiteral(
3466 const AstRawString* name, AstValueFactory* ast_value_factory, 3435 const AstRawString* name, AstValueFactory* ast_value_factory,
3467 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, 3436 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count,
3468 int expected_property_count, int handler_count, int parameter_count, 3437 int expected_property_count, int handler_count, int parameter_count,
3469 FunctionLiteral::ParameterFlag has_duplicate_parameters, 3438 FunctionLiteral::ParameterFlag has_duplicate_parameters,
3470 FunctionLiteral::FunctionType function_type, 3439 FunctionLiteral::FunctionType function_type,
3471 FunctionLiteral::IsFunctionFlag is_function, 3440 FunctionLiteral::IsFunctionFlag is_function,
3472 FunctionLiteral::IsParenthesizedFlag is_parenthesized, 3441 FunctionLiteral::IsParenthesizedFlag is_parenthesized,
3473 FunctionLiteral::KindFlag kind, int position) { 3442 FunctionLiteral::KindFlag kind, int position) {
3474 FunctionLiteral* lit = new (zone_) FunctionLiteral( 3443 FunctionLiteral* lit = new (zone_) FunctionLiteral(
3475 zone_, name, ast_value_factory, scope, body, materialized_literal_count, 3444 zone_, name, ast_value_factory, scope, body, materialized_literal_count,
3476 expected_property_count, handler_count, parameter_count, function_type, 3445 expected_property_count, handler_count, parameter_count, function_type,
3477 has_duplicate_parameters, is_function, is_parenthesized, kind, 3446 has_duplicate_parameters, is_function, is_parenthesized, kind, position,
3478 position); 3447 id_gen_);
3479 // Top-level literal doesn't count for the AST's properties. 3448 // Top-level literal doesn't count for the AST's properties.
3480 if (is_function == FunctionLiteral::kIsFunction) { 3449 if (is_function == FunctionLiteral::kIsFunction) {
3481 visitor_.VisitFunctionLiteral(lit); 3450 visitor_.VisitFunctionLiteral(lit);
3482 } 3451 }
3483 return lit; 3452 return lit;
3484 } 3453 }
3485 3454
3486 NativeFunctionLiteral* NewNativeFunctionLiteral( 3455 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
3487 const AstRawString* name, v8::Extension* extension, 3456 v8::Extension* extension,
3488 int pos) { 3457 int pos) {
3489 NativeFunctionLiteral* lit = 3458 NativeFunctionLiteral* lit =
3490 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); 3459 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_);
3491 VISIT_AND_RETURN(NativeFunctionLiteral, lit) 3460 VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3492 } 3461 }
3493 3462
3494 ThisFunction* NewThisFunction(int pos) { 3463 ThisFunction* NewThisFunction(int pos) {
3495 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); 3464 ThisFunction* fun = new (zone_) ThisFunction(zone_, pos, id_gen_);
3496 VISIT_AND_RETURN(ThisFunction, fun) 3465 VISIT_AND_RETURN(ThisFunction, fun)
3497 } 3466 }
3498 3467
3499 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) { 3468 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) {
3500 SuperReference* super = new (zone_) SuperReference(zone_, this_var, pos); 3469 SuperReference* super =
3470 new (zone_) SuperReference(zone_, this_var, pos, id_gen_);
3501 VISIT_AND_RETURN(SuperReference, super); 3471 VISIT_AND_RETURN(SuperReference, super);
3502 } 3472 }
3503 3473
3504 #undef VISIT_AND_RETURN 3474 #undef VISIT_AND_RETURN
3505 3475
3506 private: 3476 private:
3507 Zone* zone_; 3477 Zone* zone_;
3508 Visitor visitor_; 3478 Visitor visitor_;
3509 AstValueFactory* ast_value_factory_; 3479 AstValueFactory* ast_value_factory_;
3480 AstNode::IdGen* id_gen_;
3510 }; 3481 };
3511 3482
3512 3483
3513 } } // namespace v8::internal 3484 } } // namespace v8::internal
3514 3485
3515 #endif // V8_AST_H_ 3486 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698