OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 30 matching lines...) Expand all Loading... |
41 // Forward declarations. | 41 // Forward declarations. |
42 class HBasicBlock; | 42 class HBasicBlock; |
43 class HEnvironment; | 43 class HEnvironment; |
44 class HInstruction; | 44 class HInstruction; |
45 class HLoopInformation; | 45 class HLoopInformation; |
46 class HValue; | 46 class HValue; |
47 class LInstruction; | 47 class LInstruction; |
48 class LChunkBuilder; | 48 class LChunkBuilder; |
49 | 49 |
50 | 50 |
51 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \ | 51 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ |
52 V(ArithmeticBinaryOperation) \ | |
53 V(BinaryCall) \ | |
54 V(BinaryOperation) \ | |
55 V(BitwiseBinaryOperation) \ | 52 V(BitwiseBinaryOperation) \ |
56 V(ControlInstruction) \ | 53 V(ControlInstruction) \ |
57 V(Instruction) \ | 54 V(Instruction) \ |
58 V(Phi) \ | |
59 V(UnaryCall) \ | |
60 V(UnaryControlInstruction) \ | |
61 V(UnaryOperation) \ | |
62 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) | |
63 | 55 |
64 | 56 |
65 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ | 57 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
66 V(AbnormalExit) \ | 58 V(AbnormalExit) \ |
67 V(AccessArgumentsAt) \ | 59 V(AccessArgumentsAt) \ |
68 V(Add) \ | 60 V(Add) \ |
69 V(ApplyArguments) \ | 61 V(ApplyArguments) \ |
70 V(ArgumentsElements) \ | 62 V(ArgumentsElements) \ |
71 V(ArgumentsLength) \ | 63 V(ArgumentsLength) \ |
72 V(ArgumentsObject) \ | 64 V(ArgumentsObject) \ |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 V(InobjectFields) \ | 167 V(InobjectFields) \ |
176 V(BackingStoreFields) \ | 168 V(BackingStoreFields) \ |
177 V(ArrayElements) \ | 169 V(ArrayElements) \ |
178 V(SpecializedArrayElements) \ | 170 V(SpecializedArrayElements) \ |
179 V(GlobalVars) \ | 171 V(GlobalVars) \ |
180 V(Maps) \ | 172 V(Maps) \ |
181 V(ArrayLengths) \ | 173 V(ArrayLengths) \ |
182 V(ContextSlots) \ | 174 V(ContextSlots) \ |
183 V(OsrEntries) | 175 V(OsrEntries) |
184 | 176 |
185 #define DECLARE_INSTRUCTION(type) \ | 177 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
186 virtual bool Is##type() const { return true; } \ | 178 virtual bool Is##type() const { return true; } \ |
187 static H##type* cast(HValue* value) { \ | 179 static H##type* cast(HValue* value) { \ |
188 ASSERT(value->Is##type()); \ | 180 ASSERT(value->Is##type()); \ |
189 return reinterpret_cast<H##type*>(value); \ | 181 return reinterpret_cast<H##type*>(value); \ |
190 } \ | 182 } |
191 Opcode opcode() const { return HValue::k##type; } | |
192 | 183 |
193 | 184 |
194 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 185 #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
195 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ | 186 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ |
196 virtual const char* Mnemonic() const { return mnemonic; } \ | 187 static H##type* cast(HValue* value) { \ |
197 DECLARE_INSTRUCTION(type) | 188 ASSERT(value->Is##type()); \ |
| 189 return reinterpret_cast<H##type*>(value); \ |
| 190 } \ |
| 191 virtual Opcode opcode() const { return HValue::k##type; } |
198 | 192 |
199 | 193 |
200 class Range: public ZoneObject { | 194 class Range: public ZoneObject { |
201 public: | 195 public: |
202 Range() | 196 Range() |
203 : lower_(kMinInt), | 197 : lower_(kMinInt), |
204 upper_(kMaxInt), | 198 upper_(kMaxInt), |
205 next_(NULL), | 199 next_(NULL), |
206 can_be_minus_zero_(false) { } | 200 can_be_minus_zero_(false) { } |
207 | 201 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 443 } |
450 | 444 |
451 static int ConvertChangesToDependsFlags(int flags) { | 445 static int ConvertChangesToDependsFlags(int flags) { |
452 return flags << kChangesToDependsFlagsLeftShift; | 446 return flags << kChangesToDependsFlagsLeftShift; |
453 } | 447 } |
454 | 448 |
455 static HValue* cast(HValue* value) { return value; } | 449 static HValue* cast(HValue* value) { return value; } |
456 | 450 |
457 enum Opcode { | 451 enum Opcode { |
458 // Declare a unique enum value for each hydrogen instruction. | 452 // Declare a unique enum value for each hydrogen instruction. |
459 #define DECLARE_DO(type) k##type, | 453 #define DECLARE_OPCODE(type) k##type, |
460 HYDROGEN_ALL_INSTRUCTION_LIST(DECLARE_DO) | 454 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) |
461 #undef DECLARE_DO | 455 kPhi |
462 kMaxInstructionClass | 456 #undef DECLARE_OPCODE |
463 }; | 457 }; |
| 458 virtual Opcode opcode() const = 0; |
| 459 |
| 460 // Declare a non-virtual predicates for each concrete HInstruction or HValue. |
| 461 #define DECLARE_PREDICATE(type) \ |
| 462 bool Is##type() const { return opcode() == k##type; } |
| 463 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
| 464 #undef DECLARE_PREDICATE |
| 465 bool IsPhi() const { return opcode() == kPhi; } |
| 466 |
| 467 // Declare virtual predicates for abstract HInstruction or HValue |
| 468 #define DECLARE_PREDICATE(type) \ |
| 469 virtual bool Is##type() const { return false; } |
| 470 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) |
| 471 #undef DECLARE_PREDICATE |
464 | 472 |
465 HValue() : block_(NULL), | 473 HValue() : block_(NULL), |
466 id_(kNoNumber), | 474 id_(kNoNumber), |
467 type_(HType::Tagged()), | 475 type_(HType::Tagged()), |
468 range_(NULL), | 476 range_(NULL), |
469 flags_(0) {} | 477 flags_(0) {} |
470 virtual ~HValue() {} | 478 virtual ~HValue() {} |
471 | 479 |
472 HBasicBlock* block() const { return block_; } | 480 HBasicBlock* block() const { return block_; } |
473 void SetBlock(HBasicBlock* block); | 481 void SetBlock(HBasicBlock* block); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 virtual Representation InferredRepresentation() { | 556 virtual Representation InferredRepresentation() { |
549 return representation(); | 557 return representation(); |
550 } | 558 } |
551 | 559 |
552 // This gives the instruction an opportunity to replace itself with an | 560 // This gives the instruction an opportunity to replace itself with an |
553 // instruction that does the same in some better way. To replace an | 561 // instruction that does the same in some better way. To replace an |
554 // instruction with a new one, first add the new instruction to the graph, | 562 // instruction with a new one, first add the new instruction to the graph, |
555 // then return it. Return NULL to have the instruction deleted. | 563 // then return it. Return NULL to have the instruction deleted. |
556 virtual HValue* Canonicalize() { return this; } | 564 virtual HValue* Canonicalize() { return this; } |
557 | 565 |
558 // Declare virtual type testers. | |
559 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } | |
560 HYDROGEN_ALL_INSTRUCTION_LIST(DECLARE_DO) | |
561 #undef DECLARE_DO | |
562 | |
563 bool Equals(HValue* other); | 566 bool Equals(HValue* other); |
564 virtual intptr_t Hashcode(); | 567 virtual intptr_t Hashcode(); |
565 | 568 |
566 // Printing support. | 569 // Printing support. |
567 virtual void PrintTo(StringStream* stream) = 0; | 570 virtual void PrintTo(StringStream* stream) = 0; |
568 void PrintNameTo(StringStream* stream); | 571 void PrintNameTo(StringStream* stream); |
569 static void PrintTypeTo(HType type, StringStream* stream); | 572 static void PrintTypeTo(HType type, StringStream* stream); |
570 | 573 |
571 virtual const char* Mnemonic() const = 0; | 574 const char* Mnemonic() const; |
572 virtual Opcode opcode() const = 0; | |
573 | 575 |
574 // Updated the inferred type of this instruction and returns true if | 576 // Updated the inferred type of this instruction and returns true if |
575 // it has changed. | 577 // it has changed. |
576 bool UpdateInferredType(); | 578 bool UpdateInferredType(); |
577 | 579 |
578 virtual HType CalculateInferredType(); | 580 virtual HType CalculateInferredType(); |
579 | 581 |
580 #ifdef DEBUG | 582 #ifdef DEBUG |
581 virtual void Verify() = 0; | 583 virtual void Verify() = 0; |
582 #endif | 584 #endif |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 #ifdef DEBUG | 652 #ifdef DEBUG |
651 virtual void Verify(); | 653 virtual void Verify(); |
652 #endif | 654 #endif |
653 | 655 |
654 // Returns whether this is some kind of deoptimizing check | 656 // Returns whether this is some kind of deoptimizing check |
655 // instruction. | 657 // instruction. |
656 virtual bool IsCheckInstruction() const { return false; } | 658 virtual bool IsCheckInstruction() const { return false; } |
657 | 659 |
658 virtual bool IsCall() { return false; } | 660 virtual bool IsCall() { return false; } |
659 | 661 |
660 DECLARE_INSTRUCTION(Instruction) | 662 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
661 | 663 |
662 protected: | 664 protected: |
663 HInstruction() | 665 HInstruction() |
664 : next_(NULL), | 666 : next_(NULL), |
665 previous_(NULL), | 667 previous_(NULL), |
666 position_(RelocInfo::kNoPosition) { | 668 position_(RelocInfo::kNoPosition) { |
667 SetFlag(kDependsOnOsrEntries); | 669 SetFlag(kDependsOnOsrEntries); |
668 } | 670 } |
669 | 671 |
670 virtual void DeleteFromGraph() { Unlink(); } | 672 virtual void DeleteFromGraph() { Unlink(); } |
(...skipping 16 matching lines...) Expand all Loading... |
687 public: | 689 public: |
688 HControlInstruction(HBasicBlock* first, HBasicBlock* second) | 690 HControlInstruction(HBasicBlock* first, HBasicBlock* second) |
689 : first_successor_(first), second_successor_(second) { | 691 : first_successor_(first), second_successor_(second) { |
690 } | 692 } |
691 | 693 |
692 HBasicBlock* FirstSuccessor() const { return first_successor_; } | 694 HBasicBlock* FirstSuccessor() const { return first_successor_; } |
693 HBasicBlock* SecondSuccessor() const { return second_successor_; } | 695 HBasicBlock* SecondSuccessor() const { return second_successor_; } |
694 | 696 |
695 virtual void PrintDataTo(StringStream* stream); | 697 virtual void PrintDataTo(StringStream* stream); |
696 | 698 |
697 DECLARE_INSTRUCTION(ControlInstruction) | 699 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) |
698 | 700 |
699 private: | 701 private: |
700 HBasicBlock* first_successor_; | 702 HBasicBlock* first_successor_; |
701 HBasicBlock* second_successor_; | 703 HBasicBlock* second_successor_; |
702 }; | 704 }; |
703 | 705 |
704 | 706 |
705 template<int NumElements> | 707 template<int NumElements> |
706 class HOperandContainer { | 708 class HOperandContainer { |
707 public: | 709 public: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 HOperandContainer<V> inputs_; | 761 HOperandContainer<V> inputs_; |
760 }; | 762 }; |
761 | 763 |
762 | 764 |
763 class HBlockEntry: public HTemplateInstruction<0> { | 765 class HBlockEntry: public HTemplateInstruction<0> { |
764 public: | 766 public: |
765 virtual Representation RequiredInputRepresentation(int index) const { | 767 virtual Representation RequiredInputRepresentation(int index) const { |
766 return Representation::None(); | 768 return Representation::None(); |
767 } | 769 } |
768 | 770 |
769 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") | 771 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) |
770 }; | 772 }; |
771 | 773 |
772 | 774 |
773 class HDeoptimize: public HControlInstruction { | 775 class HDeoptimize: public HControlInstruction { |
774 public: | 776 public: |
775 explicit HDeoptimize(int environment_length) | 777 explicit HDeoptimize(int environment_length) |
776 : HControlInstruction(NULL, NULL), | 778 : HControlInstruction(NULL, NULL), |
777 values_(environment_length) { } | 779 values_(environment_length) { } |
778 | 780 |
779 virtual Representation RequiredInputRepresentation(int index) const { | 781 virtual Representation RequiredInputRepresentation(int index) const { |
780 return Representation::None(); | 782 return Representation::None(); |
781 } | 783 } |
782 | 784 |
783 virtual int OperandCount() { return values_.length(); } | 785 virtual int OperandCount() { return values_.length(); } |
784 virtual HValue* OperandAt(int index) { return values_[index]; } | 786 virtual HValue* OperandAt(int index) { return values_[index]; } |
785 | 787 |
786 void AddEnvironmentValue(HValue* value) { | 788 void AddEnvironmentValue(HValue* value) { |
787 values_.Add(NULL); | 789 values_.Add(NULL); |
788 SetOperandAt(values_.length() - 1, value); | 790 SetOperandAt(values_.length() - 1, value); |
789 } | 791 } |
790 | 792 |
791 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") | 793 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
792 | 794 |
793 protected: | 795 protected: |
794 virtual void InternalSetOperandAt(int index, HValue* value) { | 796 virtual void InternalSetOperandAt(int index, HValue* value) { |
795 values_[index] = value; | 797 values_[index] = value; |
796 } | 798 } |
797 | 799 |
798 private: | 800 private: |
799 ZoneList<HValue*> values_; | 801 ZoneList<HValue*> values_; |
800 }; | 802 }; |
801 | 803 |
802 | 804 |
803 class HGoto: public HTemplateControlInstruction<0> { | 805 class HGoto: public HTemplateControlInstruction<0> { |
804 public: | 806 public: |
805 explicit HGoto(HBasicBlock* target) | 807 explicit HGoto(HBasicBlock* target) |
806 : HTemplateControlInstruction<0>(target, NULL), | 808 : HTemplateControlInstruction<0>(target, NULL), |
807 include_stack_check_(false) { } | 809 include_stack_check_(false) { } |
808 | 810 |
809 void set_include_stack_check(bool include_stack_check) { | 811 void set_include_stack_check(bool include_stack_check) { |
810 include_stack_check_ = include_stack_check; | 812 include_stack_check_ = include_stack_check; |
811 } | 813 } |
812 bool include_stack_check() const { return include_stack_check_; } | 814 bool include_stack_check() const { return include_stack_check_; } |
813 | 815 |
814 virtual Representation RequiredInputRepresentation(int index) const { | 816 virtual Representation RequiredInputRepresentation(int index) const { |
815 return Representation::None(); | 817 return Representation::None(); |
816 } | 818 } |
817 | 819 |
818 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") | 820 DECLARE_CONCRETE_INSTRUCTION(Goto) |
819 | 821 |
820 private: | 822 private: |
821 bool include_stack_check_; | 823 bool include_stack_check_; |
822 }; | 824 }; |
823 | 825 |
824 | 826 |
825 class HUnaryControlInstruction: public HTemplateControlInstruction<1> { | 827 class HUnaryControlInstruction: public HTemplateControlInstruction<1> { |
826 public: | 828 public: |
827 explicit HUnaryControlInstruction(HValue* value, | 829 explicit HUnaryControlInstruction(HValue* value, |
828 HBasicBlock* true_target, | 830 HBasicBlock* true_target, |
829 HBasicBlock* false_target) | 831 HBasicBlock* false_target) |
830 : HTemplateControlInstruction<1>(true_target, false_target) { | 832 : HTemplateControlInstruction<1>(true_target, false_target) { |
831 SetOperandAt(0, value); | 833 SetOperandAt(0, value); |
832 } | 834 } |
833 | 835 |
834 virtual void PrintDataTo(StringStream* stream); | 836 virtual void PrintDataTo(StringStream* stream); |
835 | 837 |
836 HValue* value() { return OperandAt(0); } | 838 HValue* value() { return OperandAt(0); } |
837 | |
838 DECLARE_INSTRUCTION(UnaryControlInstruction) | |
839 }; | 839 }; |
840 | 840 |
841 | 841 |
842 class HTest: public HUnaryControlInstruction { | 842 class HTest: public HUnaryControlInstruction { |
843 public: | 843 public: |
844 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) | 844 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) |
845 : HUnaryControlInstruction(value, true_target, false_target) { | 845 : HUnaryControlInstruction(value, true_target, false_target) { |
846 ASSERT(true_target != NULL && false_target != NULL); | 846 ASSERT(true_target != NULL && false_target != NULL); |
847 } | 847 } |
848 | 848 |
849 virtual Representation RequiredInputRepresentation(int index) const { | 849 virtual Representation RequiredInputRepresentation(int index) const { |
850 return Representation::None(); | 850 return Representation::None(); |
851 } | 851 } |
852 | 852 |
853 DECLARE_CONCRETE_INSTRUCTION(Test, "test") | 853 DECLARE_CONCRETE_INSTRUCTION(Test) |
854 }; | 854 }; |
855 | 855 |
856 | 856 |
857 class HCompareMap: public HUnaryControlInstruction { | 857 class HCompareMap: public HUnaryControlInstruction { |
858 public: | 858 public: |
859 HCompareMap(HValue* value, | 859 HCompareMap(HValue* value, |
860 Handle<Map> map, | 860 Handle<Map> map, |
861 HBasicBlock* true_target, | 861 HBasicBlock* true_target, |
862 HBasicBlock* false_target) | 862 HBasicBlock* false_target) |
863 : HUnaryControlInstruction(value, true_target, false_target), | 863 : HUnaryControlInstruction(value, true_target, false_target), |
864 map_(map) { | 864 map_(map) { |
865 ASSERT(true_target != NULL); | 865 ASSERT(true_target != NULL); |
866 ASSERT(false_target != NULL); | 866 ASSERT(false_target != NULL); |
867 ASSERT(!map.is_null()); | 867 ASSERT(!map.is_null()); |
868 } | 868 } |
869 | 869 |
870 virtual void PrintDataTo(StringStream* stream); | 870 virtual void PrintDataTo(StringStream* stream); |
871 | 871 |
872 Handle<Map> map() const { return map_; } | 872 Handle<Map> map() const { return map_; } |
873 | 873 |
874 virtual Representation RequiredInputRepresentation(int index) const { | 874 virtual Representation RequiredInputRepresentation(int index) const { |
875 return Representation::Tagged(); | 875 return Representation::Tagged(); |
876 } | 876 } |
877 | 877 |
878 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map") | 878 DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
879 | 879 |
880 private: | 880 private: |
881 Handle<Map> map_; | 881 Handle<Map> map_; |
882 }; | 882 }; |
883 | 883 |
884 | 884 |
885 class HReturn: public HUnaryControlInstruction { | 885 class HReturn: public HUnaryControlInstruction { |
886 public: | 886 public: |
887 explicit HReturn(HValue* value) | 887 explicit HReturn(HValue* value) |
888 : HUnaryControlInstruction(value, NULL, NULL) { | 888 : HUnaryControlInstruction(value, NULL, NULL) { |
889 } | 889 } |
890 | 890 |
891 virtual Representation RequiredInputRepresentation(int index) const { | 891 virtual Representation RequiredInputRepresentation(int index) const { |
892 return Representation::Tagged(); | 892 return Representation::Tagged(); |
893 } | 893 } |
894 | 894 |
895 DECLARE_CONCRETE_INSTRUCTION(Return, "return") | 895 DECLARE_CONCRETE_INSTRUCTION(Return) |
896 }; | 896 }; |
897 | 897 |
898 | 898 |
899 class HAbnormalExit: public HTemplateControlInstruction<0> { | 899 class HAbnormalExit: public HTemplateControlInstruction<0> { |
900 public: | 900 public: |
901 HAbnormalExit() : HTemplateControlInstruction<0>(NULL, NULL) { } | 901 HAbnormalExit() : HTemplateControlInstruction<0>(NULL, NULL) { } |
902 | 902 |
903 virtual Representation RequiredInputRepresentation(int index) const { | 903 virtual Representation RequiredInputRepresentation(int index) const { |
904 return Representation::None(); | 904 return Representation::None(); |
905 } | 905 } |
906 | 906 |
907 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit") | 907 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
908 }; | 908 }; |
909 | 909 |
910 | 910 |
911 class HUnaryOperation: public HTemplateInstruction<1> { | 911 class HUnaryOperation: public HTemplateInstruction<1> { |
912 public: | 912 public: |
913 explicit HUnaryOperation(HValue* value) { | 913 explicit HUnaryOperation(HValue* value) { |
914 SetOperandAt(0, value); | 914 SetOperandAt(0, value); |
915 } | 915 } |
916 | 916 |
917 HValue* value() { return OperandAt(0); } | 917 HValue* value() { return OperandAt(0); } |
918 virtual void PrintDataTo(StringStream* stream); | 918 virtual void PrintDataTo(StringStream* stream); |
919 | |
920 DECLARE_INSTRUCTION(UnaryOperation) | |
921 }; | 919 }; |
922 | 920 |
923 | 921 |
924 class HThrow: public HUnaryOperation { | 922 class HThrow: public HUnaryOperation { |
925 public: | 923 public: |
926 explicit HThrow(HValue* value) : HUnaryOperation(value) { | 924 explicit HThrow(HValue* value) : HUnaryOperation(value) { |
927 SetAllSideEffects(); | 925 SetAllSideEffects(); |
928 } | 926 } |
929 | 927 |
930 virtual Representation RequiredInputRepresentation(int index) const { | 928 virtual Representation RequiredInputRepresentation(int index) const { |
931 return Representation::Tagged(); | 929 return Representation::Tagged(); |
932 } | 930 } |
933 | 931 |
934 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") | 932 DECLARE_CONCRETE_INSTRUCTION(Throw) |
935 }; | 933 }; |
936 | 934 |
937 | 935 |
938 class HChange: public HUnaryOperation { | 936 class HChange: public HUnaryOperation { |
939 public: | 937 public: |
940 HChange(HValue* value, | 938 HChange(HValue* value, |
941 Representation from, | 939 Representation from, |
942 Representation to, | 940 Representation to, |
943 bool is_truncating) | 941 bool is_truncating) |
944 : HUnaryOperation(value), from_(from) { | 942 : HUnaryOperation(value), from_(from) { |
(...skipping 13 matching lines...) Expand all Loading... |
958 Representation from() const { return from_; } | 956 Representation from() const { return from_; } |
959 Representation to() const { return representation(); } | 957 Representation to() const { return representation(); } |
960 virtual Representation RequiredInputRepresentation(int index) const { | 958 virtual Representation RequiredInputRepresentation(int index) const { |
961 return from_; | 959 return from_; |
962 } | 960 } |
963 | 961 |
964 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 962 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
965 | 963 |
966 virtual void PrintDataTo(StringStream* stream); | 964 virtual void PrintDataTo(StringStream* stream); |
967 | 965 |
968 DECLARE_CONCRETE_INSTRUCTION(Change, | 966 DECLARE_CONCRETE_INSTRUCTION(Change) |
969 CanTruncateToInt32() ? "truncate" : "change") | |
970 | 967 |
971 protected: | 968 protected: |
972 virtual bool DataEquals(HValue* other) { | 969 virtual bool DataEquals(HValue* other) { |
973 if (!other->IsChange()) return false; | 970 if (!other->IsChange()) return false; |
974 HChange* change = HChange::cast(other); | 971 HChange* change = HChange::cast(other); |
975 return value() == change->value() | 972 return value() == change->value() |
976 && to().Equals(change->to()); | 973 && to().Equals(change->to()); |
977 } | 974 } |
978 | 975 |
979 private: | 976 private: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 void AddPushedValue(HValue* value) { | 1011 void AddPushedValue(HValue* value) { |
1015 AddValue(kNoIndex, value); | 1012 AddValue(kNoIndex, value); |
1016 } | 1013 } |
1017 virtual int OperandCount() { return values_.length(); } | 1014 virtual int OperandCount() { return values_.length(); } |
1018 virtual HValue* OperandAt(int index) { return values_[index]; } | 1015 virtual HValue* OperandAt(int index) { return values_[index]; } |
1019 | 1016 |
1020 virtual Representation RequiredInputRepresentation(int index) const { | 1017 virtual Representation RequiredInputRepresentation(int index) const { |
1021 return Representation::None(); | 1018 return Representation::None(); |
1022 } | 1019 } |
1023 | 1020 |
1024 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate") | 1021 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
1025 | 1022 |
1026 #ifdef DEBUG | 1023 #ifdef DEBUG |
1027 virtual void Verify(); | 1024 virtual void Verify(); |
1028 #endif | 1025 #endif |
1029 | 1026 |
1030 protected: | 1027 protected: |
1031 virtual void InternalSetOperandAt(int index, HValue* value) { | 1028 virtual void InternalSetOperandAt(int index, HValue* value) { |
1032 values_[index] = value; | 1029 values_[index] = value; |
1033 } | 1030 } |
1034 | 1031 |
(...skipping 15 matching lines...) Expand all Loading... |
1050 | 1047 |
1051 | 1048 |
1052 class HStackCheck: public HTemplateInstruction<0> { | 1049 class HStackCheck: public HTemplateInstruction<0> { |
1053 public: | 1050 public: |
1054 HStackCheck() { } | 1051 HStackCheck() { } |
1055 | 1052 |
1056 virtual Representation RequiredInputRepresentation(int index) const { | 1053 virtual Representation RequiredInputRepresentation(int index) const { |
1057 return Representation::None(); | 1054 return Representation::None(); |
1058 } | 1055 } |
1059 | 1056 |
1060 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check") | 1057 DECLARE_CONCRETE_INSTRUCTION(StackCheck) |
1061 }; | 1058 }; |
1062 | 1059 |
1063 | 1060 |
1064 class HEnterInlined: public HTemplateInstruction<0> { | 1061 class HEnterInlined: public HTemplateInstruction<0> { |
1065 public: | 1062 public: |
1066 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) | 1063 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) |
1067 : closure_(closure), function_(function) { | 1064 : closure_(closure), function_(function) { |
1068 } | 1065 } |
1069 | 1066 |
1070 virtual void PrintDataTo(StringStream* stream); | 1067 virtual void PrintDataTo(StringStream* stream); |
1071 | 1068 |
1072 Handle<JSFunction> closure() const { return closure_; } | 1069 Handle<JSFunction> closure() const { return closure_; } |
1073 FunctionLiteral* function() const { return function_; } | 1070 FunctionLiteral* function() const { return function_; } |
1074 | 1071 |
1075 virtual Representation RequiredInputRepresentation(int index) const { | 1072 virtual Representation RequiredInputRepresentation(int index) const { |
1076 return Representation::None(); | 1073 return Representation::None(); |
1077 } | 1074 } |
1078 | 1075 |
1079 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined") | 1076 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
1080 | 1077 |
1081 private: | 1078 private: |
1082 Handle<JSFunction> closure_; | 1079 Handle<JSFunction> closure_; |
1083 FunctionLiteral* function_; | 1080 FunctionLiteral* function_; |
1084 }; | 1081 }; |
1085 | 1082 |
1086 | 1083 |
1087 class HLeaveInlined: public HTemplateInstruction<0> { | 1084 class HLeaveInlined: public HTemplateInstruction<0> { |
1088 public: | 1085 public: |
1089 HLeaveInlined() {} | 1086 HLeaveInlined() {} |
1090 | 1087 |
1091 virtual Representation RequiredInputRepresentation(int index) const { | 1088 virtual Representation RequiredInputRepresentation(int index) const { |
1092 return Representation::None(); | 1089 return Representation::None(); |
1093 } | 1090 } |
1094 | 1091 |
1095 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined, "leave_inlined") | 1092 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
1096 }; | 1093 }; |
1097 | 1094 |
1098 | 1095 |
1099 class HPushArgument: public HUnaryOperation { | 1096 class HPushArgument: public HUnaryOperation { |
1100 public: | 1097 public: |
1101 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | 1098 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { |
1102 set_representation(Representation::Tagged()); | 1099 set_representation(Representation::Tagged()); |
1103 } | 1100 } |
1104 | 1101 |
1105 virtual Representation RequiredInputRepresentation(int index) const { | 1102 virtual Representation RequiredInputRepresentation(int index) const { |
1106 return Representation::Tagged(); | 1103 return Representation::Tagged(); |
1107 } | 1104 } |
1108 | 1105 |
1109 HValue* argument() { return OperandAt(0); } | 1106 HValue* argument() { return OperandAt(0); } |
1110 | 1107 |
1111 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") | 1108 DECLARE_CONCRETE_INSTRUCTION(PushArgument) |
1112 }; | 1109 }; |
1113 | 1110 |
1114 | 1111 |
1115 class HContext: public HTemplateInstruction<0> { | 1112 class HContext: public HTemplateInstruction<0> { |
1116 public: | 1113 public: |
1117 HContext() { | 1114 HContext() { |
1118 set_representation(Representation::Tagged()); | 1115 set_representation(Representation::Tagged()); |
1119 SetFlag(kUseGVN); | 1116 SetFlag(kUseGVN); |
1120 } | 1117 } |
1121 | 1118 |
1122 virtual Representation RequiredInputRepresentation(int index) const { | 1119 virtual Representation RequiredInputRepresentation(int index) const { |
1123 return Representation::None(); | 1120 return Representation::None(); |
1124 } | 1121 } |
1125 | 1122 |
1126 DECLARE_CONCRETE_INSTRUCTION(Context, "context"); | 1123 DECLARE_CONCRETE_INSTRUCTION(Context); |
1127 | 1124 |
1128 protected: | 1125 protected: |
1129 virtual bool DataEquals(HValue* other) { return true; } | 1126 virtual bool DataEquals(HValue* other) { return true; } |
1130 }; | 1127 }; |
1131 | 1128 |
1132 | 1129 |
1133 class HOuterContext: public HUnaryOperation { | 1130 class HOuterContext: public HUnaryOperation { |
1134 public: | 1131 public: |
1135 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | 1132 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { |
1136 set_representation(Representation::Tagged()); | 1133 set_representation(Representation::Tagged()); |
1137 SetFlag(kUseGVN); | 1134 SetFlag(kUseGVN); |
1138 } | 1135 } |
1139 | 1136 |
1140 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context"); | 1137 DECLARE_CONCRETE_INSTRUCTION(OuterContext); |
1141 | 1138 |
1142 virtual Representation RequiredInputRepresentation(int index) const { | 1139 virtual Representation RequiredInputRepresentation(int index) const { |
1143 return Representation::Tagged(); | 1140 return Representation::Tagged(); |
1144 } | 1141 } |
1145 | 1142 |
1146 protected: | 1143 protected: |
1147 virtual bool DataEquals(HValue* other) { return true; } | 1144 virtual bool DataEquals(HValue* other) { return true; } |
1148 }; | 1145 }; |
1149 | 1146 |
1150 | 1147 |
1151 class HGlobalObject: public HUnaryOperation { | 1148 class HGlobalObject: public HUnaryOperation { |
1152 public: | 1149 public: |
1153 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { | 1150 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { |
1154 set_representation(Representation::Tagged()); | 1151 set_representation(Representation::Tagged()); |
1155 SetFlag(kUseGVN); | 1152 SetFlag(kUseGVN); |
1156 } | 1153 } |
1157 | 1154 |
1158 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") | 1155 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) |
1159 | 1156 |
1160 virtual Representation RequiredInputRepresentation(int index) const { | 1157 virtual Representation RequiredInputRepresentation(int index) const { |
1161 return Representation::Tagged(); | 1158 return Representation::Tagged(); |
1162 } | 1159 } |
1163 | 1160 |
1164 protected: | 1161 protected: |
1165 virtual bool DataEquals(HValue* other) { return true; } | 1162 virtual bool DataEquals(HValue* other) { return true; } |
1166 }; | 1163 }; |
1167 | 1164 |
1168 | 1165 |
1169 class HGlobalReceiver: public HUnaryOperation { | 1166 class HGlobalReceiver: public HUnaryOperation { |
1170 public: | 1167 public: |
1171 explicit HGlobalReceiver(HValue* global_object) | 1168 explicit HGlobalReceiver(HValue* global_object) |
1172 : HUnaryOperation(global_object) { | 1169 : HUnaryOperation(global_object) { |
1173 set_representation(Representation::Tagged()); | 1170 set_representation(Representation::Tagged()); |
1174 SetFlag(kUseGVN); | 1171 SetFlag(kUseGVN); |
1175 } | 1172 } |
1176 | 1173 |
1177 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") | 1174 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) |
1178 | 1175 |
1179 virtual Representation RequiredInputRepresentation(int index) const { | 1176 virtual Representation RequiredInputRepresentation(int index) const { |
1180 return Representation::Tagged(); | 1177 return Representation::Tagged(); |
1181 } | 1178 } |
1182 | 1179 |
1183 protected: | 1180 protected: |
1184 virtual bool DataEquals(HValue* other) { return true; } | 1181 virtual bool DataEquals(HValue* other) { return true; } |
1185 }; | 1182 }; |
1186 | 1183 |
1187 | 1184 |
(...skipping 24 matching lines...) Expand all Loading... |
1212 SetOperandAt(0, value); | 1209 SetOperandAt(0, value); |
1213 } | 1210 } |
1214 | 1211 |
1215 virtual Representation RequiredInputRepresentation(int index) const { | 1212 virtual Representation RequiredInputRepresentation(int index) const { |
1216 return Representation::Tagged(); | 1213 return Representation::Tagged(); |
1217 } | 1214 } |
1218 | 1215 |
1219 virtual void PrintDataTo(StringStream* stream); | 1216 virtual void PrintDataTo(StringStream* stream); |
1220 | 1217 |
1221 HValue* value() { return OperandAt(0); } | 1218 HValue* value() { return OperandAt(0); } |
1222 | |
1223 DECLARE_INSTRUCTION(UnaryCall) | |
1224 }; | 1219 }; |
1225 | 1220 |
1226 | 1221 |
1227 class HBinaryCall: public HCall<2> { | 1222 class HBinaryCall: public HCall<2> { |
1228 public: | 1223 public: |
1229 HBinaryCall(HValue* first, HValue* second, int argument_count) | 1224 HBinaryCall(HValue* first, HValue* second, int argument_count) |
1230 : HCall<2>(argument_count) { | 1225 : HCall<2>(argument_count) { |
1231 SetOperandAt(0, first); | 1226 SetOperandAt(0, first); |
1232 SetOperandAt(1, second); | 1227 SetOperandAt(1, second); |
1233 } | 1228 } |
1234 | 1229 |
1235 virtual void PrintDataTo(StringStream* stream); | 1230 virtual void PrintDataTo(StringStream* stream); |
1236 | 1231 |
1237 virtual Representation RequiredInputRepresentation(int index) const { | 1232 virtual Representation RequiredInputRepresentation(int index) const { |
1238 return Representation::Tagged(); | 1233 return Representation::Tagged(); |
1239 } | 1234 } |
1240 | 1235 |
1241 HValue* first() { return OperandAt(0); } | 1236 HValue* first() { return OperandAt(0); } |
1242 HValue* second() { return OperandAt(1); } | 1237 HValue* second() { return OperandAt(1); } |
1243 | |
1244 DECLARE_INSTRUCTION(BinaryCall) | |
1245 }; | 1238 }; |
1246 | 1239 |
1247 | 1240 |
1248 class HInvokeFunction: public HBinaryCall { | 1241 class HInvokeFunction: public HBinaryCall { |
1249 public: | 1242 public: |
1250 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 1243 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
1251 : HBinaryCall(context, function, argument_count) { | 1244 : HBinaryCall(context, function, argument_count) { |
1252 } | 1245 } |
1253 | 1246 |
1254 virtual Representation RequiredInputRepresentation(int index) const { | 1247 virtual Representation RequiredInputRepresentation(int index) const { |
1255 return Representation::Tagged(); | 1248 return Representation::Tagged(); |
1256 } | 1249 } |
1257 | 1250 |
1258 HValue* context() { return first(); } | 1251 HValue* context() { return first(); } |
1259 HValue* function() { return second(); } | 1252 HValue* function() { return second(); } |
1260 | 1253 |
1261 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke_function") | 1254 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
1262 }; | 1255 }; |
1263 | 1256 |
1264 | 1257 |
1265 class HCallConstantFunction: public HCall<0> { | 1258 class HCallConstantFunction: public HCall<0> { |
1266 public: | 1259 public: |
1267 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 1260 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
1268 : HCall<0>(argument_count), function_(function) { } | 1261 : HCall<0>(argument_count), function_(function) { } |
1269 | 1262 |
1270 Handle<JSFunction> function() const { return function_; } | 1263 Handle<JSFunction> function() const { return function_; } |
1271 | 1264 |
1272 bool IsApplyFunction() const { | 1265 bool IsApplyFunction() const { |
1273 return function_->code() == | 1266 return function_->code() == |
1274 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); | 1267 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); |
1275 } | 1268 } |
1276 | 1269 |
1277 virtual void PrintDataTo(StringStream* stream); | 1270 virtual void PrintDataTo(StringStream* stream); |
1278 | 1271 |
1279 virtual Representation RequiredInputRepresentation(int index) const { | 1272 virtual Representation RequiredInputRepresentation(int index) const { |
1280 return Representation::None(); | 1273 return Representation::None(); |
1281 } | 1274 } |
1282 | 1275 |
1283 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function") | 1276 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
1284 | 1277 |
1285 private: | 1278 private: |
1286 Handle<JSFunction> function_; | 1279 Handle<JSFunction> function_; |
1287 }; | 1280 }; |
1288 | 1281 |
1289 | 1282 |
1290 class HCallKeyed: public HBinaryCall { | 1283 class HCallKeyed: public HBinaryCall { |
1291 public: | 1284 public: |
1292 HCallKeyed(HValue* context, HValue* key, int argument_count) | 1285 HCallKeyed(HValue* context, HValue* key, int argument_count) |
1293 : HBinaryCall(context, key, argument_count) { | 1286 : HBinaryCall(context, key, argument_count) { |
1294 } | 1287 } |
1295 | 1288 |
1296 virtual Representation RequiredInputRepresentation(int index) const { | 1289 virtual Representation RequiredInputRepresentation(int index) const { |
1297 return Representation::Tagged(); | 1290 return Representation::Tagged(); |
1298 } | 1291 } |
1299 | 1292 |
1300 HValue* context() { return first(); } | 1293 HValue* context() { return first(); } |
1301 HValue* key() { return second(); } | 1294 HValue* key() { return second(); } |
1302 | 1295 |
1303 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed") | 1296 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) |
1304 }; | 1297 }; |
1305 | 1298 |
1306 | 1299 |
1307 class HCallNamed: public HUnaryCall { | 1300 class HCallNamed: public HUnaryCall { |
1308 public: | 1301 public: |
1309 HCallNamed(HValue* context, Handle<String> name, int argument_count) | 1302 HCallNamed(HValue* context, Handle<String> name, int argument_count) |
1310 : HUnaryCall(context, argument_count), name_(name) { | 1303 : HUnaryCall(context, argument_count), name_(name) { |
1311 } | 1304 } |
1312 | 1305 |
1313 virtual void PrintDataTo(StringStream* stream); | 1306 virtual void PrintDataTo(StringStream* stream); |
1314 | 1307 |
1315 HValue* context() { return value(); } | 1308 HValue* context() { return value(); } |
1316 Handle<String> name() const { return name_; } | 1309 Handle<String> name() const { return name_; } |
1317 | 1310 |
1318 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named") | 1311 DECLARE_CONCRETE_INSTRUCTION(CallNamed) |
1319 | 1312 |
1320 virtual Representation RequiredInputRepresentation(int index) const { | 1313 virtual Representation RequiredInputRepresentation(int index) const { |
1321 return Representation::Tagged(); | 1314 return Representation::Tagged(); |
1322 } | 1315 } |
1323 | 1316 |
1324 private: | 1317 private: |
1325 Handle<String> name_; | 1318 Handle<String> name_; |
1326 }; | 1319 }; |
1327 | 1320 |
1328 | 1321 |
1329 class HCallFunction: public HUnaryCall { | 1322 class HCallFunction: public HUnaryCall { |
1330 public: | 1323 public: |
1331 HCallFunction(HValue* context, int argument_count) | 1324 HCallFunction(HValue* context, int argument_count) |
1332 : HUnaryCall(context, argument_count) { | 1325 : HUnaryCall(context, argument_count) { |
1333 } | 1326 } |
1334 | 1327 |
1335 HValue* context() { return value(); } | 1328 HValue* context() { return value(); } |
1336 | 1329 |
1337 virtual Representation RequiredInputRepresentation(int index) const { | 1330 virtual Representation RequiredInputRepresentation(int index) const { |
1338 return Representation::Tagged(); | 1331 return Representation::Tagged(); |
1339 } | 1332 } |
1340 | 1333 |
1341 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function") | 1334 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
1342 }; | 1335 }; |
1343 | 1336 |
1344 | 1337 |
1345 class HCallGlobal: public HUnaryCall { | 1338 class HCallGlobal: public HUnaryCall { |
1346 public: | 1339 public: |
1347 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | 1340 HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
1348 : HUnaryCall(context, argument_count), name_(name) { | 1341 : HUnaryCall(context, argument_count), name_(name) { |
1349 } | 1342 } |
1350 | 1343 |
1351 virtual void PrintDataTo(StringStream* stream); | 1344 virtual void PrintDataTo(StringStream* stream); |
1352 | 1345 |
1353 HValue* context() { return value(); } | 1346 HValue* context() { return value(); } |
1354 Handle<String> name() const { return name_; } | 1347 Handle<String> name() const { return name_; } |
1355 | 1348 |
1356 virtual Representation RequiredInputRepresentation(int index) const { | 1349 virtual Representation RequiredInputRepresentation(int index) const { |
1357 return Representation::Tagged(); | 1350 return Representation::Tagged(); |
1358 } | 1351 } |
1359 | 1352 |
1360 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global") | 1353 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) |
1361 | 1354 |
1362 private: | 1355 private: |
1363 Handle<String> name_; | 1356 Handle<String> name_; |
1364 }; | 1357 }; |
1365 | 1358 |
1366 | 1359 |
1367 class HCallKnownGlobal: public HCall<0> { | 1360 class HCallKnownGlobal: public HCall<0> { |
1368 public: | 1361 public: |
1369 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | 1362 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
1370 : HCall<0>(argument_count), target_(target) { } | 1363 : HCall<0>(argument_count), target_(target) { } |
1371 | 1364 |
1372 virtual void PrintDataTo(StringStream* stream); | 1365 virtual void PrintDataTo(StringStream* stream); |
1373 | 1366 |
1374 Handle<JSFunction> target() const { return target_; } | 1367 Handle<JSFunction> target() const { return target_; } |
1375 | 1368 |
1376 virtual Representation RequiredInputRepresentation(int index) const { | 1369 virtual Representation RequiredInputRepresentation(int index) const { |
1377 return Representation::None(); | 1370 return Representation::None(); |
1378 } | 1371 } |
1379 | 1372 |
1380 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") | 1373 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) |
1381 | 1374 |
1382 private: | 1375 private: |
1383 Handle<JSFunction> target_; | 1376 Handle<JSFunction> target_; |
1384 }; | 1377 }; |
1385 | 1378 |
1386 | 1379 |
1387 class HCallNew: public HBinaryCall { | 1380 class HCallNew: public HBinaryCall { |
1388 public: | 1381 public: |
1389 HCallNew(HValue* context, HValue* constructor, int argument_count) | 1382 HCallNew(HValue* context, HValue* constructor, int argument_count) |
1390 : HBinaryCall(context, constructor, argument_count) { | 1383 : HBinaryCall(context, constructor, argument_count) { |
1391 } | 1384 } |
1392 | 1385 |
1393 virtual Representation RequiredInputRepresentation(int index) const { | 1386 virtual Representation RequiredInputRepresentation(int index) const { |
1394 return Representation::Tagged(); | 1387 return Representation::Tagged(); |
1395 } | 1388 } |
1396 | 1389 |
1397 HValue* context() { return first(); } | 1390 HValue* context() { return first(); } |
1398 HValue* constructor() { return second(); } | 1391 HValue* constructor() { return second(); } |
1399 | 1392 |
1400 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") | 1393 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
1401 }; | 1394 }; |
1402 | 1395 |
1403 | 1396 |
1404 class HCallRuntime: public HCall<0> { | 1397 class HCallRuntime: public HCall<0> { |
1405 public: | 1398 public: |
1406 HCallRuntime(Handle<String> name, | 1399 HCallRuntime(Handle<String> name, |
1407 const Runtime::Function* c_function, | 1400 const Runtime::Function* c_function, |
1408 int argument_count) | 1401 int argument_count) |
1409 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } | 1402 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } |
1410 virtual void PrintDataTo(StringStream* stream); | 1403 virtual void PrintDataTo(StringStream* stream); |
1411 | 1404 |
1412 const Runtime::Function* function() const { return c_function_; } | 1405 const Runtime::Function* function() const { return c_function_; } |
1413 Handle<String> name() const { return name_; } | 1406 Handle<String> name() const { return name_; } |
1414 | 1407 |
1415 virtual Representation RequiredInputRepresentation(int index) const { | 1408 virtual Representation RequiredInputRepresentation(int index) const { |
1416 return Representation::None(); | 1409 return Representation::None(); |
1417 } | 1410 } |
1418 | 1411 |
1419 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") | 1412 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
1420 | 1413 |
1421 private: | 1414 private: |
1422 const Runtime::Function* c_function_; | 1415 const Runtime::Function* c_function_; |
1423 Handle<String> name_; | 1416 Handle<String> name_; |
1424 }; | 1417 }; |
1425 | 1418 |
1426 | 1419 |
1427 class HJSArrayLength: public HUnaryOperation { | 1420 class HJSArrayLength: public HUnaryOperation { |
1428 public: | 1421 public: |
1429 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { | 1422 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { |
1430 // The length of an array is stored as a tagged value in the array | 1423 // The length of an array is stored as a tagged value in the array |
1431 // object. It is guaranteed to be 32 bit integer, but it can be | 1424 // object. It is guaranteed to be 32 bit integer, but it can be |
1432 // represented as either a smi or heap number. | 1425 // represented as either a smi or heap number. |
1433 set_representation(Representation::Tagged()); | 1426 set_representation(Representation::Tagged()); |
1434 SetFlag(kUseGVN); | 1427 SetFlag(kUseGVN); |
1435 SetFlag(kDependsOnArrayLengths); | 1428 SetFlag(kDependsOnArrayLengths); |
1436 SetFlag(kDependsOnMaps); | 1429 SetFlag(kDependsOnMaps); |
1437 } | 1430 } |
1438 | 1431 |
1439 virtual Representation RequiredInputRepresentation(int index) const { | 1432 virtual Representation RequiredInputRepresentation(int index) const { |
1440 return Representation::Tagged(); | 1433 return Representation::Tagged(); |
1441 } | 1434 } |
1442 | 1435 |
1443 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") | 1436 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
1444 | 1437 |
1445 protected: | 1438 protected: |
1446 virtual bool DataEquals(HValue* other) { return true; } | 1439 virtual bool DataEquals(HValue* other) { return true; } |
1447 }; | 1440 }; |
1448 | 1441 |
1449 | 1442 |
1450 class HFixedArrayLength: public HUnaryOperation { | 1443 class HFixedArrayLength: public HUnaryOperation { |
1451 public: | 1444 public: |
1452 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { | 1445 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { |
1453 set_representation(Representation::Tagged()); | 1446 set_representation(Representation::Tagged()); |
1454 SetFlag(kUseGVN); | 1447 SetFlag(kUseGVN); |
1455 SetFlag(kDependsOnArrayLengths); | 1448 SetFlag(kDependsOnArrayLengths); |
1456 } | 1449 } |
1457 | 1450 |
1458 virtual Representation RequiredInputRepresentation(int index) const { | 1451 virtual Representation RequiredInputRepresentation(int index) const { |
1459 return Representation::Tagged(); | 1452 return Representation::Tagged(); |
1460 } | 1453 } |
1461 | 1454 |
1462 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") | 1455 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength) |
1463 | 1456 |
1464 protected: | 1457 protected: |
1465 virtual bool DataEquals(HValue* other) { return true; } | 1458 virtual bool DataEquals(HValue* other) { return true; } |
1466 }; | 1459 }; |
1467 | 1460 |
1468 | 1461 |
1469 class HExternalArrayLength: public HUnaryOperation { | 1462 class HExternalArrayLength: public HUnaryOperation { |
1470 public: | 1463 public: |
1471 explicit HExternalArrayLength(HValue* value) : HUnaryOperation(value) { | 1464 explicit HExternalArrayLength(HValue* value) : HUnaryOperation(value) { |
1472 set_representation(Representation::Integer32()); | 1465 set_representation(Representation::Integer32()); |
1473 // The result of this instruction is idempotent as long as its inputs don't | 1466 // The result of this instruction is idempotent as long as its inputs don't |
1474 // change. The length of a pixel array cannot change once set, so it's not | 1467 // change. The length of a pixel array cannot change once set, so it's not |
1475 // necessary to introduce a kDependsOnArrayLengths or any other dependency. | 1468 // necessary to introduce a kDependsOnArrayLengths or any other dependency. |
1476 SetFlag(kUseGVN); | 1469 SetFlag(kUseGVN); |
1477 } | 1470 } |
1478 | 1471 |
1479 virtual Representation RequiredInputRepresentation(int index) const { | 1472 virtual Representation RequiredInputRepresentation(int index) const { |
1480 return Representation::Tagged(); | 1473 return Representation::Tagged(); |
1481 } | 1474 } |
1482 | 1475 |
1483 DECLARE_CONCRETE_INSTRUCTION(ExternalArrayLength, "external_array_length") | 1476 DECLARE_CONCRETE_INSTRUCTION(ExternalArrayLength) |
1484 | 1477 |
1485 protected: | 1478 protected: |
1486 virtual bool DataEquals(HValue* other) { return true; } | 1479 virtual bool DataEquals(HValue* other) { return true; } |
1487 }; | 1480 }; |
1488 | 1481 |
1489 | 1482 |
1490 class HBitNot: public HUnaryOperation { | 1483 class HBitNot: public HUnaryOperation { |
1491 public: | 1484 public: |
1492 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 1485 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
1493 set_representation(Representation::Integer32()); | 1486 set_representation(Representation::Integer32()); |
1494 SetFlag(kUseGVN); | 1487 SetFlag(kUseGVN); |
1495 SetFlag(kTruncatingToInt32); | 1488 SetFlag(kTruncatingToInt32); |
1496 } | 1489 } |
1497 | 1490 |
1498 virtual Representation RequiredInputRepresentation(int index) const { | 1491 virtual Representation RequiredInputRepresentation(int index) const { |
1499 return Representation::Integer32(); | 1492 return Representation::Integer32(); |
1500 } | 1493 } |
1501 virtual HType CalculateInferredType(); | 1494 virtual HType CalculateInferredType(); |
1502 | 1495 |
1503 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") | 1496 DECLARE_CONCRETE_INSTRUCTION(BitNot) |
1504 | 1497 |
1505 protected: | 1498 protected: |
1506 virtual bool DataEquals(HValue* other) { return true; } | 1499 virtual bool DataEquals(HValue* other) { return true; } |
1507 }; | 1500 }; |
1508 | 1501 |
1509 | 1502 |
1510 class HUnaryMathOperation: public HUnaryOperation { | 1503 class HUnaryMathOperation: public HUnaryOperation { |
1511 public: | 1504 public: |
1512 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) | 1505 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) |
1513 : HUnaryOperation(value), op_(op) { | 1506 : HUnaryOperation(value), op_(op) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 // introduced. | 1558 // introduced. |
1566 if (op() == kMathFloor) { | 1559 if (op() == kMathFloor) { |
1567 if (value()->representation().IsInteger32()) return value(); | 1560 if (value()->representation().IsInteger32()) return value(); |
1568 } | 1561 } |
1569 return this; | 1562 return this; |
1570 } | 1563 } |
1571 | 1564 |
1572 BuiltinFunctionId op() const { return op_; } | 1565 BuiltinFunctionId op() const { return op_; } |
1573 const char* OpName() const; | 1566 const char* OpName() const; |
1574 | 1567 |
1575 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation") | 1568 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) |
1576 | 1569 |
1577 protected: | 1570 protected: |
1578 virtual bool DataEquals(HValue* other) { | 1571 virtual bool DataEquals(HValue* other) { |
1579 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); | 1572 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
1580 return op_ == b->op(); | 1573 return op_ == b->op(); |
1581 } | 1574 } |
1582 | 1575 |
1583 private: | 1576 private: |
1584 BuiltinFunctionId op_; | 1577 BuiltinFunctionId op_; |
1585 }; | 1578 }; |
1586 | 1579 |
1587 | 1580 |
1588 class HLoadElements: public HUnaryOperation { | 1581 class HLoadElements: public HUnaryOperation { |
1589 public: | 1582 public: |
1590 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { | 1583 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
1591 set_representation(Representation::Tagged()); | 1584 set_representation(Representation::Tagged()); |
1592 SetFlag(kUseGVN); | 1585 SetFlag(kUseGVN); |
1593 SetFlag(kDependsOnMaps); | 1586 SetFlag(kDependsOnMaps); |
1594 } | 1587 } |
1595 | 1588 |
1596 virtual Representation RequiredInputRepresentation(int index) const { | 1589 virtual Representation RequiredInputRepresentation(int index) const { |
1597 return Representation::Tagged(); | 1590 return Representation::Tagged(); |
1598 } | 1591 } |
1599 | 1592 |
1600 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") | 1593 DECLARE_CONCRETE_INSTRUCTION(LoadElements) |
1601 | 1594 |
1602 protected: | 1595 protected: |
1603 virtual bool DataEquals(HValue* other) { return true; } | 1596 virtual bool DataEquals(HValue* other) { return true; } |
1604 }; | 1597 }; |
1605 | 1598 |
1606 | 1599 |
1607 class HLoadExternalArrayPointer: public HUnaryOperation { | 1600 class HLoadExternalArrayPointer: public HUnaryOperation { |
1608 public: | 1601 public: |
1609 explicit HLoadExternalArrayPointer(HValue* value) | 1602 explicit HLoadExternalArrayPointer(HValue* value) |
1610 : HUnaryOperation(value) { | 1603 : HUnaryOperation(value) { |
1611 set_representation(Representation::External()); | 1604 set_representation(Representation::External()); |
1612 // The result of this instruction is idempotent as long as its inputs don't | 1605 // The result of this instruction is idempotent as long as its inputs don't |
1613 // change. The external array of a specialized array elements object cannot | 1606 // change. The external array of a specialized array elements object cannot |
1614 // change once set, so it's no necessary to introduce any additional | 1607 // change once set, so it's no necessary to introduce any additional |
1615 // dependencies on top of the inputs. | 1608 // dependencies on top of the inputs. |
1616 SetFlag(kUseGVN); | 1609 SetFlag(kUseGVN); |
1617 } | 1610 } |
1618 | 1611 |
1619 virtual Representation RequiredInputRepresentation(int index) const { | 1612 virtual Representation RequiredInputRepresentation(int index) const { |
1620 return Representation::Tagged(); | 1613 return Representation::Tagged(); |
1621 } | 1614 } |
1622 | 1615 |
1623 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, | 1616 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
1624 "load-external-array-pointer") | |
1625 | 1617 |
1626 protected: | 1618 protected: |
1627 virtual bool DataEquals(HValue* other) { return true; } | 1619 virtual bool DataEquals(HValue* other) { return true; } |
1628 }; | 1620 }; |
1629 | 1621 |
1630 | 1622 |
1631 class HCheckMap: public HUnaryOperation { | 1623 class HCheckMap: public HUnaryOperation { |
1632 public: | 1624 public: |
1633 HCheckMap(HValue* value, Handle<Map> map) | 1625 HCheckMap(HValue* value, Handle<Map> map) |
1634 : HUnaryOperation(value), map_(map) { | 1626 : HUnaryOperation(value), map_(map) { |
1635 set_representation(Representation::Tagged()); | 1627 set_representation(Representation::Tagged()); |
1636 SetFlag(kUseGVN); | 1628 SetFlag(kUseGVN); |
1637 SetFlag(kDependsOnMaps); | 1629 SetFlag(kDependsOnMaps); |
1638 } | 1630 } |
1639 | 1631 |
1640 virtual bool IsCheckInstruction() const { return true; } | 1632 virtual bool IsCheckInstruction() const { return true; } |
1641 | 1633 |
1642 virtual Representation RequiredInputRepresentation(int index) const { | 1634 virtual Representation RequiredInputRepresentation(int index) const { |
1643 return Representation::Tagged(); | 1635 return Representation::Tagged(); |
1644 } | 1636 } |
1645 virtual void PrintDataTo(StringStream* stream); | 1637 virtual void PrintDataTo(StringStream* stream); |
1646 virtual HType CalculateInferredType(); | 1638 virtual HType CalculateInferredType(); |
1647 | 1639 |
1648 #ifdef DEBUG | 1640 #ifdef DEBUG |
1649 virtual void Verify(); | 1641 virtual void Verify(); |
1650 #endif | 1642 #endif |
1651 | 1643 |
1652 Handle<Map> map() const { return map_; } | 1644 Handle<Map> map() const { return map_; } |
1653 | 1645 |
1654 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map") | 1646 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
1655 | 1647 |
1656 protected: | 1648 protected: |
1657 virtual bool DataEquals(HValue* other) { | 1649 virtual bool DataEquals(HValue* other) { |
1658 HCheckMap* b = HCheckMap::cast(other); | 1650 HCheckMap* b = HCheckMap::cast(other); |
1659 return map_.is_identical_to(b->map()); | 1651 return map_.is_identical_to(b->map()); |
1660 } | 1652 } |
1661 | 1653 |
1662 private: | 1654 private: |
1663 Handle<Map> map_; | 1655 Handle<Map> map_; |
1664 }; | 1656 }; |
(...skipping 14 matching lines...) Expand all Loading... |
1679 } | 1671 } |
1680 virtual void PrintDataTo(StringStream* stream); | 1672 virtual void PrintDataTo(StringStream* stream); |
1681 virtual HType CalculateInferredType(); | 1673 virtual HType CalculateInferredType(); |
1682 | 1674 |
1683 #ifdef DEBUG | 1675 #ifdef DEBUG |
1684 virtual void Verify(); | 1676 virtual void Verify(); |
1685 #endif | 1677 #endif |
1686 | 1678 |
1687 Handle<JSFunction> target() const { return target_; } | 1679 Handle<JSFunction> target() const { return target_; } |
1688 | 1680 |
1689 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function") | 1681 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) |
1690 | 1682 |
1691 protected: | 1683 protected: |
1692 virtual bool DataEquals(HValue* other) { | 1684 virtual bool DataEquals(HValue* other) { |
1693 HCheckFunction* b = HCheckFunction::cast(other); | 1685 HCheckFunction* b = HCheckFunction::cast(other); |
1694 return target_.is_identical_to(b->target()); | 1686 return target_.is_identical_to(b->target()); |
1695 } | 1687 } |
1696 | 1688 |
1697 private: | 1689 private: |
1698 Handle<JSFunction> target_; | 1690 Handle<JSFunction> target_; |
1699 }; | 1691 }; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 return NULL; | 1726 return NULL; |
1735 } | 1727 } |
1736 return this; | 1728 return this; |
1737 } | 1729 } |
1738 | 1730 |
1739 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); | 1731 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); |
1740 | 1732 |
1741 InstanceType first() const { return first_; } | 1733 InstanceType first() const { return first_; } |
1742 InstanceType last() const { return last_; } | 1734 InstanceType last() const { return last_; } |
1743 | 1735 |
1744 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type") | 1736 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
1745 | 1737 |
1746 protected: | 1738 protected: |
1747 // TODO(ager): It could be nice to allow the ommision of instance | 1739 // TODO(ager): It could be nice to allow the ommision of instance |
1748 // type checks if we have already performed an instance type check | 1740 // type checks if we have already performed an instance type check |
1749 // with a larger range. | 1741 // with a larger range. |
1750 virtual bool DataEquals(HValue* other) { | 1742 virtual bool DataEquals(HValue* other) { |
1751 HCheckInstanceType* b = HCheckInstanceType::cast(other); | 1743 HCheckInstanceType* b = HCheckInstanceType::cast(other); |
1752 return (first_ == b->first()) && (last_ == b->last()); | 1744 return (first_ == b->first()) && (last_ == b->last()); |
1753 } | 1745 } |
1754 | 1746 |
(...skipping 27 matching lines...) Expand all Loading... |
1782 if (!value_type.IsUninitialized() && | 1774 if (!value_type.IsUninitialized() && |
1783 (value_type.IsHeapNumber() || | 1775 (value_type.IsHeapNumber() || |
1784 value_type.IsString() || | 1776 value_type.IsString() || |
1785 value_type.IsBoolean() || | 1777 value_type.IsBoolean() || |
1786 value_type.IsNonPrimitive())) { | 1778 value_type.IsNonPrimitive())) { |
1787 return NULL; | 1779 return NULL; |
1788 } | 1780 } |
1789 return this; | 1781 return this; |
1790 } | 1782 } |
1791 | 1783 |
1792 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") | 1784 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi) |
1793 | 1785 |
1794 protected: | 1786 protected: |
1795 virtual bool DataEquals(HValue* other) { return true; } | 1787 virtual bool DataEquals(HValue* other) { return true; } |
1796 }; | 1788 }; |
1797 | 1789 |
1798 | 1790 |
1799 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 1791 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
1800 public: | 1792 public: |
1801 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 1793 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
1802 : prototype_(prototype), holder_(holder) { | 1794 : prototype_(prototype), holder_(holder) { |
1803 SetFlag(kUseGVN); | 1795 SetFlag(kUseGVN); |
1804 SetFlag(kDependsOnMaps); | 1796 SetFlag(kDependsOnMaps); |
1805 } | 1797 } |
1806 | 1798 |
1807 virtual bool IsCheckInstruction() const { return true; } | 1799 virtual bool IsCheckInstruction() const { return true; } |
1808 | 1800 |
1809 #ifdef DEBUG | 1801 #ifdef DEBUG |
1810 virtual void Verify(); | 1802 virtual void Verify(); |
1811 #endif | 1803 #endif |
1812 | 1804 |
1813 Handle<JSObject> prototype() const { return prototype_; } | 1805 Handle<JSObject> prototype() const { return prototype_; } |
1814 Handle<JSObject> holder() const { return holder_; } | 1806 Handle<JSObject> holder() const { return holder_; } |
1815 | 1807 |
1816 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") | 1808 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
1817 | 1809 |
1818 virtual Representation RequiredInputRepresentation(int index) const { | 1810 virtual Representation RequiredInputRepresentation(int index) const { |
1819 return Representation::None(); | 1811 return Representation::None(); |
1820 } | 1812 } |
1821 | 1813 |
1822 virtual intptr_t Hashcode() { | 1814 virtual intptr_t Hashcode() { |
1823 ASSERT(!HEAP->IsAllocationAllowed()); | 1815 ASSERT(!HEAP->IsAllocationAllowed()); |
1824 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); | 1816 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); |
1825 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); | 1817 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); |
1826 return hash; | 1818 return hash; |
(...skipping 23 matching lines...) Expand all Loading... |
1850 | 1842 |
1851 virtual Representation RequiredInputRepresentation(int index) const { | 1843 virtual Representation RequiredInputRepresentation(int index) const { |
1852 return Representation::Tagged(); | 1844 return Representation::Tagged(); |
1853 } | 1845 } |
1854 virtual HType CalculateInferredType(); | 1846 virtual HType CalculateInferredType(); |
1855 | 1847 |
1856 #ifdef DEBUG | 1848 #ifdef DEBUG |
1857 virtual void Verify(); | 1849 virtual void Verify(); |
1858 #endif | 1850 #endif |
1859 | 1851 |
1860 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") | 1852 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
1861 | 1853 |
1862 protected: | 1854 protected: |
1863 virtual bool DataEquals(HValue* other) { return true; } | 1855 virtual bool DataEquals(HValue* other) { return true; } |
1864 }; | 1856 }; |
1865 | 1857 |
1866 | 1858 |
1867 class HPhi: public HValue { | 1859 class HPhi: public HValue { |
1868 public: | 1860 public: |
1869 explicit HPhi(int merged_index) | 1861 explicit HPhi(int merged_index) |
1870 : inputs_(2), | 1862 : inputs_(2), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 virtual int OperandCount() { return inputs_.length(); } | 1895 virtual int OperandCount() { return inputs_.length(); } |
1904 virtual HValue* OperandAt(int index) { return inputs_[index]; } | 1896 virtual HValue* OperandAt(int index) { return inputs_[index]; } |
1905 HValue* GetRedundantReplacement(); | 1897 HValue* GetRedundantReplacement(); |
1906 void AddInput(HValue* value); | 1898 void AddInput(HValue* value); |
1907 bool HasRealUses(); | 1899 bool HasRealUses(); |
1908 | 1900 |
1909 bool IsReceiver() { return merged_index_ == 0; } | 1901 bool IsReceiver() { return merged_index_ == 0; } |
1910 | 1902 |
1911 int merged_index() const { return merged_index_; } | 1903 int merged_index() const { return merged_index_; } |
1912 | 1904 |
1913 virtual const char* Mnemonic() const { return "phi"; } | |
1914 | |
1915 virtual void PrintTo(StringStream* stream); | 1905 virtual void PrintTo(StringStream* stream); |
1916 | 1906 |
1917 #ifdef DEBUG | 1907 #ifdef DEBUG |
1918 virtual void Verify(); | 1908 virtual void Verify(); |
1919 #endif | 1909 #endif |
1920 | 1910 |
1921 DECLARE_INSTRUCTION(Phi) | |
1922 | |
1923 void InitRealUses(int id); | 1911 void InitRealUses(int id); |
1924 void AddNonPhiUsesFrom(HPhi* other); | 1912 void AddNonPhiUsesFrom(HPhi* other); |
1925 void AddIndirectUsesTo(int* use_count); | 1913 void AddIndirectUsesTo(int* use_count); |
1926 | 1914 |
1927 int tagged_non_phi_uses() const { | 1915 int tagged_non_phi_uses() const { |
1928 return non_phi_uses_[Representation::kTagged]; | 1916 return non_phi_uses_[Representation::kTagged]; |
1929 } | 1917 } |
1930 int int32_non_phi_uses() const { | 1918 int int32_non_phi_uses() const { |
1931 return non_phi_uses_[Representation::kInteger32]; | 1919 return non_phi_uses_[Representation::kInteger32]; |
1932 } | 1920 } |
1933 int double_non_phi_uses() const { | 1921 int double_non_phi_uses() const { |
1934 return non_phi_uses_[Representation::kDouble]; | 1922 return non_phi_uses_[Representation::kDouble]; |
1935 } | 1923 } |
1936 int tagged_indirect_uses() const { | 1924 int tagged_indirect_uses() const { |
1937 return indirect_uses_[Representation::kTagged]; | 1925 return indirect_uses_[Representation::kTagged]; |
1938 } | 1926 } |
1939 int int32_indirect_uses() const { | 1927 int int32_indirect_uses() const { |
1940 return indirect_uses_[Representation::kInteger32]; | 1928 return indirect_uses_[Representation::kInteger32]; |
1941 } | 1929 } |
1942 int double_indirect_uses() const { | 1930 int double_indirect_uses() const { |
1943 return indirect_uses_[Representation::kDouble]; | 1931 return indirect_uses_[Representation::kDouble]; |
1944 } | 1932 } |
1945 int phi_id() { return phi_id_; } | 1933 int phi_id() { return phi_id_; } |
1946 bool is_live() { return is_live_; } | 1934 bool is_live() { return is_live_; } |
1947 void set_is_live(bool b) { is_live_ = b; } | 1935 void set_is_live(bool b) { is_live_ = b; } |
1948 | 1936 |
| 1937 static HPhi* cast(HValue* value) { |
| 1938 ASSERT(value->IsPhi()); |
| 1939 return reinterpret_cast<HPhi*>(value); |
| 1940 } |
| 1941 virtual Opcode opcode() const { return HValue::kPhi; } |
| 1942 |
1949 protected: | 1943 protected: |
1950 virtual void DeleteFromGraph(); | 1944 virtual void DeleteFromGraph(); |
1951 virtual void InternalSetOperandAt(int index, HValue* value) { | 1945 virtual void InternalSetOperandAt(int index, HValue* value) { |
1952 inputs_[index] = value; | 1946 inputs_[index] = value; |
1953 } | 1947 } |
1954 | 1948 |
1955 private: | 1949 private: |
1956 ZoneList<HValue*> inputs_; | 1950 ZoneList<HValue*> inputs_; |
1957 int merged_index_; | 1951 int merged_index_; |
1958 | 1952 |
1959 int non_phi_uses_[Representation::kNumRepresentations]; | 1953 int non_phi_uses_[Representation::kNumRepresentations]; |
1960 int indirect_uses_[Representation::kNumRepresentations]; | 1954 int indirect_uses_[Representation::kNumRepresentations]; |
1961 int phi_id_; | 1955 int phi_id_; |
1962 bool is_live_; | 1956 bool is_live_; |
1963 }; | 1957 }; |
1964 | 1958 |
1965 | 1959 |
1966 class HArgumentsObject: public HTemplateInstruction<0> { | 1960 class HArgumentsObject: public HTemplateInstruction<0> { |
1967 public: | 1961 public: |
1968 HArgumentsObject() { | 1962 HArgumentsObject() { |
1969 set_representation(Representation::Tagged()); | 1963 set_representation(Representation::Tagged()); |
1970 SetFlag(kIsArguments); | 1964 SetFlag(kIsArguments); |
1971 } | 1965 } |
1972 | 1966 |
1973 virtual Representation RequiredInputRepresentation(int index) const { | 1967 virtual Representation RequiredInputRepresentation(int index) const { |
1974 return Representation::None(); | 1968 return Representation::None(); |
1975 } | 1969 } |
1976 | 1970 |
1977 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") | 1971 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
1978 }; | 1972 }; |
1979 | 1973 |
1980 | 1974 |
1981 class HConstant: public HTemplateInstruction<0> { | 1975 class HConstant: public HTemplateInstruction<0> { |
1982 public: | 1976 public: |
1983 HConstant(Handle<Object> handle, Representation r); | 1977 HConstant(Handle<Object> handle, Representation r); |
1984 | 1978 |
1985 Handle<Object> handle() const { return handle_; } | 1979 Handle<Object> handle() const { return handle_; } |
1986 | 1980 |
1987 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 1981 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
(...skipping 24 matching lines...) Expand all Loading... |
2012 | 2006 |
2013 virtual intptr_t Hashcode() { | 2007 virtual intptr_t Hashcode() { |
2014 ASSERT(!HEAP->allow_allocation(false)); | 2008 ASSERT(!HEAP->allow_allocation(false)); |
2015 return reinterpret_cast<intptr_t>(*handle()); | 2009 return reinterpret_cast<intptr_t>(*handle()); |
2016 } | 2010 } |
2017 | 2011 |
2018 #ifdef DEBUG | 2012 #ifdef DEBUG |
2019 virtual void Verify() { } | 2013 virtual void Verify() { } |
2020 #endif | 2014 #endif |
2021 | 2015 |
2022 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant") | 2016 DECLARE_CONCRETE_INSTRUCTION(Constant) |
2023 | 2017 |
2024 protected: | 2018 protected: |
2025 virtual Range* InferRange(); | 2019 virtual Range* InferRange(); |
2026 | 2020 |
2027 virtual bool DataEquals(HValue* other) { | 2021 virtual bool DataEquals(HValue* other) { |
2028 HConstant* other_constant = HConstant::cast(other); | 2022 HConstant* other_constant = HConstant::cast(other); |
2029 return handle().is_identical_to(other_constant->handle()); | 2023 return handle().is_identical_to(other_constant->handle()); |
2030 } | 2024 } |
2031 | 2025 |
2032 private: | 2026 private: |
(...skipping 27 matching lines...) Expand all Loading... |
2060 return left(); | 2054 return left(); |
2061 } | 2055 } |
2062 HValue* MostConstantOperand() { | 2056 HValue* MostConstantOperand() { |
2063 if (IsCommutative() && left()->IsConstant()) return left(); | 2057 if (IsCommutative() && left()->IsConstant()) return left(); |
2064 return right(); | 2058 return right(); |
2065 } | 2059 } |
2066 | 2060 |
2067 virtual bool IsCommutative() const { return false; } | 2061 virtual bool IsCommutative() const { return false; } |
2068 | 2062 |
2069 virtual void PrintDataTo(StringStream* stream); | 2063 virtual void PrintDataTo(StringStream* stream); |
2070 | |
2071 DECLARE_INSTRUCTION(BinaryOperation) | |
2072 }; | 2064 }; |
2073 | 2065 |
2074 | 2066 |
2075 class HApplyArguments: public HTemplateInstruction<4> { | 2067 class HApplyArguments: public HTemplateInstruction<4> { |
2076 public: | 2068 public: |
2077 HApplyArguments(HValue* function, | 2069 HApplyArguments(HValue* function, |
2078 HValue* receiver, | 2070 HValue* receiver, |
2079 HValue* length, | 2071 HValue* length, |
2080 HValue* elements) { | 2072 HValue* elements) { |
2081 set_representation(Representation::Tagged()); | 2073 set_representation(Representation::Tagged()); |
2082 SetOperandAt(0, function); | 2074 SetOperandAt(0, function); |
2083 SetOperandAt(1, receiver); | 2075 SetOperandAt(1, receiver); |
2084 SetOperandAt(2, length); | 2076 SetOperandAt(2, length); |
2085 SetOperandAt(3, elements); | 2077 SetOperandAt(3, elements); |
2086 SetAllSideEffects(); | 2078 SetAllSideEffects(); |
2087 } | 2079 } |
2088 | 2080 |
2089 virtual Representation RequiredInputRepresentation(int index) const { | 2081 virtual Representation RequiredInputRepresentation(int index) const { |
2090 // The length is untagged, all other inputs are tagged. | 2082 // The length is untagged, all other inputs are tagged. |
2091 return (index == 2) | 2083 return (index == 2) |
2092 ? Representation::Integer32() | 2084 ? Representation::Integer32() |
2093 : Representation::Tagged(); | 2085 : Representation::Tagged(); |
2094 } | 2086 } |
2095 | 2087 |
2096 HValue* function() { return OperandAt(0); } | 2088 HValue* function() { return OperandAt(0); } |
2097 HValue* receiver() { return OperandAt(1); } | 2089 HValue* receiver() { return OperandAt(1); } |
2098 HValue* length() { return OperandAt(2); } | 2090 HValue* length() { return OperandAt(2); } |
2099 HValue* elements() { return OperandAt(3); } | 2091 HValue* elements() { return OperandAt(3); } |
2100 | 2092 |
2101 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply_arguments") | 2093 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) |
2102 }; | 2094 }; |
2103 | 2095 |
2104 | 2096 |
2105 class HArgumentsElements: public HTemplateInstruction<0> { | 2097 class HArgumentsElements: public HTemplateInstruction<0> { |
2106 public: | 2098 public: |
2107 HArgumentsElements() { | 2099 HArgumentsElements() { |
2108 // The value produced by this instruction is a pointer into the stack | 2100 // The value produced by this instruction is a pointer into the stack |
2109 // that looks as if it was a smi because of alignment. | 2101 // that looks as if it was a smi because of alignment. |
2110 set_representation(Representation::Tagged()); | 2102 set_representation(Representation::Tagged()); |
2111 SetFlag(kUseGVN); | 2103 SetFlag(kUseGVN); |
2112 } | 2104 } |
2113 | 2105 |
2114 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") | 2106 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
2115 | 2107 |
2116 virtual Representation RequiredInputRepresentation(int index) const { | 2108 virtual Representation RequiredInputRepresentation(int index) const { |
2117 return Representation::None(); | 2109 return Representation::None(); |
2118 } | 2110 } |
2119 | 2111 |
2120 protected: | 2112 protected: |
2121 virtual bool DataEquals(HValue* other) { return true; } | 2113 virtual bool DataEquals(HValue* other) { return true; } |
2122 }; | 2114 }; |
2123 | 2115 |
2124 | 2116 |
2125 class HArgumentsLength: public HUnaryOperation { | 2117 class HArgumentsLength: public HUnaryOperation { |
2126 public: | 2118 public: |
2127 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 2119 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
2128 set_representation(Representation::Integer32()); | 2120 set_representation(Representation::Integer32()); |
2129 SetFlag(kUseGVN); | 2121 SetFlag(kUseGVN); |
2130 } | 2122 } |
2131 | 2123 |
2132 virtual Representation RequiredInputRepresentation(int index) const { | 2124 virtual Representation RequiredInputRepresentation(int index) const { |
2133 return Representation::Tagged(); | 2125 return Representation::Tagged(); |
2134 } | 2126 } |
2135 | 2127 |
2136 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") | 2128 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
2137 | 2129 |
2138 protected: | 2130 protected: |
2139 virtual bool DataEquals(HValue* other) { return true; } | 2131 virtual bool DataEquals(HValue* other) { return true; } |
2140 }; | 2132 }; |
2141 | 2133 |
2142 | 2134 |
2143 class HAccessArgumentsAt: public HTemplateInstruction<3> { | 2135 class HAccessArgumentsAt: public HTemplateInstruction<3> { |
2144 public: | 2136 public: |
2145 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 2137 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
2146 set_representation(Representation::Tagged()); | 2138 set_representation(Representation::Tagged()); |
2147 SetFlag(kUseGVN); | 2139 SetFlag(kUseGVN); |
2148 SetOperandAt(0, arguments); | 2140 SetOperandAt(0, arguments); |
2149 SetOperandAt(1, length); | 2141 SetOperandAt(1, length); |
2150 SetOperandAt(2, index); | 2142 SetOperandAt(2, index); |
2151 } | 2143 } |
2152 | 2144 |
2153 virtual void PrintDataTo(StringStream* stream); | 2145 virtual void PrintDataTo(StringStream* stream); |
2154 | 2146 |
2155 virtual Representation RequiredInputRepresentation(int index) const { | 2147 virtual Representation RequiredInputRepresentation(int index) const { |
2156 // The arguments elements is considered tagged. | 2148 // The arguments elements is considered tagged. |
2157 return index == 0 | 2149 return index == 0 |
2158 ? Representation::Tagged() | 2150 ? Representation::Tagged() |
2159 : Representation::Integer32(); | 2151 : Representation::Integer32(); |
2160 } | 2152 } |
2161 | 2153 |
2162 HValue* arguments() { return OperandAt(0); } | 2154 HValue* arguments() { return OperandAt(0); } |
2163 HValue* length() { return OperandAt(1); } | 2155 HValue* length() { return OperandAt(1); } |
2164 HValue* index() { return OperandAt(2); } | 2156 HValue* index() { return OperandAt(2); } |
2165 | 2157 |
2166 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") | 2158 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
2167 | 2159 |
2168 virtual bool DataEquals(HValue* other) { return true; } | 2160 virtual bool DataEquals(HValue* other) { return true; } |
2169 }; | 2161 }; |
2170 | 2162 |
2171 | 2163 |
2172 class HBoundsCheck: public HBinaryOperation { | 2164 class HBoundsCheck: public HBinaryOperation { |
2173 public: | 2165 public: |
2174 HBoundsCheck(HValue* index, HValue* length) | 2166 HBoundsCheck(HValue* index, HValue* length) |
2175 : HBinaryOperation(index, length) { | 2167 : HBinaryOperation(index, length) { |
2176 SetFlag(kUseGVN); | 2168 SetFlag(kUseGVN); |
2177 } | 2169 } |
2178 | 2170 |
2179 virtual bool IsCheckInstruction() const { return true; } | 2171 virtual bool IsCheckInstruction() const { return true; } |
2180 | 2172 |
2181 virtual Representation RequiredInputRepresentation(int index) const { | 2173 virtual Representation RequiredInputRepresentation(int index) const { |
2182 return Representation::Integer32(); | 2174 return Representation::Integer32(); |
2183 } | 2175 } |
2184 | 2176 |
2185 #ifdef DEBUG | 2177 #ifdef DEBUG |
2186 virtual void Verify(); | 2178 virtual void Verify(); |
2187 #endif | 2179 #endif |
2188 | 2180 |
2189 HValue* index() { return left(); } | 2181 HValue* index() { return left(); } |
2190 HValue* length() { return right(); } | 2182 HValue* length() { return right(); } |
2191 | 2183 |
2192 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") | 2184 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
2193 | 2185 |
2194 protected: | 2186 protected: |
2195 virtual bool DataEquals(HValue* other) { return true; } | 2187 virtual bool DataEquals(HValue* other) { return true; } |
2196 }; | 2188 }; |
2197 | 2189 |
2198 | 2190 |
2199 class HBitwiseBinaryOperation: public HBinaryOperation { | 2191 class HBitwiseBinaryOperation: public HBinaryOperation { |
2200 public: | 2192 public: |
2201 HBitwiseBinaryOperation(HValue* left, HValue* right) | 2193 HBitwiseBinaryOperation(HValue* left, HValue* right) |
2202 : HBinaryOperation(left, right) { | 2194 : HBinaryOperation(left, right) { |
(...skipping 10 matching lines...) Expand all Loading... |
2213 if (!to.IsTagged()) { | 2205 if (!to.IsTagged()) { |
2214 ASSERT(to.IsInteger32()); | 2206 ASSERT(to.IsInteger32()); |
2215 ClearAllSideEffects(); | 2207 ClearAllSideEffects(); |
2216 SetFlag(kTruncatingToInt32); | 2208 SetFlag(kTruncatingToInt32); |
2217 SetFlag(kUseGVN); | 2209 SetFlag(kUseGVN); |
2218 } | 2210 } |
2219 } | 2211 } |
2220 | 2212 |
2221 virtual HType CalculateInferredType(); | 2213 virtual HType CalculateInferredType(); |
2222 | 2214 |
2223 DECLARE_INSTRUCTION(BitwiseBinaryOperation) | 2215 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
2224 }; | 2216 }; |
2225 | 2217 |
2226 | 2218 |
2227 class HArithmeticBinaryOperation: public HBinaryOperation { | 2219 class HArithmeticBinaryOperation: public HBinaryOperation { |
2228 public: | 2220 public: |
2229 HArithmeticBinaryOperation(HValue* left, HValue* right) | 2221 HArithmeticBinaryOperation(HValue* left, HValue* right) |
2230 : HBinaryOperation(left, right) { | 2222 : HBinaryOperation(left, right) { |
2231 set_representation(Representation::Tagged()); | 2223 set_representation(Representation::Tagged()); |
2232 SetFlag(kFlexibleRepresentation); | 2224 SetFlag(kFlexibleRepresentation); |
2233 SetAllSideEffects(); | 2225 SetAllSideEffects(); |
2234 } | 2226 } |
2235 | 2227 |
2236 virtual void RepresentationChanged(Representation to) { | 2228 virtual void RepresentationChanged(Representation to) { |
2237 if (!to.IsTagged()) { | 2229 if (!to.IsTagged()) { |
2238 ClearAllSideEffects(); | 2230 ClearAllSideEffects(); |
2239 SetFlag(kUseGVN); | 2231 SetFlag(kUseGVN); |
2240 } | 2232 } |
2241 } | 2233 } |
2242 | 2234 |
2243 virtual HType CalculateInferredType(); | 2235 virtual HType CalculateInferredType(); |
2244 virtual Representation RequiredInputRepresentation(int index) const { | 2236 virtual Representation RequiredInputRepresentation(int index) const { |
2245 return representation(); | 2237 return representation(); |
2246 } | 2238 } |
2247 virtual Representation InferredRepresentation() { | 2239 virtual Representation InferredRepresentation() { |
2248 if (left()->representation().Equals(right()->representation())) { | 2240 if (left()->representation().Equals(right()->representation())) { |
2249 return left()->representation(); | 2241 return left()->representation(); |
2250 } | 2242 } |
2251 return HValue::InferredRepresentation(); | 2243 return HValue::InferredRepresentation(); |
2252 } | 2244 } |
2253 | |
2254 DECLARE_INSTRUCTION(ArithmeticBinaryOperation) | |
2255 }; | 2245 }; |
2256 | 2246 |
2257 | 2247 |
2258 class HCompare: public HBinaryOperation { | 2248 class HCompare: public HBinaryOperation { |
2259 public: | 2249 public: |
2260 HCompare(HValue* left, HValue* right, Token::Value token) | 2250 HCompare(HValue* left, HValue* right, Token::Value token) |
2261 : HBinaryOperation(left, right), token_(token) { | 2251 : HBinaryOperation(left, right), token_(token) { |
2262 ASSERT(Token::IsCompareOp(token)); | 2252 ASSERT(Token::IsCompareOp(token)); |
2263 set_representation(Representation::Tagged()); | 2253 set_representation(Representation::Tagged()); |
2264 SetAllSideEffects(); | 2254 SetAllSideEffects(); |
(...skipping 13 matching lines...) Expand all Loading... |
2278 } | 2268 } |
2279 Token::Value token() const { return token_; } | 2269 Token::Value token() const { return token_; } |
2280 virtual void PrintDataTo(StringStream* stream); | 2270 virtual void PrintDataTo(StringStream* stream); |
2281 | 2271 |
2282 virtual HType CalculateInferredType(); | 2272 virtual HType CalculateInferredType(); |
2283 | 2273 |
2284 virtual intptr_t Hashcode() { | 2274 virtual intptr_t Hashcode() { |
2285 return HValue::Hashcode() * 7 + token_; | 2275 return HValue::Hashcode() * 7 + token_; |
2286 } | 2276 } |
2287 | 2277 |
2288 DECLARE_CONCRETE_INSTRUCTION(Compare, "compare") | 2278 DECLARE_CONCRETE_INSTRUCTION(Compare) |
2289 | 2279 |
2290 protected: | 2280 protected: |
2291 virtual bool DataEquals(HValue* other) { | 2281 virtual bool DataEquals(HValue* other) { |
2292 HCompare* comp = HCompare::cast(other); | 2282 HCompare* comp = HCompare::cast(other); |
2293 return token_ == comp->token(); | 2283 return token_ == comp->token(); |
2294 } | 2284 } |
2295 | 2285 |
2296 private: | 2286 private: |
2297 Representation input_representation_; | 2287 Representation input_representation_; |
2298 Token::Value token_; | 2288 Token::Value token_; |
(...skipping 11 matching lines...) Expand all Loading... |
2310 | 2300 |
2311 virtual bool EmitAtUses() { | 2301 virtual bool EmitAtUses() { |
2312 return !HasSideEffects() && (uses()->length() <= 1); | 2302 return !HasSideEffects() && (uses()->length() <= 1); |
2313 } | 2303 } |
2314 | 2304 |
2315 virtual Representation RequiredInputRepresentation(int index) const { | 2305 virtual Representation RequiredInputRepresentation(int index) const { |
2316 return Representation::Tagged(); | 2306 return Representation::Tagged(); |
2317 } | 2307 } |
2318 virtual HType CalculateInferredType(); | 2308 virtual HType CalculateInferredType(); |
2319 | 2309 |
2320 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") | 2310 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq) |
2321 | 2311 |
2322 protected: | 2312 protected: |
2323 virtual bool DataEquals(HValue* other) { return true; } | 2313 virtual bool DataEquals(HValue* other) { return true; } |
2324 }; | 2314 }; |
2325 | 2315 |
2326 | 2316 |
2327 class HUnaryPredicate: public HUnaryOperation { | 2317 class HUnaryPredicate: public HUnaryOperation { |
2328 public: | 2318 public: |
2329 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | 2319 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
2330 set_representation(Representation::Tagged()); | 2320 set_representation(Representation::Tagged()); |
(...skipping 11 matching lines...) Expand all Loading... |
2342 }; | 2332 }; |
2343 | 2333 |
2344 | 2334 |
2345 class HIsNull: public HUnaryPredicate { | 2335 class HIsNull: public HUnaryPredicate { |
2346 public: | 2336 public: |
2347 HIsNull(HValue* value, bool is_strict) | 2337 HIsNull(HValue* value, bool is_strict) |
2348 : HUnaryPredicate(value), is_strict_(is_strict) { } | 2338 : HUnaryPredicate(value), is_strict_(is_strict) { } |
2349 | 2339 |
2350 bool is_strict() const { return is_strict_; } | 2340 bool is_strict() const { return is_strict_; } |
2351 | 2341 |
2352 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is_null") | 2342 DECLARE_CONCRETE_INSTRUCTION(IsNull) |
2353 | 2343 |
2354 protected: | 2344 protected: |
2355 virtual bool DataEquals(HValue* other) { | 2345 virtual bool DataEquals(HValue* other) { |
2356 HIsNull* b = HIsNull::cast(other); | 2346 HIsNull* b = HIsNull::cast(other); |
2357 return is_strict_ == b->is_strict(); | 2347 return is_strict_ == b->is_strict(); |
2358 } | 2348 } |
2359 | 2349 |
2360 private: | 2350 private: |
2361 bool is_strict_; | 2351 bool is_strict_; |
2362 }; | 2352 }; |
2363 | 2353 |
2364 | 2354 |
2365 class HIsObject: public HUnaryPredicate { | 2355 class HIsObject: public HUnaryPredicate { |
2366 public: | 2356 public: |
2367 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } | 2357 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } |
2368 | 2358 |
2369 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") | 2359 DECLARE_CONCRETE_INSTRUCTION(IsObject) |
2370 | 2360 |
2371 protected: | 2361 protected: |
2372 virtual bool DataEquals(HValue* other) { return true; } | 2362 virtual bool DataEquals(HValue* other) { return true; } |
2373 }; | 2363 }; |
2374 | 2364 |
2375 | 2365 |
2376 class HIsSmi: public HUnaryPredicate { | 2366 class HIsSmi: public HUnaryPredicate { |
2377 public: | 2367 public: |
2378 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } | 2368 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } |
2379 | 2369 |
2380 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") | 2370 DECLARE_CONCRETE_INSTRUCTION(IsSmi) |
2381 | 2371 |
2382 protected: | 2372 protected: |
2383 virtual bool DataEquals(HValue* other) { return true; } | 2373 virtual bool DataEquals(HValue* other) { return true; } |
2384 }; | 2374 }; |
2385 | 2375 |
2386 | 2376 |
2387 class HIsConstructCall: public HTemplateInstruction<0> { | 2377 class HIsConstructCall: public HTemplateInstruction<0> { |
2388 public: | 2378 public: |
2389 HIsConstructCall() { | 2379 HIsConstructCall() { |
2390 set_representation(Representation::Tagged()); | 2380 set_representation(Representation::Tagged()); |
2391 SetFlag(kUseGVN); | 2381 SetFlag(kUseGVN); |
2392 } | 2382 } |
2393 | 2383 |
2394 virtual bool EmitAtUses() { | 2384 virtual bool EmitAtUses() { |
2395 return !HasSideEffects() && (uses()->length() <= 1); | 2385 return !HasSideEffects() && (uses()->length() <= 1); |
2396 } | 2386 } |
2397 | 2387 |
2398 virtual Representation RequiredInputRepresentation(int index) const { | 2388 virtual Representation RequiredInputRepresentation(int index) const { |
2399 return Representation::None(); | 2389 return Representation::None(); |
2400 } | 2390 } |
2401 | 2391 |
2402 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call") | 2392 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall) |
2403 | 2393 |
2404 protected: | 2394 protected: |
2405 virtual bool DataEquals(HValue* other) { return true; } | 2395 virtual bool DataEquals(HValue* other) { return true; } |
2406 }; | 2396 }; |
2407 | 2397 |
2408 | 2398 |
2409 class HHasInstanceType: public HUnaryPredicate { | 2399 class HHasInstanceType: public HUnaryPredicate { |
2410 public: | 2400 public: |
2411 HHasInstanceType(HValue* value, InstanceType type) | 2401 HHasInstanceType(HValue* value, InstanceType type) |
2412 : HUnaryPredicate(value), from_(type), to_(type) { } | 2402 : HUnaryPredicate(value), from_(type), to_(type) { } |
2413 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) | 2403 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) |
2414 : HUnaryPredicate(value), from_(from), to_(to) { | 2404 : HUnaryPredicate(value), from_(from), to_(to) { |
2415 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 2405 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
2416 } | 2406 } |
2417 | 2407 |
2418 InstanceType from() { return from_; } | 2408 InstanceType from() { return from_; } |
2419 InstanceType to() { return to_; } | 2409 InstanceType to() { return to_; } |
2420 | 2410 |
2421 virtual void PrintDataTo(StringStream* stream); | 2411 virtual void PrintDataTo(StringStream* stream); |
2422 | 2412 |
2423 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has_instance_type") | 2413 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType) |
2424 | 2414 |
2425 protected: | 2415 protected: |
2426 virtual bool DataEquals(HValue* other) { | 2416 virtual bool DataEquals(HValue* other) { |
2427 HHasInstanceType* b = HHasInstanceType::cast(other); | 2417 HHasInstanceType* b = HHasInstanceType::cast(other); |
2428 return (from_ == b->from()) && (to_ == b->to()); | 2418 return (from_ == b->from()) && (to_ == b->to()); |
2429 } | 2419 } |
2430 | 2420 |
2431 private: | 2421 private: |
2432 InstanceType from_; | 2422 InstanceType from_; |
2433 InstanceType to_; // Inclusive range, not all combinations work. | 2423 InstanceType to_; // Inclusive range, not all combinations work. |
2434 }; | 2424 }; |
2435 | 2425 |
2436 | 2426 |
2437 class HHasCachedArrayIndex: public HUnaryPredicate { | 2427 class HHasCachedArrayIndex: public HUnaryPredicate { |
2438 public: | 2428 public: |
2439 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } | 2429 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } |
2440 | 2430 |
2441 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") | 2431 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex) |
2442 | 2432 |
2443 protected: | 2433 protected: |
2444 virtual bool DataEquals(HValue* other) { return true; } | 2434 virtual bool DataEquals(HValue* other) { return true; } |
2445 }; | 2435 }; |
2446 | 2436 |
2447 | 2437 |
2448 class HGetCachedArrayIndex: public HUnaryPredicate { | 2438 class HGetCachedArrayIndex: public HUnaryPredicate { |
2449 public: | 2439 public: |
2450 explicit HGetCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } | 2440 explicit HGetCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } |
2451 | 2441 |
2452 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get_cached_array_index") | 2442 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
2453 | 2443 |
2454 protected: | 2444 protected: |
2455 virtual bool DataEquals(HValue* other) { return true; } | 2445 virtual bool DataEquals(HValue* other) { return true; } |
2456 }; | 2446 }; |
2457 | 2447 |
2458 | 2448 |
2459 class HClassOfTest: public HUnaryPredicate { | 2449 class HClassOfTest: public HUnaryPredicate { |
2460 public: | 2450 public: |
2461 HClassOfTest(HValue* value, Handle<String> class_name) | 2451 HClassOfTest(HValue* value, Handle<String> class_name) |
2462 : HUnaryPredicate(value), class_name_(class_name) { } | 2452 : HUnaryPredicate(value), class_name_(class_name) { } |
2463 | 2453 |
2464 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") | 2454 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest) |
2465 | 2455 |
2466 virtual void PrintDataTo(StringStream* stream); | 2456 virtual void PrintDataTo(StringStream* stream); |
2467 | 2457 |
2468 Handle<String> class_name() const { return class_name_; } | 2458 Handle<String> class_name() const { return class_name_; } |
2469 | 2459 |
2470 protected: | 2460 protected: |
2471 virtual bool DataEquals(HValue* other) { | 2461 virtual bool DataEquals(HValue* other) { |
2472 HClassOfTest* b = HClassOfTest::cast(other); | 2462 HClassOfTest* b = HClassOfTest::cast(other); |
2473 return class_name_.is_identical_to(b->class_name_); | 2463 return class_name_.is_identical_to(b->class_name_); |
2474 } | 2464 } |
2475 | 2465 |
2476 private: | 2466 private: |
2477 Handle<String> class_name_; | 2467 Handle<String> class_name_; |
2478 }; | 2468 }; |
2479 | 2469 |
2480 | 2470 |
2481 class HTypeofIs: public HUnaryPredicate { | 2471 class HTypeofIs: public HUnaryPredicate { |
2482 public: | 2472 public: |
2483 HTypeofIs(HValue* value, Handle<String> type_literal) | 2473 HTypeofIs(HValue* value, Handle<String> type_literal) |
2484 : HUnaryPredicate(value), type_literal_(type_literal) { } | 2474 : HUnaryPredicate(value), type_literal_(type_literal) { } |
2485 | 2475 |
2486 Handle<String> type_literal() { return type_literal_; } | 2476 Handle<String> type_literal() { return type_literal_; } |
2487 virtual void PrintDataTo(StringStream* stream); | 2477 virtual void PrintDataTo(StringStream* stream); |
2488 | 2478 |
2489 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof_is") | 2479 DECLARE_CONCRETE_INSTRUCTION(TypeofIs) |
2490 | 2480 |
2491 protected: | 2481 protected: |
2492 virtual bool DataEquals(HValue* other) { | 2482 virtual bool DataEquals(HValue* other) { |
2493 HTypeofIs* b = HTypeofIs::cast(other); | 2483 HTypeofIs* b = HTypeofIs::cast(other); |
2494 return type_literal_.is_identical_to(b->type_literal_); | 2484 return type_literal_.is_identical_to(b->type_literal_); |
2495 } | 2485 } |
2496 | 2486 |
2497 private: | 2487 private: |
2498 Handle<String> type_literal_; | 2488 Handle<String> type_literal_; |
2499 }; | 2489 }; |
(...skipping 16 matching lines...) Expand all Loading... |
2516 virtual bool EmitAtUses() { | 2506 virtual bool EmitAtUses() { |
2517 return !HasSideEffects() && (uses()->length() <= 1); | 2507 return !HasSideEffects() && (uses()->length() <= 1); |
2518 } | 2508 } |
2519 | 2509 |
2520 virtual Representation RequiredInputRepresentation(int index) const { | 2510 virtual Representation RequiredInputRepresentation(int index) const { |
2521 return Representation::Tagged(); | 2511 return Representation::Tagged(); |
2522 } | 2512 } |
2523 | 2513 |
2524 virtual void PrintDataTo(StringStream* stream); | 2514 virtual void PrintDataTo(StringStream* stream); |
2525 | 2515 |
2526 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") | 2516 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
2527 }; | 2517 }; |
2528 | 2518 |
2529 | 2519 |
2530 class HInstanceOfKnownGlobal: public HUnaryOperation { | 2520 class HInstanceOfKnownGlobal: public HUnaryOperation { |
2531 public: | 2521 public: |
2532 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) | 2522 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) |
2533 : HUnaryOperation(left), function_(right) { | 2523 : HUnaryOperation(left), function_(right) { |
2534 set_representation(Representation::Tagged()); | 2524 set_representation(Representation::Tagged()); |
2535 SetAllSideEffects(); | 2525 SetAllSideEffects(); |
2536 } | 2526 } |
2537 | 2527 |
2538 Handle<JSFunction> function() { return function_; } | 2528 Handle<JSFunction> function() { return function_; } |
2539 | 2529 |
2540 virtual Representation RequiredInputRepresentation(int index) const { | 2530 virtual Representation RequiredInputRepresentation(int index) const { |
2541 return Representation::Tagged(); | 2531 return Representation::Tagged(); |
2542 } | 2532 } |
2543 | 2533 |
2544 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, | 2534 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
2545 "instance_of_known_global") | |
2546 | 2535 |
2547 private: | 2536 private: |
2548 Handle<JSFunction> function_; | 2537 Handle<JSFunction> function_; |
2549 }; | 2538 }; |
2550 | 2539 |
2551 | 2540 |
2552 class HPower: public HBinaryOperation { | 2541 class HPower: public HBinaryOperation { |
2553 public: | 2542 public: |
2554 HPower(HValue* left, HValue* right) | 2543 HPower(HValue* left, HValue* right) |
2555 : HBinaryOperation(left, right) { | 2544 : HBinaryOperation(left, right) { |
2556 set_representation(Representation::Double()); | 2545 set_representation(Representation::Double()); |
2557 SetFlag(kUseGVN); | 2546 SetFlag(kUseGVN); |
2558 } | 2547 } |
2559 | 2548 |
2560 virtual Representation RequiredInputRepresentation(int index) const { | 2549 virtual Representation RequiredInputRepresentation(int index) const { |
2561 return (index == 1) ? Representation::None() : Representation::Double(); | 2550 return (index == 1) ? Representation::None() : Representation::Double(); |
2562 } | 2551 } |
2563 | 2552 |
2564 DECLARE_CONCRETE_INSTRUCTION(Power, "power") | 2553 DECLARE_CONCRETE_INSTRUCTION(Power) |
2565 | 2554 |
2566 protected: | 2555 protected: |
2567 virtual bool DataEquals(HValue* other) { return true; } | 2556 virtual bool DataEquals(HValue* other) { return true; } |
2568 }; | 2557 }; |
2569 | 2558 |
2570 | 2559 |
2571 class HAdd: public HArithmeticBinaryOperation { | 2560 class HAdd: public HArithmeticBinaryOperation { |
2572 public: | 2561 public: |
2573 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2562 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
2574 SetFlag(kCanOverflow); | 2563 SetFlag(kCanOverflow); |
2575 } | 2564 } |
2576 | 2565 |
2577 // Add is only commutative if two integer values are added and not if two | 2566 // Add is only commutative if two integer values are added and not if two |
2578 // tagged values are added (because it might be a String concatenation). | 2567 // tagged values are added (because it might be a String concatenation). |
2579 virtual bool IsCommutative() const { | 2568 virtual bool IsCommutative() const { |
2580 return !representation().IsTagged(); | 2569 return !representation().IsTagged(); |
2581 } | 2570 } |
2582 | 2571 |
2583 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2572 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2584 | 2573 |
2585 virtual HType CalculateInferredType(); | 2574 virtual HType CalculateInferredType(); |
2586 | 2575 |
2587 DECLARE_CONCRETE_INSTRUCTION(Add, "add") | 2576 DECLARE_CONCRETE_INSTRUCTION(Add) |
2588 | 2577 |
2589 protected: | 2578 protected: |
2590 virtual bool DataEquals(HValue* other) { return true; } | 2579 virtual bool DataEquals(HValue* other) { return true; } |
2591 | 2580 |
2592 virtual Range* InferRange(); | 2581 virtual Range* InferRange(); |
2593 }; | 2582 }; |
2594 | 2583 |
2595 | 2584 |
2596 class HSub: public HArithmeticBinaryOperation { | 2585 class HSub: public HArithmeticBinaryOperation { |
2597 public: | 2586 public: |
2598 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2587 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
2599 SetFlag(kCanOverflow); | 2588 SetFlag(kCanOverflow); |
2600 } | 2589 } |
2601 | 2590 |
2602 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2591 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2603 | 2592 |
2604 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub") | 2593 DECLARE_CONCRETE_INSTRUCTION(Sub) |
2605 | 2594 |
2606 protected: | 2595 protected: |
2607 virtual bool DataEquals(HValue* other) { return true; } | 2596 virtual bool DataEquals(HValue* other) { return true; } |
2608 | 2597 |
2609 virtual Range* InferRange(); | 2598 virtual Range* InferRange(); |
2610 }; | 2599 }; |
2611 | 2600 |
2612 | 2601 |
2613 class HMul: public HArithmeticBinaryOperation { | 2602 class HMul: public HArithmeticBinaryOperation { |
2614 public: | 2603 public: |
2615 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2604 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
2616 SetFlag(kCanOverflow); | 2605 SetFlag(kCanOverflow); |
2617 } | 2606 } |
2618 | 2607 |
2619 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2608 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2620 | 2609 |
2621 // Only commutative if it is certain that not two objects are multiplicated. | 2610 // Only commutative if it is certain that not two objects are multiplicated. |
2622 virtual bool IsCommutative() const { | 2611 virtual bool IsCommutative() const { |
2623 return !representation().IsTagged(); | 2612 return !representation().IsTagged(); |
2624 } | 2613 } |
2625 | 2614 |
2626 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul") | 2615 DECLARE_CONCRETE_INSTRUCTION(Mul) |
2627 | 2616 |
2628 protected: | 2617 protected: |
2629 virtual bool DataEquals(HValue* other) { return true; } | 2618 virtual bool DataEquals(HValue* other) { return true; } |
2630 | 2619 |
2631 virtual Range* InferRange(); | 2620 virtual Range* InferRange(); |
2632 }; | 2621 }; |
2633 | 2622 |
2634 | 2623 |
2635 class HMod: public HArithmeticBinaryOperation { | 2624 class HMod: public HArithmeticBinaryOperation { |
2636 public: | 2625 public: |
2637 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2626 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
2638 SetFlag(kCanBeDivByZero); | 2627 SetFlag(kCanBeDivByZero); |
2639 } | 2628 } |
2640 | 2629 |
2641 bool HasPowerOf2Divisor() { | 2630 bool HasPowerOf2Divisor() { |
2642 if (right()->IsConstant() && | 2631 if (right()->IsConstant() && |
2643 HConstant::cast(right())->HasInteger32Value()) { | 2632 HConstant::cast(right())->HasInteger32Value()) { |
2644 int32_t value = HConstant::cast(right())->Integer32Value(); | 2633 int32_t value = HConstant::cast(right())->Integer32Value(); |
2645 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); | 2634 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
2646 } | 2635 } |
2647 | 2636 |
2648 return false; | 2637 return false; |
2649 } | 2638 } |
2650 | 2639 |
2651 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2640 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2652 | 2641 |
2653 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") | 2642 DECLARE_CONCRETE_INSTRUCTION(Mod) |
2654 | 2643 |
2655 protected: | 2644 protected: |
2656 virtual bool DataEquals(HValue* other) { return true; } | 2645 virtual bool DataEquals(HValue* other) { return true; } |
2657 | 2646 |
2658 virtual Range* InferRange(); | 2647 virtual Range* InferRange(); |
2659 }; | 2648 }; |
2660 | 2649 |
2661 | 2650 |
2662 class HDiv: public HArithmeticBinaryOperation { | 2651 class HDiv: public HArithmeticBinaryOperation { |
2663 public: | 2652 public: |
2664 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2653 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
2665 SetFlag(kCanBeDivByZero); | 2654 SetFlag(kCanBeDivByZero); |
2666 SetFlag(kCanOverflow); | 2655 SetFlag(kCanOverflow); |
2667 } | 2656 } |
2668 | 2657 |
2669 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2658 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2670 | 2659 |
2671 DECLARE_CONCRETE_INSTRUCTION(Div, "div") | 2660 DECLARE_CONCRETE_INSTRUCTION(Div) |
2672 | 2661 |
2673 protected: | 2662 protected: |
2674 virtual bool DataEquals(HValue* other) { return true; } | 2663 virtual bool DataEquals(HValue* other) { return true; } |
2675 | 2664 |
2676 virtual Range* InferRange(); | 2665 virtual Range* InferRange(); |
2677 }; | 2666 }; |
2678 | 2667 |
2679 | 2668 |
2680 class HBitAnd: public HBitwiseBinaryOperation { | 2669 class HBitAnd: public HBitwiseBinaryOperation { |
2681 public: | 2670 public: |
2682 HBitAnd(HValue* left, HValue* right) | 2671 HBitAnd(HValue* left, HValue* right) |
2683 : HBitwiseBinaryOperation(left, right) { } | 2672 : HBitwiseBinaryOperation(left, right) { } |
2684 | 2673 |
2685 virtual bool IsCommutative() const { return true; } | 2674 virtual bool IsCommutative() const { return true; } |
2686 virtual HType CalculateInferredType(); | 2675 virtual HType CalculateInferredType(); |
2687 | 2676 |
2688 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and") | 2677 DECLARE_CONCRETE_INSTRUCTION(BitAnd) |
2689 | 2678 |
2690 protected: | 2679 protected: |
2691 virtual bool DataEquals(HValue* other) { return true; } | 2680 virtual bool DataEquals(HValue* other) { return true; } |
2692 | 2681 |
2693 virtual Range* InferRange(); | 2682 virtual Range* InferRange(); |
2694 }; | 2683 }; |
2695 | 2684 |
2696 | 2685 |
2697 class HBitXor: public HBitwiseBinaryOperation { | 2686 class HBitXor: public HBitwiseBinaryOperation { |
2698 public: | 2687 public: |
2699 HBitXor(HValue* left, HValue* right) | 2688 HBitXor(HValue* left, HValue* right) |
2700 : HBitwiseBinaryOperation(left, right) { } | 2689 : HBitwiseBinaryOperation(left, right) { } |
2701 | 2690 |
2702 virtual bool IsCommutative() const { return true; } | 2691 virtual bool IsCommutative() const { return true; } |
2703 virtual HType CalculateInferredType(); | 2692 virtual HType CalculateInferredType(); |
2704 | 2693 |
2705 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor") | 2694 DECLARE_CONCRETE_INSTRUCTION(BitXor) |
2706 | 2695 |
2707 protected: | 2696 protected: |
2708 virtual bool DataEquals(HValue* other) { return true; } | 2697 virtual bool DataEquals(HValue* other) { return true; } |
2709 }; | 2698 }; |
2710 | 2699 |
2711 | 2700 |
2712 class HBitOr: public HBitwiseBinaryOperation { | 2701 class HBitOr: public HBitwiseBinaryOperation { |
2713 public: | 2702 public: |
2714 HBitOr(HValue* left, HValue* right) | 2703 HBitOr(HValue* left, HValue* right) |
2715 : HBitwiseBinaryOperation(left, right) { } | 2704 : HBitwiseBinaryOperation(left, right) { } |
2716 | 2705 |
2717 virtual bool IsCommutative() const { return true; } | 2706 virtual bool IsCommutative() const { return true; } |
2718 virtual HType CalculateInferredType(); | 2707 virtual HType CalculateInferredType(); |
2719 | 2708 |
2720 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or") | 2709 DECLARE_CONCRETE_INSTRUCTION(BitOr) |
2721 | 2710 |
2722 protected: | 2711 protected: |
2723 virtual bool DataEquals(HValue* other) { return true; } | 2712 virtual bool DataEquals(HValue* other) { return true; } |
2724 | 2713 |
2725 virtual Range* InferRange(); | 2714 virtual Range* InferRange(); |
2726 }; | 2715 }; |
2727 | 2716 |
2728 | 2717 |
2729 class HShl: public HBitwiseBinaryOperation { | 2718 class HShl: public HBitwiseBinaryOperation { |
2730 public: | 2719 public: |
2731 HShl(HValue* left, HValue* right) | 2720 HShl(HValue* left, HValue* right) |
2732 : HBitwiseBinaryOperation(left, right) { } | 2721 : HBitwiseBinaryOperation(left, right) { } |
2733 | 2722 |
2734 virtual Range* InferRange(); | 2723 virtual Range* InferRange(); |
2735 virtual HType CalculateInferredType(); | 2724 virtual HType CalculateInferredType(); |
2736 | 2725 |
2737 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl") | 2726 DECLARE_CONCRETE_INSTRUCTION(Shl) |
2738 | 2727 |
2739 protected: | 2728 protected: |
2740 virtual bool DataEquals(HValue* other) { return true; } | 2729 virtual bool DataEquals(HValue* other) { return true; } |
2741 }; | 2730 }; |
2742 | 2731 |
2743 | 2732 |
2744 class HShr: public HBitwiseBinaryOperation { | 2733 class HShr: public HBitwiseBinaryOperation { |
2745 public: | 2734 public: |
2746 HShr(HValue* left, HValue* right) | 2735 HShr(HValue* left, HValue* right) |
2747 : HBitwiseBinaryOperation(left, right) { } | 2736 : HBitwiseBinaryOperation(left, right) { } |
2748 | 2737 |
2749 virtual HType CalculateInferredType(); | 2738 virtual HType CalculateInferredType(); |
2750 | 2739 |
2751 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr") | 2740 DECLARE_CONCRETE_INSTRUCTION(Shr) |
2752 | 2741 |
2753 protected: | 2742 protected: |
2754 virtual bool DataEquals(HValue* other) { return true; } | 2743 virtual bool DataEquals(HValue* other) { return true; } |
2755 }; | 2744 }; |
2756 | 2745 |
2757 | 2746 |
2758 class HSar: public HBitwiseBinaryOperation { | 2747 class HSar: public HBitwiseBinaryOperation { |
2759 public: | 2748 public: |
2760 HSar(HValue* left, HValue* right) | 2749 HSar(HValue* left, HValue* right) |
2761 : HBitwiseBinaryOperation(left, right) { } | 2750 : HBitwiseBinaryOperation(left, right) { } |
2762 | 2751 |
2763 virtual Range* InferRange(); | 2752 virtual Range* InferRange(); |
2764 virtual HType CalculateInferredType(); | 2753 virtual HType CalculateInferredType(); |
2765 | 2754 |
2766 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") | 2755 DECLARE_CONCRETE_INSTRUCTION(Sar) |
2767 | 2756 |
2768 protected: | 2757 protected: |
2769 virtual bool DataEquals(HValue* other) { return true; } | 2758 virtual bool DataEquals(HValue* other) { return true; } |
2770 }; | 2759 }; |
2771 | 2760 |
2772 | 2761 |
2773 class HOsrEntry: public HTemplateInstruction<0> { | 2762 class HOsrEntry: public HTemplateInstruction<0> { |
2774 public: | 2763 public: |
2775 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { | 2764 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { |
2776 SetFlag(kChangesOsrEntries); | 2765 SetFlag(kChangesOsrEntries); |
2777 } | 2766 } |
2778 | 2767 |
2779 int ast_id() const { return ast_id_; } | 2768 int ast_id() const { return ast_id_; } |
2780 | 2769 |
2781 virtual Representation RequiredInputRepresentation(int index) const { | 2770 virtual Representation RequiredInputRepresentation(int index) const { |
2782 return Representation::None(); | 2771 return Representation::None(); |
2783 } | 2772 } |
2784 | 2773 |
2785 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry") | 2774 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
2786 | 2775 |
2787 private: | 2776 private: |
2788 int ast_id_; | 2777 int ast_id_; |
2789 }; | 2778 }; |
2790 | 2779 |
2791 | 2780 |
2792 class HParameter: public HTemplateInstruction<0> { | 2781 class HParameter: public HTemplateInstruction<0> { |
2793 public: | 2782 public: |
2794 explicit HParameter(unsigned index) : index_(index) { | 2783 explicit HParameter(unsigned index) : index_(index) { |
2795 set_representation(Representation::Tagged()); | 2784 set_representation(Representation::Tagged()); |
2796 } | 2785 } |
2797 | 2786 |
2798 unsigned index() const { return index_; } | 2787 unsigned index() const { return index_; } |
2799 | 2788 |
2800 virtual void PrintDataTo(StringStream* stream); | 2789 virtual void PrintDataTo(StringStream* stream); |
2801 | 2790 |
2802 virtual Representation RequiredInputRepresentation(int index) const { | 2791 virtual Representation RequiredInputRepresentation(int index) const { |
2803 return Representation::None(); | 2792 return Representation::None(); |
2804 } | 2793 } |
2805 | 2794 |
2806 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") | 2795 DECLARE_CONCRETE_INSTRUCTION(Parameter) |
2807 | 2796 |
2808 private: | 2797 private: |
2809 unsigned index_; | 2798 unsigned index_; |
2810 }; | 2799 }; |
2811 | 2800 |
2812 | 2801 |
2813 class HCallStub: public HUnaryCall { | 2802 class HCallStub: public HUnaryCall { |
2814 public: | 2803 public: |
2815 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) | 2804 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) |
2816 : HUnaryCall(context, argument_count), | 2805 : HUnaryCall(context, argument_count), |
(...skipping 11 matching lines...) Expand all Loading... |
2828 TranscendentalCache::Type transcendental_type() { | 2817 TranscendentalCache::Type transcendental_type() { |
2829 return transcendental_type_; | 2818 return transcendental_type_; |
2830 } | 2819 } |
2831 | 2820 |
2832 virtual void PrintDataTo(StringStream* stream); | 2821 virtual void PrintDataTo(StringStream* stream); |
2833 | 2822 |
2834 virtual Representation RequiredInputRepresentation(int index) const { | 2823 virtual Representation RequiredInputRepresentation(int index) const { |
2835 return Representation::Tagged(); | 2824 return Representation::Tagged(); |
2836 } | 2825 } |
2837 | 2826 |
2838 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub") | 2827 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
2839 | 2828 |
2840 private: | 2829 private: |
2841 CodeStub::Major major_key_; | 2830 CodeStub::Major major_key_; |
2842 TranscendentalCache::Type transcendental_type_; | 2831 TranscendentalCache::Type transcendental_type_; |
2843 }; | 2832 }; |
2844 | 2833 |
2845 | 2834 |
2846 class HUnknownOSRValue: public HTemplateInstruction<0> { | 2835 class HUnknownOSRValue: public HTemplateInstruction<0> { |
2847 public: | 2836 public: |
2848 HUnknownOSRValue() { set_representation(Representation::Tagged()); } | 2837 HUnknownOSRValue() { set_representation(Representation::Tagged()); } |
2849 | 2838 |
2850 virtual Representation RequiredInputRepresentation(int index) const { | 2839 virtual Representation RequiredInputRepresentation(int index) const { |
2851 return Representation::None(); | 2840 return Representation::None(); |
2852 } | 2841 } |
2853 | 2842 |
2854 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") | 2843 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
2855 }; | 2844 }; |
2856 | 2845 |
2857 | 2846 |
2858 class HLoadGlobalCell: public HTemplateInstruction<0> { | 2847 class HLoadGlobalCell: public HTemplateInstruction<0> { |
2859 public: | 2848 public: |
2860 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) | 2849 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) |
2861 : cell_(cell), check_hole_value_(check_hole_value) { | 2850 : cell_(cell), check_hole_value_(check_hole_value) { |
2862 set_representation(Representation::Tagged()); | 2851 set_representation(Representation::Tagged()); |
2863 SetFlag(kUseGVN); | 2852 SetFlag(kUseGVN); |
2864 SetFlag(kDependsOnGlobalVars); | 2853 SetFlag(kDependsOnGlobalVars); |
2865 } | 2854 } |
2866 | 2855 |
2867 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2856 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
2868 bool check_hole_value() const { return check_hole_value_; } | 2857 bool check_hole_value() const { return check_hole_value_; } |
2869 | 2858 |
2870 virtual void PrintDataTo(StringStream* stream); | 2859 virtual void PrintDataTo(StringStream* stream); |
2871 | 2860 |
2872 virtual intptr_t Hashcode() { | 2861 virtual intptr_t Hashcode() { |
2873 ASSERT(!HEAP->allow_allocation(false)); | 2862 ASSERT(!HEAP->allow_allocation(false)); |
2874 return reinterpret_cast<intptr_t>(*cell_); | 2863 return reinterpret_cast<intptr_t>(*cell_); |
2875 } | 2864 } |
2876 | 2865 |
2877 virtual Representation RequiredInputRepresentation(int index) const { | 2866 virtual Representation RequiredInputRepresentation(int index) const { |
2878 return Representation::None(); | 2867 return Representation::None(); |
2879 } | 2868 } |
2880 | 2869 |
2881 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load_global_cell") | 2870 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
2882 | 2871 |
2883 protected: | 2872 protected: |
2884 virtual bool DataEquals(HValue* other) { | 2873 virtual bool DataEquals(HValue* other) { |
2885 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 2874 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
2886 return cell_.is_identical_to(b->cell()); | 2875 return cell_.is_identical_to(b->cell()); |
2887 } | 2876 } |
2888 | 2877 |
2889 private: | 2878 private: |
2890 Handle<JSGlobalPropertyCell> cell_; | 2879 Handle<JSGlobalPropertyCell> cell_; |
2891 bool check_hole_value_; | 2880 bool check_hole_value_; |
(...skipping 17 matching lines...) Expand all Loading... |
2909 HValue* global_object() { return OperandAt(1); } | 2898 HValue* global_object() { return OperandAt(1); } |
2910 Handle<Object> name() const { return name_; } | 2899 Handle<Object> name() const { return name_; } |
2911 bool for_typeof() const { return for_typeof_; } | 2900 bool for_typeof() const { return for_typeof_; } |
2912 | 2901 |
2913 virtual void PrintDataTo(StringStream* stream); | 2902 virtual void PrintDataTo(StringStream* stream); |
2914 | 2903 |
2915 virtual Representation RequiredInputRepresentation(int index) const { | 2904 virtual Representation RequiredInputRepresentation(int index) const { |
2916 return Representation::Tagged(); | 2905 return Representation::Tagged(); |
2917 } | 2906 } |
2918 | 2907 |
2919 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load_global_generic") | 2908 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
2920 | 2909 |
2921 private: | 2910 private: |
2922 Handle<Object> name_; | 2911 Handle<Object> name_; |
2923 bool for_typeof_; | 2912 bool for_typeof_; |
2924 }; | 2913 }; |
2925 | 2914 |
2926 | 2915 |
2927 class HStoreGlobalCell: public HUnaryOperation { | 2916 class HStoreGlobalCell: public HUnaryOperation { |
2928 public: | 2917 public: |
2929 HStoreGlobalCell(HValue* value, | 2918 HStoreGlobalCell(HValue* value, |
2930 Handle<JSGlobalPropertyCell> cell, | 2919 Handle<JSGlobalPropertyCell> cell, |
2931 bool check_hole_value) | 2920 bool check_hole_value) |
2932 : HUnaryOperation(value), | 2921 : HUnaryOperation(value), |
2933 cell_(cell), | 2922 cell_(cell), |
2934 check_hole_value_(check_hole_value) { | 2923 check_hole_value_(check_hole_value) { |
2935 SetFlag(kChangesGlobalVars); | 2924 SetFlag(kChangesGlobalVars); |
2936 } | 2925 } |
2937 | 2926 |
2938 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2927 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
2939 bool check_hole_value() const { return check_hole_value_; } | 2928 bool check_hole_value() const { return check_hole_value_; } |
2940 | 2929 |
2941 virtual Representation RequiredInputRepresentation(int index) const { | 2930 virtual Representation RequiredInputRepresentation(int index) const { |
2942 return Representation::Tagged(); | 2931 return Representation::Tagged(); |
2943 } | 2932 } |
2944 virtual void PrintDataTo(StringStream* stream); | 2933 virtual void PrintDataTo(StringStream* stream); |
2945 | 2934 |
2946 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store_global_cell") | 2935 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
2947 | 2936 |
2948 private: | 2937 private: |
2949 Handle<JSGlobalPropertyCell> cell_; | 2938 Handle<JSGlobalPropertyCell> cell_; |
2950 bool check_hole_value_; | 2939 bool check_hole_value_; |
2951 }; | 2940 }; |
2952 | 2941 |
2953 | 2942 |
2954 class HStoreGlobalGeneric: public HTemplateInstruction<3> { | 2943 class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
2955 public: | 2944 public: |
2956 HStoreGlobalGeneric(HValue* context, | 2945 HStoreGlobalGeneric(HValue* context, |
(...skipping 15 matching lines...) Expand all Loading... |
2972 Handle<Object> name() const { return name_; } | 2961 Handle<Object> name() const { return name_; } |
2973 HValue* value() { return OperandAt(2); } | 2962 HValue* value() { return OperandAt(2); } |
2974 bool strict_mode() { return strict_mode_; } | 2963 bool strict_mode() { return strict_mode_; } |
2975 | 2964 |
2976 virtual void PrintDataTo(StringStream* stream); | 2965 virtual void PrintDataTo(StringStream* stream); |
2977 | 2966 |
2978 virtual Representation RequiredInputRepresentation(int index) const { | 2967 virtual Representation RequiredInputRepresentation(int index) const { |
2979 return Representation::Tagged(); | 2968 return Representation::Tagged(); |
2980 } | 2969 } |
2981 | 2970 |
2982 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store_global_generic") | 2971 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) |
2983 | 2972 |
2984 private: | 2973 private: |
2985 Handle<Object> name_; | 2974 Handle<Object> name_; |
2986 bool strict_mode_; | 2975 bool strict_mode_; |
2987 }; | 2976 }; |
2988 | 2977 |
2989 | 2978 |
2990 class HLoadContextSlot: public HUnaryOperation { | 2979 class HLoadContextSlot: public HUnaryOperation { |
2991 public: | 2980 public: |
2992 HLoadContextSlot(HValue* context , int slot_index) | 2981 HLoadContextSlot(HValue* context , int slot_index) |
2993 : HUnaryOperation(context), slot_index_(slot_index) { | 2982 : HUnaryOperation(context), slot_index_(slot_index) { |
2994 set_representation(Representation::Tagged()); | 2983 set_representation(Representation::Tagged()); |
2995 SetFlag(kUseGVN); | 2984 SetFlag(kUseGVN); |
2996 SetFlag(kDependsOnContextSlots); | 2985 SetFlag(kDependsOnContextSlots); |
2997 } | 2986 } |
2998 | 2987 |
2999 int slot_index() const { return slot_index_; } | 2988 int slot_index() const { return slot_index_; } |
3000 | 2989 |
3001 virtual Representation RequiredInputRepresentation(int index) const { | 2990 virtual Representation RequiredInputRepresentation(int index) const { |
3002 return Representation::Tagged(); | 2991 return Representation::Tagged(); |
3003 } | 2992 } |
3004 | 2993 |
3005 virtual void PrintDataTo(StringStream* stream); | 2994 virtual void PrintDataTo(StringStream* stream); |
3006 | 2995 |
3007 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot") | 2996 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
3008 | 2997 |
3009 protected: | 2998 protected: |
3010 virtual bool DataEquals(HValue* other) { | 2999 virtual bool DataEquals(HValue* other) { |
3011 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 3000 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
3012 return (slot_index() == b->slot_index()); | 3001 return (slot_index() == b->slot_index()); |
3013 } | 3002 } |
3014 | 3003 |
3015 private: | 3004 private: |
3016 int slot_index_; | 3005 int slot_index_; |
3017 }; | 3006 }; |
(...skipping 19 matching lines...) Expand all Loading... |
3037 bool NeedsWriteBarrier() { | 3026 bool NeedsWriteBarrier() { |
3038 return StoringValueNeedsWriteBarrier(value()); | 3027 return StoringValueNeedsWriteBarrier(value()); |
3039 } | 3028 } |
3040 | 3029 |
3041 virtual Representation RequiredInputRepresentation(int index) const { | 3030 virtual Representation RequiredInputRepresentation(int index) const { |
3042 return Representation::Tagged(); | 3031 return Representation::Tagged(); |
3043 } | 3032 } |
3044 | 3033 |
3045 virtual void PrintDataTo(StringStream* stream); | 3034 virtual void PrintDataTo(StringStream* stream); |
3046 | 3035 |
3047 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store_context_slot") | 3036 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
3048 | 3037 |
3049 private: | 3038 private: |
3050 int slot_index_; | 3039 int slot_index_; |
3051 }; | 3040 }; |
3052 | 3041 |
3053 | 3042 |
3054 class HLoadNamedField: public HUnaryOperation { | 3043 class HLoadNamedField: public HUnaryOperation { |
3055 public: | 3044 public: |
3056 HLoadNamedField(HValue* object, bool is_in_object, int offset) | 3045 HLoadNamedField(HValue* object, bool is_in_object, int offset) |
3057 : HUnaryOperation(object), | 3046 : HUnaryOperation(object), |
(...skipping 11 matching lines...) Expand all Loading... |
3069 | 3058 |
3070 HValue* object() { return OperandAt(0); } | 3059 HValue* object() { return OperandAt(0); } |
3071 bool is_in_object() const { return is_in_object_; } | 3060 bool is_in_object() const { return is_in_object_; } |
3072 int offset() const { return offset_; } | 3061 int offset() const { return offset_; } |
3073 | 3062 |
3074 virtual Representation RequiredInputRepresentation(int index) const { | 3063 virtual Representation RequiredInputRepresentation(int index) const { |
3075 return Representation::Tagged(); | 3064 return Representation::Tagged(); |
3076 } | 3065 } |
3077 virtual void PrintDataTo(StringStream* stream); | 3066 virtual void PrintDataTo(StringStream* stream); |
3078 | 3067 |
3079 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load_named_field") | 3068 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
3080 | 3069 |
3081 protected: | 3070 protected: |
3082 virtual bool DataEquals(HValue* other) { | 3071 virtual bool DataEquals(HValue* other) { |
3083 HLoadNamedField* b = HLoadNamedField::cast(other); | 3072 HLoadNamedField* b = HLoadNamedField::cast(other); |
3084 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; | 3073 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; |
3085 } | 3074 } |
3086 | 3075 |
3087 private: | 3076 private: |
3088 bool is_in_object_; | 3077 bool is_in_object_; |
3089 int offset_; | 3078 int offset_; |
3090 }; | 3079 }; |
3091 | 3080 |
3092 | 3081 |
3093 class HLoadNamedFieldPolymorphic: public HUnaryOperation { | 3082 class HLoadNamedFieldPolymorphic: public HUnaryOperation { |
3094 public: | 3083 public: |
3095 HLoadNamedFieldPolymorphic(HValue* object, | 3084 HLoadNamedFieldPolymorphic(HValue* object, |
3096 ZoneMapList* types, | 3085 ZoneMapList* types, |
3097 Handle<String> name); | 3086 Handle<String> name); |
3098 | 3087 |
3099 HValue* object() { return OperandAt(0); } | 3088 HValue* object() { return OperandAt(0); } |
3100 ZoneMapList* types() { return &types_; } | 3089 ZoneMapList* types() { return &types_; } |
3101 Handle<String> name() { return name_; } | 3090 Handle<String> name() { return name_; } |
3102 bool need_generic() { return need_generic_; } | 3091 bool need_generic() { return need_generic_; } |
3103 | 3092 |
3104 virtual Representation RequiredInputRepresentation(int index) const { | 3093 virtual Representation RequiredInputRepresentation(int index) const { |
3105 return Representation::Tagged(); | 3094 return Representation::Tagged(); |
3106 } | 3095 } |
3107 | 3096 |
3108 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic, | 3097 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) |
3109 "load_named_field_polymorphic") | |
3110 | 3098 |
3111 static const int kMaxLoadPolymorphism = 4; | 3099 static const int kMaxLoadPolymorphism = 4; |
3112 | 3100 |
3113 protected: | 3101 protected: |
3114 virtual bool DataEquals(HValue* value); | 3102 virtual bool DataEquals(HValue* value); |
3115 | 3103 |
3116 private: | 3104 private: |
3117 ZoneMapList types_; | 3105 ZoneMapList types_; |
3118 Handle<String> name_; | 3106 Handle<String> name_; |
3119 bool need_generic_; | 3107 bool need_generic_; |
(...skipping 10 matching lines...) Expand all Loading... |
3130 } | 3118 } |
3131 | 3119 |
3132 HValue* context() { return OperandAt(0); } | 3120 HValue* context() { return OperandAt(0); } |
3133 HValue* object() { return OperandAt(1); } | 3121 HValue* object() { return OperandAt(1); } |
3134 Handle<Object> name() const { return name_; } | 3122 Handle<Object> name() const { return name_; } |
3135 | 3123 |
3136 virtual Representation RequiredInputRepresentation(int index) const { | 3124 virtual Representation RequiredInputRepresentation(int index) const { |
3137 return Representation::Tagged(); | 3125 return Representation::Tagged(); |
3138 } | 3126 } |
3139 | 3127 |
3140 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic") | 3128 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
3141 | 3129 |
3142 private: | 3130 private: |
3143 Handle<Object> name_; | 3131 Handle<Object> name_; |
3144 }; | 3132 }; |
3145 | 3133 |
3146 | 3134 |
3147 class HLoadFunctionPrototype: public HUnaryOperation { | 3135 class HLoadFunctionPrototype: public HUnaryOperation { |
3148 public: | 3136 public: |
3149 explicit HLoadFunctionPrototype(HValue* function) | 3137 explicit HLoadFunctionPrototype(HValue* function) |
3150 : HUnaryOperation(function) { | 3138 : HUnaryOperation(function) { |
3151 set_representation(Representation::Tagged()); | 3139 set_representation(Representation::Tagged()); |
3152 SetFlag(kUseGVN); | 3140 SetFlag(kUseGVN); |
3153 SetFlag(kDependsOnCalls); | 3141 SetFlag(kDependsOnCalls); |
3154 } | 3142 } |
3155 | 3143 |
3156 HValue* function() { return OperandAt(0); } | 3144 HValue* function() { return OperandAt(0); } |
3157 | 3145 |
3158 virtual Representation RequiredInputRepresentation(int index) const { | 3146 virtual Representation RequiredInputRepresentation(int index) const { |
3159 return Representation::Tagged(); | 3147 return Representation::Tagged(); |
3160 } | 3148 } |
3161 | 3149 |
3162 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") | 3150 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
3163 | 3151 |
3164 protected: | 3152 protected: |
3165 virtual bool DataEquals(HValue* other) { return true; } | 3153 virtual bool DataEquals(HValue* other) { return true; } |
3166 }; | 3154 }; |
3167 | 3155 |
3168 | 3156 |
3169 class HLoadKeyedFastElement: public HBinaryOperation { | 3157 class HLoadKeyedFastElement: public HBinaryOperation { |
3170 public: | 3158 public: |
3171 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { | 3159 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { |
3172 set_representation(Representation::Tagged()); | 3160 set_representation(Representation::Tagged()); |
3173 SetFlag(kDependsOnArrayElements); | 3161 SetFlag(kDependsOnArrayElements); |
3174 SetFlag(kUseGVN); | 3162 SetFlag(kUseGVN); |
3175 } | 3163 } |
3176 | 3164 |
3177 HValue* object() { return OperandAt(0); } | 3165 HValue* object() { return OperandAt(0); } |
3178 HValue* key() { return OperandAt(1); } | 3166 HValue* key() { return OperandAt(1); } |
3179 | 3167 |
3180 virtual Representation RequiredInputRepresentation(int index) const { | 3168 virtual Representation RequiredInputRepresentation(int index) const { |
3181 // The key is supposed to be Integer32. | 3169 // The key is supposed to be Integer32. |
3182 return (index == 1) ? Representation::Integer32() | 3170 return (index == 1) ? Representation::Integer32() |
3183 : Representation::Tagged(); | 3171 : Representation::Tagged(); |
3184 } | 3172 } |
3185 | 3173 |
3186 virtual void PrintDataTo(StringStream* stream); | 3174 virtual void PrintDataTo(StringStream* stream); |
3187 | 3175 |
3188 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, | 3176 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
3189 "load_keyed_fast_element") | |
3190 | 3177 |
3191 protected: | 3178 protected: |
3192 virtual bool DataEquals(HValue* other) { return true; } | 3179 virtual bool DataEquals(HValue* other) { return true; } |
3193 }; | 3180 }; |
3194 | 3181 |
3195 | 3182 |
3196 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { | 3183 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { |
3197 public: | 3184 public: |
3198 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 3185 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
3199 HValue* key, | 3186 HValue* key, |
(...skipping 17 matching lines...) Expand all Loading... |
3217 // The key is supposed to be Integer32, but the base pointer | 3204 // The key is supposed to be Integer32, but the base pointer |
3218 // for the element load is a naked pointer. | 3205 // for the element load is a naked pointer. |
3219 return (index == 1) ? Representation::Integer32() | 3206 return (index == 1) ? Representation::Integer32() |
3220 : Representation::External(); | 3207 : Representation::External(); |
3221 } | 3208 } |
3222 | 3209 |
3223 HValue* external_pointer() { return OperandAt(0); } | 3210 HValue* external_pointer() { return OperandAt(0); } |
3224 HValue* key() { return OperandAt(1); } | 3211 HValue* key() { return OperandAt(1); } |
3225 ExternalArrayType array_type() const { return array_type_; } | 3212 ExternalArrayType array_type() const { return array_type_; } |
3226 | 3213 |
3227 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement, | 3214 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) |
3228 "load_keyed_specialized_array_element") | |
3229 | 3215 |
3230 protected: | 3216 protected: |
3231 virtual bool DataEquals(HValue* other) { | 3217 virtual bool DataEquals(HValue* other) { |
3232 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; | 3218 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; |
3233 HLoadKeyedSpecializedArrayElement* cast_other = | 3219 HLoadKeyedSpecializedArrayElement* cast_other = |
3234 HLoadKeyedSpecializedArrayElement::cast(other); | 3220 HLoadKeyedSpecializedArrayElement::cast(other); |
3235 return array_type_ == cast_other->array_type(); | 3221 return array_type_ == cast_other->array_type(); |
3236 } | 3222 } |
3237 | 3223 |
3238 private: | 3224 private: |
(...skipping 14 matching lines...) Expand all Loading... |
3253 HValue* object() { return OperandAt(0); } | 3239 HValue* object() { return OperandAt(0); } |
3254 HValue* key() { return OperandAt(1); } | 3240 HValue* key() { return OperandAt(1); } |
3255 HValue* context() { return OperandAt(2); } | 3241 HValue* context() { return OperandAt(2); } |
3256 | 3242 |
3257 virtual void PrintDataTo(StringStream* stream); | 3243 virtual void PrintDataTo(StringStream* stream); |
3258 | 3244 |
3259 virtual Representation RequiredInputRepresentation(int index) const { | 3245 virtual Representation RequiredInputRepresentation(int index) const { |
3260 return Representation::Tagged(); | 3246 return Representation::Tagged(); |
3261 } | 3247 } |
3262 | 3248 |
3263 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") | 3249 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
3264 }; | 3250 }; |
3265 | 3251 |
3266 | 3252 |
3267 class HStoreNamedField: public HBinaryOperation { | 3253 class HStoreNamedField: public HBinaryOperation { |
3268 public: | 3254 public: |
3269 HStoreNamedField(HValue* obj, | 3255 HStoreNamedField(HValue* obj, |
3270 Handle<String> name, | 3256 Handle<String> name, |
3271 HValue* val, | 3257 HValue* val, |
3272 bool in_object, | 3258 bool in_object, |
3273 int offset) | 3259 int offset) |
3274 : HBinaryOperation(obj, val), | 3260 : HBinaryOperation(obj, val), |
3275 name_(name), | 3261 name_(name), |
3276 is_in_object_(in_object), | 3262 is_in_object_(in_object), |
3277 offset_(offset) { | 3263 offset_(offset) { |
3278 if (is_in_object_) { | 3264 if (is_in_object_) { |
3279 SetFlag(kChangesInobjectFields); | 3265 SetFlag(kChangesInobjectFields); |
3280 } else { | 3266 } else { |
3281 SetFlag(kChangesBackingStoreFields); | 3267 SetFlag(kChangesBackingStoreFields); |
3282 } | 3268 } |
3283 } | 3269 } |
3284 | 3270 |
3285 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") | 3271 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
3286 | 3272 |
3287 virtual Representation RequiredInputRepresentation(int index) const { | 3273 virtual Representation RequiredInputRepresentation(int index) const { |
3288 return Representation::Tagged(); | 3274 return Representation::Tagged(); |
3289 } | 3275 } |
3290 virtual void PrintDataTo(StringStream* stream); | 3276 virtual void PrintDataTo(StringStream* stream); |
3291 | 3277 |
3292 HValue* object() { return OperandAt(0); } | 3278 HValue* object() { return OperandAt(0); } |
3293 HValue* value() { return OperandAt(1); } | 3279 HValue* value() { return OperandAt(1); } |
3294 | 3280 |
3295 Handle<String> name() const { return name_; } | 3281 Handle<String> name() const { return name_; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3330 HValue* context() { return OperandAt(2); } | 3316 HValue* context() { return OperandAt(2); } |
3331 Handle<String> name() { return name_; } | 3317 Handle<String> name() { return name_; } |
3332 bool strict_mode() { return strict_mode_; } | 3318 bool strict_mode() { return strict_mode_; } |
3333 | 3319 |
3334 virtual void PrintDataTo(StringStream* stream); | 3320 virtual void PrintDataTo(StringStream* stream); |
3335 | 3321 |
3336 virtual Representation RequiredInputRepresentation(int index) const { | 3322 virtual Representation RequiredInputRepresentation(int index) const { |
3337 return Representation::Tagged(); | 3323 return Representation::Tagged(); |
3338 } | 3324 } |
3339 | 3325 |
3340 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic") | 3326 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) |
3341 | 3327 |
3342 private: | 3328 private: |
3343 Handle<String> name_; | 3329 Handle<String> name_; |
3344 bool strict_mode_; | 3330 bool strict_mode_; |
3345 }; | 3331 }; |
3346 | 3332 |
3347 | 3333 |
3348 class HStoreKeyedFastElement: public HTemplateInstruction<3> { | 3334 class HStoreKeyedFastElement: public HTemplateInstruction<3> { |
3349 public: | 3335 public: |
3350 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { | 3336 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { |
(...skipping 12 matching lines...) Expand all Loading... |
3363 HValue* object() { return OperandAt(0); } | 3349 HValue* object() { return OperandAt(0); } |
3364 HValue* key() { return OperandAt(1); } | 3350 HValue* key() { return OperandAt(1); } |
3365 HValue* value() { return OperandAt(2); } | 3351 HValue* value() { return OperandAt(2); } |
3366 | 3352 |
3367 bool NeedsWriteBarrier() { | 3353 bool NeedsWriteBarrier() { |
3368 return StoringValueNeedsWriteBarrier(value()); | 3354 return StoringValueNeedsWriteBarrier(value()); |
3369 } | 3355 } |
3370 | 3356 |
3371 virtual void PrintDataTo(StringStream* stream); | 3357 virtual void PrintDataTo(StringStream* stream); |
3372 | 3358 |
3373 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, | 3359 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) |
3374 "store_keyed_fast_element") | |
3375 }; | 3360 }; |
3376 | 3361 |
3377 | 3362 |
3378 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { | 3363 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { |
3379 public: | 3364 public: |
3380 HStoreKeyedSpecializedArrayElement(HValue* external_elements, | 3365 HStoreKeyedSpecializedArrayElement(HValue* external_elements, |
3381 HValue* key, | 3366 HValue* key, |
3382 HValue* val, | 3367 HValue* val, |
3383 ExternalArrayType array_type) | 3368 ExternalArrayType array_type) |
3384 : array_type_(array_type) { | 3369 : array_type_(array_type) { |
(...skipping 15 matching lines...) Expand all Loading... |
3400 return Representation::Integer32(); | 3385 return Representation::Integer32(); |
3401 } | 3386 } |
3402 } | 3387 } |
3403 } | 3388 } |
3404 | 3389 |
3405 HValue* external_pointer() { return OperandAt(0); } | 3390 HValue* external_pointer() { return OperandAt(0); } |
3406 HValue* key() { return OperandAt(1); } | 3391 HValue* key() { return OperandAt(1); } |
3407 HValue* value() { return OperandAt(2); } | 3392 HValue* value() { return OperandAt(2); } |
3408 ExternalArrayType array_type() const { return array_type_; } | 3393 ExternalArrayType array_type() const { return array_type_; } |
3409 | 3394 |
3410 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement, | 3395 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement) |
3411 "store_keyed_specialized_array_element") | 3396 |
3412 private: | 3397 private: |
3413 ExternalArrayType array_type_; | 3398 ExternalArrayType array_type_; |
3414 }; | 3399 }; |
3415 | 3400 |
3416 | 3401 |
3417 class HStoreKeyedGeneric: public HTemplateInstruction<4> { | 3402 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
3418 public: | 3403 public: |
3419 HStoreKeyedGeneric(HValue* context, | 3404 HStoreKeyedGeneric(HValue* context, |
3420 HValue* object, | 3405 HValue* object, |
3421 HValue* key, | 3406 HValue* key, |
(...skipping 12 matching lines...) Expand all Loading... |
3434 HValue* value() { return OperandAt(2); } | 3419 HValue* value() { return OperandAt(2); } |
3435 HValue* context() { return OperandAt(3); } | 3420 HValue* context() { return OperandAt(3); } |
3436 bool strict_mode() { return strict_mode_; } | 3421 bool strict_mode() { return strict_mode_; } |
3437 | 3422 |
3438 virtual Representation RequiredInputRepresentation(int index) const { | 3423 virtual Representation RequiredInputRepresentation(int index) const { |
3439 return Representation::Tagged(); | 3424 return Representation::Tagged(); |
3440 } | 3425 } |
3441 | 3426 |
3442 virtual void PrintDataTo(StringStream* stream); | 3427 virtual void PrintDataTo(StringStream* stream); |
3443 | 3428 |
3444 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") | 3429 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
3445 | 3430 |
3446 private: | 3431 private: |
3447 bool strict_mode_; | 3432 bool strict_mode_; |
3448 }; | 3433 }; |
3449 | 3434 |
3450 | 3435 |
3451 class HStringAdd: public HBinaryOperation { | 3436 class HStringAdd: public HBinaryOperation { |
3452 public: | 3437 public: |
3453 HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { | 3438 HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { |
3454 set_representation(Representation::Tagged()); | 3439 set_representation(Representation::Tagged()); |
3455 SetFlag(kUseGVN); | 3440 SetFlag(kUseGVN); |
3456 SetFlag(kDependsOnMaps); | 3441 SetFlag(kDependsOnMaps); |
3457 } | 3442 } |
3458 | 3443 |
3459 virtual Representation RequiredInputRepresentation(int index) const { | 3444 virtual Representation RequiredInputRepresentation(int index) const { |
3460 return Representation::Tagged(); | 3445 return Representation::Tagged(); |
3461 } | 3446 } |
3462 | 3447 |
3463 virtual HType CalculateInferredType() { | 3448 virtual HType CalculateInferredType() { |
3464 return HType::String(); | 3449 return HType::String(); |
3465 } | 3450 } |
3466 | 3451 |
3467 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string_add") | 3452 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
3468 | 3453 |
3469 protected: | 3454 protected: |
3470 virtual bool DataEquals(HValue* other) { return true; } | 3455 virtual bool DataEquals(HValue* other) { return true; } |
3471 }; | 3456 }; |
3472 | 3457 |
3473 | 3458 |
3474 class HStringCharCodeAt: public HBinaryOperation { | 3459 class HStringCharCodeAt: public HBinaryOperation { |
3475 public: | 3460 public: |
3476 HStringCharCodeAt(HValue* string, HValue* index) | 3461 HStringCharCodeAt(HValue* string, HValue* index) |
3477 : HBinaryOperation(string, index) { | 3462 : HBinaryOperation(string, index) { |
3478 set_representation(Representation::Integer32()); | 3463 set_representation(Representation::Integer32()); |
3479 SetFlag(kUseGVN); | 3464 SetFlag(kUseGVN); |
3480 SetFlag(kDependsOnMaps); | 3465 SetFlag(kDependsOnMaps); |
3481 } | 3466 } |
3482 | 3467 |
3483 virtual Representation RequiredInputRepresentation(int index) const { | 3468 virtual Representation RequiredInputRepresentation(int index) const { |
3484 // The index is supposed to be Integer32. | 3469 // The index is supposed to be Integer32. |
3485 return (index == 1) ? Representation::Integer32() | 3470 return (index == 1) ? Representation::Integer32() |
3486 : Representation::Tagged(); | 3471 : Representation::Tagged(); |
3487 } | 3472 } |
3488 | 3473 |
3489 HValue* string() { return OperandAt(0); } | 3474 HValue* string() { return OperandAt(0); } |
3490 HValue* index() { return OperandAt(1); } | 3475 HValue* index() { return OperandAt(1); } |
3491 | 3476 |
3492 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at") | 3477 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
3493 | 3478 |
3494 protected: | 3479 protected: |
3495 virtual bool DataEquals(HValue* other) { return true; } | 3480 virtual bool DataEquals(HValue* other) { return true; } |
3496 | 3481 |
3497 virtual Range* InferRange() { | 3482 virtual Range* InferRange() { |
3498 return new Range(0, String::kMaxUC16CharCode); | 3483 return new Range(0, String::kMaxUC16CharCode); |
3499 } | 3484 } |
3500 }; | 3485 }; |
3501 | 3486 |
3502 | 3487 |
3503 class HStringCharFromCode: public HUnaryOperation { | 3488 class HStringCharFromCode: public HUnaryOperation { |
3504 public: | 3489 public: |
3505 explicit HStringCharFromCode(HValue* char_code) : HUnaryOperation(char_code) { | 3490 explicit HStringCharFromCode(HValue* char_code) : HUnaryOperation(char_code) { |
3506 set_representation(Representation::Tagged()); | 3491 set_representation(Representation::Tagged()); |
3507 SetFlag(kUseGVN); | 3492 SetFlag(kUseGVN); |
3508 } | 3493 } |
3509 | 3494 |
3510 virtual Representation RequiredInputRepresentation(int index) const { | 3495 virtual Representation RequiredInputRepresentation(int index) const { |
3511 return Representation::Integer32(); | 3496 return Representation::Integer32(); |
3512 } | 3497 } |
3513 | 3498 |
3514 virtual bool DataEquals(HValue* other) { return true; } | 3499 virtual bool DataEquals(HValue* other) { return true; } |
3515 | 3500 |
3516 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string_char_from_code") | 3501 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
3517 }; | 3502 }; |
3518 | 3503 |
3519 | 3504 |
3520 class HStringLength: public HUnaryOperation { | 3505 class HStringLength: public HUnaryOperation { |
3521 public: | 3506 public: |
3522 explicit HStringLength(HValue* string) : HUnaryOperation(string) { | 3507 explicit HStringLength(HValue* string) : HUnaryOperation(string) { |
3523 set_representation(Representation::Tagged()); | 3508 set_representation(Representation::Tagged()); |
3524 SetFlag(kUseGVN); | 3509 SetFlag(kUseGVN); |
3525 SetFlag(kDependsOnMaps); | 3510 SetFlag(kDependsOnMaps); |
3526 } | 3511 } |
3527 | 3512 |
3528 virtual Representation RequiredInputRepresentation(int index) const { | 3513 virtual Representation RequiredInputRepresentation(int index) const { |
3529 return Representation::Tagged(); | 3514 return Representation::Tagged(); |
3530 } | 3515 } |
3531 | 3516 |
3532 virtual HType CalculateInferredType() { | 3517 virtual HType CalculateInferredType() { |
3533 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 3518 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
3534 return HType::Smi(); | 3519 return HType::Smi(); |
3535 } | 3520 } |
3536 | 3521 |
3537 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length") | 3522 DECLARE_CONCRETE_INSTRUCTION(StringLength) |
3538 | 3523 |
3539 protected: | 3524 protected: |
3540 virtual bool DataEquals(HValue* other) { return true; } | 3525 virtual bool DataEquals(HValue* other) { return true; } |
3541 | 3526 |
3542 virtual Range* InferRange() { | 3527 virtual Range* InferRange() { |
3543 return new Range(0, String::kMaxLength); | 3528 return new Range(0, String::kMaxLength); |
3544 } | 3529 } |
3545 }; | 3530 }; |
3546 | 3531 |
3547 | 3532 |
(...skipping 26 matching lines...) Expand all Loading... |
3574 | 3559 |
3575 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 3560 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
3576 int length() const { return length_; } | 3561 int length() const { return length_; } |
3577 | 3562 |
3578 bool IsCopyOnWrite() const; | 3563 bool IsCopyOnWrite() const; |
3579 | 3564 |
3580 virtual Representation RequiredInputRepresentation(int index) const { | 3565 virtual Representation RequiredInputRepresentation(int index) const { |
3581 return Representation::None(); | 3566 return Representation::None(); |
3582 } | 3567 } |
3583 | 3568 |
3584 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal") | 3569 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
3585 | 3570 |
3586 private: | 3571 private: |
3587 int length_; | 3572 int length_; |
3588 Handle<FixedArray> constant_elements_; | 3573 Handle<FixedArray> constant_elements_; |
3589 }; | 3574 }; |
3590 | 3575 |
3591 | 3576 |
3592 class HObjectLiteral: public HMaterializedLiteral<1> { | 3577 class HObjectLiteral: public HMaterializedLiteral<1> { |
3593 public: | 3578 public: |
3594 HObjectLiteral(HValue* context, | 3579 HObjectLiteral(HValue* context, |
(...skipping 13 matching lines...) Expand all Loading... |
3608 Handle<FixedArray> constant_properties() const { | 3593 Handle<FixedArray> constant_properties() const { |
3609 return constant_properties_; | 3594 return constant_properties_; |
3610 } | 3595 } |
3611 bool fast_elements() const { return fast_elements_; } | 3596 bool fast_elements() const { return fast_elements_; } |
3612 bool has_function() const { return has_function_; } | 3597 bool has_function() const { return has_function_; } |
3613 | 3598 |
3614 virtual Representation RequiredInputRepresentation(int index) const { | 3599 virtual Representation RequiredInputRepresentation(int index) const { |
3615 return Representation::Tagged(); | 3600 return Representation::Tagged(); |
3616 } | 3601 } |
3617 | 3602 |
3618 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal") | 3603 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) |
3619 | 3604 |
3620 private: | 3605 private: |
3621 Handle<FixedArray> constant_properties_; | 3606 Handle<FixedArray> constant_properties_; |
3622 bool fast_elements_; | 3607 bool fast_elements_; |
3623 bool has_function_; | 3608 bool has_function_; |
3624 }; | 3609 }; |
3625 | 3610 |
3626 | 3611 |
3627 class HRegExpLiteral: public HMaterializedLiteral<0> { | 3612 class HRegExpLiteral: public HMaterializedLiteral<0> { |
3628 public: | 3613 public: |
3629 HRegExpLiteral(Handle<String> pattern, | 3614 HRegExpLiteral(Handle<String> pattern, |
3630 Handle<String> flags, | 3615 Handle<String> flags, |
3631 int literal_index) | 3616 int literal_index) |
3632 : HMaterializedLiteral<0>(literal_index, 0), | 3617 : HMaterializedLiteral<0>(literal_index, 0), |
3633 pattern_(pattern), | 3618 pattern_(pattern), |
3634 flags_(flags) { } | 3619 flags_(flags) { } |
3635 | 3620 |
3636 Handle<String> pattern() { return pattern_; } | 3621 Handle<String> pattern() { return pattern_; } |
3637 Handle<String> flags() { return flags_; } | 3622 Handle<String> flags() { return flags_; } |
3638 | 3623 |
3639 virtual Representation RequiredInputRepresentation(int index) const { | 3624 virtual Representation RequiredInputRepresentation(int index) const { |
3640 return Representation::None(); | 3625 return Representation::None(); |
3641 } | 3626 } |
3642 | 3627 |
3643 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp_literal") | 3628 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
3644 | 3629 |
3645 private: | 3630 private: |
3646 Handle<String> pattern_; | 3631 Handle<String> pattern_; |
3647 Handle<String> flags_; | 3632 Handle<String> flags_; |
3648 }; | 3633 }; |
3649 | 3634 |
3650 | 3635 |
3651 class HFunctionLiteral: public HTemplateInstruction<0> { | 3636 class HFunctionLiteral: public HTemplateInstruction<0> { |
3652 public: | 3637 public: |
3653 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) | 3638 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) |
3654 : shared_info_(shared), pretenure_(pretenure) { | 3639 : shared_info_(shared), pretenure_(pretenure) { |
3655 set_representation(Representation::Tagged()); | 3640 set_representation(Representation::Tagged()); |
3656 } | 3641 } |
3657 | 3642 |
3658 virtual Representation RequiredInputRepresentation(int index) const { | 3643 virtual Representation RequiredInputRepresentation(int index) const { |
3659 return Representation::None(); | 3644 return Representation::None(); |
3660 } | 3645 } |
3661 | 3646 |
3662 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function_literal") | 3647 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
3663 | 3648 |
3664 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 3649 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
3665 bool pretenure() const { return pretenure_; } | 3650 bool pretenure() const { return pretenure_; } |
3666 | 3651 |
3667 private: | 3652 private: |
3668 Handle<SharedFunctionInfo> shared_info_; | 3653 Handle<SharedFunctionInfo> shared_info_; |
3669 bool pretenure_; | 3654 bool pretenure_; |
3670 }; | 3655 }; |
3671 | 3656 |
3672 | 3657 |
3673 class HTypeof: public HUnaryOperation { | 3658 class HTypeof: public HUnaryOperation { |
3674 public: | 3659 public: |
3675 explicit HTypeof(HValue* value) : HUnaryOperation(value) { | 3660 explicit HTypeof(HValue* value) : HUnaryOperation(value) { |
3676 set_representation(Representation::Tagged()); | 3661 set_representation(Representation::Tagged()); |
3677 } | 3662 } |
3678 | 3663 |
3679 virtual Representation RequiredInputRepresentation(int index) const { | 3664 virtual Representation RequiredInputRepresentation(int index) const { |
3680 return Representation::Tagged(); | 3665 return Representation::Tagged(); |
3681 } | 3666 } |
3682 | 3667 |
3683 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") | 3668 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
3684 }; | 3669 }; |
3685 | 3670 |
3686 | 3671 |
3687 class HToFastProperties: public HUnaryOperation { | 3672 class HToFastProperties: public HUnaryOperation { |
3688 public: | 3673 public: |
3689 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 3674 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
3690 // This instruction is not marked as having side effects, but | 3675 // This instruction is not marked as having side effects, but |
3691 // changes the map of the input operand. Use it only when creating | 3676 // changes the map of the input operand. Use it only when creating |
3692 // object literals. | 3677 // object literals. |
3693 ASSERT(value->IsObjectLiteral()); | 3678 ASSERT(value->IsObjectLiteral()); |
3694 set_representation(Representation::Tagged()); | 3679 set_representation(Representation::Tagged()); |
3695 } | 3680 } |
3696 | 3681 |
3697 virtual Representation RequiredInputRepresentation(int index) const { | 3682 virtual Representation RequiredInputRepresentation(int index) const { |
3698 return Representation::Tagged(); | 3683 return Representation::Tagged(); |
3699 } | 3684 } |
3700 | 3685 |
3701 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to_fast_properties") | 3686 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
3702 }; | 3687 }; |
3703 | 3688 |
3704 | 3689 |
3705 class HValueOf: public HUnaryOperation { | 3690 class HValueOf: public HUnaryOperation { |
3706 public: | 3691 public: |
3707 explicit HValueOf(HValue* value) : HUnaryOperation(value) { | 3692 explicit HValueOf(HValue* value) : HUnaryOperation(value) { |
3708 set_representation(Representation::Tagged()); | 3693 set_representation(Representation::Tagged()); |
3709 } | 3694 } |
3710 | 3695 |
3711 virtual Representation RequiredInputRepresentation(int index) const { | 3696 virtual Representation RequiredInputRepresentation(int index) const { |
3712 return Representation::Tagged(); | 3697 return Representation::Tagged(); |
3713 } | 3698 } |
3714 | 3699 |
3715 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value_of") | 3700 DECLARE_CONCRETE_INSTRUCTION(ValueOf) |
3716 }; | 3701 }; |
3717 | 3702 |
3718 | 3703 |
3719 class HDeleteProperty: public HBinaryOperation { | 3704 class HDeleteProperty: public HBinaryOperation { |
3720 public: | 3705 public: |
3721 HDeleteProperty(HValue* obj, HValue* key) | 3706 HDeleteProperty(HValue* obj, HValue* key) |
3722 : HBinaryOperation(obj, key) { | 3707 : HBinaryOperation(obj, key) { |
3723 set_representation(Representation::Tagged()); | 3708 set_representation(Representation::Tagged()); |
3724 SetAllSideEffects(); | 3709 SetAllSideEffects(); |
3725 } | 3710 } |
3726 | 3711 |
3727 virtual Representation RequiredInputRepresentation(int index) const { | 3712 virtual Representation RequiredInputRepresentation(int index) const { |
3728 return Representation::Tagged(); | 3713 return Representation::Tagged(); |
3729 } | 3714 } |
3730 | 3715 |
3731 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete_property") | 3716 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) |
3732 | 3717 |
3733 HValue* object() { return left(); } | 3718 HValue* object() { return left(); } |
3734 HValue* key() { return right(); } | 3719 HValue* key() { return right(); } |
3735 }; | 3720 }; |
3736 | 3721 |
3737 #undef DECLARE_INSTRUCTION | 3722 #undef DECLARE_INSTRUCTION |
3738 #undef DECLARE_CONCRETE_INSTRUCTION | 3723 #undef DECLARE_CONCRETE_INSTRUCTION |
3739 | 3724 |
3740 } } // namespace v8::internal | 3725 } } // namespace v8::internal |
3741 | 3726 |
3742 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3727 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |