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

Side by Side Diff: src/ast.h

Issue 102563004: Zonify types in compiler frontend (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 12 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 | « src/arm/stub-cache-arm.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; } 219 type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; }
220 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 220 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
221 #undef DECLARE_NODE_FUNCTIONS 221 #undef DECLARE_NODE_FUNCTIONS
222 222
223 virtual TargetCollector* AsTargetCollector() { return NULL; } 223 virtual TargetCollector* AsTargetCollector() { return NULL; }
224 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 224 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
225 virtual IterationStatement* AsIterationStatement() { return NULL; } 225 virtual IterationStatement* AsIterationStatement() { return NULL; }
226 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 226 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
227 227
228 protected: 228 protected:
229 static int GetNextId(Isolate* isolate) { 229 static int GetNextId(Zone* zone) {
230 return ReserveIdRange(isolate, 1); 230 return ReserveIdRange(zone, 1);
231 } 231 }
232 232
233 static int ReserveIdRange(Isolate* isolate, int n) { 233 static int ReserveIdRange(Zone* zone, int n) {
234 int tmp = isolate->ast_node_id(); 234 int tmp = zone->isolate()->ast_node_id();
235 isolate->set_ast_node_id(tmp + n); 235 zone->isolate()->set_ast_node_id(tmp + n);
236 return tmp; 236 return tmp;
237 } 237 }
238 238
239 // Some nodes re-use bailout IDs for type feedback. 239 // Some nodes re-use bailout IDs for type feedback.
240 static TypeFeedbackId reuse(BailoutId id) { 240 static TypeFeedbackId reuse(BailoutId id) {
241 return TypeFeedbackId(id.ToInt()); 241 return TypeFeedbackId(id.ToInt());
242 } 242 }
243 243
244 244
245 private: 245 private:
246 // Hidden to prevent accidental usage. It would have to load the 246 // Hidden to prevent accidental usage. It would have to load the
247 // current zone from the TLS. 247 // current zone from the TLS.
248 void* operator new(size_t size); 248 void* operator new(size_t size);
249 249
250 friend class CaseClause; // Generates AST IDs. 250 friend class CaseClause; // Generates AST IDs.
251 251
252 int position_; 252 int position_;
253 }; 253 };
254 254
255 255
256 class Statement : public AstNode { 256 class Statement : public AstNode {
257 public: 257 public:
258 explicit Statement(int position) : AstNode(position) {} 258 explicit Statement(Zone* zone, int position) : AstNode(position) {}
259 259
260 bool IsEmpty() { return AsEmptyStatement() != NULL; } 260 bool IsEmpty() { return AsEmptyStatement() != NULL; }
261 virtual bool IsJump() const { return false; } 261 virtual bool IsJump() const { return false; }
262 }; 262 };
263 263
264 264
265 class SmallMapList V8_FINAL { 265 class SmallMapList V8_FINAL {
266 public: 266 public:
267 SmallMapList() {} 267 SmallMapList() {}
268 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} 268 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {}
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 370 }
371 371
372 // TODO(rossberg): this should move to its own AST node eventually. 372 // TODO(rossberg): this should move to its own AST node eventually.
373 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 373 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
374 byte to_boolean_types() const { return to_boolean_types_; } 374 byte to_boolean_types() const { return to_boolean_types_; }
375 375
376 BailoutId id() const { return id_; } 376 BailoutId id() const { return id_; }
377 TypeFeedbackId test_id() const { return test_id_; } 377 TypeFeedbackId test_id() const { return test_id_; }
378 378
379 protected: 379 protected:
380 Expression(Isolate* isolate, int pos) 380 Expression(Zone* zone, int pos)
381 : AstNode(pos), 381 : AstNode(pos),
382 bounds_(Bounds::Unbounded(isolate)), 382 bounds_(Bounds::Unbounded(zone)),
383 id_(GetNextId(isolate)), 383 id_(GetNextId(zone)),
384 test_id_(GetNextId(isolate)) {} 384 test_id_(GetNextId(zone)) {}
385 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } 385 void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
386 386
387 private: 387 private:
388 Bounds bounds_; 388 Bounds bounds_;
389 byte to_boolean_types_; 389 byte to_boolean_types_;
390 390
391 const BailoutId id_; 391 const BailoutId id_;
392 const TypeFeedbackId test_id_; 392 const TypeFeedbackId test_id_;
393 }; 393 };
394 394
(...skipping 20 matching lines...) Expand all
415 // Testers. 415 // Testers.
416 bool is_target_for_anonymous() const { 416 bool is_target_for_anonymous() const {
417 return breakable_type_ == TARGET_FOR_ANONYMOUS; 417 return breakable_type_ == TARGET_FOR_ANONYMOUS;
418 } 418 }
419 419
420 BailoutId EntryId() const { return entry_id_; } 420 BailoutId EntryId() const { return entry_id_; }
421 BailoutId ExitId() const { return exit_id_; } 421 BailoutId ExitId() const { return exit_id_; }
422 422
423 protected: 423 protected:
424 BreakableStatement( 424 BreakableStatement(
425 Isolate* isolate, ZoneStringList* labels, 425 Zone* zone, ZoneStringList* labels,
426 BreakableType breakable_type, int position) 426 BreakableType breakable_type, int position)
427 : Statement(position), 427 : Statement(zone, position),
428 labels_(labels), 428 labels_(labels),
429 breakable_type_(breakable_type), 429 breakable_type_(breakable_type),
430 entry_id_(GetNextId(isolate)), 430 entry_id_(GetNextId(zone)),
431 exit_id_(GetNextId(isolate)) { 431 exit_id_(GetNextId(zone)) {
432 ASSERT(labels == NULL || labels->length() > 0); 432 ASSERT(labels == NULL || labels->length() > 0);
433 } 433 }
434 434
435 435
436 private: 436 private:
437 ZoneStringList* labels_; 437 ZoneStringList* labels_;
438 BreakableType breakable_type_; 438 BreakableType breakable_type_;
439 Label break_target_; 439 Label break_target_;
440 const BailoutId entry_id_; 440 const BailoutId entry_id_;
441 const BailoutId exit_id_; 441 const BailoutId exit_id_;
(...skipping 13 matching lines...) Expand all
455 455
456 virtual bool IsJump() const V8_OVERRIDE { 456 virtual bool IsJump() const V8_OVERRIDE {
457 return !statements_.is_empty() && statements_.last()->IsJump() 457 return !statements_.is_empty() && statements_.last()->IsJump()
458 && labels() == NULL; // Good enough as an approximation... 458 && labels() == NULL; // Good enough as an approximation...
459 } 459 }
460 460
461 Scope* scope() const { return scope_; } 461 Scope* scope() const { return scope_; }
462 void set_scope(Scope* scope) { scope_ = scope; } 462 void set_scope(Scope* scope) { scope_ = scope; }
463 463
464 protected: 464 protected:
465 Block(Isolate* isolate, 465 Block(Zone* zone,
466 ZoneStringList* labels, 466 ZoneStringList* labels,
467 int capacity, 467 int capacity,
468 bool is_initializer_block, 468 bool is_initializer_block,
469 int pos, 469 int pos)
470 Zone* zone) 470 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos),
471 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY, pos),
472 statements_(capacity, zone), 471 statements_(capacity, zone),
473 is_initializer_block_(is_initializer_block), 472 is_initializer_block_(is_initializer_block),
474 scope_(NULL) { 473 scope_(NULL) {
475 } 474 }
476 475
477 private: 476 private:
478 ZoneList<Statement*> statements_; 477 ZoneList<Statement*> statements_;
479 bool is_initializer_block_; 478 bool is_initializer_block_;
480 Scope* scope_; 479 Scope* scope_;
481 }; 480 };
482 481
483 482
484 class Declaration : public AstNode { 483 class Declaration : public AstNode {
485 public: 484 public:
486 VariableProxy* proxy() const { return proxy_; } 485 VariableProxy* proxy() const { return proxy_; }
487 VariableMode mode() const { return mode_; } 486 VariableMode mode() const { return mode_; }
488 Scope* scope() const { return scope_; } 487 Scope* scope() const { return scope_; }
489 virtual InitializationFlag initialization() const = 0; 488 virtual InitializationFlag initialization() const = 0;
490 virtual bool IsInlineable() const; 489 virtual bool IsInlineable() const;
491 490
492 protected: 491 protected:
493 Declaration(VariableProxy* proxy, 492 Declaration(Zone* zone,
493 VariableProxy* proxy,
494 VariableMode mode, 494 VariableMode mode,
495 Scope* scope, 495 Scope* scope,
496 int pos) 496 int pos)
497 : AstNode(pos), 497 : AstNode(pos),
498 proxy_(proxy), 498 proxy_(proxy),
499 mode_(mode), 499 mode_(mode),
500 scope_(scope) { 500 scope_(scope) {
501 ASSERT(IsDeclaredVariableMode(mode)); 501 ASSERT(IsDeclaredVariableMode(mode));
502 } 502 }
503 503
504 private: 504 private:
505 VariableProxy* proxy_; 505 VariableProxy* proxy_;
506 VariableMode mode_; 506 VariableMode mode_;
507 507
508 // Nested scope from which the declaration originated. 508 // Nested scope from which the declaration originated.
509 Scope* scope_; 509 Scope* scope_;
510 }; 510 };
511 511
512 512
513 class VariableDeclaration V8_FINAL : public Declaration { 513 class VariableDeclaration V8_FINAL : public Declaration {
514 public: 514 public:
515 DECLARE_NODE_TYPE(VariableDeclaration) 515 DECLARE_NODE_TYPE(VariableDeclaration)
516 516
517 virtual InitializationFlag initialization() const V8_OVERRIDE { 517 virtual InitializationFlag initialization() const V8_OVERRIDE {
518 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; 518 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
519 } 519 }
520 520
521 protected: 521 protected:
522 VariableDeclaration(VariableProxy* proxy, 522 VariableDeclaration(Zone* zone,
523 VariableProxy* proxy,
523 VariableMode mode, 524 VariableMode mode,
524 Scope* scope, 525 Scope* scope,
525 int pos) 526 int pos)
526 : Declaration(proxy, mode, scope, pos) { 527 : Declaration(zone, proxy, mode, scope, pos) {
527 } 528 }
528 }; 529 };
529 530
530 531
531 class FunctionDeclaration V8_FINAL : public Declaration { 532 class FunctionDeclaration V8_FINAL : public Declaration {
532 public: 533 public:
533 DECLARE_NODE_TYPE(FunctionDeclaration) 534 DECLARE_NODE_TYPE(FunctionDeclaration)
534 535
535 FunctionLiteral* fun() const { return fun_; } 536 FunctionLiteral* fun() const { return fun_; }
536 virtual InitializationFlag initialization() const V8_OVERRIDE { 537 virtual InitializationFlag initialization() const V8_OVERRIDE {
537 return kCreatedInitialized; 538 return kCreatedInitialized;
538 } 539 }
539 virtual bool IsInlineable() const V8_OVERRIDE; 540 virtual bool IsInlineable() const V8_OVERRIDE;
540 541
541 protected: 542 protected:
542 FunctionDeclaration(VariableProxy* proxy, 543 FunctionDeclaration(Zone* zone,
544 VariableProxy* proxy,
543 VariableMode mode, 545 VariableMode mode,
544 FunctionLiteral* fun, 546 FunctionLiteral* fun,
545 Scope* scope, 547 Scope* scope,
546 int pos) 548 int pos)
547 : Declaration(proxy, mode, scope, pos), 549 : Declaration(zone, proxy, mode, scope, pos),
548 fun_(fun) { 550 fun_(fun) {
549 // At the moment there are no "const functions" in JavaScript... 551 // At the moment there are no "const functions" in JavaScript...
550 ASSERT(mode == VAR || mode == LET); 552 ASSERT(mode == VAR || mode == LET);
551 ASSERT(fun != NULL); 553 ASSERT(fun != NULL);
552 } 554 }
553 555
554 private: 556 private:
555 FunctionLiteral* fun_; 557 FunctionLiteral* fun_;
556 }; 558 };
557 559
558 560
559 class ModuleDeclaration V8_FINAL : public Declaration { 561 class ModuleDeclaration V8_FINAL : public Declaration {
560 public: 562 public:
561 DECLARE_NODE_TYPE(ModuleDeclaration) 563 DECLARE_NODE_TYPE(ModuleDeclaration)
562 564
563 Module* module() const { return module_; } 565 Module* module() const { return module_; }
564 virtual InitializationFlag initialization() const V8_OVERRIDE { 566 virtual InitializationFlag initialization() const V8_OVERRIDE {
565 return kCreatedInitialized; 567 return kCreatedInitialized;
566 } 568 }
567 569
568 protected: 570 protected:
569 ModuleDeclaration(VariableProxy* proxy, 571 ModuleDeclaration(Zone* zone,
572 VariableProxy* proxy,
570 Module* module, 573 Module* module,
571 Scope* scope, 574 Scope* scope,
572 int pos) 575 int pos)
573 : Declaration(proxy, MODULE, scope, pos), 576 : Declaration(zone, proxy, MODULE, scope, pos),
574 module_(module) { 577 module_(module) {
575 } 578 }
576 579
577 private: 580 private:
578 Module* module_; 581 Module* module_;
579 }; 582 };
580 583
581 584
582 class ImportDeclaration V8_FINAL : public Declaration { 585 class ImportDeclaration V8_FINAL : public Declaration {
583 public: 586 public:
584 DECLARE_NODE_TYPE(ImportDeclaration) 587 DECLARE_NODE_TYPE(ImportDeclaration)
585 588
586 Module* module() const { return module_; } 589 Module* module() const { return module_; }
587 virtual InitializationFlag initialization() const V8_OVERRIDE { 590 virtual InitializationFlag initialization() const V8_OVERRIDE {
588 return kCreatedInitialized; 591 return kCreatedInitialized;
589 } 592 }
590 593
591 protected: 594 protected:
592 ImportDeclaration(VariableProxy* proxy, 595 ImportDeclaration(Zone* zone,
596 VariableProxy* proxy,
593 Module* module, 597 Module* module,
594 Scope* scope, 598 Scope* scope,
595 int pos) 599 int pos)
596 : Declaration(proxy, LET, scope, pos), 600 : Declaration(zone, proxy, LET, scope, pos),
597 module_(module) { 601 module_(module) {
598 } 602 }
599 603
600 private: 604 private:
601 Module* module_; 605 Module* module_;
602 }; 606 };
603 607
604 608
605 class ExportDeclaration V8_FINAL : public Declaration { 609 class ExportDeclaration V8_FINAL : public Declaration {
606 public: 610 public:
607 DECLARE_NODE_TYPE(ExportDeclaration) 611 DECLARE_NODE_TYPE(ExportDeclaration)
608 612
609 virtual InitializationFlag initialization() const V8_OVERRIDE { 613 virtual InitializationFlag initialization() const V8_OVERRIDE {
610 return kCreatedInitialized; 614 return kCreatedInitialized;
611 } 615 }
612 616
613 protected: 617 protected:
614 ExportDeclaration(VariableProxy* proxy, Scope* scope, int pos) 618 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos)
615 : Declaration(proxy, LET, scope, pos) {} 619 : Declaration(zone, proxy, LET, scope, pos) {}
616 }; 620 };
617 621
618 622
619 class Module : public AstNode { 623 class Module : public AstNode {
620 public: 624 public:
621 Interface* interface() const { return interface_; } 625 Interface* interface() const { return interface_; }
622 Block* body() const { return body_; } 626 Block* body() const { return body_; }
623 627
624 protected: 628 protected:
625 Module(Zone* zone, int pos) 629 Module(Zone* zone, int pos)
626 : AstNode(pos), 630 : AstNode(pos),
627 interface_(Interface::NewModule(zone)), 631 interface_(Interface::NewModule(zone)),
628 body_(NULL) {} 632 body_(NULL) {}
629 Module(Interface* interface, int pos, Block* body = NULL) 633 Module(Zone* zone, Interface* interface, int pos, Block* body = NULL)
630 : AstNode(pos), 634 : AstNode(pos),
631 interface_(interface), 635 interface_(interface),
632 body_(body) {} 636 body_(body) {}
633 637
634 private: 638 private:
635 Interface* interface_; 639 Interface* interface_;
636 Block* body_; 640 Block* body_;
637 }; 641 };
638 642
639 643
640 class ModuleLiteral V8_FINAL : public Module { 644 class ModuleLiteral V8_FINAL : public Module {
641 public: 645 public:
642 DECLARE_NODE_TYPE(ModuleLiteral) 646 DECLARE_NODE_TYPE(ModuleLiteral)
643 647
644 protected: 648 protected:
645 ModuleLiteral(Block* body, Interface* interface, int pos) 649 ModuleLiteral(Zone* zone, Block* body, Interface* interface, int pos)
646 : Module(interface, pos, body) {} 650 : Module(zone, interface, pos, body) {}
647 }; 651 };
648 652
649 653
650 class ModuleVariable V8_FINAL : public Module { 654 class ModuleVariable V8_FINAL : public Module {
651 public: 655 public:
652 DECLARE_NODE_TYPE(ModuleVariable) 656 DECLARE_NODE_TYPE(ModuleVariable)
653 657
654 VariableProxy* proxy() const { return proxy_; } 658 VariableProxy* proxy() const { return proxy_; }
655 659
656 protected: 660 protected:
657 inline ModuleVariable(VariableProxy* proxy, int pos); 661 inline ModuleVariable(Zone* zone, VariableProxy* proxy, int pos);
658 662
659 private: 663 private:
660 VariableProxy* proxy_; 664 VariableProxy* proxy_;
661 }; 665 };
662 666
663 667
664 class ModulePath V8_FINAL : public Module { 668 class ModulePath V8_FINAL : public Module {
665 public: 669 public:
666 DECLARE_NODE_TYPE(ModulePath) 670 DECLARE_NODE_TYPE(ModulePath)
667 671
668 Module* module() const { return module_; } 672 Module* module() const { return module_; }
669 Handle<String> name() const { return name_; } 673 Handle<String> name() const { return name_; }
670 674
671 protected: 675 protected:
672 ModulePath(Module* module, Handle<String> name, Zone* zone, int pos) 676 ModulePath(Zone* zone, Module* module, Handle<String> name, int pos)
673 : Module(zone, pos), 677 : Module(zone, pos),
674 module_(module), 678 module_(module),
675 name_(name) { 679 name_(name) {
676 } 680 }
677 681
678 private: 682 private:
679 Module* module_; 683 Module* module_;
680 Handle<String> name_; 684 Handle<String> name_;
681 }; 685 };
682 686
683 687
684 class ModuleUrl V8_FINAL : public Module { 688 class ModuleUrl V8_FINAL : public Module {
685 public: 689 public:
686 DECLARE_NODE_TYPE(ModuleUrl) 690 DECLARE_NODE_TYPE(ModuleUrl)
687 691
688 Handle<String> url() const { return url_; } 692 Handle<String> url() const { return url_; }
689 693
690 protected: 694 protected:
691 ModuleUrl(Handle<String> url, Zone* zone, int pos) 695 ModuleUrl(Zone* zone, Handle<String> url, int pos)
692 : Module(zone, pos), url_(url) { 696 : Module(zone, pos), url_(url) {
693 } 697 }
694 698
695 private: 699 private:
696 Handle<String> url_; 700 Handle<String> url_;
697 }; 701 };
698 702
699 703
700 class ModuleStatement V8_FINAL : public Statement { 704 class ModuleStatement V8_FINAL : public Statement {
701 public: 705 public:
702 DECLARE_NODE_TYPE(ModuleStatement) 706 DECLARE_NODE_TYPE(ModuleStatement)
703 707
704 VariableProxy* proxy() const { return proxy_; } 708 VariableProxy* proxy() const { return proxy_; }
705 Block* body() const { return body_; } 709 Block* body() const { return body_; }
706 710
707 protected: 711 protected:
708 ModuleStatement(VariableProxy* proxy, Block* body, int pos) 712 ModuleStatement(Zone* zone, VariableProxy* proxy, Block* body, int pos)
709 : Statement(pos), 713 : Statement(zone, pos),
710 proxy_(proxy), 714 proxy_(proxy),
711 body_(body) { 715 body_(body) {
712 } 716 }
713 717
714 private: 718 private:
715 VariableProxy* proxy_; 719 VariableProxy* proxy_;
716 Block* body_; 720 Block* body_;
717 }; 721 };
718 722
719 723
720 class IterationStatement : public BreakableStatement { 724 class IterationStatement : public BreakableStatement {
721 public: 725 public:
722 // Type testing & conversion. 726 // Type testing & conversion.
723 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE { 727 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE {
724 return this; 728 return this;
725 } 729 }
726 730
727 Statement* body() const { return body_; } 731 Statement* body() const { return body_; }
728 732
729 BailoutId OsrEntryId() const { return osr_entry_id_; } 733 BailoutId OsrEntryId() const { return osr_entry_id_; }
730 virtual BailoutId ContinueId() const = 0; 734 virtual BailoutId ContinueId() const = 0;
731 virtual BailoutId StackCheckId() const = 0; 735 virtual BailoutId StackCheckId() const = 0;
732 736
733 // Code generation 737 // Code generation
734 Label* continue_target() { return &continue_target_; } 738 Label* continue_target() { return &continue_target_; }
735 739
736 protected: 740 protected:
737 IterationStatement(Isolate* isolate, ZoneStringList* labels, int pos) 741 IterationStatement(Zone* zone, ZoneStringList* labels, int pos)
738 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos), 742 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
739 body_(NULL), 743 body_(NULL),
740 osr_entry_id_(GetNextId(isolate)) { 744 osr_entry_id_(GetNextId(zone)) {
741 } 745 }
742 746
743 void Initialize(Statement* body) { 747 void Initialize(Statement* body) {
744 body_ = body; 748 body_ = body;
745 } 749 }
746 750
747 private: 751 private:
748 Statement* body_; 752 Statement* body_;
749 Label continue_target_; 753 Label continue_target_;
750 754
(...skipping 10 matching lines...) Expand all
761 cond_ = cond; 765 cond_ = cond;
762 } 766 }
763 767
764 Expression* cond() const { return cond_; } 768 Expression* cond() const { return cond_; }
765 769
766 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } 770 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
767 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } 771 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; }
768 BailoutId BackEdgeId() const { return back_edge_id_; } 772 BailoutId BackEdgeId() const { return back_edge_id_; }
769 773
770 protected: 774 protected:
771 DoWhileStatement(Isolate* isolate, ZoneStringList* labels, int pos) 775 DoWhileStatement(Zone* zone, ZoneStringList* labels, int pos)
772 : IterationStatement(isolate, labels, pos), 776 : IterationStatement(zone, labels, pos),
773 cond_(NULL), 777 cond_(NULL),
774 continue_id_(GetNextId(isolate)), 778 continue_id_(GetNextId(zone)),
775 back_edge_id_(GetNextId(isolate)) { 779 back_edge_id_(GetNextId(zone)) {
776 } 780 }
777 781
778 private: 782 private:
779 Expression* cond_; 783 Expression* cond_;
780 784
781 const BailoutId continue_id_; 785 const BailoutId continue_id_;
782 const BailoutId back_edge_id_; 786 const BailoutId back_edge_id_;
783 }; 787 };
784 788
785 789
(...skipping 12 matching lines...) Expand all
798 } 802 }
799 void set_may_have_function_literal(bool value) { 803 void set_may_have_function_literal(bool value) {
800 may_have_function_literal_ = value; 804 may_have_function_literal_ = value;
801 } 805 }
802 806
803 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } 807 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
804 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } 808 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
805 BailoutId BodyId() const { return body_id_; } 809 BailoutId BodyId() const { return body_id_; }
806 810
807 protected: 811 protected:
808 WhileStatement(Isolate* isolate, ZoneStringList* labels, int pos) 812 WhileStatement(Zone* zone, ZoneStringList* labels, int pos)
809 : IterationStatement(isolate, labels, pos), 813 : IterationStatement(zone, labels, pos),
810 cond_(NULL), 814 cond_(NULL),
811 may_have_function_literal_(true), 815 may_have_function_literal_(true),
812 body_id_(GetNextId(isolate)) { 816 body_id_(GetNextId(zone)) {
813 } 817 }
814 818
815 private: 819 private:
816 Expression* cond_; 820 Expression* cond_;
817 821
818 // True if there is a function literal subexpression in the condition. 822 // True if there is a function literal subexpression in the condition.
819 bool may_have_function_literal_; 823 bool may_have_function_literal_;
820 824
821 const BailoutId body_id_; 825 const BailoutId body_id_;
822 }; 826 };
(...skipping 26 matching lines...) Expand all
849 853
850 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } 854 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; }
851 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } 855 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
852 BailoutId BodyId() const { return body_id_; } 856 BailoutId BodyId() const { return body_id_; }
853 857
854 bool is_fast_smi_loop() { return loop_variable_ != NULL; } 858 bool is_fast_smi_loop() { return loop_variable_ != NULL; }
855 Variable* loop_variable() { return loop_variable_; } 859 Variable* loop_variable() { return loop_variable_; }
856 void set_loop_variable(Variable* var) { loop_variable_ = var; } 860 void set_loop_variable(Variable* var) { loop_variable_ = var; }
857 861
858 protected: 862 protected:
859 ForStatement(Isolate* isolate, ZoneStringList* labels, int pos) 863 ForStatement(Zone* zone, ZoneStringList* labels, int pos)
860 : IterationStatement(isolate, labels, pos), 864 : IterationStatement(zone, labels, pos),
861 init_(NULL), 865 init_(NULL),
862 cond_(NULL), 866 cond_(NULL),
863 next_(NULL), 867 next_(NULL),
864 may_have_function_literal_(true), 868 may_have_function_literal_(true),
865 loop_variable_(NULL), 869 loop_variable_(NULL),
866 continue_id_(GetNextId(isolate)), 870 continue_id_(GetNextId(zone)),
867 body_id_(GetNextId(isolate)) { 871 body_id_(GetNextId(zone)) {
868 } 872 }
869 873
870 private: 874 private:
871 Statement* init_; 875 Statement* init_;
872 Expression* cond_; 876 Expression* cond_;
873 Statement* next_; 877 Statement* next_;
874 878
875 // True if there is a function literal subexpression in the condition. 879 // True if there is a function literal subexpression in the condition.
876 bool may_have_function_literal_; 880 bool may_have_function_literal_;
877 Variable* loop_variable_; 881 Variable* loop_variable_;
(...skipping 13 matching lines...) Expand all
891 void Initialize(Expression* each, Expression* subject, Statement* body) { 895 void Initialize(Expression* each, Expression* subject, Statement* body) {
892 IterationStatement::Initialize(body); 896 IterationStatement::Initialize(body);
893 each_ = each; 897 each_ = each;
894 subject_ = subject; 898 subject_ = subject;
895 } 899 }
896 900
897 Expression* each() const { return each_; } 901 Expression* each() const { return each_; }
898 Expression* subject() const { return subject_; } 902 Expression* subject() const { return subject_; }
899 903
900 protected: 904 protected:
901 ForEachStatement(Isolate* isolate, ZoneStringList* labels, int pos) 905 ForEachStatement(Zone* zone, ZoneStringList* labels, int pos)
902 : IterationStatement(isolate, labels, pos), 906 : IterationStatement(zone, labels, pos),
903 each_(NULL), 907 each_(NULL),
904 subject_(NULL) { 908 subject_(NULL) {
905 } 909 }
906 910
907 private: 911 private:
908 Expression* each_; 912 Expression* each_;
909 Expression* subject_; 913 Expression* subject_;
910 }; 914 };
911 915
912 916
913 class ForInStatement V8_FINAL : public ForEachStatement { 917 class ForInStatement V8_FINAL : public ForEachStatement {
914 public: 918 public:
915 DECLARE_NODE_TYPE(ForInStatement) 919 DECLARE_NODE_TYPE(ForInStatement)
916 920
917 Expression* enumerable() const { 921 Expression* enumerable() const {
918 return subject(); 922 return subject();
919 } 923 }
920 924
921 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } 925 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); }
922 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 926 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
923 ForInType for_in_type() const { return for_in_type_; } 927 ForInType for_in_type() const { return for_in_type_; }
924 void set_for_in_type(ForInType type) { for_in_type_ = type; } 928 void set_for_in_type(ForInType type) { for_in_type_ = type; }
925 929
926 BailoutId BodyId() const { return body_id_; } 930 BailoutId BodyId() const { return body_id_; }
927 BailoutId PrepareId() const { return prepare_id_; } 931 BailoutId PrepareId() const { return prepare_id_; }
928 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } 932 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
929 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } 933 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
930 934
931 protected: 935 protected:
932 ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos) 936 ForInStatement(Zone* zone, ZoneStringList* labels, int pos)
933 : ForEachStatement(isolate, labels, pos), 937 : ForEachStatement(zone, labels, pos),
934 for_in_type_(SLOW_FOR_IN), 938 for_in_type_(SLOW_FOR_IN),
935 body_id_(GetNextId(isolate)), 939 body_id_(GetNextId(zone)),
936 prepare_id_(GetNextId(isolate)) { 940 prepare_id_(GetNextId(zone)) {
937 } 941 }
938 942
939 ForInType for_in_type_; 943 ForInType for_in_type_;
940 const BailoutId body_id_; 944 const BailoutId body_id_;
941 const BailoutId prepare_id_; 945 const BailoutId prepare_id_;
942 }; 946 };
943 947
944 948
945 class ForOfStatement V8_FINAL : public ForEachStatement { 949 class ForOfStatement V8_FINAL : public ForEachStatement {
946 public: 950 public:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 Expression* assign_each() const { 987 Expression* assign_each() const {
984 return assign_each_; 988 return assign_each_;
985 } 989 }
986 990
987 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } 991 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); }
988 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } 992 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); }
989 993
990 BailoutId BackEdgeId() const { return back_edge_id_; } 994 BailoutId BackEdgeId() const { return back_edge_id_; }
991 995
992 protected: 996 protected:
993 ForOfStatement(Isolate* isolate, ZoneStringList* labels, int pos) 997 ForOfStatement(Zone* zone, ZoneStringList* labels, int pos)
994 : ForEachStatement(isolate, labels, pos), 998 : ForEachStatement(zone, labels, pos),
995 assign_iterator_(NULL), 999 assign_iterator_(NULL),
996 next_result_(NULL), 1000 next_result_(NULL),
997 result_done_(NULL), 1001 result_done_(NULL),
998 assign_each_(NULL), 1002 assign_each_(NULL),
999 back_edge_id_(GetNextId(isolate)) { 1003 back_edge_id_(GetNextId(zone)) {
1000 } 1004 }
1001 1005
1002 Expression* assign_iterator_; 1006 Expression* assign_iterator_;
1003 Expression* next_result_; 1007 Expression* next_result_;
1004 Expression* result_done_; 1008 Expression* result_done_;
1005 Expression* assign_each_; 1009 Expression* assign_each_;
1006 const BailoutId back_edge_id_; 1010 const BailoutId back_edge_id_;
1007 }; 1011 };
1008 1012
1009 1013
1010 class ExpressionStatement V8_FINAL : public Statement { 1014 class ExpressionStatement V8_FINAL : public Statement {
1011 public: 1015 public:
1012 DECLARE_NODE_TYPE(ExpressionStatement) 1016 DECLARE_NODE_TYPE(ExpressionStatement)
1013 1017
1014 void set_expression(Expression* e) { expression_ = e; } 1018 void set_expression(Expression* e) { expression_ = e; }
1015 Expression* expression() const { return expression_; } 1019 Expression* expression() const { return expression_; }
1016 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); } 1020 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); }
1017 1021
1018 protected: 1022 protected:
1019 ExpressionStatement(Expression* expression, int pos) 1023 ExpressionStatement(Zone* zone, Expression* expression, int pos)
1020 : Statement(pos), expression_(expression) { } 1024 : Statement(zone, pos), expression_(expression) { }
1021 1025
1022 private: 1026 private:
1023 Expression* expression_; 1027 Expression* expression_;
1024 }; 1028 };
1025 1029
1026 1030
1027 class JumpStatement : public Statement { 1031 class JumpStatement : public Statement {
1028 public: 1032 public:
1029 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; } 1033 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; }
1030 1034
1031 protected: 1035 protected:
1032 explicit JumpStatement(int pos) : Statement(pos) {} 1036 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {}
1033 }; 1037 };
1034 1038
1035 1039
1036 class ContinueStatement V8_FINAL : public JumpStatement { 1040 class ContinueStatement V8_FINAL : public JumpStatement {
1037 public: 1041 public:
1038 DECLARE_NODE_TYPE(ContinueStatement) 1042 DECLARE_NODE_TYPE(ContinueStatement)
1039 1043
1040 IterationStatement* target() const { return target_; } 1044 IterationStatement* target() const { return target_; }
1041 1045
1042 protected: 1046 protected:
1043 explicit ContinueStatement(IterationStatement* target, int pos) 1047 explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos)
1044 : JumpStatement(pos), target_(target) { } 1048 : JumpStatement(zone, pos), target_(target) { }
1045 1049
1046 private: 1050 private:
1047 IterationStatement* target_; 1051 IterationStatement* target_;
1048 }; 1052 };
1049 1053
1050 1054
1051 class BreakStatement V8_FINAL : public JumpStatement { 1055 class BreakStatement V8_FINAL : public JumpStatement {
1052 public: 1056 public:
1053 DECLARE_NODE_TYPE(BreakStatement) 1057 DECLARE_NODE_TYPE(BreakStatement)
1054 1058
1055 BreakableStatement* target() const { return target_; } 1059 BreakableStatement* target() const { return target_; }
1056 1060
1057 protected: 1061 protected:
1058 explicit BreakStatement(BreakableStatement* target, int pos) 1062 explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos)
1059 : JumpStatement(pos), target_(target) { } 1063 : JumpStatement(zone, pos), target_(target) { }
1060 1064
1061 private: 1065 private:
1062 BreakableStatement* target_; 1066 BreakableStatement* target_;
1063 }; 1067 };
1064 1068
1065 1069
1066 class ReturnStatement V8_FINAL : public JumpStatement { 1070 class ReturnStatement V8_FINAL : public JumpStatement {
1067 public: 1071 public:
1068 DECLARE_NODE_TYPE(ReturnStatement) 1072 DECLARE_NODE_TYPE(ReturnStatement)
1069 1073
1070 Expression* expression() const { return expression_; } 1074 Expression* expression() const { return expression_; }
1071 1075
1072 protected: 1076 protected:
1073 explicit ReturnStatement(Expression* expression, int pos) 1077 explicit ReturnStatement(Zone* zone, Expression* expression, int pos)
1074 : JumpStatement(pos), expression_(expression) { } 1078 : JumpStatement(zone, pos), expression_(expression) { }
1075 1079
1076 private: 1080 private:
1077 Expression* expression_; 1081 Expression* expression_;
1078 }; 1082 };
1079 1083
1080 1084
1081 class WithStatement V8_FINAL : public Statement { 1085 class WithStatement V8_FINAL : public Statement {
1082 public: 1086 public:
1083 DECLARE_NODE_TYPE(WithStatement) 1087 DECLARE_NODE_TYPE(WithStatement)
1084 1088
1085 Scope* scope() { return scope_; } 1089 Scope* scope() { return scope_; }
1086 Expression* expression() const { return expression_; } 1090 Expression* expression() const { return expression_; }
1087 Statement* statement() const { return statement_; } 1091 Statement* statement() const { return statement_; }
1088 1092
1089 protected: 1093 protected:
1090 WithStatement( 1094 WithStatement(
1091 Scope* scope, Expression* expression, Statement* statement, int pos) 1095 Zone* zone, Scope* scope,
1092 : Statement(pos), 1096 Expression* expression, Statement* statement, int pos)
1097 : Statement(zone, pos),
1093 scope_(scope), 1098 scope_(scope),
1094 expression_(expression), 1099 expression_(expression),
1095 statement_(statement) { } 1100 statement_(statement) { }
1096 1101
1097 private: 1102 private:
1098 Scope* scope_; 1103 Scope* scope_;
1099 Expression* expression_; 1104 Expression* expression_;
1100 Statement* statement_; 1105 Statement* statement_;
1101 }; 1106 };
1102 1107
1103 1108
1104 class CaseClause V8_FINAL : public Expression { 1109 class CaseClause V8_FINAL : public Expression {
1105 public: 1110 public:
1106 DECLARE_NODE_TYPE(CaseClause) 1111 DECLARE_NODE_TYPE(CaseClause)
1107 1112
1108 bool is_default() const { return label_ == NULL; } 1113 bool is_default() const { return label_ == NULL; }
1109 Expression* label() const { 1114 Expression* label() const {
1110 CHECK(!is_default()); 1115 CHECK(!is_default());
1111 return label_; 1116 return label_;
1112 } 1117 }
1113 Label* body_target() { return &body_target_; } 1118 Label* body_target() { return &body_target_; }
1114 ZoneList<Statement*>* statements() const { return statements_; } 1119 ZoneList<Statement*>* statements() const { return statements_; }
1115 1120
1116 BailoutId EntryId() const { return entry_id_; } 1121 BailoutId EntryId() const { return entry_id_; }
1117 1122
1118 // Type feedback information. 1123 // Type feedback information.
1119 TypeFeedbackId CompareId() { return compare_id_; } 1124 TypeFeedbackId CompareId() { return compare_id_; }
1120 Handle<Type> compare_type() { return compare_type_; } 1125 Type* compare_type() { return compare_type_; }
1121 void set_compare_type(Handle<Type> type) { compare_type_ = type; } 1126 void set_compare_type(Type* type) { compare_type_ = type; }
1122 1127
1123 private: 1128 private:
1124 CaseClause(Isolate* isolate, 1129 CaseClause(Zone* zone,
1125 Expression* label, 1130 Expression* label,
1126 ZoneList<Statement*>* statements, 1131 ZoneList<Statement*>* statements,
1127 int pos); 1132 int pos);
1128 1133
1129 Expression* label_; 1134 Expression* label_;
1130 Label body_target_; 1135 Label body_target_;
1131 ZoneList<Statement*>* statements_; 1136 ZoneList<Statement*>* statements_;
1132 Handle<Type> compare_type_; 1137 Type* compare_type_;
1133 1138
1134 const TypeFeedbackId compare_id_; 1139 const TypeFeedbackId compare_id_;
1135 const BailoutId entry_id_; 1140 const BailoutId entry_id_;
1136 }; 1141 };
1137 1142
1138 1143
1139 class SwitchStatement V8_FINAL : public BreakableStatement { 1144 class SwitchStatement V8_FINAL : public BreakableStatement {
1140 public: 1145 public:
1141 DECLARE_NODE_TYPE(SwitchStatement) 1146 DECLARE_NODE_TYPE(SwitchStatement)
1142 1147
1143 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1148 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1144 tag_ = tag; 1149 tag_ = tag;
1145 cases_ = cases; 1150 cases_ = cases;
1146 } 1151 }
1147 1152
1148 Expression* tag() const { return tag_; } 1153 Expression* tag() const { return tag_; }
1149 ZoneList<CaseClause*>* cases() const { return cases_; } 1154 ZoneList<CaseClause*>* cases() const { return cases_; }
1150 1155
1151 protected: 1156 protected:
1152 SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos) 1157 SwitchStatement(Zone* zone, ZoneStringList* labels, int pos)
1153 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos), 1158 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
1154 tag_(NULL), 1159 tag_(NULL),
1155 cases_(NULL) { } 1160 cases_(NULL) { }
1156 1161
1157 private: 1162 private:
1158 Expression* tag_; 1163 Expression* tag_;
1159 ZoneList<CaseClause*>* cases_; 1164 ZoneList<CaseClause*>* cases_;
1160 }; 1165 };
1161 1166
1162 1167
1163 // If-statements always have non-null references to their then- and 1168 // If-statements always have non-null references to their then- and
(...skipping 15 matching lines...) Expand all
1179 virtual bool IsJump() const V8_OVERRIDE { 1184 virtual bool IsJump() const V8_OVERRIDE {
1180 return HasThenStatement() && then_statement()->IsJump() 1185 return HasThenStatement() && then_statement()->IsJump()
1181 && HasElseStatement() && else_statement()->IsJump(); 1186 && HasElseStatement() && else_statement()->IsJump();
1182 } 1187 }
1183 1188
1184 BailoutId IfId() const { return if_id_; } 1189 BailoutId IfId() const { return if_id_; }
1185 BailoutId ThenId() const { return then_id_; } 1190 BailoutId ThenId() const { return then_id_; }
1186 BailoutId ElseId() const { return else_id_; } 1191 BailoutId ElseId() const { return else_id_; }
1187 1192
1188 protected: 1193 protected:
1189 IfStatement(Isolate* isolate, 1194 IfStatement(Zone* zone,
1190 Expression* condition, 1195 Expression* condition,
1191 Statement* then_statement, 1196 Statement* then_statement,
1192 Statement* else_statement, 1197 Statement* else_statement,
1193 int pos) 1198 int pos)
1194 : Statement(pos), 1199 : Statement(zone, pos),
1195 condition_(condition), 1200 condition_(condition),
1196 then_statement_(then_statement), 1201 then_statement_(then_statement),
1197 else_statement_(else_statement), 1202 else_statement_(else_statement),
1198 if_id_(GetNextId(isolate)), 1203 if_id_(GetNextId(zone)),
1199 then_id_(GetNextId(isolate)), 1204 then_id_(GetNextId(zone)),
1200 else_id_(GetNextId(isolate)) { 1205 else_id_(GetNextId(zone)) {
1201 } 1206 }
1202 1207
1203 private: 1208 private:
1204 Expression* condition_; 1209 Expression* condition_;
1205 Statement* then_statement_; 1210 Statement* then_statement_;
1206 Statement* else_statement_; 1211 Statement* else_statement_;
1207 const BailoutId if_id_; 1212 const BailoutId if_id_;
1208 const BailoutId then_id_; 1213 const BailoutId then_id_;
1209 const BailoutId else_id_; 1214 const BailoutId else_id_;
1210 }; 1215 };
(...skipping 27 matching lines...) Expand all
1238 public: 1243 public:
1239 void set_escaping_targets(ZoneList<Label*>* targets) { 1244 void set_escaping_targets(ZoneList<Label*>* targets) {
1240 escaping_targets_ = targets; 1245 escaping_targets_ = targets;
1241 } 1246 }
1242 1247
1243 int index() const { return index_; } 1248 int index() const { return index_; }
1244 Block* try_block() const { return try_block_; } 1249 Block* try_block() const { return try_block_; }
1245 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } 1250 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
1246 1251
1247 protected: 1252 protected:
1248 TryStatement(int index, Block* try_block, int pos) 1253 TryStatement(Zone* zone, int index, Block* try_block, int pos)
1249 : Statement(pos), 1254 : Statement(zone, pos),
1250 index_(index), 1255 index_(index),
1251 try_block_(try_block), 1256 try_block_(try_block),
1252 escaping_targets_(NULL) { } 1257 escaping_targets_(NULL) { }
1253 1258
1254 private: 1259 private:
1255 // Unique (per-function) index of this handler. This is not an AST ID. 1260 // Unique (per-function) index of this handler. This is not an AST ID.
1256 int index_; 1261 int index_;
1257 1262
1258 Block* try_block_; 1263 Block* try_block_;
1259 ZoneList<Label*>* escaping_targets_; 1264 ZoneList<Label*>* escaping_targets_;
1260 }; 1265 };
1261 1266
1262 1267
1263 class TryCatchStatement V8_FINAL : public TryStatement { 1268 class TryCatchStatement V8_FINAL : public TryStatement {
1264 public: 1269 public:
1265 DECLARE_NODE_TYPE(TryCatchStatement) 1270 DECLARE_NODE_TYPE(TryCatchStatement)
1266 1271
1267 Scope* scope() { return scope_; } 1272 Scope* scope() { return scope_; }
1268 Variable* variable() { return variable_; } 1273 Variable* variable() { return variable_; }
1269 Block* catch_block() const { return catch_block_; } 1274 Block* catch_block() const { return catch_block_; }
1270 1275
1271 protected: 1276 protected:
1272 TryCatchStatement(int index, 1277 TryCatchStatement(Zone* zone,
1278 int index,
1273 Block* try_block, 1279 Block* try_block,
1274 Scope* scope, 1280 Scope* scope,
1275 Variable* variable, 1281 Variable* variable,
1276 Block* catch_block, 1282 Block* catch_block,
1277 int pos) 1283 int pos)
1278 : TryStatement(index, try_block, pos), 1284 : TryStatement(zone, index, try_block, pos),
1279 scope_(scope), 1285 scope_(scope),
1280 variable_(variable), 1286 variable_(variable),
1281 catch_block_(catch_block) { 1287 catch_block_(catch_block) {
1282 } 1288 }
1283 1289
1284 private: 1290 private:
1285 Scope* scope_; 1291 Scope* scope_;
1286 Variable* variable_; 1292 Variable* variable_;
1287 Block* catch_block_; 1293 Block* catch_block_;
1288 }; 1294 };
1289 1295
1290 1296
1291 class TryFinallyStatement V8_FINAL : public TryStatement { 1297 class TryFinallyStatement V8_FINAL : public TryStatement {
1292 public: 1298 public:
1293 DECLARE_NODE_TYPE(TryFinallyStatement) 1299 DECLARE_NODE_TYPE(TryFinallyStatement)
1294 1300
1295 Block* finally_block() const { return finally_block_; } 1301 Block* finally_block() const { return finally_block_; }
1296 1302
1297 protected: 1303 protected:
1298 TryFinallyStatement( 1304 TryFinallyStatement(
1299 int index, Block* try_block, Block* finally_block, int pos) 1305 Zone* zone, int index, Block* try_block, Block* finally_block, int pos)
1300 : TryStatement(index, try_block, pos), 1306 : TryStatement(zone, index, try_block, pos),
1301 finally_block_(finally_block) { } 1307 finally_block_(finally_block) { }
1302 1308
1303 private: 1309 private:
1304 Block* finally_block_; 1310 Block* finally_block_;
1305 }; 1311 };
1306 1312
1307 1313
1308 class DebuggerStatement V8_FINAL : public Statement { 1314 class DebuggerStatement V8_FINAL : public Statement {
1309 public: 1315 public:
1310 DECLARE_NODE_TYPE(DebuggerStatement) 1316 DECLARE_NODE_TYPE(DebuggerStatement)
1311 1317
1312 protected: 1318 protected:
1313 explicit DebuggerStatement(int pos): Statement(pos) {} 1319 explicit DebuggerStatement(Zone* zone, int pos): Statement(zone, pos) {}
1314 }; 1320 };
1315 1321
1316 1322
1317 class EmptyStatement V8_FINAL : public Statement { 1323 class EmptyStatement V8_FINAL : public Statement {
1318 public: 1324 public:
1319 DECLARE_NODE_TYPE(EmptyStatement) 1325 DECLARE_NODE_TYPE(EmptyStatement)
1320 1326
1321 protected: 1327 protected:
1322 explicit EmptyStatement(int pos): Statement(pos) {} 1328 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {}
1323 }; 1329 };
1324 1330
1325 1331
1326 class Literal V8_FINAL : public Expression { 1332 class Literal V8_FINAL : public Expression {
1327 public: 1333 public:
1328 DECLARE_NODE_TYPE(Literal) 1334 DECLARE_NODE_TYPE(Literal)
1329 1335
1330 virtual bool IsPropertyName() V8_OVERRIDE { 1336 virtual bool IsPropertyName() V8_OVERRIDE {
1331 if (value_->IsInternalizedString()) { 1337 if (value_->IsInternalizedString()) {
1332 uint32_t ignored; 1338 uint32_t ignored;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 1375
1370 static bool Match(void* literal1, void* literal2) { 1376 static bool Match(void* literal1, void* literal2) {
1371 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); 1377 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString();
1372 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); 1378 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString();
1373 return s1->Equals(*s2); 1379 return s1->Equals(*s2);
1374 } 1380 }
1375 1381
1376 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } 1382 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
1377 1383
1378 protected: 1384 protected:
1379 Literal( 1385 Literal(Zone* zone, Handle<Object> value, int position)
1380 Isolate* isolate, Handle<Object> value, int position) 1386 : Expression(zone, position),
1381 : Expression(isolate, position),
1382 value_(value), 1387 value_(value),
1383 isolate_(isolate) { } 1388 isolate_(zone->isolate()) { }
1384 1389
1385 private: 1390 private:
1386 Handle<String> ToString(); 1391 Handle<String> ToString();
1387 1392
1388 Handle<Object> value_; 1393 Handle<Object> value_;
1389 // TODO(dcarney): remove. this is only needed for Match and Hash. 1394 // TODO(dcarney): remove. this is only needed for Match and Hash.
1390 Isolate* isolate_; 1395 Isolate* isolate_;
1391 }; 1396 };
1392 1397
1393 1398
1394 // Base class for literals that needs space in the corresponding JSFunction. 1399 // Base class for literals that needs space in the corresponding JSFunction.
1395 class MaterializedLiteral : public Expression { 1400 class MaterializedLiteral : public Expression {
1396 public: 1401 public:
1397 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } 1402 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; }
1398 1403
1399 int literal_index() { return literal_index_; } 1404 int literal_index() { return literal_index_; }
1400 1405
1401 int depth() const { 1406 int depth() const {
1402 // only callable after initialization. 1407 // only callable after initialization.
1403 ASSERT(depth_ >= 1); 1408 ASSERT(depth_ >= 1);
1404 return depth_; 1409 return depth_;
1405 } 1410 }
1406 1411
1407 protected: 1412 protected:
1408 MaterializedLiteral(Isolate* isolate, 1413 MaterializedLiteral(Zone* zone,
1409 int literal_index, 1414 int literal_index,
1410 int pos) 1415 int pos)
1411 : Expression(isolate, pos), 1416 : Expression(zone, pos),
1412 literal_index_(literal_index), 1417 literal_index_(literal_index),
1413 is_simple_(false), 1418 is_simple_(false),
1414 depth_(0) {} 1419 depth_(0) {}
1415 1420
1416 // A materialized literal is simple if the values consist of only 1421 // A materialized literal is simple if the values consist of only
1417 // constants and simple object and array literals. 1422 // constants and simple object and array literals.
1418 bool is_simple() const { return is_simple_; } 1423 bool is_simple() const { return is_simple_; }
1419 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } 1424 void set_is_simple(bool is_simple) { is_simple_ = is_simple; }
1420 friend class CompileTimeValue; 1425 friend class CompileTimeValue;
1421 1426
(...skipping 27 matching lines...) Expand all
1449 class ObjectLiteralProperty V8_FINAL : public ZoneObject { 1454 class ObjectLiteralProperty V8_FINAL : public ZoneObject {
1450 public: 1455 public:
1451 enum Kind { 1456 enum Kind {
1452 CONSTANT, // Property with constant value (compile time). 1457 CONSTANT, // Property with constant value (compile time).
1453 COMPUTED, // Property with computed value (execution time). 1458 COMPUTED, // Property with computed value (execution time).
1454 MATERIALIZED_LITERAL, // Property value is a materialized literal. 1459 MATERIALIZED_LITERAL, // Property value is a materialized literal.
1455 GETTER, SETTER, // Property is an accessor function. 1460 GETTER, SETTER, // Property is an accessor function.
1456 PROTOTYPE // Property is __proto__. 1461 PROTOTYPE // Property is __proto__.
1457 }; 1462 };
1458 1463
1459 ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate); 1464 ObjectLiteralProperty(Zone* zone, Literal* key, Expression* value);
1460 1465
1461 Literal* key() { return key_; } 1466 Literal* key() { return key_; }
1462 Expression* value() { return value_; } 1467 Expression* value() { return value_; }
1463 Kind kind() { return kind_; } 1468 Kind kind() { return kind_; }
1464 1469
1465 // Type feedback information. 1470 // Type feedback information.
1466 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1471 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1467 bool IsMonomorphic() { return !receiver_type_.is_null(); } 1472 bool IsMonomorphic() { return !receiver_type_.is_null(); }
1468 Handle<Map> GetReceiverType() { return receiver_type_; } 1473 Handle<Map> GetReceiverType() { return receiver_type_; }
1469 1474
1470 bool IsCompileTimeValue(); 1475 bool IsCompileTimeValue();
1471 1476
1472 void set_emit_store(bool emit_store); 1477 void set_emit_store(bool emit_store);
1473 bool emit_store(); 1478 bool emit_store();
1474 1479
1475 protected: 1480 protected:
1476 template<class> friend class AstNodeFactory; 1481 template<class> friend class AstNodeFactory;
1477 1482
1478 ObjectLiteralProperty(bool is_getter, FunctionLiteral* value); 1483 ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value);
1479 void set_key(Literal* key) { key_ = key; } 1484 void set_key(Literal* key) { key_ = key; }
1480 1485
1481 private: 1486 private:
1482 Literal* key_; 1487 Literal* key_;
1483 Expression* value_; 1488 Expression* value_;
1484 Kind kind_; 1489 Kind kind_;
1485 bool emit_store_; 1490 bool emit_store_;
1486 Handle<Map> receiver_type_; 1491 Handle<Map> receiver_type_;
1487 }; 1492 };
1488 1493
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 kHasFunction = 1 << 1 1525 kHasFunction = 1 << 1
1521 }; 1526 };
1522 1527
1523 struct Accessors: public ZoneObject { 1528 struct Accessors: public ZoneObject {
1524 Accessors() : getter(NULL), setter(NULL) { } 1529 Accessors() : getter(NULL), setter(NULL) { }
1525 Expression* getter; 1530 Expression* getter;
1526 Expression* setter; 1531 Expression* setter;
1527 }; 1532 };
1528 1533
1529 protected: 1534 protected:
1530 ObjectLiteral(Isolate* isolate, 1535 ObjectLiteral(Zone* zone,
1531 ZoneList<Property*>* properties, 1536 ZoneList<Property*>* properties,
1532 int literal_index, 1537 int literal_index,
1533 int boilerplate_properties, 1538 int boilerplate_properties,
1534 bool has_function, 1539 bool has_function,
1535 int pos) 1540 int pos)
1536 : MaterializedLiteral(isolate, literal_index, pos), 1541 : MaterializedLiteral(zone, literal_index, pos),
1537 properties_(properties), 1542 properties_(properties),
1538 boilerplate_properties_(boilerplate_properties), 1543 boilerplate_properties_(boilerplate_properties),
1539 fast_elements_(false), 1544 fast_elements_(false),
1540 may_store_doubles_(false), 1545 may_store_doubles_(false),
1541 has_function_(has_function) {} 1546 has_function_(has_function) {}
1542 1547
1543 private: 1548 private:
1544 Handle<FixedArray> constant_properties_; 1549 Handle<FixedArray> constant_properties_;
1545 ZoneList<Property*>* properties_; 1550 ZoneList<Property*>* properties_;
1546 int boilerplate_properties_; 1551 int boilerplate_properties_;
1547 bool fast_elements_; 1552 bool fast_elements_;
1548 bool may_store_doubles_; 1553 bool may_store_doubles_;
1549 bool has_function_; 1554 bool has_function_;
1550 }; 1555 };
1551 1556
1552 1557
1553 // Node for capturing a regexp literal. 1558 // Node for capturing a regexp literal.
1554 class RegExpLiteral V8_FINAL : public MaterializedLiteral { 1559 class RegExpLiteral V8_FINAL : public MaterializedLiteral {
1555 public: 1560 public:
1556 DECLARE_NODE_TYPE(RegExpLiteral) 1561 DECLARE_NODE_TYPE(RegExpLiteral)
1557 1562
1558 Handle<String> pattern() const { return pattern_; } 1563 Handle<String> pattern() const { return pattern_; }
1559 Handle<String> flags() const { return flags_; } 1564 Handle<String> flags() const { return flags_; }
1560 1565
1561 protected: 1566 protected:
1562 RegExpLiteral(Isolate* isolate, 1567 RegExpLiteral(Zone* zone,
1563 Handle<String> pattern, 1568 Handle<String> pattern,
1564 Handle<String> flags, 1569 Handle<String> flags,
1565 int literal_index, 1570 int literal_index,
1566 int pos) 1571 int pos)
1567 : MaterializedLiteral(isolate, literal_index, pos), 1572 : MaterializedLiteral(zone, literal_index, pos),
1568 pattern_(pattern), 1573 pattern_(pattern),
1569 flags_(flags) { 1574 flags_(flags) {
1570 set_depth(1); 1575 set_depth(1);
1571 } 1576 }
1572 1577
1573 private: 1578 private:
1574 Handle<String> pattern_; 1579 Handle<String> pattern_;
1575 Handle<String> flags_; 1580 Handle<String> flags_;
1576 }; 1581 };
1577 1582
(...skipping 15 matching lines...) Expand all
1593 // Populate the constant elements fixed array. 1598 // Populate the constant elements fixed array.
1594 void BuildConstantElements(Isolate* isolate); 1599 void BuildConstantElements(Isolate* isolate);
1595 1600
1596 enum Flags { 1601 enum Flags {
1597 kNoFlags = 0, 1602 kNoFlags = 0,
1598 kShallowElements = 1, 1603 kShallowElements = 1,
1599 kDisableMementos = 1 << 1 1604 kDisableMementos = 1 << 1
1600 }; 1605 };
1601 1606
1602 protected: 1607 protected:
1603 ArrayLiteral(Isolate* isolate, 1608 ArrayLiteral(Zone* zone,
1604 ZoneList<Expression*>* values, 1609 ZoneList<Expression*>* values,
1605 int literal_index, 1610 int literal_index,
1606 int pos) 1611 int pos)
1607 : MaterializedLiteral(isolate, literal_index, pos), 1612 : MaterializedLiteral(zone, literal_index, pos),
1608 values_(values), 1613 values_(values),
1609 first_element_id_(ReserveIdRange(isolate, values->length())) {} 1614 first_element_id_(ReserveIdRange(zone, values->length())) {}
1610 1615
1611 private: 1616 private:
1612 Handle<FixedArray> constant_elements_; 1617 Handle<FixedArray> constant_elements_;
1613 ZoneList<Expression*>* values_; 1618 ZoneList<Expression*>* values_;
1614 const BailoutId first_element_id_; 1619 const BailoutId first_element_id_;
1615 }; 1620 };
1616 1621
1617 1622
1618 class VariableProxy V8_FINAL : public Expression { 1623 class VariableProxy V8_FINAL : public Expression {
1619 public: 1624 public:
(...skipping 19 matching lines...) Expand all
1639 Interface* interface() const { return interface_; } 1644 Interface* interface() const { return interface_; }
1640 1645
1641 1646
1642 void MarkAsTrivial() { is_trivial_ = true; } 1647 void MarkAsTrivial() { is_trivial_ = true; }
1643 void MarkAsLValue() { is_lvalue_ = true; } 1648 void MarkAsLValue() { is_lvalue_ = true; }
1644 1649
1645 // Bind this proxy to the variable var. Interfaces must match. 1650 // Bind this proxy to the variable var. Interfaces must match.
1646 void BindTo(Variable* var); 1651 void BindTo(Variable* var);
1647 1652
1648 protected: 1653 protected:
1649 VariableProxy(Isolate* isolate, Variable* var, int position); 1654 VariableProxy(Zone* zone, Variable* var, int position);
1650 1655
1651 VariableProxy(Isolate* isolate, 1656 VariableProxy(Zone* zone,
1652 Handle<String> name, 1657 Handle<String> name,
1653 bool is_this, 1658 bool is_this,
1654 Interface* interface, 1659 Interface* interface,
1655 int position); 1660 int position);
1656 1661
1657 Handle<String> name_; 1662 Handle<String> name_;
1658 Variable* var_; // resolved variable, or NULL 1663 Variable* var_; // resolved variable, or NULL
1659 bool is_this_; 1664 bool is_this_;
1660 bool is_trivial_; 1665 bool is_trivial_;
1661 // True if this variable proxy is being used in an assignment 1666 // True if this variable proxy is being used in an assignment
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 return is_uninitialized_ || is_pre_monomorphic_; 1700 return is_uninitialized_ || is_pre_monomorphic_;
1696 } 1701 }
1697 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } 1702 void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
1698 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } 1703 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; }
1699 void set_is_string_access(bool b) { is_string_access_ = b; } 1704 void set_is_string_access(bool b) { is_string_access_ = b; }
1700 void set_is_function_prototype(bool b) { is_function_prototype_ = b; } 1705 void set_is_function_prototype(bool b) { is_function_prototype_ = b; }
1701 1706
1702 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } 1707 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
1703 1708
1704 protected: 1709 protected:
1705 Property(Isolate* isolate, 1710 Property(Zone* zone,
1706 Expression* obj, 1711 Expression* obj,
1707 Expression* key, 1712 Expression* key,
1708 int pos) 1713 int pos)
1709 : Expression(isolate, pos), 1714 : Expression(zone, pos),
1710 obj_(obj), 1715 obj_(obj),
1711 key_(key), 1716 key_(key),
1712 load_id_(GetNextId(isolate)), 1717 load_id_(GetNextId(zone)),
1713 is_pre_monomorphic_(false), 1718 is_pre_monomorphic_(false),
1714 is_uninitialized_(false), 1719 is_uninitialized_(false),
1715 is_string_access_(false), 1720 is_string_access_(false),
1716 is_function_prototype_(false) { } 1721 is_function_prototype_(false) { }
1717 1722
1718 private: 1723 private:
1719 Expression* obj_; 1724 Expression* obj_;
1720 Expression* key_; 1725 Expression* key_;
1721 const BailoutId load_id_; 1726 const BailoutId load_id_;
1722 1727
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 // various similar methods in objets.cc), but for now... 1783 // various similar methods in objets.cc), but for now...
1779 static Handle<JSObject> GetPrototypeForPrimitiveCheck( 1784 static Handle<JSObject> GetPrototypeForPrimitiveCheck(
1780 CheckType check, Isolate* isolate); 1785 CheckType check, Isolate* isolate);
1781 1786
1782 #ifdef DEBUG 1787 #ifdef DEBUG
1783 // Used to assert that the FullCodeGenerator records the return site. 1788 // Used to assert that the FullCodeGenerator records the return site.
1784 bool return_is_recorded_; 1789 bool return_is_recorded_;
1785 #endif 1790 #endif
1786 1791
1787 protected: 1792 protected:
1788 Call(Isolate* isolate, 1793 Call(Zone* zone,
1789 Expression* expression, 1794 Expression* expression,
1790 ZoneList<Expression*>* arguments, 1795 ZoneList<Expression*>* arguments,
1791 int pos) 1796 int pos)
1792 : Expression(isolate, pos), 1797 : Expression(zone, pos),
1793 expression_(expression), 1798 expression_(expression),
1794 arguments_(arguments), 1799 arguments_(arguments),
1795 is_monomorphic_(false), 1800 is_monomorphic_(false),
1796 keyed_array_call_is_holey_(true), 1801 keyed_array_call_is_holey_(true),
1797 check_type_(RECEIVER_MAP_CHECK), 1802 check_type_(RECEIVER_MAP_CHECK),
1798 return_id_(GetNextId(isolate)) { } 1803 return_id_(GetNextId(zone)) { }
1799 1804
1800 private: 1805 private:
1801 Expression* expression_; 1806 Expression* expression_;
1802 ZoneList<Expression*>* arguments_; 1807 ZoneList<Expression*>* arguments_;
1803 1808
1804 bool is_monomorphic_; 1809 bool is_monomorphic_;
1805 bool keyed_array_call_is_holey_; 1810 bool keyed_array_call_is_holey_;
1806 CheckType check_type_; 1811 CheckType check_type_;
1807 SmallMapList receiver_types_; 1812 SmallMapList receiver_types_;
1808 Handle<JSFunction> target_; 1813 Handle<JSFunction> target_;
(...skipping 17 matching lines...) Expand all
1826 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } 1831 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
1827 Handle<JSFunction> target() const { return target_; } 1832 Handle<JSFunction> target() const { return target_; }
1828 ElementsKind elements_kind() const { return elements_kind_; } 1833 ElementsKind elements_kind() const { return elements_kind_; }
1829 Handle<Cell> allocation_info_cell() const { 1834 Handle<Cell> allocation_info_cell() const {
1830 return allocation_info_cell_; 1835 return allocation_info_cell_;
1831 } 1836 }
1832 1837
1833 BailoutId ReturnId() const { return return_id_; } 1838 BailoutId ReturnId() const { return return_id_; }
1834 1839
1835 protected: 1840 protected:
1836 CallNew(Isolate* isolate, 1841 CallNew(Zone* zone,
1837 Expression* expression, 1842 Expression* expression,
1838 ZoneList<Expression*>* arguments, 1843 ZoneList<Expression*>* arguments,
1839 int pos) 1844 int pos)
1840 : Expression(isolate, pos), 1845 : Expression(zone, pos),
1841 expression_(expression), 1846 expression_(expression),
1842 arguments_(arguments), 1847 arguments_(arguments),
1843 is_monomorphic_(false), 1848 is_monomorphic_(false),
1844 elements_kind_(GetInitialFastElementsKind()), 1849 elements_kind_(GetInitialFastElementsKind()),
1845 return_id_(GetNextId(isolate)) { } 1850 return_id_(GetNextId(zone)) { }
1846 1851
1847 private: 1852 private:
1848 Expression* expression_; 1853 Expression* expression_;
1849 ZoneList<Expression*>* arguments_; 1854 ZoneList<Expression*>* arguments_;
1850 1855
1851 bool is_monomorphic_; 1856 bool is_monomorphic_;
1852 Handle<JSFunction> target_; 1857 Handle<JSFunction> target_;
1853 ElementsKind elements_kind_; 1858 ElementsKind elements_kind_;
1854 Handle<Cell> allocation_info_cell_; 1859 Handle<Cell> allocation_info_cell_;
1855 1860
(...skipping 10 matching lines...) Expand all
1866 DECLARE_NODE_TYPE(CallRuntime) 1871 DECLARE_NODE_TYPE(CallRuntime)
1867 1872
1868 Handle<String> name() const { return name_; } 1873 Handle<String> name() const { return name_; }
1869 const Runtime::Function* function() const { return function_; } 1874 const Runtime::Function* function() const { return function_; }
1870 ZoneList<Expression*>* arguments() const { return arguments_; } 1875 ZoneList<Expression*>* arguments() const { return arguments_; }
1871 bool is_jsruntime() const { return function_ == NULL; } 1876 bool is_jsruntime() const { return function_ == NULL; }
1872 1877
1873 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } 1878 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
1874 1879
1875 protected: 1880 protected:
1876 CallRuntime(Isolate* isolate, 1881 CallRuntime(Zone* zone,
1877 Handle<String> name, 1882 Handle<String> name,
1878 const Runtime::Function* function, 1883 const Runtime::Function* function,
1879 ZoneList<Expression*>* arguments, 1884 ZoneList<Expression*>* arguments,
1880 int pos) 1885 int pos)
1881 : Expression(isolate, pos), 1886 : Expression(zone, pos),
1882 name_(name), 1887 name_(name),
1883 function_(function), 1888 function_(function),
1884 arguments_(arguments) { } 1889 arguments_(arguments) { }
1885 1890
1886 private: 1891 private:
1887 Handle<String> name_; 1892 Handle<String> name_;
1888 const Runtime::Function* function_; 1893 const Runtime::Function* function_;
1889 ZoneList<Expression*>* arguments_; 1894 ZoneList<Expression*>* arguments_;
1890 }; 1895 };
1891 1896
1892 1897
1893 class UnaryOperation V8_FINAL : public Expression { 1898 class UnaryOperation V8_FINAL : public Expression {
1894 public: 1899 public:
1895 DECLARE_NODE_TYPE(UnaryOperation) 1900 DECLARE_NODE_TYPE(UnaryOperation)
1896 1901
1897 Token::Value op() const { return op_; } 1902 Token::Value op() const { return op_; }
1898 Expression* expression() const { return expression_; } 1903 Expression* expression() const { return expression_; }
1899 1904
1900 BailoutId MaterializeTrueId() { return materialize_true_id_; } 1905 BailoutId MaterializeTrueId() { return materialize_true_id_; }
1901 BailoutId MaterializeFalseId() { return materialize_false_id_; } 1906 BailoutId MaterializeFalseId() { return materialize_false_id_; }
1902 1907
1903 virtual void RecordToBooleanTypeFeedback( 1908 virtual void RecordToBooleanTypeFeedback(
1904 TypeFeedbackOracle* oracle) V8_OVERRIDE; 1909 TypeFeedbackOracle* oracle) V8_OVERRIDE;
1905 1910
1906 protected: 1911 protected:
1907 UnaryOperation(Isolate* isolate, 1912 UnaryOperation(Zone* zone,
1908 Token::Value op, 1913 Token::Value op,
1909 Expression* expression, 1914 Expression* expression,
1910 int pos) 1915 int pos)
1911 : Expression(isolate, pos), 1916 : Expression(zone, pos),
1912 op_(op), 1917 op_(op),
1913 expression_(expression), 1918 expression_(expression),
1914 materialize_true_id_(GetNextId(isolate)), 1919 materialize_true_id_(GetNextId(zone)),
1915 materialize_false_id_(GetNextId(isolate)) { 1920 materialize_false_id_(GetNextId(zone)) {
1916 ASSERT(Token::IsUnaryOp(op)); 1921 ASSERT(Token::IsUnaryOp(op));
1917 } 1922 }
1918 1923
1919 private: 1924 private:
1920 Token::Value op_; 1925 Token::Value op_;
1921 Expression* expression_; 1926 Expression* expression_;
1922 1927
1923 // For unary not (Token::NOT), the AST ids where true and false will 1928 // For unary not (Token::NOT), the AST ids where true and false will
1924 // actually be materialized, respectively. 1929 // actually be materialized, respectively.
1925 const BailoutId materialize_true_id_; 1930 const BailoutId materialize_true_id_;
(...skipping 14 matching lines...) Expand all
1940 BailoutId RightId() const { return right_id_; } 1945 BailoutId RightId() const { return right_id_; }
1941 1946
1942 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } 1947 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); }
1943 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } 1948 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
1944 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } 1949 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
1945 1950
1946 virtual void RecordToBooleanTypeFeedback( 1951 virtual void RecordToBooleanTypeFeedback(
1947 TypeFeedbackOracle* oracle) V8_OVERRIDE; 1952 TypeFeedbackOracle* oracle) V8_OVERRIDE;
1948 1953
1949 protected: 1954 protected:
1950 BinaryOperation(Isolate* isolate, 1955 BinaryOperation(Zone* zone,
1951 Token::Value op, 1956 Token::Value op,
1952 Expression* left, 1957 Expression* left,
1953 Expression* right, 1958 Expression* right,
1954 int pos) 1959 int pos)
1955 : Expression(isolate, pos), 1960 : Expression(zone, pos),
1956 op_(op), 1961 op_(op),
1957 left_(left), 1962 left_(left),
1958 right_(right), 1963 right_(right),
1959 right_id_(GetNextId(isolate)) { 1964 right_id_(GetNextId(zone)) {
1960 ASSERT(Token::IsBinaryOp(op)); 1965 ASSERT(Token::IsBinaryOp(op));
1961 } 1966 }
1962 1967
1963 private: 1968 private:
1964 Token::Value op_; 1969 Token::Value op_;
1965 Expression* left_; 1970 Expression* left_;
1966 Expression* right_; 1971 Expression* right_;
1967 1972
1968 // TODO(rossberg): the fixed arg should probably be represented as a Constant 1973 // TODO(rossberg): the fixed arg should probably be represented as a Constant
1969 // type for the RHS. 1974 // type for the RHS.
(...skipping 21 matching lines...) Expand all
1991 1996
1992 virtual bool IsMonomorphic() V8_OVERRIDE { 1997 virtual bool IsMonomorphic() V8_OVERRIDE {
1993 return receiver_types_.length() == 1; 1998 return receiver_types_.length() == 1;
1994 } 1999 }
1995 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { 2000 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
1996 return &receiver_types_; 2001 return &receiver_types_;
1997 } 2002 }
1998 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { 2003 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
1999 return store_mode_; 2004 return store_mode_;
2000 } 2005 }
2001 Handle<Type> type() const { return type_; } 2006 Type* type() const { return type_; }
2002 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2007 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2003 void set_type(Handle<Type> type) { type_ = type; } 2008 void set_type(Type* type) { type_ = type; }
2004 2009
2005 BailoutId AssignmentId() const { return assignment_id_; } 2010 BailoutId AssignmentId() const { return assignment_id_; }
2006 2011
2007 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } 2012 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; }
2008 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } 2013 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
2009 2014
2010 protected: 2015 protected:
2011 CountOperation(Isolate* isolate, 2016 CountOperation(Zone* zone,
2012 Token::Value op, 2017 Token::Value op,
2013 bool is_prefix, 2018 bool is_prefix,
2014 Expression* expr, 2019 Expression* expr,
2015 int pos) 2020 int pos)
2016 : Expression(isolate, pos), 2021 : Expression(zone, pos),
2017 op_(op), 2022 op_(op),
2018 is_prefix_(is_prefix), 2023 is_prefix_(is_prefix),
2019 store_mode_(STANDARD_STORE), 2024 store_mode_(STANDARD_STORE),
2020 expression_(expr), 2025 expression_(expr),
2021 assignment_id_(GetNextId(isolate)), 2026 assignment_id_(GetNextId(zone)),
2022 count_id_(GetNextId(isolate)) {} 2027 count_id_(GetNextId(zone)) {}
2023 2028
2024 private: 2029 private:
2025 Token::Value op_; 2030 Token::Value op_;
2026 bool is_prefix_ : 1; 2031 bool is_prefix_ : 1;
2027 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2032 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2028 // must have extra bit. 2033 // must have extra bit.
2029 Handle<Type> type_; 2034 Type* type_;
2030 2035
2031 Expression* expression_; 2036 Expression* expression_;
2032 const BailoutId assignment_id_; 2037 const BailoutId assignment_id_;
2033 const TypeFeedbackId count_id_; 2038 const TypeFeedbackId count_id_;
2034 SmallMapList receiver_types_; 2039 SmallMapList receiver_types_;
2035 }; 2040 };
2036 2041
2037 2042
2038 class CompareOperation V8_FINAL : public Expression { 2043 class CompareOperation V8_FINAL : public Expression {
2039 public: 2044 public:
2040 DECLARE_NODE_TYPE(CompareOperation) 2045 DECLARE_NODE_TYPE(CompareOperation)
2041 2046
2042 Token::Value op() const { return op_; } 2047 Token::Value op() const { return op_; }
2043 Expression* left() const { return left_; } 2048 Expression* left() const { return left_; }
2044 Expression* right() const { return right_; } 2049 Expression* right() const { return right_; }
2045 2050
2046 // Type feedback information. 2051 // Type feedback information.
2047 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } 2052 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
2048 Handle<Type> combined_type() const { return combined_type_; } 2053 Type* combined_type() const { return combined_type_; }
2049 void set_combined_type(Handle<Type> type) { combined_type_ = type; } 2054 void set_combined_type(Type* type) { combined_type_ = type; }
2050 2055
2051 // Match special cases. 2056 // Match special cases.
2052 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); 2057 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
2053 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); 2058 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate);
2054 bool IsLiteralCompareNull(Expression** expr); 2059 bool IsLiteralCompareNull(Expression** expr);
2055 2060
2056 protected: 2061 protected:
2057 CompareOperation(Isolate* isolate, 2062 CompareOperation(Zone* zone,
2058 Token::Value op, 2063 Token::Value op,
2059 Expression* left, 2064 Expression* left,
2060 Expression* right, 2065 Expression* right,
2061 int pos) 2066 int pos)
2062 : Expression(isolate, pos), 2067 : Expression(zone, pos),
2063 op_(op), 2068 op_(op),
2064 left_(left), 2069 left_(left),
2065 right_(right), 2070 right_(right),
2066 combined_type_(Type::None(isolate)) { 2071 combined_type_(Type::None(zone)) {
2067 ASSERT(Token::IsCompareOp(op)); 2072 ASSERT(Token::IsCompareOp(op));
2068 } 2073 }
2069 2074
2070 private: 2075 private:
2071 Token::Value op_; 2076 Token::Value op_;
2072 Expression* left_; 2077 Expression* left_;
2073 Expression* right_; 2078 Expression* right_;
2074 2079
2075 Handle<Type> combined_type_; 2080 Type* combined_type_;
2076 }; 2081 };
2077 2082
2078 2083
2079 class Conditional V8_FINAL : public Expression { 2084 class Conditional V8_FINAL : public Expression {
2080 public: 2085 public:
2081 DECLARE_NODE_TYPE(Conditional) 2086 DECLARE_NODE_TYPE(Conditional)
2082 2087
2083 Expression* condition() const { return condition_; } 2088 Expression* condition() const { return condition_; }
2084 Expression* then_expression() const { return then_expression_; } 2089 Expression* then_expression() const { return then_expression_; }
2085 Expression* else_expression() const { return else_expression_; } 2090 Expression* else_expression() const { return else_expression_; }
2086 2091
2087 BailoutId ThenId() const { return then_id_; } 2092 BailoutId ThenId() const { return then_id_; }
2088 BailoutId ElseId() const { return else_id_; } 2093 BailoutId ElseId() const { return else_id_; }
2089 2094
2090 protected: 2095 protected:
2091 Conditional(Isolate* isolate, 2096 Conditional(Zone* zone,
2092 Expression* condition, 2097 Expression* condition,
2093 Expression* then_expression, 2098 Expression* then_expression,
2094 Expression* else_expression, 2099 Expression* else_expression,
2095 int position) 2100 int position)
2096 : Expression(isolate, position), 2101 : Expression(zone, position),
2097 condition_(condition), 2102 condition_(condition),
2098 then_expression_(then_expression), 2103 then_expression_(then_expression),
2099 else_expression_(else_expression), 2104 else_expression_(else_expression),
2100 then_id_(GetNextId(isolate)), 2105 then_id_(GetNextId(zone)),
2101 else_id_(GetNextId(isolate)) { } 2106 else_id_(GetNextId(zone)) { }
2102 2107
2103 private: 2108 private:
2104 Expression* condition_; 2109 Expression* condition_;
2105 Expression* then_expression_; 2110 Expression* then_expression_;
2106 Expression* else_expression_; 2111 Expression* else_expression_;
2107 const BailoutId then_id_; 2112 const BailoutId then_id_;
2108 const BailoutId else_id_; 2113 const BailoutId else_id_;
2109 }; 2114 };
2110 2115
2111 2116
(...skipping 29 matching lines...) Expand all
2141 return &receiver_types_; 2146 return &receiver_types_;
2142 } 2147 }
2143 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { 2148 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
2144 return store_mode_; 2149 return store_mode_;
2145 } 2150 }
2146 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } 2151 void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
2147 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } 2152 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; }
2148 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2153 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2149 2154
2150 protected: 2155 protected:
2151 Assignment(Isolate* isolate, 2156 Assignment(Zone* zone,
2152 Token::Value op, 2157 Token::Value op,
2153 Expression* target, 2158 Expression* target,
2154 Expression* value, 2159 Expression* value,
2155 int pos); 2160 int pos);
2156 2161
2157 template<class Visitor> 2162 template<class Visitor>
2158 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { 2163 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) {
2159 ASSERT(Token::IsAssignmentOp(op_)); 2164 ASSERT(Token::IsAssignmentOp(op_));
2160 if (is_compound()) { 2165 if (is_compound()) {
2161 binary_operation_ = factory->NewBinaryOperation( 2166 binary_operation_ = factory->NewBinaryOperation(
2162 binary_op(), target_, value_, position() + 1); 2167 binary_op(), target_, value_, position() + 1);
2163 } 2168 }
2164 } 2169 }
2165 2170
2166 private: 2171 private:
2167 Token::Value op_; 2172 Token::Value op_;
2168 Expression* target_; 2173 Expression* target_;
(...skipping 30 matching lines...) Expand all
2199 int index() const { 2204 int index() const {
2200 ASSERT(yield_kind() == DELEGATING); 2205 ASSERT(yield_kind() == DELEGATING);
2201 return index_; 2206 return index_;
2202 } 2207 }
2203 void set_index(int index) { 2208 void set_index(int index) {
2204 ASSERT(yield_kind() == DELEGATING); 2209 ASSERT(yield_kind() == DELEGATING);
2205 index_ = index; 2210 index_ = index;
2206 } 2211 }
2207 2212
2208 protected: 2213 protected:
2209 Yield(Isolate* isolate, 2214 Yield(Zone* zone,
2210 Expression* generator_object, 2215 Expression* generator_object,
2211 Expression* expression, 2216 Expression* expression,
2212 Kind yield_kind, 2217 Kind yield_kind,
2213 int pos) 2218 int pos)
2214 : Expression(isolate, pos), 2219 : Expression(zone, pos),
2215 generator_object_(generator_object), 2220 generator_object_(generator_object),
2216 expression_(expression), 2221 expression_(expression),
2217 yield_kind_(yield_kind), 2222 yield_kind_(yield_kind),
2218 index_(-1) { } 2223 index_(-1) { }
2219 2224
2220 private: 2225 private:
2221 Expression* generator_object_; 2226 Expression* generator_object_;
2222 Expression* expression_; 2227 Expression* expression_;
2223 Kind yield_kind_; 2228 Kind yield_kind_;
2224 int index_; 2229 int index_;
2225 }; 2230 };
2226 2231
2227 2232
2228 class Throw V8_FINAL : public Expression { 2233 class Throw V8_FINAL : public Expression {
2229 public: 2234 public:
2230 DECLARE_NODE_TYPE(Throw) 2235 DECLARE_NODE_TYPE(Throw)
2231 2236
2232 Expression* exception() const { return exception_; } 2237 Expression* exception() const { return exception_; }
2233 2238
2234 protected: 2239 protected:
2235 Throw(Isolate* isolate, Expression* exception, int pos) 2240 Throw(Zone* zone, Expression* exception, int pos)
2236 : Expression(isolate, pos), exception_(exception) {} 2241 : Expression(zone, pos), exception_(exception) {}
2237 2242
2238 private: 2243 private:
2239 Expression* exception_; 2244 Expression* exception_;
2240 }; 2245 };
2241 2246
2242 2247
2243 class FunctionLiteral V8_FINAL : public Expression { 2248 class FunctionLiteral V8_FINAL : public Expression {
2244 public: 2249 public:
2245 enum FunctionType { 2250 enum FunctionType {
2246 ANONYMOUS_EXPRESSION, 2251 ANONYMOUS_EXPRESSION,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 ast_properties_ = *ast_properties; 2337 ast_properties_ = *ast_properties;
2333 } 2338 }
2334 2339
2335 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } 2340 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; }
2336 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } 2341 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
2337 void set_dont_optimize_reason(BailoutReason reason) { 2342 void set_dont_optimize_reason(BailoutReason reason) {
2338 dont_optimize_reason_ = reason; 2343 dont_optimize_reason_ = reason;
2339 } 2344 }
2340 2345
2341 protected: 2346 protected:
2342 FunctionLiteral(Isolate* isolate, 2347 FunctionLiteral(Zone* zone,
2343 Handle<String> name, 2348 Handle<String> name,
2344 Scope* scope, 2349 Scope* scope,
2345 ZoneList<Statement*>* body, 2350 ZoneList<Statement*>* body,
2346 int materialized_literal_count, 2351 int materialized_literal_count,
2347 int expected_property_count, 2352 int expected_property_count,
2348 int handler_count, 2353 int handler_count,
2349 int parameter_count, 2354 int parameter_count,
2350 FunctionType function_type, 2355 FunctionType function_type,
2351 ParameterFlag has_duplicate_parameters, 2356 ParameterFlag has_duplicate_parameters,
2352 IsFunctionFlag is_function, 2357 IsFunctionFlag is_function,
2353 IsParenthesizedFlag is_parenthesized, 2358 IsParenthesizedFlag is_parenthesized,
2354 IsGeneratorFlag is_generator, 2359 IsGeneratorFlag is_generator,
2355 int position) 2360 int position)
2356 : Expression(isolate, position), 2361 : Expression(zone, position),
2357 name_(name), 2362 name_(name),
2358 scope_(scope), 2363 scope_(scope),
2359 body_(body), 2364 body_(body),
2360 inferred_name_(isolate->factory()->empty_string()), 2365 inferred_name_(zone->isolate()->factory()->empty_string()),
2361 dont_optimize_reason_(kNoReason), 2366 dont_optimize_reason_(kNoReason),
2362 materialized_literal_count_(materialized_literal_count), 2367 materialized_literal_count_(materialized_literal_count),
2363 expected_property_count_(expected_property_count), 2368 expected_property_count_(expected_property_count),
2364 handler_count_(handler_count), 2369 handler_count_(handler_count),
2365 parameter_count_(parameter_count), 2370 parameter_count_(parameter_count),
2366 function_token_position_(RelocInfo::kNoPosition) { 2371 function_token_position_(RelocInfo::kNoPosition) {
2367 bitfield_ = 2372 bitfield_ =
2368 IsExpression::encode(function_type != DECLARATION) | 2373 IsExpression::encode(function_type != DECLARATION) |
2369 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | 2374 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) |
2370 Pretenure::encode(false) | 2375 Pretenure::encode(false) |
(...skipping 30 matching lines...) Expand all
2401 2406
2402 class NativeFunctionLiteral V8_FINAL : public Expression { 2407 class NativeFunctionLiteral V8_FINAL : public Expression {
2403 public: 2408 public:
2404 DECLARE_NODE_TYPE(NativeFunctionLiteral) 2409 DECLARE_NODE_TYPE(NativeFunctionLiteral)
2405 2410
2406 Handle<String> name() const { return name_; } 2411 Handle<String> name() const { return name_; }
2407 v8::Extension* extension() const { return extension_; } 2412 v8::Extension* extension() const { return extension_; }
2408 2413
2409 protected: 2414 protected:
2410 NativeFunctionLiteral( 2415 NativeFunctionLiteral(
2411 Isolate* isolate, Handle<String> name, v8::Extension* extension, int pos) 2416 Zone* zone, Handle<String> name, v8::Extension* extension, int pos)
2412 : Expression(isolate, pos), name_(name), extension_(extension) {} 2417 : Expression(zone, pos), name_(name), extension_(extension) {}
2413 2418
2414 private: 2419 private:
2415 Handle<String> name_; 2420 Handle<String> name_;
2416 v8::Extension* extension_; 2421 v8::Extension* extension_;
2417 }; 2422 };
2418 2423
2419 2424
2420 class ThisFunction V8_FINAL : public Expression { 2425 class ThisFunction V8_FINAL : public Expression {
2421 public: 2426 public:
2422 DECLARE_NODE_TYPE(ThisFunction) 2427 DECLARE_NODE_TYPE(ThisFunction)
2423 2428
2424 protected: 2429 protected:
2425 explicit ThisFunction(Isolate* isolate, int pos): Expression(isolate, pos) {} 2430 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {}
2426 }; 2431 };
2427 2432
2428 #undef DECLARE_NODE_TYPE 2433 #undef DECLARE_NODE_TYPE
2429 2434
2430 2435
2431 // ---------------------------------------------------------------------------- 2436 // ----------------------------------------------------------------------------
2432 // Regular expressions 2437 // Regular expressions
2433 2438
2434 2439
2435 class RegExpVisitor BASE_EMBEDDED { 2440 class RegExpVisitor BASE_EMBEDDED {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 static RegExpEmpty* GetInstance() { 2787 static RegExpEmpty* GetInstance() {
2783 static RegExpEmpty* instance = ::new RegExpEmpty(); 2788 static RegExpEmpty* instance = ::new RegExpEmpty();
2784 return instance; 2789 return instance;
2785 } 2790 }
2786 }; 2791 };
2787 2792
2788 2793
2789 // ---------------------------------------------------------------------------- 2794 // ----------------------------------------------------------------------------
2790 // Out-of-line inline constructors (to side-step cyclic dependencies). 2795 // Out-of-line inline constructors (to side-step cyclic dependencies).
2791 2796
2792 inline ModuleVariable::ModuleVariable(VariableProxy* proxy, int pos) 2797 inline ModuleVariable::ModuleVariable(Zone* zone, VariableProxy* proxy, int pos)
2793 : Module(proxy->interface(), pos), 2798 : Module(zone, proxy->interface(), pos),
2794 proxy_(proxy) { 2799 proxy_(proxy) {
2795 } 2800 }
2796 2801
2797 2802
2798 // ---------------------------------------------------------------------------- 2803 // ----------------------------------------------------------------------------
2799 // Basic visitor 2804 // Basic visitor
2800 // - leaf node visitors are abstract. 2805 // - leaf node visitors are abstract.
2801 2806
2802 class AstVisitor BASE_EMBEDDED { 2807 class AstVisitor BASE_EMBEDDED {
2803 public: 2808 public:
(...skipping 11 matching lines...) Expand all
2815 // Individual AST nodes. 2820 // Individual AST nodes.
2816 #define DEF_VISIT(type) \ 2821 #define DEF_VISIT(type) \
2817 virtual void Visit##type(type* node) = 0; 2822 virtual void Visit##type(type* node) = 0;
2818 AST_NODE_LIST(DEF_VISIT) 2823 AST_NODE_LIST(DEF_VISIT)
2819 #undef DEF_VISIT 2824 #undef DEF_VISIT
2820 }; 2825 };
2821 2826
2822 2827
2823 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ 2828 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
2824 public: \ 2829 public: \
2825 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \ 2830 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \
2826 if (!CheckStackOverflow()) node->Accept(this); \ 2831 if (!CheckStackOverflow()) node->Accept(this); \
2827 } \ 2832 } \
2828 \ 2833 \
2829 void SetStackOverflow() { stack_overflow_ = true; } \ 2834 void SetStackOverflow() { stack_overflow_ = true; } \
2830 void ClearStackOverflow() { stack_overflow_ = false; } \ 2835 void ClearStackOverflow() { stack_overflow_ = false; } \
2831 bool HasStackOverflow() const { return stack_overflow_; } \ 2836 bool HasStackOverflow() const { return stack_overflow_; } \
2832 \ 2837 \
2833 bool CheckStackOverflow() { \ 2838 bool CheckStackOverflow() { \
2834 if (stack_overflow_) return true; \ 2839 if (stack_overflow_) return true; \
2835 StackLimitCheck check(isolate_); \ 2840 StackLimitCheck check(zone_->isolate()); \
2836 if (!check.HasOverflowed()) return false; \ 2841 if (!check.HasOverflowed()) return false; \
2837 return (stack_overflow_ = true); \ 2842 return (stack_overflow_ = true); \
2838 } \ 2843 } \
2839 \ 2844 \
2840 private: \ 2845 private: \
2841 void InitializeAstVisitor(Isolate* isolate) { \ 2846 void InitializeAstVisitor(Zone* zone) { \
2842 isolate_ = isolate; \ 2847 zone_ = zone; \
2843 stack_overflow_ = false; \ 2848 stack_overflow_ = false; \
2844 } \ 2849 } \
2845 Isolate* isolate() { return isolate_; } \ 2850 Zone* zone() { return zone_; } \
2851 Isolate* isolate() { return zone_->isolate(); } \
2846 \ 2852 \
2847 Isolate* isolate_; \ 2853 Zone* zone_; \
2848 bool stack_overflow_ 2854 bool stack_overflow_
2849 2855
2850 2856
2851 // ---------------------------------------------------------------------------- 2857 // ----------------------------------------------------------------------------
2852 // Construction time visitor. 2858 // Construction time visitor.
2853 2859
2854 class AstConstructionVisitor BASE_EMBEDDED { 2860 class AstConstructionVisitor BASE_EMBEDDED {
2855 public: 2861 public:
2856 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { } 2862 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { }
2857 2863
(...skipping 30 matching lines...) Expand all
2888 }; 2894 };
2889 2895
2890 2896
2891 2897
2892 // ---------------------------------------------------------------------------- 2898 // ----------------------------------------------------------------------------
2893 // AstNode factory 2899 // AstNode factory
2894 2900
2895 template<class Visitor> 2901 template<class Visitor>
2896 class AstNodeFactory V8_FINAL BASE_EMBEDDED { 2902 class AstNodeFactory V8_FINAL BASE_EMBEDDED {
2897 public: 2903 public:
2898 AstNodeFactory(Isolate* isolate, Zone* zone) 2904 explicit AstNodeFactory(Zone* zone) : zone_(zone) { }
2899 : isolate_(isolate),
2900 zone_(zone) { }
2901 2905
2902 Visitor* visitor() { return &visitor_; } 2906 Visitor* visitor() { return &visitor_; }
2903 2907
2904 #define VISIT_AND_RETURN(NodeType, node) \ 2908 #define VISIT_AND_RETURN(NodeType, node) \
2905 visitor_.Visit##NodeType((node)); \ 2909 visitor_.Visit##NodeType((node)); \
2906 return node; 2910 return node;
2907 2911
2908 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, 2912 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
2909 VariableMode mode, 2913 VariableMode mode,
2910 Scope* scope, 2914 Scope* scope,
2911 int pos) { 2915 int pos) {
2912 VariableDeclaration* decl = 2916 VariableDeclaration* decl =
2913 new(zone_) VariableDeclaration(proxy, mode, scope, pos); 2917 new(zone_) VariableDeclaration(zone_, proxy, mode, scope, pos);
2914 VISIT_AND_RETURN(VariableDeclaration, decl) 2918 VISIT_AND_RETURN(VariableDeclaration, decl)
2915 } 2919 }
2916 2920
2917 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, 2921 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy,
2918 VariableMode mode, 2922 VariableMode mode,
2919 FunctionLiteral* fun, 2923 FunctionLiteral* fun,
2920 Scope* scope, 2924 Scope* scope,
2921 int pos) { 2925 int pos) {
2922 FunctionDeclaration* decl = 2926 FunctionDeclaration* decl =
2923 new(zone_) FunctionDeclaration(proxy, mode, fun, scope, pos); 2927 new(zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos);
2924 VISIT_AND_RETURN(FunctionDeclaration, decl) 2928 VISIT_AND_RETURN(FunctionDeclaration, decl)
2925 } 2929 }
2926 2930
2927 ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy, 2931 ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy,
2928 Module* module, 2932 Module* module,
2929 Scope* scope, 2933 Scope* scope,
2930 int pos) { 2934 int pos) {
2931 ModuleDeclaration* decl = 2935 ModuleDeclaration* decl =
2932 new(zone_) ModuleDeclaration(proxy, module, scope, pos); 2936 new(zone_) ModuleDeclaration(zone_, proxy, module, scope, pos);
2933 VISIT_AND_RETURN(ModuleDeclaration, decl) 2937 VISIT_AND_RETURN(ModuleDeclaration, decl)
2934 } 2938 }
2935 2939
2936 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, 2940 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy,
2937 Module* module, 2941 Module* module,
2938 Scope* scope, 2942 Scope* scope,
2939 int pos) { 2943 int pos) {
2940 ImportDeclaration* decl = 2944 ImportDeclaration* decl =
2941 new(zone_) ImportDeclaration(proxy, module, scope, pos); 2945 new(zone_) ImportDeclaration(zone_, proxy, module, scope, pos);
2942 VISIT_AND_RETURN(ImportDeclaration, decl) 2946 VISIT_AND_RETURN(ImportDeclaration, decl)
2943 } 2947 }
2944 2948
2945 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, 2949 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy,
2946 Scope* scope, 2950 Scope* scope,
2947 int pos) { 2951 int pos) {
2948 ExportDeclaration* decl = 2952 ExportDeclaration* decl =
2949 new(zone_) ExportDeclaration(proxy, scope, pos); 2953 new(zone_) ExportDeclaration(zone_, proxy, scope, pos);
2950 VISIT_AND_RETURN(ExportDeclaration, decl) 2954 VISIT_AND_RETURN(ExportDeclaration, decl)
2951 } 2955 }
2952 2956
2953 ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) { 2957 ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) {
2954 ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface, pos); 2958 ModuleLiteral* module =
2959 new(zone_) ModuleLiteral(zone_, body, interface, pos);
2955 VISIT_AND_RETURN(ModuleLiteral, module) 2960 VISIT_AND_RETURN(ModuleLiteral, module)
2956 } 2961 }
2957 2962
2958 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { 2963 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) {
2959 ModuleVariable* module = new(zone_) ModuleVariable(proxy, pos); 2964 ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos);
2960 VISIT_AND_RETURN(ModuleVariable, module) 2965 VISIT_AND_RETURN(ModuleVariable, module)
2961 } 2966 }
2962 2967
2963 ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) { 2968 ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) {
2964 ModulePath* module = new(zone_) ModulePath(origin, name, zone_, pos); 2969 ModulePath* module = new(zone_) ModulePath(zone_, origin, name, pos);
2965 VISIT_AND_RETURN(ModulePath, module) 2970 VISIT_AND_RETURN(ModulePath, module)
2966 } 2971 }
2967 2972
2968 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { 2973 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
2969 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_, pos); 2974 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos);
2970 VISIT_AND_RETURN(ModuleUrl, module) 2975 VISIT_AND_RETURN(ModuleUrl, module)
2971 } 2976 }
2972 2977
2973 Block* NewBlock(ZoneStringList* labels, 2978 Block* NewBlock(ZoneStringList* labels,
2974 int capacity, 2979 int capacity,
2975 bool is_initializer_block, 2980 bool is_initializer_block,
2976 int pos) { 2981 int pos) {
2977 Block* block = new(zone_) Block( 2982 Block* block = new(zone_) Block(
2978 isolate_, labels, capacity, is_initializer_block, pos, zone_); 2983 zone_, labels, capacity, is_initializer_block, pos);
2979 VISIT_AND_RETURN(Block, block) 2984 VISIT_AND_RETURN(Block, block)
2980 } 2985 }
2981 2986
2982 #define STATEMENT_WITH_LABELS(NodeType) \ 2987 #define STATEMENT_WITH_LABELS(NodeType) \
2983 NodeType* New##NodeType(ZoneStringList* labels, int pos) { \ 2988 NodeType* New##NodeType(ZoneStringList* labels, int pos) { \
2984 NodeType* stmt = new(zone_) NodeType(isolate_, labels, pos); \ 2989 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \
2985 VISIT_AND_RETURN(NodeType, stmt); \ 2990 VISIT_AND_RETURN(NodeType, stmt); \
2986 } 2991 }
2987 STATEMENT_WITH_LABELS(DoWhileStatement) 2992 STATEMENT_WITH_LABELS(DoWhileStatement)
2988 STATEMENT_WITH_LABELS(WhileStatement) 2993 STATEMENT_WITH_LABELS(WhileStatement)
2989 STATEMENT_WITH_LABELS(ForStatement) 2994 STATEMENT_WITH_LABELS(ForStatement)
2990 STATEMENT_WITH_LABELS(SwitchStatement) 2995 STATEMENT_WITH_LABELS(SwitchStatement)
2991 #undef STATEMENT_WITH_LABELS 2996 #undef STATEMENT_WITH_LABELS
2992 2997
2993 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, 2998 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode,
2994 ZoneStringList* labels, 2999 ZoneStringList* labels,
2995 int pos) { 3000 int pos) {
2996 switch (visit_mode) { 3001 switch (visit_mode) {
2997 case ForEachStatement::ENUMERATE: { 3002 case ForEachStatement::ENUMERATE: {
2998 ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels, pos); 3003 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos);
2999 VISIT_AND_RETURN(ForInStatement, stmt); 3004 VISIT_AND_RETURN(ForInStatement, stmt);
3000 } 3005 }
3001 case ForEachStatement::ITERATE: { 3006 case ForEachStatement::ITERATE: {
3002 ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels, pos); 3007 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos);
3003 VISIT_AND_RETURN(ForOfStatement, stmt); 3008 VISIT_AND_RETURN(ForOfStatement, stmt);
3004 } 3009 }
3005 } 3010 }
3006 UNREACHABLE(); 3011 UNREACHABLE();
3007 return NULL; 3012 return NULL;
3008 } 3013 }
3009 3014
3010 ModuleStatement* NewModuleStatement( 3015 ModuleStatement* NewModuleStatement(
3011 VariableProxy* proxy, Block* body, int pos) { 3016 VariableProxy* proxy, Block* body, int pos) {
3012 ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body, pos); 3017 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos);
3013 VISIT_AND_RETURN(ModuleStatement, stmt) 3018 VISIT_AND_RETURN(ModuleStatement, stmt)
3014 } 3019 }
3015 3020
3016 ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) { 3021 ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) {
3017 ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression, pos); 3022 ExpressionStatement* stmt =
3023 new(zone_) ExpressionStatement(zone_, expression, pos);
3018 VISIT_AND_RETURN(ExpressionStatement, stmt) 3024 VISIT_AND_RETURN(ExpressionStatement, stmt)
3019 } 3025 }
3020 3026
3021 ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) { 3027 ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) {
3022 ContinueStatement* stmt = new(zone_) ContinueStatement(target, pos); 3028 ContinueStatement* stmt = new(zone_) ContinueStatement(zone_, target, pos);
3023 VISIT_AND_RETURN(ContinueStatement, stmt) 3029 VISIT_AND_RETURN(ContinueStatement, stmt)
3024 } 3030 }
3025 3031
3026 BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) { 3032 BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) {
3027 BreakStatement* stmt = new(zone_) BreakStatement(target, pos); 3033 BreakStatement* stmt = new(zone_) BreakStatement(zone_, target, pos);
3028 VISIT_AND_RETURN(BreakStatement, stmt) 3034 VISIT_AND_RETURN(BreakStatement, stmt)
3029 } 3035 }
3030 3036
3031 ReturnStatement* NewReturnStatement(Expression* expression, int pos) { 3037 ReturnStatement* NewReturnStatement(Expression* expression, int pos) {
3032 ReturnStatement* stmt = new(zone_) ReturnStatement(expression, pos); 3038 ReturnStatement* stmt = new(zone_) ReturnStatement(zone_, expression, pos);
3033 VISIT_AND_RETURN(ReturnStatement, stmt) 3039 VISIT_AND_RETURN(ReturnStatement, stmt)
3034 } 3040 }
3035 3041
3036 WithStatement* NewWithStatement(Scope* scope, 3042 WithStatement* NewWithStatement(Scope* scope,
3037 Expression* expression, 3043 Expression* expression,
3038 Statement* statement, 3044 Statement* statement,
3039 int pos) { 3045 int pos) {
3040 WithStatement* stmt = new(zone_) WithStatement( 3046 WithStatement* stmt = new(zone_) WithStatement(
3041 scope, expression, statement, pos); 3047 zone_, scope, expression, statement, pos);
3042 VISIT_AND_RETURN(WithStatement, stmt) 3048 VISIT_AND_RETURN(WithStatement, stmt)
3043 } 3049 }
3044 3050
3045 IfStatement* NewIfStatement(Expression* condition, 3051 IfStatement* NewIfStatement(Expression* condition,
3046 Statement* then_statement, 3052 Statement* then_statement,
3047 Statement* else_statement, 3053 Statement* else_statement,
3048 int pos) { 3054 int pos) {
3049 IfStatement* stmt = new(zone_) IfStatement( 3055 IfStatement* stmt = new(zone_) IfStatement(
3050 isolate_, condition, then_statement, else_statement, pos); 3056 zone_, condition, then_statement, else_statement, pos);
3051 VISIT_AND_RETURN(IfStatement, stmt) 3057 VISIT_AND_RETURN(IfStatement, stmt)
3052 } 3058 }
3053 3059
3054 TryCatchStatement* NewTryCatchStatement(int index, 3060 TryCatchStatement* NewTryCatchStatement(int index,
3055 Block* try_block, 3061 Block* try_block,
3056 Scope* scope, 3062 Scope* scope,
3057 Variable* variable, 3063 Variable* variable,
3058 Block* catch_block, 3064 Block* catch_block,
3059 int pos) { 3065 int pos) {
3060 TryCatchStatement* stmt = new(zone_) TryCatchStatement( 3066 TryCatchStatement* stmt = new(zone_) TryCatchStatement(
3061 index, try_block, scope, variable, catch_block, pos); 3067 zone_, index, try_block, scope, variable, catch_block, pos);
3062 VISIT_AND_RETURN(TryCatchStatement, stmt) 3068 VISIT_AND_RETURN(TryCatchStatement, stmt)
3063 } 3069 }
3064 3070
3065 TryFinallyStatement* NewTryFinallyStatement(int index, 3071 TryFinallyStatement* NewTryFinallyStatement(int index,
3066 Block* try_block, 3072 Block* try_block,
3067 Block* finally_block, 3073 Block* finally_block,
3068 int pos) { 3074 int pos) {
3069 TryFinallyStatement* stmt = 3075 TryFinallyStatement* stmt = new(zone_) TryFinallyStatement(
3070 new(zone_) TryFinallyStatement(index, try_block, finally_block, pos); 3076 zone_, index, try_block, finally_block, pos);
3071 VISIT_AND_RETURN(TryFinallyStatement, stmt) 3077 VISIT_AND_RETURN(TryFinallyStatement, stmt)
3072 } 3078 }
3073 3079
3074 DebuggerStatement* NewDebuggerStatement(int pos) { 3080 DebuggerStatement* NewDebuggerStatement(int pos) {
3075 DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos); 3081 DebuggerStatement* stmt = new(zone_) DebuggerStatement(zone_, pos);
3076 VISIT_AND_RETURN(DebuggerStatement, stmt) 3082 VISIT_AND_RETURN(DebuggerStatement, stmt)
3077 } 3083 }
3078 3084
3079 EmptyStatement* NewEmptyStatement(int pos) { 3085 EmptyStatement* NewEmptyStatement(int pos) {
3080 return new(zone_) EmptyStatement(pos); 3086 return new(zone_) EmptyStatement(zone_, pos);
3081 } 3087 }
3082 3088
3083 CaseClause* NewCaseClause( 3089 CaseClause* NewCaseClause(
3084 Expression* label, ZoneList<Statement*>* statements, int pos) { 3090 Expression* label, ZoneList<Statement*>* statements, int pos) {
3085 CaseClause* clause = 3091 CaseClause* clause =
3086 new(zone_) CaseClause(isolate_, label, statements, pos); 3092 new(zone_) CaseClause(zone_, label, statements, pos);
3087 VISIT_AND_RETURN(CaseClause, clause) 3093 VISIT_AND_RETURN(CaseClause, clause)
3088 } 3094 }
3089 3095
3090 Literal* NewLiteral(Handle<Object> handle, int pos) { 3096 Literal* NewLiteral(Handle<Object> handle, int pos) {
3091 Literal* lit = new(zone_) Literal(isolate_, handle, pos); 3097 Literal* lit = new(zone_) Literal(zone_, handle, pos);
3092 VISIT_AND_RETURN(Literal, lit) 3098 VISIT_AND_RETURN(Literal, lit)
3093 } 3099 }
3094 3100
3095 Literal* NewNumberLiteral(double number, int pos) { 3101 Literal* NewNumberLiteral(double number, int pos) {
3096 return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos); 3102 return NewLiteral(
3103 zone_->isolate()->factory()->NewNumber(number, TENURED), pos);
3097 } 3104 }
3098 3105
3099 ObjectLiteral* NewObjectLiteral( 3106 ObjectLiteral* NewObjectLiteral(
3100 ZoneList<ObjectLiteral::Property*>* properties, 3107 ZoneList<ObjectLiteral::Property*>* properties,
3101 int literal_index, 3108 int literal_index,
3102 int boilerplate_properties, 3109 int boilerplate_properties,
3103 bool has_function, 3110 bool has_function,
3104 int pos) { 3111 int pos) {
3105 ObjectLiteral* lit = new(zone_) ObjectLiteral( 3112 ObjectLiteral* lit = new(zone_) ObjectLiteral(
3106 isolate_, properties, literal_index, boilerplate_properties, 3113 zone_, properties, literal_index, boilerplate_properties,
3107 has_function, pos); 3114 has_function, pos);
3108 VISIT_AND_RETURN(ObjectLiteral, lit) 3115 VISIT_AND_RETURN(ObjectLiteral, lit)
3109 } 3116 }
3110 3117
3118 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
3119 Expression* value) {
3120 return new(zone_) ObjectLiteral::Property(zone_, key, value);
3121 }
3122
3111 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, 3123 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
3112 FunctionLiteral* value, 3124 FunctionLiteral* value,
3113 int pos) { 3125 int pos) {
3114 ObjectLiteral::Property* prop = 3126 ObjectLiteral::Property* prop =
3115 new(zone_) ObjectLiteral::Property(is_getter, value); 3127 new(zone_) ObjectLiteral::Property(zone_, is_getter, value);
3116 prop->set_key(NewLiteral(value->name(), pos)); 3128 prop->set_key(NewLiteral(value->name(), pos));
3117 return prop; // Not an AST node, will not be visited. 3129 return prop; // Not an AST node, will not be visited.
3118 } 3130 }
3119 3131
3120 RegExpLiteral* NewRegExpLiteral(Handle<String> pattern, 3132 RegExpLiteral* NewRegExpLiteral(Handle<String> pattern,
3121 Handle<String> flags, 3133 Handle<String> flags,
3122 int literal_index, 3134 int literal_index,
3123 int pos) { 3135 int pos) {
3124 RegExpLiteral* lit = 3136 RegExpLiteral* lit =
3125 new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index, pos); 3137 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos);
3126 VISIT_AND_RETURN(RegExpLiteral, lit); 3138 VISIT_AND_RETURN(RegExpLiteral, lit);
3127 } 3139 }
3128 3140
3129 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, 3141 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
3130 int literal_index, 3142 int literal_index,
3131 int pos) { 3143 int pos) {
3132 ArrayLiteral* lit = new(zone_) ArrayLiteral( 3144 ArrayLiteral* lit = new(zone_) ArrayLiteral(
3133 isolate_, values, literal_index, pos); 3145 zone_, values, literal_index, pos);
3134 VISIT_AND_RETURN(ArrayLiteral, lit) 3146 VISIT_AND_RETURN(ArrayLiteral, lit)
3135 } 3147 }
3136 3148
3137 VariableProxy* NewVariableProxy(Variable* var, 3149 VariableProxy* NewVariableProxy(Variable* var,
3138 int pos = RelocInfo::kNoPosition) { 3150 int pos = RelocInfo::kNoPosition) {
3139 VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var, pos); 3151 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos);
3140 VISIT_AND_RETURN(VariableProxy, proxy) 3152 VISIT_AND_RETURN(VariableProxy, proxy)
3141 } 3153 }
3142 3154
3143 VariableProxy* NewVariableProxy(Handle<String> name, 3155 VariableProxy* NewVariableProxy(Handle<String> name,
3144 bool is_this, 3156 bool is_this,
3145 Interface* interface = Interface::NewValue(), 3157 Interface* interface = Interface::NewValue(),
3146 int position = RelocInfo::kNoPosition) { 3158 int position = RelocInfo::kNoPosition) {
3147 VariableProxy* proxy = 3159 VariableProxy* proxy =
3148 new(zone_) VariableProxy(isolate_, name, is_this, interface, position); 3160 new(zone_) VariableProxy(zone_, name, is_this, interface, position);
3149 VISIT_AND_RETURN(VariableProxy, proxy) 3161 VISIT_AND_RETURN(VariableProxy, proxy)
3150 } 3162 }
3151 3163
3152 Property* NewProperty(Expression* obj, Expression* key, int pos) { 3164 Property* NewProperty(Expression* obj, Expression* key, int pos) {
3153 Property* prop = new(zone_) Property(isolate_, obj, key, pos); 3165 Property* prop = new(zone_) Property(zone_, obj, key, pos);
3154 VISIT_AND_RETURN(Property, prop) 3166 VISIT_AND_RETURN(Property, prop)
3155 } 3167 }
3156 3168
3157 Call* NewCall(Expression* expression, 3169 Call* NewCall(Expression* expression,
3158 ZoneList<Expression*>* arguments, 3170 ZoneList<Expression*>* arguments,
3159 int pos) { 3171 int pos) {
3160 Call* call = new(zone_) Call(isolate_, expression, arguments, pos); 3172 Call* call = new(zone_) Call(zone_, expression, arguments, pos);
3161 VISIT_AND_RETURN(Call, call) 3173 VISIT_AND_RETURN(Call, call)
3162 } 3174 }
3163 3175
3164 CallNew* NewCallNew(Expression* expression, 3176 CallNew* NewCallNew(Expression* expression,
3165 ZoneList<Expression*>* arguments, 3177 ZoneList<Expression*>* arguments,
3166 int pos) { 3178 int pos) {
3167 CallNew* call = new(zone_) CallNew(isolate_, expression, arguments, pos); 3179 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos);
3168 VISIT_AND_RETURN(CallNew, call) 3180 VISIT_AND_RETURN(CallNew, call)
3169 } 3181 }
3170 3182
3171 CallRuntime* NewCallRuntime(Handle<String> name, 3183 CallRuntime* NewCallRuntime(Handle<String> name,
3172 const Runtime::Function* function, 3184 const Runtime::Function* function,
3173 ZoneList<Expression*>* arguments, 3185 ZoneList<Expression*>* arguments,
3174 int pos) { 3186 int pos) {
3175 CallRuntime* call = 3187 CallRuntime* call =
3176 new(zone_) CallRuntime(isolate_, name, function, arguments, pos); 3188 new(zone_) CallRuntime(zone_, name, function, arguments, pos);
3177 VISIT_AND_RETURN(CallRuntime, call) 3189 VISIT_AND_RETURN(CallRuntime, call)
3178 } 3190 }
3179 3191
3180 UnaryOperation* NewUnaryOperation(Token::Value op, 3192 UnaryOperation* NewUnaryOperation(Token::Value op,
3181 Expression* expression, 3193 Expression* expression,
3182 int pos) { 3194 int pos) {
3183 UnaryOperation* node = 3195 UnaryOperation* node =
3184 new(zone_) UnaryOperation(isolate_, op, expression, pos); 3196 new(zone_) UnaryOperation(zone_, op, expression, pos);
3185 VISIT_AND_RETURN(UnaryOperation, node) 3197 VISIT_AND_RETURN(UnaryOperation, node)
3186 } 3198 }
3187 3199
3188 BinaryOperation* NewBinaryOperation(Token::Value op, 3200 BinaryOperation* NewBinaryOperation(Token::Value op,
3189 Expression* left, 3201 Expression* left,
3190 Expression* right, 3202 Expression* right,
3191 int pos) { 3203 int pos) {
3192 BinaryOperation* node = 3204 BinaryOperation* node =
3193 new(zone_) BinaryOperation(isolate_, op, left, right, pos); 3205 new(zone_) BinaryOperation(zone_, op, left, right, pos);
3194 VISIT_AND_RETURN(BinaryOperation, node) 3206 VISIT_AND_RETURN(BinaryOperation, node)
3195 } 3207 }
3196 3208
3197 CountOperation* NewCountOperation(Token::Value op, 3209 CountOperation* NewCountOperation(Token::Value op,
3198 bool is_prefix, 3210 bool is_prefix,
3199 Expression* expr, 3211 Expression* expr,
3200 int pos) { 3212 int pos) {
3201 CountOperation* node = 3213 CountOperation* node =
3202 new(zone_) CountOperation(isolate_, op, is_prefix, expr, pos); 3214 new(zone_) CountOperation(zone_, op, is_prefix, expr, pos);
3203 VISIT_AND_RETURN(CountOperation, node) 3215 VISIT_AND_RETURN(CountOperation, node)
3204 } 3216 }
3205 3217
3206 CompareOperation* NewCompareOperation(Token::Value op, 3218 CompareOperation* NewCompareOperation(Token::Value op,
3207 Expression* left, 3219 Expression* left,
3208 Expression* right, 3220 Expression* right,
3209 int pos) { 3221 int pos) {
3210 CompareOperation* node = 3222 CompareOperation* node =
3211 new(zone_) CompareOperation(isolate_, op, left, right, pos); 3223 new(zone_) CompareOperation(zone_, op, left, right, pos);
3212 VISIT_AND_RETURN(CompareOperation, node) 3224 VISIT_AND_RETURN(CompareOperation, node)
3213 } 3225 }
3214 3226
3215 Conditional* NewConditional(Expression* condition, 3227 Conditional* NewConditional(Expression* condition,
3216 Expression* then_expression, 3228 Expression* then_expression,
3217 Expression* else_expression, 3229 Expression* else_expression,
3218 int position) { 3230 int position) {
3219 Conditional* cond = new(zone_) Conditional( 3231 Conditional* cond = new(zone_) Conditional(
3220 isolate_, condition, then_expression, else_expression, position); 3232 zone_, condition, then_expression, else_expression, position);
3221 VISIT_AND_RETURN(Conditional, cond) 3233 VISIT_AND_RETURN(Conditional, cond)
3222 } 3234 }
3223 3235
3224 Assignment* NewAssignment(Token::Value op, 3236 Assignment* NewAssignment(Token::Value op,
3225 Expression* target, 3237 Expression* target,
3226 Expression* value, 3238 Expression* value,
3227 int pos) { 3239 int pos) {
3228 Assignment* assign = 3240 Assignment* assign =
3229 new(zone_) Assignment(isolate_, op, target, value, pos); 3241 new(zone_) Assignment(zone_, op, target, value, pos);
3230 assign->Init(isolate_, this); 3242 assign->Init(zone_, this);
3231 VISIT_AND_RETURN(Assignment, assign) 3243 VISIT_AND_RETURN(Assignment, assign)
3232 } 3244 }
3233 3245
3234 Yield* NewYield(Expression *generator_object, 3246 Yield* NewYield(Expression *generator_object,
3235 Expression* expression, 3247 Expression* expression,
3236 Yield::Kind yield_kind, 3248 Yield::Kind yield_kind,
3237 int pos) { 3249 int pos) {
3238 Yield* yield = new(zone_) Yield( 3250 Yield* yield = new(zone_) Yield(
3239 isolate_, generator_object, expression, yield_kind, pos); 3251 zone_, generator_object, expression, yield_kind, pos);
3240 VISIT_AND_RETURN(Yield, yield) 3252 VISIT_AND_RETURN(Yield, yield)
3241 } 3253 }
3242 3254
3243 Throw* NewThrow(Expression* exception, int pos) { 3255 Throw* NewThrow(Expression* exception, int pos) {
3244 Throw* t = new(zone_) Throw(isolate_, exception, pos); 3256 Throw* t = new(zone_) Throw(zone_, exception, pos);
3245 VISIT_AND_RETURN(Throw, t) 3257 VISIT_AND_RETURN(Throw, t)
3246 } 3258 }
3247 3259
3248 FunctionLiteral* NewFunctionLiteral( 3260 FunctionLiteral* NewFunctionLiteral(
3249 Handle<String> name, 3261 Handle<String> name,
3250 Scope* scope, 3262 Scope* scope,
3251 ZoneList<Statement*>* body, 3263 ZoneList<Statement*>* body,
3252 int materialized_literal_count, 3264 int materialized_literal_count,
3253 int expected_property_count, 3265 int expected_property_count,
3254 int handler_count, 3266 int handler_count,
3255 int parameter_count, 3267 int parameter_count,
3256 FunctionLiteral::ParameterFlag has_duplicate_parameters, 3268 FunctionLiteral::ParameterFlag has_duplicate_parameters,
3257 FunctionLiteral::FunctionType function_type, 3269 FunctionLiteral::FunctionType function_type,
3258 FunctionLiteral::IsFunctionFlag is_function, 3270 FunctionLiteral::IsFunctionFlag is_function,
3259 FunctionLiteral::IsParenthesizedFlag is_parenthesized, 3271 FunctionLiteral::IsParenthesizedFlag is_parenthesized,
3260 FunctionLiteral::IsGeneratorFlag is_generator, 3272 FunctionLiteral::IsGeneratorFlag is_generator,
3261 int position) { 3273 int position) {
3262 FunctionLiteral* lit = new(zone_) FunctionLiteral( 3274 FunctionLiteral* lit = new(zone_) FunctionLiteral(
3263 isolate_, name, scope, body, 3275 zone_, name, scope, body,
3264 materialized_literal_count, expected_property_count, handler_count, 3276 materialized_literal_count, expected_property_count, handler_count,
3265 parameter_count, function_type, has_duplicate_parameters, is_function, 3277 parameter_count, function_type, has_duplicate_parameters, is_function,
3266 is_parenthesized, is_generator, position); 3278 is_parenthesized, is_generator, position);
3267 // Top-level literal doesn't count for the AST's properties. 3279 // Top-level literal doesn't count for the AST's properties.
3268 if (is_function == FunctionLiteral::kIsFunction) { 3280 if (is_function == FunctionLiteral::kIsFunction) {
3269 visitor_.VisitFunctionLiteral(lit); 3281 visitor_.VisitFunctionLiteral(lit);
3270 } 3282 }
3271 return lit; 3283 return lit;
3272 } 3284 }
3273 3285
3274 NativeFunctionLiteral* NewNativeFunctionLiteral( 3286 NativeFunctionLiteral* NewNativeFunctionLiteral(
3275 Handle<String> name, v8::Extension* extension, int pos) { 3287 Handle<String> name, v8::Extension* extension, int pos) {
3276 NativeFunctionLiteral* lit = 3288 NativeFunctionLiteral* lit =
3277 new(zone_) NativeFunctionLiteral(isolate_, name, extension, pos); 3289 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos);
3278 VISIT_AND_RETURN(NativeFunctionLiteral, lit) 3290 VISIT_AND_RETURN(NativeFunctionLiteral, lit)
3279 } 3291 }
3280 3292
3281 ThisFunction* NewThisFunction(int pos) { 3293 ThisFunction* NewThisFunction(int pos) {
3282 ThisFunction* fun = new(zone_) ThisFunction(isolate_, pos); 3294 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos);
3283 VISIT_AND_RETURN(ThisFunction, fun) 3295 VISIT_AND_RETURN(ThisFunction, fun)
3284 } 3296 }
3285 3297
3286 #undef VISIT_AND_RETURN 3298 #undef VISIT_AND_RETURN
3287 3299
3288 private: 3300 private:
3289 Isolate* isolate_;
3290 Zone* zone_; 3301 Zone* zone_;
3291 Visitor visitor_; 3302 Visitor visitor_;
3292 }; 3303 };
3293 3304
3294 3305
3295 } } // namespace v8::internal 3306 } } // namespace v8::internal
3296 3307
3297 #endif // V8_AST_H_ 3308 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698