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

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

Powered by Google App Engine
This is Rietveld 408576698