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