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

Side by Side Diff: src/hydrogen-instructions.h

Issue 6597029: [Isolates] Merge r 6300:6500 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 27 matching lines...) Expand all
39 // Forward declarations. 39 // Forward declarations.
40 class HBasicBlock; 40 class HBasicBlock;
41 class HEnvironment; 41 class HEnvironment;
42 class HInstruction; 42 class HInstruction;
43 class HLoopInformation; 43 class HLoopInformation;
44 class HValue; 44 class HValue;
45 class LInstruction; 45 class LInstruction;
46 class LChunkBuilder; 46 class LChunkBuilder;
47 47
48 48
49 // Type hierarchy:
50 //
51 // HValue
52 // HInstruction
53 // HAccessArgumentsAt
54 // HApplyArguments
55 // HArgumentsElements
56 // HArgumentsLength
57 // HArgumentsObject
58 // HBinaryOperation
59 // HArithmeticBinaryOperation
60 // HAdd
61 // HDiv
62 // HMod
63 // HMul
64 // HSub
65 // HBitwiseBinaryOperation
66 // HBitAnd
67 // HBitOr
68 // HBitXor
69 // HSar
70 // HShl
71 // HShr
72 // HBoundsCheck
73 // HCompare
74 // HCompareJSObjectEq
75 // HInstanceOf
76 // HInstanceOfKnownGlobal
77 // HLoadKeyed
78 // HLoadKeyedFastElement
79 // HLoadKeyedGeneric
80 // HPower
81 // HStoreNamed
82 // HStoreNamedField
83 // HStoreNamedGeneric
84 // HBlockEntry
85 // HCall
86 // HCallConstantFunction
87 // HCallFunction
88 // HCallGlobal
89 // HCallKeyed
90 // HCallKnownGlobal
91 // HCallNamed
92 // HCallNew
93 // HCallRuntime
94 // HCallStub
95 // HCheckPrototypeMaps
96 // HConstant
97 // HControlInstruction
98 // HDeoptimize
99 // HGoto
100 // HUnaryControlInstruction
101 // HBranch
102 // HCompareMapAndBranch
103 // HReturn
104 // HThrow
105 // HEnterInlined
106 // HFunctionLiteral
107 // HGlobalObject
108 // HGlobalReceiver
109 // HLeaveInlined
110 // HLoadGlobal
111 // HMaterializedLiteral
112 // HArrayLiteral
113 // HObjectLiteral
114 // HRegExpLiteral
115 // HOsrEntry
116 // HParameter
117 // HSimulate
118 // HStackCheck
119 // HStoreKeyed
120 // HStoreKeyedFastElement
121 // HStoreKeyedGeneric
122 // HUnaryOperation
123 // HBitNot
124 // HChange
125 // HCheckFunction
126 // HCheckInstanceType
127 // HCheckMap
128 // HCheckNonSmi
129 // HCheckSmi
130 // HDeleteProperty
131 // HFixedArrayLength
132 // HJSArrayLength
133 // HLoadElements
134 // HTypeofIs
135 // HLoadNamedField
136 // HLoadNamedGeneric
137 // HLoadFunctionPrototype
138 // HPushArgument
139 // HTypeof
140 // HUnaryMathOperation
141 // HUnaryPredicate
142 // HClassOfTest
143 // HHasCachedArrayIndex
144 // HHasInstanceType
145 // HIsNull
146 // HIsObject
147 // HIsSmi
148 // HValueOf
149 // HUnknownOSRValue
150 // HPhi
151
152 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \ 49 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \
153 V(ArithmeticBinaryOperation) \ 50 V(ArithmeticBinaryOperation) \
154 V(BinaryOperation) \ 51 V(BinaryOperation) \
155 V(BitwiseBinaryOperation) \ 52 V(BitwiseBinaryOperation) \
156 V(Call) \ 53 V(Call) \
157 V(ControlInstruction) \ 54 V(ControlInstruction) \
158 V(Instruction) \ 55 V(Instruction) \
159 V(LoadKeyed) \ 56 V(LoadKeyed) \
160 V(MaterializedLiteral) \ 57 V(MaterializedLiteral) \
161 V(Phi) \ 58 V(Phi) \
(...skipping 11 matching lines...) Expand all
173 V(ArgumentsElements) \ 70 V(ArgumentsElements) \
174 V(ArgumentsLength) \ 71 V(ArgumentsLength) \
175 V(ArgumentsObject) \ 72 V(ArgumentsObject) \
176 V(ArrayLiteral) \ 73 V(ArrayLiteral) \
177 V(BitAnd) \ 74 V(BitAnd) \
178 V(BitNot) \ 75 V(BitNot) \
179 V(BitOr) \ 76 V(BitOr) \
180 V(BitXor) \ 77 V(BitXor) \
181 V(BlockEntry) \ 78 V(BlockEntry) \
182 V(BoundsCheck) \ 79 V(BoundsCheck) \
183 V(Branch) \
184 V(CallConstantFunction) \ 80 V(CallConstantFunction) \
185 V(CallFunction) \ 81 V(CallFunction) \
186 V(CallGlobal) \ 82 V(CallGlobal) \
187 V(CallKeyed) \ 83 V(CallKeyed) \
188 V(CallKnownGlobal) \ 84 V(CallKnownGlobal) \
189 V(CallNamed) \ 85 V(CallNamed) \
190 V(CallNew) \ 86 V(CallNew) \
191 V(CallRuntime) \ 87 V(CallRuntime) \
192 V(CallStub) \ 88 V(CallStub) \
193 V(Change) \ 89 V(Change) \
194 V(CheckFunction) \ 90 V(CheckFunction) \
195 V(CheckInstanceType) \ 91 V(CheckInstanceType) \
196 V(CheckMap) \ 92 V(CheckMap) \
197 V(CheckNonSmi) \ 93 V(CheckNonSmi) \
198 V(CheckPrototypeMaps) \ 94 V(CheckPrototypeMaps) \
199 V(CheckSmi) \ 95 V(CheckSmi) \
200 V(Compare) \ 96 V(Compare) \
201 V(CompareJSObjectEq) \ 97 V(CompareJSObjectEq) \
202 V(CompareMapAndBranch) \ 98 V(CompareMap) \
203 V(Constant) \ 99 V(Constant) \
204 V(DeleteProperty) \ 100 V(DeleteProperty) \
205 V(Deoptimize) \ 101 V(Deoptimize) \
206 V(Div) \ 102 V(Div) \
207 V(EnterInlined) \ 103 V(EnterInlined) \
208 V(FixedArrayLength) \ 104 V(FixedArrayLength) \
209 V(FunctionLiteral) \ 105 V(FunctionLiteral) \
210 V(GlobalObject) \ 106 V(GlobalObject) \
211 V(GlobalReceiver) \ 107 V(GlobalReceiver) \
212 V(Goto) \ 108 V(Goto) \
213 V(InstanceOf) \ 109 V(InstanceOf) \
214 V(InstanceOfKnownGlobal) \ 110 V(InstanceOfKnownGlobal) \
215 V(IsNull) \ 111 V(IsNull) \
216 V(IsObject) \ 112 V(IsObject) \
217 V(IsSmi) \ 113 V(IsSmi) \
218 V(HasInstanceType) \ 114 V(HasInstanceType) \
219 V(HasCachedArrayIndex) \ 115 V(HasCachedArrayIndex) \
220 V(JSArrayLength) \ 116 V(JSArrayLength) \
221 V(ClassOfTest) \ 117 V(ClassOfTest) \
222 V(LeaveInlined) \ 118 V(LeaveInlined) \
119 V(LoadContextSlot) \
223 V(LoadElements) \ 120 V(LoadElements) \
121 V(LoadFunctionPrototype) \
224 V(LoadGlobal) \ 122 V(LoadGlobal) \
225 V(LoadKeyedFastElement) \ 123 V(LoadKeyedFastElement) \
226 V(LoadKeyedGeneric) \ 124 V(LoadKeyedGeneric) \
227 V(LoadNamedField) \ 125 V(LoadNamedField) \
228 V(LoadNamedGeneric) \ 126 V(LoadNamedGeneric) \
229 V(LoadFunctionPrototype) \
230 V(Mod) \ 127 V(Mod) \
231 V(Mul) \ 128 V(Mul) \
232 V(ObjectLiteral) \ 129 V(ObjectLiteral) \
233 V(OsrEntry) \ 130 V(OsrEntry) \
234 V(Parameter) \ 131 V(Parameter) \
235 V(Power) \ 132 V(Power) \
236 V(PushArgument) \ 133 V(PushArgument) \
237 V(RegExpLiteral) \ 134 V(RegExpLiteral) \
238 V(Return) \ 135 V(Return) \
239 V(Sar) \ 136 V(Sar) \
240 V(Shl) \ 137 V(Shl) \
241 V(Shr) \ 138 V(Shr) \
242 V(Simulate) \ 139 V(Simulate) \
243 V(StackCheck) \ 140 V(StackCheck) \
244 V(StoreGlobal) \ 141 V(StoreGlobal) \
245 V(StoreKeyedFastElement) \ 142 V(StoreKeyedFastElement) \
246 V(StoreKeyedGeneric) \ 143 V(StoreKeyedGeneric) \
247 V(StoreNamedField) \ 144 V(StoreNamedField) \
248 V(StoreNamedGeneric) \ 145 V(StoreNamedGeneric) \
146 V(StringCharCodeAt) \
147 V(StringLength) \
249 V(Sub) \ 148 V(Sub) \
149 V(Test) \
250 V(Throw) \ 150 V(Throw) \
251 V(Typeof) \ 151 V(Typeof) \
252 V(TypeofIs) \ 152 V(TypeofIs) \
253 V(UnaryMathOperation) \ 153 V(UnaryMathOperation) \
254 V(UnknownOSRValue) \ 154 V(UnknownOSRValue) \
255 V(ValueOf) 155 V(ValueOf)
256 156
257 #define GVN_FLAG_LIST(V) \ 157 #define GVN_FLAG_LIST(V) \
258 V(Calls) \ 158 V(Calls) \
259 V(InobjectFields) \ 159 V(InobjectFields) \
260 V(BackingStoreFields) \ 160 V(BackingStoreFields) \
261 V(ArrayElements) \ 161 V(ArrayElements) \
262 V(GlobalVars) \ 162 V(GlobalVars) \
263 V(Maps) \ 163 V(Maps) \
264 V(ArrayLengths) \ 164 V(ArrayLengths) \
265 V(FunctionPrototypes) \
266 V(OsrEntries) 165 V(OsrEntries)
267 166
268 #define DECLARE_INSTRUCTION(type) \ 167 #define DECLARE_INSTRUCTION(type) \
269 virtual bool Is##type() const { return true; } \ 168 virtual bool Is##type() const { return true; } \
270 static H##type* cast(HValue* value) { \ 169 static H##type* cast(HValue* value) { \
271 ASSERT(value->Is##type()); \ 170 ASSERT(value->Is##type()); \
272 return reinterpret_cast<H##type*>(value); \ 171 return reinterpret_cast<H##type*>(value); \
273 } \ 172 } \
274 Opcode opcode() const { return HValue::k##type; } 173 Opcode opcode() const { return HValue::k##type; }
275 174
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 459 }
561 460
562 static int DependsFlagsMask() { 461 static int DependsFlagsMask() {
563 return ConvertChangesToDependsFlags(ChangesFlagsMask()); 462 return ConvertChangesToDependsFlags(ChangesFlagsMask());
564 } 463 }
565 464
566 static int ConvertChangesToDependsFlags(int flags) { 465 static int ConvertChangesToDependsFlags(int flags) {
567 return flags << kChangesToDependsFlagsLeftShift; 466 return flags << kChangesToDependsFlagsLeftShift;
568 } 467 }
569 468
570 // A flag mask to mark an instruction as having arbitrary side effects.
571 static int AllSideEffects() {
572 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries);
573 }
574
575 static HValue* cast(HValue* value) { return value; } 469 static HValue* cast(HValue* value) { return value; }
576 470
577 enum Opcode { 471 enum Opcode {
578 // Declare a unique enum value for each hydrogen instruction. 472 // Declare a unique enum value for each hydrogen instruction.
579 #define DECLARE_DO(type) k##type, 473 #define DECLARE_DO(type) k##type,
580 HYDROGEN_ALL_INSTRUCTION_LIST(DECLARE_DO) 474 HYDROGEN_ALL_INSTRUCTION_LIST(DECLARE_DO)
581 #undef DECLARE_DO 475 #undef DECLARE_DO
582 kMaxInstructionClass 476 kMaxInstructionClass
583 }; 477 };
584 478
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // If the operation also exists in a form that takes int32 and outputs int32 517 // If the operation also exists in a form that takes int32 and outputs int32
624 // then the operation should return its input value so that we can propagate 518 // then the operation should return its input value so that we can propagate
625 // back. There are two operations that need to propagate back to more than 519 // back. There are two operations that need to propagate back to more than
626 // one input. They are phi and binary add. They always return NULL and 520 // one input. They are phi and binary add. They always return NULL and
627 // expect the caller to take care of things. 521 // expect the caller to take care of things.
628 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { 522 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) {
629 visited->Add(id()); 523 visited->Add(id());
630 return NULL; 524 return NULL;
631 } 525 }
632 526
633 bool HasSideEffects() const {
634 return (flags_ & AllSideEffects()) != 0;
635 }
636 bool IsDefinedAfter(HBasicBlock* other) const; 527 bool IsDefinedAfter(HBasicBlock* other) const;
637 528
638 // Operands. 529 // Operands.
639 virtual int OperandCount() const { return 0; } 530 virtual int OperandCount() const { return 0; }
640 virtual HValue* OperandAt(int index) const { 531 virtual HValue* OperandAt(int index) const {
641 UNREACHABLE(); 532 UNREACHABLE();
642 return NULL; 533 return NULL;
643 } 534 }
644 void SetOperandAt(int index, HValue* value); 535 void SetOperandAt(int index, HValue* value);
645 536
646 int LookupOperandIndex(int occurrence_index, HValue* op) const; 537 int LookupOperandIndex(int occurrence_index, HValue* op) const;
647 bool UsesMultipleTimes(HValue* op) const; 538 bool UsesMultipleTimes(HValue* op) const;
648 539
649 void ReplaceAndDelete(HValue* other); 540 void ReplaceAndDelete(HValue* other);
650 void ReplaceValue(HValue* other); 541 void ReplaceValue(HValue* other);
651 void ReplaceAtUse(HValue* use, HValue* other); 542 void ReplaceAtUse(HValue* use, HValue* other);
652 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r); 543 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r);
653 bool HasNoUses() const { return uses_.is_empty(); } 544 bool HasNoUses() const { return uses_.is_empty(); }
654 void ClearOperands(); 545 void ClearOperands();
655 void Delete(); 546 void Delete();
656 547
657 int flags() const { return flags_; } 548 int flags() const { return flags_; }
658 void SetFlagMask(int mask) { flags_ |= mask; } 549 void SetFlag(Flag f) { flags_ |= (1 << f); }
659 void SetFlag(Flag f) { SetFlagMask(1 << f); } 550 void ClearFlag(Flag f) { flags_ &= ~(1 << f); }
660 void ClearFlagMask(int mask) { flags_ &= ~mask; } 551 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; }
661 void ClearFlag(Flag f) { ClearFlagMask(1 << f); } 552
662 bool CheckFlag(Flag f) const { return CheckFlagMask(1 << f); } 553 void SetAllSideEffects() { flags_ |= AllSideEffects(); }
663 bool CheckFlagMask(int mask) const { return (flags_ & mask) != 0; } 554 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); }
555 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; }
664 556
665 Range* range() const { return range_; } 557 Range* range() const { return range_; }
666 bool HasRange() const { return range_ != NULL; } 558 bool HasRange() const { return range_ != NULL; }
667 void AddNewRange(Range* r); 559 void AddNewRange(Range* r);
668 void RemoveLastAddedRange(); 560 void RemoveLastAddedRange();
669 void ComputeInitialRange(); 561 void ComputeInitialRange();
670 562
671 // Representation helpers. 563 // Representation helpers.
672 virtual Representation RequiredInputRepresentation(int index) const { 564 virtual Representation RequiredInputRepresentation(int index) const {
673 return Representation::None(); 565 return Representation::None();
(...skipping 27 matching lines...) Expand all
701 // Updated the inferred type of this instruction and returns true if 593 // Updated the inferred type of this instruction and returns true if
702 // it has changed. 594 // it has changed.
703 bool UpdateInferredType(); 595 bool UpdateInferredType();
704 596
705 virtual HType CalculateInferredType() const; 597 virtual HType CalculateInferredType() const;
706 598
707 // Helper for type conversions used by normal and phi instructions. 599 // Helper for type conversions used by normal and phi instructions.
708 void InsertInputConversion(HInstruction* previous, int index, HType type); 600 void InsertInputConversion(HInstruction* previous, int index, HType type);
709 601
710 #ifdef DEBUG 602 #ifdef DEBUG
711 virtual void Verify() const = 0; 603 virtual void Verify() = 0;
712 #endif 604 #endif
713 605
714 protected: 606 protected:
715 virtual bool DataEquals(HValue* other) const { return true; } 607 // This function must be overridden for instructions with flag kUseGVN, to
608 // compare the non-Operand parts of the instruction.
609 virtual bool DataEquals(HValue* other) const {
610 UNREACHABLE();
611 return false;
612 }
716 virtual void RepresentationChanged(Representation to) { } 613 virtual void RepresentationChanged(Representation to) { }
717 virtual Range* InferRange(); 614 virtual Range* InferRange();
718 virtual void DeleteFromGraph() = 0; 615 virtual void DeleteFromGraph() = 0;
719 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); } 616 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); }
720 void clear_block() { 617 void clear_block() {
721 ASSERT(block_ != NULL); 618 ASSERT(block_ != NULL);
722 block_ = NULL; 619 block_ = NULL;
723 } 620 }
724 621
725 void set_representation(Representation r) { 622 void set_representation(Representation r) {
726 // Representation is set-once. 623 // Representation is set-once.
727 ASSERT(representation_.IsNone() && !r.IsNone()); 624 ASSERT(representation_.IsNone() && !r.IsNone());
728 representation_ = r; 625 representation_ = r;
729 } 626 }
730 627
731 private: 628 private:
629 // A flag mask to mark an instruction as having arbitrary side effects.
630 static int AllSideEffects() {
631 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries);
632 }
633
732 void InternalReplaceAtUse(HValue* use, HValue* other); 634 void InternalReplaceAtUse(HValue* use, HValue* other);
733 void RegisterUse(int index, HValue* new_value); 635 void RegisterUse(int index, HValue* new_value);
734 636
735 HBasicBlock* block_; 637 HBasicBlock* block_;
736 638
737 // The id of this instruction in the hydrogen graph, assigned when first 639 // The id of this instruction in the hydrogen graph, assigned when first
738 // added to the graph. Reflects creation order. 640 // added to the graph. Reflects creation order.
739 int id_; 641 int id_;
740 642
741 Representation representation_; 643 Representation representation_;
(...skipping 19 matching lines...) Expand all
761 void InsertBefore(HInstruction* next); 663 void InsertBefore(HInstruction* next);
762 void InsertAfter(HInstruction* previous); 664 void InsertAfter(HInstruction* previous);
763 665
764 int position() const { return position_; } 666 int position() const { return position_; }
765 bool has_position() const { return position_ != RelocInfo::kNoPosition; } 667 bool has_position() const { return position_ != RelocInfo::kNoPosition; }
766 void set_position(int position) { position_ = position; } 668 void set_position(int position) { position_ = position; }
767 669
768 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; 670 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0;
769 671
770 #ifdef DEBUG 672 #ifdef DEBUG
771 virtual void Verify() const; 673 virtual void Verify();
772 #endif 674 #endif
773 675
676 // Returns whether this is some kind of deoptimizing check
677 // instruction.
678 virtual bool IsCheckInstruction() const { return false; }
679
774 DECLARE_INSTRUCTION(Instruction) 680 DECLARE_INSTRUCTION(Instruction)
775 681
776 protected: 682 protected:
777 HInstruction() 683 HInstruction()
778 : next_(NULL), 684 : next_(NULL),
779 previous_(NULL), 685 previous_(NULL),
780 position_(RelocInfo::kNoPosition) { 686 position_(RelocInfo::kNoPosition) {
781 SetFlag(kDependsOnOsrEntries); 687 SetFlag(kDependsOnOsrEntries);
782 } 688 }
783 689
(...skipping 14 matching lines...) Expand all
798 704
799 705
800 class HBlockEntry: public HInstruction { 706 class HBlockEntry: public HInstruction {
801 public: 707 public:
802 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") 708 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
803 }; 709 };
804 710
805 711
806 class HControlInstruction: public HInstruction { 712 class HControlInstruction: public HInstruction {
807 public: 713 public:
808 virtual HBasicBlock* FirstSuccessor() const { return NULL; } 714 HControlInstruction(HBasicBlock* first, HBasicBlock* second)
809 virtual HBasicBlock* SecondSuccessor() const { return NULL; } 715 : first_successor_(first), second_successor_(second) {
716 }
717
718 HBasicBlock* FirstSuccessor() const { return first_successor_; }
719 HBasicBlock* SecondSuccessor() const { return second_successor_; }
720
721 virtual void PrintDataTo(StringStream* stream) const;
810 722
811 DECLARE_INSTRUCTION(ControlInstruction) 723 DECLARE_INSTRUCTION(ControlInstruction)
724
725 private:
726 HBasicBlock* first_successor_;
727 HBasicBlock* second_successor_;
812 }; 728 };
813 729
814 730
815 class HDeoptimize: public HControlInstruction { 731 class HDeoptimize: public HControlInstruction {
816 public: 732 public:
733 HDeoptimize() : HControlInstruction(NULL, NULL) { }
734
817 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 735 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
818 }; 736 };
819 737
820 738
821 class HGoto: public HControlInstruction { 739 class HGoto: public HControlInstruction {
822 public: 740 public:
823 explicit HGoto(HBasicBlock* destination) 741 explicit HGoto(HBasicBlock* target)
824 : destination_(destination), 742 : HControlInstruction(target, NULL), include_stack_check_(false) {
825 include_stack_check_(false) {} 743 }
826 744
827 virtual HBasicBlock* FirstSuccessor() const { return destination_; }
828 void set_include_stack_check(bool include_stack_check) { 745 void set_include_stack_check(bool include_stack_check) {
829 include_stack_check_ = include_stack_check; 746 include_stack_check_ = include_stack_check;
830 } 747 }
831 bool include_stack_check() const { return include_stack_check_; } 748 bool include_stack_check() const { return include_stack_check_; }
832 749
833 virtual void PrintDataTo(StringStream* stream) const;
834
835 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") 750 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
836 751
837 private: 752 private:
838 HBasicBlock* destination_;
839 bool include_stack_check_; 753 bool include_stack_check_;
840 }; 754 };
841 755
842 756
843 class HUnaryControlInstruction: public HControlInstruction { 757 class HUnaryControlInstruction: public HControlInstruction {
844 public: 758 public:
845 explicit HUnaryControlInstruction(HValue* value) { 759 explicit HUnaryControlInstruction(HValue* value,
760 HBasicBlock* true_target,
761 HBasicBlock* false_target)
762 : HControlInstruction(true_target, false_target) {
846 SetOperandAt(0, value); 763 SetOperandAt(0, value);
847 } 764 }
848 765
849 virtual Representation RequiredInputRepresentation(int index) const { 766 virtual Representation RequiredInputRepresentation(int index) const {
850 return Representation::Tagged(); 767 return Representation::Tagged();
851 } 768 }
852 769
770 virtual void PrintDataTo(StringStream* stream) const;
771
853 HValue* value() const { return OperandAt(0); } 772 HValue* value() const { return OperandAt(0); }
854 virtual int OperandCount() const { return 1; } 773 virtual int OperandCount() const { return 1; }
855 virtual HValue* OperandAt(int index) const { return operands_[index]; } 774 virtual HValue* OperandAt(int index) const { return operands_[index]; }
856 775
857 DECLARE_INSTRUCTION(UnaryControlInstruction) 776 DECLARE_INSTRUCTION(UnaryControlInstruction)
858 777
859 protected: 778 protected:
860 virtual void InternalSetOperandAt(int index, HValue* value) { 779 virtual void InternalSetOperandAt(int index, HValue* value) {
861 operands_[index] = value; 780 operands_[index] = value;
862 } 781 }
863 782
864 private: 783 private:
865 HOperandVector<1> operands_; 784 HOperandVector<1> operands_;
866 }; 785 };
867 786
868 787
869 class HBranch: public HUnaryControlInstruction { 788 class HTest: public HUnaryControlInstruction {
870 public: 789 public:
871 HBranch(HBasicBlock* true_destination, 790 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target)
872 HBasicBlock* false_destination, 791 : HUnaryControlInstruction(value, true_target, false_target) {
873 HValue* boolean_value) 792 ASSERT(true_target != NULL && false_target != NULL);
874 : HUnaryControlInstruction(boolean_value),
875 true_destination_(true_destination),
876 false_destination_(false_destination) {
877 ASSERT(true_destination != NULL && false_destination != NULL);
878 } 793 }
879 794
880 virtual Representation RequiredInputRepresentation(int index) const { 795 virtual Representation RequiredInputRepresentation(int index) const {
881 return Representation::None(); 796 return Representation::None();
882 } 797 }
883 798
884 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } 799 DECLARE_CONCRETE_INSTRUCTION(Test, "test")
885 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
886
887 virtual void PrintDataTo(StringStream* stream) const;
888
889 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
890
891 private:
892 HBasicBlock* true_destination_;
893 HBasicBlock* false_destination_;
894 }; 800 };
895 801
896 802
897 class HCompareMapAndBranch: public HUnaryControlInstruction { 803 class HCompareMap: public HUnaryControlInstruction {
898 public: 804 public:
899 HCompareMapAndBranch(HValue* result, 805 HCompareMap(HValue* value,
900 Handle<Map> map, 806 Handle<Map> map,
901 HBasicBlock* true_destination, 807 HBasicBlock* true_target,
902 HBasicBlock* false_destination) 808 HBasicBlock* false_target)
903 : HUnaryControlInstruction(result), 809 : HUnaryControlInstruction(value, true_target, false_target),
904 map_(map), 810 map_(map) {
905 true_destination_(true_destination), 811 ASSERT(true_target != NULL);
906 false_destination_(false_destination) { 812 ASSERT(false_target != NULL);
907 ASSERT(true_destination != NULL);
908 ASSERT(false_destination != NULL);
909 ASSERT(!map.is_null()); 813 ASSERT(!map.is_null());
910 } 814 }
911 815
912 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; }
913 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
914
915 HBasicBlock* true_destination() const { return true_destination_; }
916 HBasicBlock* false_destination() const { return false_destination_; }
917
918 virtual void PrintDataTo(StringStream* stream) const; 816 virtual void PrintDataTo(StringStream* stream) const;
919 817
920 Handle<Map> map() const { return map_; } 818 Handle<Map> map() const { return map_; }
921 819
922 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") 820 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
923 821
924 private: 822 private:
925 Handle<Map> map_; 823 Handle<Map> map_;
926 HBasicBlock* true_destination_;
927 HBasicBlock* false_destination_;
928 }; 824 };
929 825
930 826
931 class HReturn: public HUnaryControlInstruction { 827 class HReturn: public HUnaryControlInstruction {
932 public: 828 public:
933 explicit HReturn(HValue* result) : HUnaryControlInstruction(result) { } 829 explicit HReturn(HValue* value)
934 830 : HUnaryControlInstruction(value, NULL, NULL) {
935 virtual void PrintDataTo(StringStream* stream) const; 831 }
936 832
937 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 833 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
938 }; 834 };
939 835
940 836
941 class HThrow: public HUnaryControlInstruction { 837 class HThrow: public HUnaryControlInstruction {
942 public: 838 public:
943 explicit HThrow(HValue* value) : HUnaryControlInstruction(value) { } 839 explicit HThrow(HValue* value)
944 840 : HUnaryControlInstruction(value, NULL, NULL) { }
945 virtual void PrintDataTo(StringStream* stream) const;
946 841
947 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 842 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
948 }; 843 };
949 844
950 845
951 class HUnaryOperation: public HInstruction { 846 class HUnaryOperation: public HInstruction {
952 public: 847 public:
953 explicit HUnaryOperation(HValue* value) { 848 explicit HUnaryOperation(HValue* value) {
954 SetOperandAt(0, value); 849 SetOperandAt(0, value);
955 } 850 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 } 952 }
1058 void AddPushedValue(HValue* value) { 953 void AddPushedValue(HValue* value) {
1059 AddValue(kNoIndex, value); 954 AddValue(kNoIndex, value);
1060 } 955 }
1061 virtual int OperandCount() const { return values_.length(); } 956 virtual int OperandCount() const { return values_.length(); }
1062 virtual HValue* OperandAt(int index) const { return values_[index]; } 957 virtual HValue* OperandAt(int index) const { return values_[index]; }
1063 958
1064 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate") 959 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate")
1065 960
1066 #ifdef DEBUG 961 #ifdef DEBUG
1067 virtual void Verify() const; 962 virtual void Verify();
1068 #endif 963 #endif
1069 964
1070 protected: 965 protected:
1071 virtual void InternalSetOperandAt(int index, HValue* value) { 966 virtual void InternalSetOperandAt(int index, HValue* value) {
1072 values_[index] = value; 967 values_[index] = value;
1073 } 968 }
1074 969
1075 private: 970 private:
1076 static const int kNoIndex = -1; 971 static const int kNoIndex = -1;
1077 void AddValue(int index, HValue* value) { 972 void AddValue(int index, HValue* value) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 1048
1154 class HGlobalObject: public HInstruction { 1049 class HGlobalObject: public HInstruction {
1155 public: 1050 public:
1156 HGlobalObject() { 1051 HGlobalObject() {
1157 set_representation(Representation::Tagged()); 1052 set_representation(Representation::Tagged());
1158 SetFlag(kUseGVN); 1053 SetFlag(kUseGVN);
1159 SetFlag(kDependsOnCalls); 1054 SetFlag(kDependsOnCalls);
1160 } 1055 }
1161 1056
1162 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") 1057 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object")
1058
1059 protected:
1060 virtual bool DataEquals(HValue* other) const { return true; }
1163 }; 1061 };
1164 1062
1165 1063
1166 class HGlobalReceiver: public HInstruction { 1064 class HGlobalReceiver: public HInstruction {
1167 public: 1065 public:
1168 HGlobalReceiver() { 1066 HGlobalReceiver() {
1169 set_representation(Representation::Tagged()); 1067 set_representation(Representation::Tagged());
1170 SetFlag(kUseGVN); 1068 SetFlag(kUseGVN);
1171 SetFlag(kDependsOnCalls); 1069 SetFlag(kDependsOnCalls);
1172 } 1070 }
1173 1071
1174 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") 1072 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver")
1073
1074 protected:
1075 virtual bool DataEquals(HValue* other) const { return true; }
1175 }; 1076 };
1176 1077
1177 1078
1178 class HCall: public HInstruction { 1079 class HCall: public HInstruction {
1179 public: 1080 public:
1180 // Construct a call with uninitialized arguments. The argument count 1081 // Construct a call with uninitialized arguments. The argument count
1181 // includes the receiver. 1082 // includes the receiver.
1182 explicit HCall(int count); 1083 explicit HCall(int count);
1183 1084
1184 virtual HType CalculateInferredType() const { return HType::Tagged(); } 1085 virtual HType CalculateInferredType() const { return HType::Tagged(); }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 set_representation(Representation::Tagged()); 1257 set_representation(Representation::Tagged());
1357 SetFlag(kDependsOnArrayLengths); 1258 SetFlag(kDependsOnArrayLengths);
1358 SetFlag(kUseGVN); 1259 SetFlag(kUseGVN);
1359 } 1260 }
1360 1261
1361 virtual Representation RequiredInputRepresentation(int index) const { 1262 virtual Representation RequiredInputRepresentation(int index) const {
1362 return Representation::Tagged(); 1263 return Representation::Tagged();
1363 } 1264 }
1364 1265
1365 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") 1266 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length")
1267
1268 protected:
1269 virtual bool DataEquals(HValue* other) const { return true; }
1366 }; 1270 };
1367 1271
1368 1272
1369 class HFixedArrayLength: public HUnaryOperation { 1273 class HFixedArrayLength: public HUnaryOperation {
1370 public: 1274 public:
1371 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { 1275 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
1372 set_representation(Representation::Tagged()); 1276 set_representation(Representation::Tagged());
1373 SetFlag(kDependsOnArrayLengths); 1277 SetFlag(kDependsOnArrayLengths);
1374 SetFlag(kUseGVN); 1278 SetFlag(kUseGVN);
1375 } 1279 }
1376 1280
1377 virtual Representation RequiredInputRepresentation(int index) const { 1281 virtual Representation RequiredInputRepresentation(int index) const {
1378 return Representation::Tagged(); 1282 return Representation::Tagged();
1379 } 1283 }
1380 1284
1381 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") 1285 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length")
1286
1287 protected:
1288 virtual bool DataEquals(HValue* other) const { return true; }
1382 }; 1289 };
1383 1290
1384 1291
1385 class HBitNot: public HUnaryOperation { 1292 class HBitNot: public HUnaryOperation {
1386 public: 1293 public:
1387 explicit HBitNot(HValue* value) : HUnaryOperation(value) { 1294 explicit HBitNot(HValue* value) : HUnaryOperation(value) {
1388 set_representation(Representation::Integer32()); 1295 set_representation(Representation::Integer32());
1389 SetFlag(kUseGVN); 1296 SetFlag(kUseGVN);
1390 SetFlag(kTruncatingToInt32); 1297 SetFlag(kTruncatingToInt32);
1391 } 1298 }
1392 1299
1393 virtual Representation RequiredInputRepresentation(int index) const { 1300 virtual Representation RequiredInputRepresentation(int index) const {
1394 return Representation::Integer32(); 1301 return Representation::Integer32();
1395 } 1302 }
1396 virtual HType CalculateInferredType() const; 1303 virtual HType CalculateInferredType() const;
1397 1304
1398 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") 1305 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not")
1306
1307 protected:
1308 virtual bool DataEquals(HValue* other) const { return true; }
1399 }; 1309 };
1400 1310
1401 1311
1402 class HUnaryMathOperation: public HUnaryOperation { 1312 class HUnaryMathOperation: public HUnaryOperation {
1403 public: 1313 public:
1404 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) 1314 HUnaryMathOperation(HValue* value, BuiltinFunctionId op)
1405 : HUnaryOperation(value), op_(op) { 1315 : HUnaryOperation(value), op_(op) {
1406 switch (op) { 1316 switch (op) {
1407 case kMathFloor: 1317 case kMathFloor:
1408 case kMathRound: 1318 case kMathRound:
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 set_representation(Representation::Tagged()); 1394 set_representation(Representation::Tagged());
1485 SetFlag(kUseGVN); 1395 SetFlag(kUseGVN);
1486 SetFlag(kDependsOnMaps); 1396 SetFlag(kDependsOnMaps);
1487 } 1397 }
1488 1398
1489 virtual Representation RequiredInputRepresentation(int index) const { 1399 virtual Representation RequiredInputRepresentation(int index) const {
1490 return Representation::Tagged(); 1400 return Representation::Tagged();
1491 } 1401 }
1492 1402
1493 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1403 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1404
1405 protected:
1406 virtual bool DataEquals(HValue* other) const { return true; }
1494 }; 1407 };
1495 1408
1496 1409
1497 class HCheckMap: public HUnaryOperation { 1410 class HCheckMap: public HUnaryOperation {
1498 public: 1411 public:
1499 HCheckMap(HValue* value, Handle<Map> map) 1412 HCheckMap(HValue* value, Handle<Map> map)
1500 : HUnaryOperation(value), map_(map) { 1413 : HUnaryOperation(value), map_(map) {
1501 set_representation(Representation::Tagged()); 1414 set_representation(Representation::Tagged());
1502 SetFlag(kUseGVN); 1415 SetFlag(kUseGVN);
1503 SetFlag(kDependsOnMaps); 1416 SetFlag(kDependsOnMaps);
1504 } 1417 }
1505 1418
1419 virtual bool IsCheckInstruction() const { return true; }
1420
1506 virtual Representation RequiredInputRepresentation(int index) const { 1421 virtual Representation RequiredInputRepresentation(int index) const {
1507 return Representation::Tagged(); 1422 return Representation::Tagged();
1508 } 1423 }
1509 virtual void PrintDataTo(StringStream* stream) const; 1424 virtual void PrintDataTo(StringStream* stream) const;
1510 virtual HType CalculateInferredType() const; 1425 virtual HType CalculateInferredType() const;
1511 1426
1512 #ifdef DEBUG 1427 #ifdef DEBUG
1513 virtual void Verify() const; 1428 virtual void Verify();
1514 #endif 1429 #endif
1515 1430
1516 Handle<Map> map() const { return map_; } 1431 Handle<Map> map() const { return map_; }
1517 1432
1518 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map") 1433 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map")
1519 1434
1520 protected: 1435 protected:
1521 virtual bool DataEquals(HValue* other) const { 1436 virtual bool DataEquals(HValue* other) const {
1522 HCheckMap* b = HCheckMap::cast(other); 1437 HCheckMap* b = HCheckMap::cast(other);
1523 return map_.is_identical_to(b->map()); 1438 return map_.is_identical_to(b->map());
1524 } 1439 }
1525 1440
1526 private: 1441 private:
1527 Handle<Map> map_; 1442 Handle<Map> map_;
1528 }; 1443 };
1529 1444
1530 1445
1531 class HCheckFunction: public HUnaryOperation { 1446 class HCheckFunction: public HUnaryOperation {
1532 public: 1447 public:
1533 HCheckFunction(HValue* value, Handle<JSFunction> function) 1448 HCheckFunction(HValue* value, Handle<JSFunction> function)
1534 : HUnaryOperation(value), target_(function) { 1449 : HUnaryOperation(value), target_(function) {
1535 set_representation(Representation::Tagged()); 1450 set_representation(Representation::Tagged());
1536 SetFlag(kUseGVN); 1451 SetFlag(kUseGVN);
1537 } 1452 }
1538 1453
1454 virtual bool IsCheckInstruction() const { return true; }
1455
1539 virtual Representation RequiredInputRepresentation(int index) const { 1456 virtual Representation RequiredInputRepresentation(int index) const {
1540 return Representation::Tagged(); 1457 return Representation::Tagged();
1541 } 1458 }
1542 virtual void PrintDataTo(StringStream* stream) const; 1459 virtual void PrintDataTo(StringStream* stream) const;
1543 virtual HType CalculateInferredType() const; 1460 virtual HType CalculateInferredType() const;
1544 1461
1545 #ifdef DEBUG 1462 #ifdef DEBUG
1546 virtual void Verify() const; 1463 virtual void Verify();
1547 #endif 1464 #endif
1548 1465
1549 Handle<JSFunction> target() const { return target_; } 1466 Handle<JSFunction> target() const { return target_; }
1550 1467
1551 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function") 1468 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function")
1552 1469
1553 protected: 1470 protected:
1554 virtual bool DataEquals(HValue* other) const { 1471 virtual bool DataEquals(HValue* other) const {
1555 HCheckFunction* b = HCheckFunction::cast(other); 1472 HCheckFunction* b = HCheckFunction::cast(other);
1556 return target_.is_identical_to(b->target()); 1473 return target_.is_identical_to(b->target());
1557 } 1474 }
1558 1475
1559 private: 1476 private:
1560 Handle<JSFunction> target_; 1477 Handle<JSFunction> target_;
1561 }; 1478 };
1562 1479
1563 1480
1564 class HCheckInstanceType: public HUnaryOperation { 1481 class HCheckInstanceType: public HUnaryOperation {
1565 public: 1482 public:
1566 // Check that the instance type is in the range [first, last] where 1483 // Check that the instance type is in the range [first, last] where
1567 // both first and last are included. 1484 // both first and last are included.
1568 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last) 1485 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last)
1569 : HUnaryOperation(value), first_(first), last_(last) { 1486 : HUnaryOperation(value), first_(first), last_(last) {
1570 ASSERT(first <= last); 1487 ASSERT(first <= last);
1571 set_representation(Representation::Tagged()); 1488 set_representation(Representation::Tagged());
1572 SetFlag(kUseGVN); 1489 SetFlag(kUseGVN);
1490 if ((FIRST_STRING_TYPE < first && last <= LAST_STRING_TYPE) ||
1491 (FIRST_STRING_TYPE <= first && last < LAST_STRING_TYPE)) {
1492 // A particular string instance type can change because of GC or
1493 // externalization, but the value still remains a string.
1494 SetFlag(kDependsOnMaps);
1495 }
1573 } 1496 }
1574 1497
1498 virtual bool IsCheckInstruction() const { return true; }
1499
1575 virtual Representation RequiredInputRepresentation(int index) const { 1500 virtual Representation RequiredInputRepresentation(int index) const {
1576 return Representation::Tagged(); 1501 return Representation::Tagged();
1577 } 1502 }
1578 1503
1579 #ifdef DEBUG 1504 #ifdef DEBUG
1580 virtual void Verify() const; 1505 virtual void Verify();
1581 #endif 1506 #endif
1582 1507
1583 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); 1508 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value);
1584 1509
1585 InstanceType first() const { return first_; } 1510 InstanceType first() const { return first_; }
1586 InstanceType last() const { return last_; } 1511 InstanceType last() const { return last_; }
1587 1512
1588 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type") 1513 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type")
1589 1514
1590 protected: 1515 protected:
(...skipping 11 matching lines...) Expand all
1602 }; 1527 };
1603 1528
1604 1529
1605 class HCheckNonSmi: public HUnaryOperation { 1530 class HCheckNonSmi: public HUnaryOperation {
1606 public: 1531 public:
1607 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { 1532 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) {
1608 set_representation(Representation::Tagged()); 1533 set_representation(Representation::Tagged());
1609 SetFlag(kUseGVN); 1534 SetFlag(kUseGVN);
1610 } 1535 }
1611 1536
1537 virtual bool IsCheckInstruction() const { return true; }
1538
1612 virtual Representation RequiredInputRepresentation(int index) const { 1539 virtual Representation RequiredInputRepresentation(int index) const {
1613 return Representation::Tagged(); 1540 return Representation::Tagged();
1614 } 1541 }
1615 1542
1616 virtual HType CalculateInferredType() const; 1543 virtual HType CalculateInferredType() const;
1617 1544
1618 #ifdef DEBUG 1545 #ifdef DEBUG
1619 virtual void Verify() const; 1546 virtual void Verify();
1620 #endif 1547 #endif
1621 1548
1622 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") 1549 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi")
1550
1551 protected:
1552 virtual bool DataEquals(HValue* other) const { return true; }
1623 }; 1553 };
1624 1554
1625 1555
1626 class HCheckPrototypeMaps: public HInstruction { 1556 class HCheckPrototypeMaps: public HInstruction {
1627 public: 1557 public:
1628 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) 1558 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder)
1629 : prototype_(prototype), holder_(holder) { 1559 : prototype_(prototype), holder_(holder) {
1630 SetFlag(kUseGVN); 1560 SetFlag(kUseGVN);
1631 SetFlag(kDependsOnMaps); 1561 SetFlag(kDependsOnMaps);
1632 } 1562 }
1633 1563
1564 virtual bool IsCheckInstruction() const { return true; }
1565
1634 #ifdef DEBUG 1566 #ifdef DEBUG
1635 virtual void Verify() const; 1567 virtual void Verify();
1636 #endif 1568 #endif
1637 1569
1638 Handle<JSObject> prototype() const { return prototype_; } 1570 Handle<JSObject> prototype() const { return prototype_; }
1639 Handle<JSObject> holder() const { return holder_; } 1571 Handle<JSObject> holder() const { return holder_; }
1640 1572
1641 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") 1573 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps")
1642 1574
1643 virtual intptr_t Hashcode() const { 1575 virtual intptr_t Hashcode() const {
1644 ASSERT(!HEAP->IsAllocationAllowed()); 1576 ASSERT(!HEAP->IsAllocationAllowed());
1645 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); 1577 intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
(...skipping 14 matching lines...) Expand all
1660 }; 1592 };
1661 1593
1662 1594
1663 class HCheckSmi: public HUnaryOperation { 1595 class HCheckSmi: public HUnaryOperation {
1664 public: 1596 public:
1665 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { 1597 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) {
1666 set_representation(Representation::Tagged()); 1598 set_representation(Representation::Tagged());
1667 SetFlag(kUseGVN); 1599 SetFlag(kUseGVN);
1668 } 1600 }
1669 1601
1602 virtual bool IsCheckInstruction() const { return true; }
1603
1670 virtual Representation RequiredInputRepresentation(int index) const { 1604 virtual Representation RequiredInputRepresentation(int index) const {
1671 return Representation::Tagged(); 1605 return Representation::Tagged();
1672 } 1606 }
1673 virtual HType CalculateInferredType() const; 1607 virtual HType CalculateInferredType() const;
1674 1608
1675 #ifdef DEBUG 1609 #ifdef DEBUG
1676 virtual void Verify() const; 1610 virtual void Verify();
1677 #endif 1611 #endif
1678 1612
1679 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") 1613 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi")
1614
1615 protected:
1616 virtual bool DataEquals(HValue* other) const { return true; }
1680 }; 1617 };
1681 1618
1682 1619
1683 class HPhi: public HValue { 1620 class HPhi: public HValue {
1684 public: 1621 public:
1685 explicit HPhi(int merged_index) 1622 explicit HPhi(int merged_index)
1686 : inputs_(2), 1623 : inputs_(2),
1687 merged_index_(merged_index), 1624 merged_index_(merged_index),
1688 phi_id_(-1) { 1625 phi_id_(-1) {
1689 for (int i = 0; i < Representation::kNumRepresentations; i++) { 1626 for (int i = 0; i < Representation::kNumRepresentations; i++) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 1659
1723 bool HasReceiverOperand(); 1660 bool HasReceiverOperand();
1724 1661
1725 int merged_index() const { return merged_index_; } 1662 int merged_index() const { return merged_index_; }
1726 1663
1727 virtual const char* Mnemonic() const { return "phi"; } 1664 virtual const char* Mnemonic() const { return "phi"; }
1728 1665
1729 virtual void PrintTo(StringStream* stream) const; 1666 virtual void PrintTo(StringStream* stream) const;
1730 1667
1731 #ifdef DEBUG 1668 #ifdef DEBUG
1732 virtual void Verify() const; 1669 virtual void Verify();
1733 #endif 1670 #endif
1734 1671
1735 DECLARE_INSTRUCTION(Phi) 1672 DECLARE_INSTRUCTION(Phi)
1736 1673
1737 void InitRealUses(int id); 1674 void InitRealUses(int id);
1738 void AddNonPhiUsesFrom(HPhi* other); 1675 void AddNonPhiUsesFrom(HPhi* other);
1739 void AddIndirectUsesTo(int* use_count); 1676 void AddIndirectUsesTo(int* use_count);
1740 1677
1741 int tagged_non_phi_uses() const { 1678 int tagged_non_phi_uses() const {
1742 return non_phi_uses_[Representation::kTagged]; 1679 return non_phi_uses_[Representation::kTagged];
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 return double_value_; 1747 return double_value_;
1811 } 1748 }
1812 bool HasStringValue() const { return handle_->IsString(); } 1749 bool HasStringValue() const { return handle_->IsString(); }
1813 1750
1814 virtual intptr_t Hashcode() const { 1751 virtual intptr_t Hashcode() const {
1815 ASSERT(!HEAP->allow_allocation(false)); 1752 ASSERT(!HEAP->allow_allocation(false));
1816 return reinterpret_cast<intptr_t>(*handle()); 1753 return reinterpret_cast<intptr_t>(*handle());
1817 } 1754 }
1818 1755
1819 #ifdef DEBUG 1756 #ifdef DEBUG
1820 virtual void Verify() const { } 1757 virtual void Verify() { }
1821 #endif 1758 #endif
1822 1759
1823 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant") 1760 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant")
1824 1761
1825 protected: 1762 protected:
1826 virtual Range* InferRange(); 1763 virtual Range* InferRange();
1827 1764
1828 virtual bool DataEquals(HValue* other) const { 1765 virtual bool DataEquals(HValue* other) const {
1829 HConstant* other_constant = HConstant::cast(other); 1766 HConstant* other_constant = HConstant::cast(other);
1830 return handle().is_identical_to(other_constant->handle()); 1767 return handle().is_identical_to(other_constant->handle());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 class HArgumentsElements: public HInstruction { 1866 class HArgumentsElements: public HInstruction {
1930 public: 1867 public:
1931 HArgumentsElements() { 1868 HArgumentsElements() {
1932 // The value produced by this instruction is a pointer into the stack 1869 // The value produced by this instruction is a pointer into the stack
1933 // that looks as if it was a smi because of alignment. 1870 // that looks as if it was a smi because of alignment.
1934 set_representation(Representation::Tagged()); 1871 set_representation(Representation::Tagged());
1935 SetFlag(kUseGVN); 1872 SetFlag(kUseGVN);
1936 } 1873 }
1937 1874
1938 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") 1875 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements")
1876
1877 protected:
1878 virtual bool DataEquals(HValue* other) const { return true; }
1939 }; 1879 };
1940 1880
1941 1881
1942 class HArgumentsLength: public HUnaryOperation { 1882 class HArgumentsLength: public HUnaryOperation {
1943 public: 1883 public:
1944 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { 1884 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) {
1945 set_representation(Representation::Integer32()); 1885 set_representation(Representation::Integer32());
1946 SetFlag(kUseGVN); 1886 SetFlag(kUseGVN);
1947 } 1887 }
1948 1888
1949 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") 1889 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
1890
1891 protected:
1892 virtual bool DataEquals(HValue* other) const { return true; }
1950 }; 1893 };
1951 1894
1952 1895
1953 class HAccessArgumentsAt: public HInstruction { 1896 class HAccessArgumentsAt: public HInstruction {
1954 public: 1897 public:
1955 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 1898 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
1956 set_representation(Representation::Tagged()); 1899 set_representation(Representation::Tagged());
1957 SetFlag(kUseGVN); 1900 SetFlag(kUseGVN);
1958 SetOperandAt(0, arguments); 1901 SetOperandAt(0, arguments);
1959 SetOperandAt(1, length); 1902 SetOperandAt(1, length);
(...skipping 16 matching lines...) Expand all
1976 virtual int OperandCount() const { return operands_.length(); } 1919 virtual int OperandCount() const { return operands_.length(); }
1977 virtual HValue* OperandAt(int index) const { return operands_[index]; } 1920 virtual HValue* OperandAt(int index) const { return operands_[index]; }
1978 1921
1979 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") 1922 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at")
1980 1923
1981 protected: 1924 protected:
1982 virtual void InternalSetOperandAt(int index, HValue* value) { 1925 virtual void InternalSetOperandAt(int index, HValue* value) {
1983 operands_[index] = value; 1926 operands_[index] = value;
1984 } 1927 }
1985 1928
1929 virtual bool DataEquals(HValue* other) const { return true; }
1930
1986 private: 1931 private:
1987 HOperandVector<3> operands_; 1932 HOperandVector<3> operands_;
1988 }; 1933 };
1989 1934
1990 1935
1991 class HBoundsCheck: public HBinaryOperation { 1936 class HBoundsCheck: public HBinaryOperation {
1992 public: 1937 public:
1993 HBoundsCheck(HValue* index, HValue* length) 1938 HBoundsCheck(HValue* index, HValue* length)
1994 : HBinaryOperation(index, length) { 1939 : HBinaryOperation(index, length) {
1995 SetFlag(kUseGVN); 1940 SetFlag(kUseGVN);
1996 } 1941 }
1997 1942
1943 virtual bool IsCheckInstruction() const { return true; }
1944
1998 virtual Representation RequiredInputRepresentation(int index) const { 1945 virtual Representation RequiredInputRepresentation(int index) const {
1999 return Representation::Integer32(); 1946 return Representation::Integer32();
2000 } 1947 }
2001 1948
2002 #ifdef DEBUG 1949 #ifdef DEBUG
2003 virtual void Verify() const; 1950 virtual void Verify();
2004 #endif 1951 #endif
2005 1952
2006 HValue* index() const { return left(); } 1953 HValue* index() const { return left(); }
2007 HValue* length() const { return right(); } 1954 HValue* length() const { return right(); }
2008 1955
2009 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") 1956 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check")
1957
1958 protected:
1959 virtual bool DataEquals(HValue* other) const { return true; }
2010 }; 1960 };
2011 1961
2012 1962
2013 class HBitwiseBinaryOperation: public HBinaryOperation { 1963 class HBitwiseBinaryOperation: public HBinaryOperation {
2014 public: 1964 public:
2015 HBitwiseBinaryOperation(HValue* left, HValue* right) 1965 HBitwiseBinaryOperation(HValue* left, HValue* right)
2016 : HBinaryOperation(left, right) { 1966 : HBinaryOperation(left, right) {
2017 // Default to truncating, Integer32, UseGVN. 1967 set_representation(Representation::Tagged());
2018 set_representation(Representation::Integer32()); 1968 SetFlag(kFlexibleRepresentation);
2019 SetFlag(kTruncatingToInt32); 1969 SetAllSideEffects();
2020 SetFlag(kUseGVN);
2021 } 1970 }
2022 1971
2023 virtual Representation RequiredInputRepresentation(int index) const { 1972 virtual Representation RequiredInputRepresentation(int index) const {
2024 return Representation::Integer32(); 1973 return representation();
2025 } 1974 }
2026 1975
1976 virtual void RepresentationChanged(Representation to) {
1977 if (!to.IsTagged()) {
1978 ASSERT(to.IsInteger32());
1979 ClearAllSideEffects();
1980 SetFlag(kTruncatingToInt32);
1981 SetFlag(kUseGVN);
1982 }
1983 }
1984
1985 HType CalculateInferredType() const;
1986
2027 DECLARE_INSTRUCTION(BitwiseBinaryOperation) 1987 DECLARE_INSTRUCTION(BitwiseBinaryOperation)
2028 }; 1988 };
2029 1989
2030 1990
2031 class HArithmeticBinaryOperation: public HBinaryOperation { 1991 class HArithmeticBinaryOperation: public HBinaryOperation {
2032 public: 1992 public:
2033 HArithmeticBinaryOperation(HValue* left, HValue* right) 1993 HArithmeticBinaryOperation(HValue* left, HValue* right)
2034 : HBinaryOperation(left, right) { 1994 : HBinaryOperation(left, right) {
2035 set_representation(Representation::Tagged()); 1995 set_representation(Representation::Tagged());
2036 SetFlag(kFlexibleRepresentation); 1996 SetFlag(kFlexibleRepresentation);
2037 SetFlagMask(AllSideEffects()); 1997 SetAllSideEffects();
2038 } 1998 }
2039 1999
2040 virtual void RepresentationChanged(Representation to) { 2000 virtual void RepresentationChanged(Representation to) {
2041 if (!to.IsTagged()) { 2001 if (!to.IsTagged()) {
2042 ClearFlagMask(AllSideEffects()); 2002 ClearAllSideEffects();
2043 SetFlag(kUseGVN); 2003 SetFlag(kUseGVN);
2044 } 2004 }
2045 } 2005 }
2046 2006
2047 virtual HType CalculateInferredType() const; 2007 virtual HType CalculateInferredType() const;
2048 virtual Representation RequiredInputRepresentation(int index) const { 2008 virtual Representation RequiredInputRepresentation(int index) const {
2049 return representation(); 2009 return representation();
2050 } 2010 }
2051 virtual Representation InferredRepresentation() const { 2011 virtual Representation InferredRepresentation() const {
2052 if (left()->representation().Equals(right()->representation())) { 2012 if (left()->representation().Equals(right()->representation())) {
2053 return left()->representation(); 2013 return left()->representation();
2054 } 2014 }
2055 return HValue::InferredRepresentation(); 2015 return HValue::InferredRepresentation();
2056 } 2016 }
2057 2017
2058 DECLARE_INSTRUCTION(ArithmeticBinaryOperation) 2018 DECLARE_INSTRUCTION(ArithmeticBinaryOperation)
2059 }; 2019 };
2060 2020
2061 2021
2062 class HCompare: public HBinaryOperation { 2022 class HCompare: public HBinaryOperation {
2063 public: 2023 public:
2064 HCompare(HValue* left, HValue* right, Token::Value token) 2024 HCompare(HValue* left, HValue* right, Token::Value token)
2065 : HBinaryOperation(left, right), token_(token) { 2025 : HBinaryOperation(left, right), token_(token) {
2066 ASSERT(Token::IsCompareOp(token)); 2026 ASSERT(Token::IsCompareOp(token));
2067 set_representation(Representation::Tagged()); 2027 set_representation(Representation::Tagged());
2068 SetFlagMask(AllSideEffects()); 2028 SetAllSideEffects();
2069 } 2029 }
2070 2030
2071 void SetInputRepresentation(Representation r); 2031 void SetInputRepresentation(Representation r);
2072 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2032 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
2073 virtual Representation RequiredInputRepresentation(int index) const { 2033 virtual Representation RequiredInputRepresentation(int index) const {
2074 return input_representation_; 2034 return input_representation_;
2075 } 2035 }
2076 Representation GetInputRepresentation() const { 2036 Representation GetInputRepresentation() const {
2077 return input_representation_; 2037 return input_representation_;
2078 } 2038 }
(...skipping 28 matching lines...) Expand all
2107 SetFlag(kUseGVN); 2067 SetFlag(kUseGVN);
2108 } 2068 }
2109 2069
2110 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2070 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
2111 virtual Representation RequiredInputRepresentation(int index) const { 2071 virtual Representation RequiredInputRepresentation(int index) const {
2112 return Representation::Tagged(); 2072 return Representation::Tagged();
2113 } 2073 }
2114 virtual HType CalculateInferredType() const; 2074 virtual HType CalculateInferredType() const;
2115 2075
2116 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") 2076 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq")
2077
2078 protected:
2079 virtual bool DataEquals(HValue* other) const { return true; }
2117 }; 2080 };
2118 2081
2119 2082
2120 class HUnaryPredicate: public HUnaryOperation { 2083 class HUnaryPredicate: public HUnaryOperation {
2121 public: 2084 public:
2122 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { 2085 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) {
2123 set_representation(Representation::Tagged()); 2086 set_representation(Representation::Tagged());
2124 SetFlag(kUseGVN); 2087 SetFlag(kUseGVN);
2125 } 2088 }
2126 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2089 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
(...skipping 22 matching lines...) Expand all
2149 private: 2112 private:
2150 bool is_strict_; 2113 bool is_strict_;
2151 }; 2114 };
2152 2115
2153 2116
2154 class HIsObject: public HUnaryPredicate { 2117 class HIsObject: public HUnaryPredicate {
2155 public: 2118 public:
2156 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } 2119 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { }
2157 2120
2158 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") 2121 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object")
2122
2123 protected:
2124 virtual bool DataEquals(HValue* other) const { return true; }
2159 }; 2125 };
2160 2126
2161 2127
2162 class HIsSmi: public HUnaryPredicate { 2128 class HIsSmi: public HUnaryPredicate {
2163 public: 2129 public:
2164 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } 2130 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { }
2165 2131
2166 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") 2132 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi")
2133
2134 protected:
2135 virtual bool DataEquals(HValue* other) const { return true; }
2167 }; 2136 };
2168 2137
2169 2138
2170 class HHasInstanceType: public HUnaryPredicate { 2139 class HHasInstanceType: public HUnaryPredicate {
2171 public: 2140 public:
2172 HHasInstanceType(HValue* value, InstanceType type) 2141 HHasInstanceType(HValue* value, InstanceType type)
2173 : HUnaryPredicate(value), from_(type), to_(type) { } 2142 : HUnaryPredicate(value), from_(type), to_(type) { }
2174 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) 2143 HHasInstanceType(HValue* value, InstanceType from, InstanceType to)
2175 : HUnaryPredicate(value), from_(from), to_(to) { 2144 : HUnaryPredicate(value), from_(from), to_(to) {
2176 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. 2145 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
(...skipping 16 matching lines...) Expand all
2193 InstanceType from_; 2162 InstanceType from_;
2194 InstanceType to_; // Inclusive range, not all combinations work. 2163 InstanceType to_; // Inclusive range, not all combinations work.
2195 }; 2164 };
2196 2165
2197 2166
2198 class HHasCachedArrayIndex: public HUnaryPredicate { 2167 class HHasCachedArrayIndex: public HUnaryPredicate {
2199 public: 2168 public:
2200 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } 2169 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { }
2201 2170
2202 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") 2171 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index")
2172
2173 protected:
2174 virtual bool DataEquals(HValue* other) const { return true; }
2203 }; 2175 };
2204 2176
2205 2177
2206 class HClassOfTest: public HUnaryPredicate { 2178 class HClassOfTest: public HUnaryPredicate {
2207 public: 2179 public:
2208 HClassOfTest(HValue* value, Handle<String> class_name) 2180 HClassOfTest(HValue* value, Handle<String> class_name)
2209 : HUnaryPredicate(value), class_name_(class_name) { } 2181 : HUnaryPredicate(value), class_name_(class_name) { }
2210 2182
2211 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") 2183 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test")
2212 2184
(...skipping 30 matching lines...) Expand all
2243 2215
2244 private: 2216 private:
2245 Handle<String> type_literal_; 2217 Handle<String> type_literal_;
2246 }; 2218 };
2247 2219
2248 2220
2249 class HInstanceOf: public HBinaryOperation { 2221 class HInstanceOf: public HBinaryOperation {
2250 public: 2222 public:
2251 HInstanceOf(HValue* left, HValue* right) : HBinaryOperation(left, right) { 2223 HInstanceOf(HValue* left, HValue* right) : HBinaryOperation(left, right) {
2252 set_representation(Representation::Tagged()); 2224 set_representation(Representation::Tagged());
2253 SetFlagMask(AllSideEffects()); 2225 SetAllSideEffects();
2254 } 2226 }
2255 2227
2256 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2228 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
2257 2229
2258 virtual Representation RequiredInputRepresentation(int index) const { 2230 virtual Representation RequiredInputRepresentation(int index) const {
2259 return Representation::Tagged(); 2231 return Representation::Tagged();
2260 } 2232 }
2261 2233
2262 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") 2234 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of")
2263 }; 2235 };
2264 2236
2265 2237
2266 class HInstanceOfKnownGlobal: public HUnaryOperation { 2238 class HInstanceOfKnownGlobal: public HUnaryOperation {
2267 public: 2239 public:
2268 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) 2240 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right)
2269 : HUnaryOperation(left), function_(right) { 2241 : HUnaryOperation(left), function_(right) {
2270 set_representation(Representation::Tagged()); 2242 set_representation(Representation::Tagged());
2271 SetFlagMask(AllSideEffects()); 2243 SetAllSideEffects();
2272 } 2244 }
2273 2245
2274 Handle<JSFunction> function() { return function_; } 2246 Handle<JSFunction> function() { return function_; }
2275 2247
2276 virtual Representation RequiredInputRepresentation(int index) const { 2248 virtual Representation RequiredInputRepresentation(int index) const {
2277 return Representation::Tagged(); 2249 return Representation::Tagged();
2278 } 2250 }
2279 2251
2280 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, 2252 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
2281 "instance_of_known_global") 2253 "instance_of_known_global")
2282 2254
2283 private: 2255 private:
2284 Handle<JSFunction> function_; 2256 Handle<JSFunction> function_;
2285 }; 2257 };
2286 2258
2287 2259
2288 class HPower: public HBinaryOperation { 2260 class HPower: public HBinaryOperation {
2289 public: 2261 public:
2290 HPower(HValue* left, HValue* right) 2262 HPower(HValue* left, HValue* right)
2291 : HBinaryOperation(left, right) { 2263 : HBinaryOperation(left, right) {
2292 set_representation(Representation::Double()); 2264 set_representation(Representation::Double());
2293 SetFlag(kUseGVN); 2265 SetFlag(kUseGVN);
2294 } 2266 }
2295 2267
2296 virtual Representation RequiredInputRepresentation(int index) const { 2268 virtual Representation RequiredInputRepresentation(int index) const {
2297 return (index == 1) ? Representation::None() : Representation::Double(); 2269 return (index == 1) ? Representation::None() : Representation::Double();
2298 } 2270 }
2299 2271
2300 DECLARE_CONCRETE_INSTRUCTION(Power, "power") 2272 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
2273
2274 protected:
2275 virtual bool DataEquals(HValue* other) const { return true; }
2301 }; 2276 };
2302 2277
2303 2278
2304 class HAdd: public HArithmeticBinaryOperation { 2279 class HAdd: public HArithmeticBinaryOperation {
2305 public: 2280 public:
2306 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2281 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2307 SetFlag(kCanOverflow); 2282 SetFlag(kCanOverflow);
2308 } 2283 }
2309 2284
2310 // Add is only commutative if two integer values are added and not if two 2285 // Add is only commutative if two integer values are added and not if two
2311 // tagged values are added (because it might be a String concatenation). 2286 // tagged values are added (because it might be a String concatenation).
2312 virtual bool IsCommutative() const { 2287 virtual bool IsCommutative() const {
2313 return !representation().IsTagged(); 2288 return !representation().IsTagged();
2314 } 2289 }
2315 2290
2316 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2291 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2317 2292
2318 virtual HType CalculateInferredType() const; 2293 virtual HType CalculateInferredType() const;
2319 2294
2320 DECLARE_CONCRETE_INSTRUCTION(Add, "add") 2295 DECLARE_CONCRETE_INSTRUCTION(Add, "add")
2321 2296
2322 protected: 2297 protected:
2298 virtual bool DataEquals(HValue* other) const { return true; }
2299
2323 virtual Range* InferRange(); 2300 virtual Range* InferRange();
2324 }; 2301 };
2325 2302
2326 2303
2327 class HSub: public HArithmeticBinaryOperation { 2304 class HSub: public HArithmeticBinaryOperation {
2328 public: 2305 public:
2329 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2306 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2330 SetFlag(kCanOverflow); 2307 SetFlag(kCanOverflow);
2331 } 2308 }
2332 2309
2333 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2310 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2334 2311
2335 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub") 2312 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub")
2336 2313
2337 protected: 2314 protected:
2315 virtual bool DataEquals(HValue* other) const { return true; }
2316
2338 virtual Range* InferRange(); 2317 virtual Range* InferRange();
2339 }; 2318 };
2340 2319
2341 2320
2342 class HMul: public HArithmeticBinaryOperation { 2321 class HMul: public HArithmeticBinaryOperation {
2343 public: 2322 public:
2344 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2323 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2345 SetFlag(kCanOverflow); 2324 SetFlag(kCanOverflow);
2346 } 2325 }
2347 2326
2348 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2327 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2349 2328
2350 // Only commutative if it is certain that not two objects are multiplicated. 2329 // Only commutative if it is certain that not two objects are multiplicated.
2351 virtual bool IsCommutative() const { 2330 virtual bool IsCommutative() const {
2352 return !representation().IsTagged(); 2331 return !representation().IsTagged();
2353 } 2332 }
2354 2333
2355 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul") 2334 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul")
2356 2335
2357 protected: 2336 protected:
2337 virtual bool DataEquals(HValue* other) const { return true; }
2338
2358 virtual Range* InferRange(); 2339 virtual Range* InferRange();
2359 }; 2340 };
2360 2341
2361 2342
2362 class HMod: public HArithmeticBinaryOperation { 2343 class HMod: public HArithmeticBinaryOperation {
2363 public: 2344 public:
2364 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2345 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2365 SetFlag(kCanBeDivByZero); 2346 SetFlag(kCanBeDivByZero);
2366 } 2347 }
2367 2348
2368 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2349 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2369 2350
2370 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") 2351 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod")
2371 2352
2372 protected: 2353 protected:
2354 virtual bool DataEquals(HValue* other) const { return true; }
2355
2373 virtual Range* InferRange(); 2356 virtual Range* InferRange();
2374 }; 2357 };
2375 2358
2376 2359
2377 class HDiv: public HArithmeticBinaryOperation { 2360 class HDiv: public HArithmeticBinaryOperation {
2378 public: 2361 public:
2379 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2362 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2380 SetFlag(kCanBeDivByZero); 2363 SetFlag(kCanBeDivByZero);
2381 SetFlag(kCanOverflow); 2364 SetFlag(kCanOverflow);
2382 } 2365 }
2383 2366
2384 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2367 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2385 2368
2386 DECLARE_CONCRETE_INSTRUCTION(Div, "div") 2369 DECLARE_CONCRETE_INSTRUCTION(Div, "div")
2387 2370
2388 protected: 2371 protected:
2372 virtual bool DataEquals(HValue* other) const { return true; }
2373
2389 virtual Range* InferRange(); 2374 virtual Range* InferRange();
2390 }; 2375 };
2391 2376
2392 2377
2393 class HBitAnd: public HBitwiseBinaryOperation { 2378 class HBitAnd: public HBitwiseBinaryOperation {
2394 public: 2379 public:
2395 HBitAnd(HValue* left, HValue* right) 2380 HBitAnd(HValue* left, HValue* right)
2396 : HBitwiseBinaryOperation(left, right) { } 2381 : HBitwiseBinaryOperation(left, right) { }
2397 2382
2398 virtual bool IsCommutative() const { return true; } 2383 virtual bool IsCommutative() const { return true; }
2399 virtual HType CalculateInferredType() const; 2384 virtual HType CalculateInferredType() const;
2400 2385
2401 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and") 2386 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and")
2402 2387
2403 protected: 2388 protected:
2389 virtual bool DataEquals(HValue* other) const { return true; }
2390
2404 virtual Range* InferRange(); 2391 virtual Range* InferRange();
2405 }; 2392 };
2406 2393
2407 2394
2408 class HBitXor: public HBitwiseBinaryOperation { 2395 class HBitXor: public HBitwiseBinaryOperation {
2409 public: 2396 public:
2410 HBitXor(HValue* left, HValue* right) 2397 HBitXor(HValue* left, HValue* right)
2411 : HBitwiseBinaryOperation(left, right) { } 2398 : HBitwiseBinaryOperation(left, right) { }
2412 2399
2413 virtual bool IsCommutative() const { return true; } 2400 virtual bool IsCommutative() const { return true; }
2414 virtual HType CalculateInferredType() const; 2401 virtual HType CalculateInferredType() const;
2415 2402
2416 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor") 2403 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor")
2404
2405 protected:
2406 virtual bool DataEquals(HValue* other) const { return true; }
2417 }; 2407 };
2418 2408
2419 2409
2420 class HBitOr: public HBitwiseBinaryOperation { 2410 class HBitOr: public HBitwiseBinaryOperation {
2421 public: 2411 public:
2422 HBitOr(HValue* left, HValue* right) 2412 HBitOr(HValue* left, HValue* right)
2423 : HBitwiseBinaryOperation(left, right) { } 2413 : HBitwiseBinaryOperation(left, right) { }
2424 2414
2425 virtual bool IsCommutative() const { return true; } 2415 virtual bool IsCommutative() const { return true; }
2426 virtual HType CalculateInferredType() const; 2416 virtual HType CalculateInferredType() const;
2427 2417
2428 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or") 2418 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or")
2429 2419
2430 protected: 2420 protected:
2421 virtual bool DataEquals(HValue* other) const { return true; }
2422
2431 virtual Range* InferRange(); 2423 virtual Range* InferRange();
2432 }; 2424 };
2433 2425
2434 2426
2435 class HShl: public HBitwiseBinaryOperation { 2427 class HShl: public HBitwiseBinaryOperation {
2436 public: 2428 public:
2437 HShl(HValue* left, HValue* right) 2429 HShl(HValue* left, HValue* right)
2438 : HBitwiseBinaryOperation(left, right) { } 2430 : HBitwiseBinaryOperation(left, right) { }
2439 2431
2440 virtual Range* InferRange(); 2432 virtual Range* InferRange();
2441 virtual HType CalculateInferredType() const; 2433 virtual HType CalculateInferredType() const;
2442 2434
2443 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl") 2435 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl")
2436
2437 protected:
2438 virtual bool DataEquals(HValue* other) const { return true; }
2444 }; 2439 };
2445 2440
2446 2441
2447 class HShr: public HBitwiseBinaryOperation { 2442 class HShr: public HBitwiseBinaryOperation {
2448 public: 2443 public:
2449 HShr(HValue* left, HValue* right) 2444 HShr(HValue* left, HValue* right)
2450 : HBitwiseBinaryOperation(left, right) { } 2445 : HBitwiseBinaryOperation(left, right) { }
2451 2446
2452 virtual HType CalculateInferredType() const; 2447 virtual HType CalculateInferredType() const;
2453 2448
2454 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr") 2449 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr")
2450
2451 protected:
2452 virtual bool DataEquals(HValue* other) const { return true; }
2455 }; 2453 };
2456 2454
2457 2455
2458 class HSar: public HBitwiseBinaryOperation { 2456 class HSar: public HBitwiseBinaryOperation {
2459 public: 2457 public:
2460 HSar(HValue* left, HValue* right) 2458 HSar(HValue* left, HValue* right)
2461 : HBitwiseBinaryOperation(left, right) { } 2459 : HBitwiseBinaryOperation(left, right) { }
2462 2460
2463 virtual Range* InferRange(); 2461 virtual Range* InferRange();
2464 virtual HType CalculateInferredType() const; 2462 virtual HType CalculateInferredType() const;
2465 2463
2466 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") 2464 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar")
2465
2466 protected:
2467 virtual bool DataEquals(HValue* other) const { return true; }
2467 }; 2468 };
2468 2469
2469 2470
2470 class HOsrEntry: public HInstruction { 2471 class HOsrEntry: public HInstruction {
2471 public: 2472 public:
2472 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { 2473 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
2473 SetFlag(kChangesOsrEntries); 2474 SetFlag(kChangesOsrEntries);
2474 } 2475 }
2475 2476
2476 int ast_id() const { return ast_id_; } 2477 int ast_id() const { return ast_id_; }
(...skipping 22 matching lines...) Expand all
2499 }; 2500 };
2500 2501
2501 2502
2502 class HCallStub: public HInstruction { 2503 class HCallStub: public HInstruction {
2503 public: 2504 public:
2504 HCallStub(CodeStub::Major major_key, int argument_count) 2505 HCallStub(CodeStub::Major major_key, int argument_count)
2505 : major_key_(major_key), 2506 : major_key_(major_key),
2506 argument_count_(argument_count), 2507 argument_count_(argument_count),
2507 transcendental_type_(TranscendentalCache::kNumberOfCaches) { 2508 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
2508 set_representation(Representation::Tagged()); 2509 set_representation(Representation::Tagged());
2509 SetFlagMask(AllSideEffects()); 2510 SetAllSideEffects();
2510 } 2511 }
2511 2512
2512 CodeStub::Major major_key() { return major_key_; } 2513 CodeStub::Major major_key() { return major_key_; }
2513 int argument_count() { return argument_count_; } 2514 int argument_count() { return argument_count_; }
2514 2515
2515 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 2516 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
2516 transcendental_type_ = transcendental_type; 2517 transcendental_type_ = transcendental_type;
2517 } 2518 }
2518 TranscendentalCache::Type transcendental_type() { 2519 TranscendentalCache::Type transcendental_type() {
2519 return transcendental_type_; 2520 return transcendental_type_;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 2583
2583 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2584 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2584 2585
2585 virtual Representation RequiredInputRepresentation(int index) const { 2586 virtual Representation RequiredInputRepresentation(int index) const {
2586 return Representation::Tagged(); 2587 return Representation::Tagged();
2587 } 2588 }
2588 virtual void PrintDataTo(StringStream* stream) const; 2589 virtual void PrintDataTo(StringStream* stream) const;
2589 2590
2590 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") 2591 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global")
2591 2592
2592 protected:
2593 virtual bool DataEquals(HValue* other) const {
2594 HStoreGlobal* b = HStoreGlobal::cast(other);
2595 return cell_.is_identical_to(b->cell());
2596 }
2597
2598 private: 2593 private:
2599 Handle<JSGlobalPropertyCell> cell_; 2594 Handle<JSGlobalPropertyCell> cell_;
2600 }; 2595 };
2601 2596
2602 2597
2598 class HLoadContextSlot: public HInstruction {
2599 public:
2600 HLoadContextSlot(int context_chain_length , int slot_index)
2601 : context_chain_length_(context_chain_length), slot_index_(slot_index) {
2602 set_representation(Representation::Tagged());
2603 SetFlag(kUseGVN);
2604 SetFlag(kDependsOnCalls);
2605 }
2606
2607 int context_chain_length() const { return context_chain_length_; }
2608 int slot_index() const { return slot_index_; }
2609
2610 virtual void PrintDataTo(StringStream* stream) const;
2611
2612 virtual intptr_t Hashcode() const {
2613 return context_chain_length() * 29 + slot_index();
2614 }
2615
2616 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot")
2617
2618 protected:
2619 virtual bool DataEquals(HValue* other) const {
2620 HLoadContextSlot* b = HLoadContextSlot::cast(other);
2621 return (context_chain_length() == b->context_chain_length())
2622 && (slot_index() == b->slot_index());
2623 }
2624
2625 private:
2626 int context_chain_length_;
2627 int slot_index_;
2628 };
2629
2630
2603 class HLoadNamedField: public HUnaryOperation { 2631 class HLoadNamedField: public HUnaryOperation {
2604 public: 2632 public:
2605 HLoadNamedField(HValue* object, bool is_in_object, int offset) 2633 HLoadNamedField(HValue* object, bool is_in_object, int offset)
2606 : HUnaryOperation(object), 2634 : HUnaryOperation(object),
2607 is_in_object_(is_in_object), 2635 is_in_object_(is_in_object),
2608 offset_(offset) { 2636 offset_(offset) {
2609 set_representation(Representation::Tagged()); 2637 set_representation(Representation::Tagged());
2610 SetFlag(kUseGVN); 2638 SetFlag(kUseGVN);
2611 if (is_in_object) { 2639 if (is_in_object) {
2612 SetFlag(kDependsOnInobjectFields); 2640 SetFlag(kDependsOnInobjectFields);
(...skipping 23 matching lines...) Expand all
2636 bool is_in_object_; 2664 bool is_in_object_;
2637 int offset_; 2665 int offset_;
2638 }; 2666 };
2639 2667
2640 2668
2641 class HLoadNamedGeneric: public HUnaryOperation { 2669 class HLoadNamedGeneric: public HUnaryOperation {
2642 public: 2670 public:
2643 HLoadNamedGeneric(HValue* object, Handle<Object> name) 2671 HLoadNamedGeneric(HValue* object, Handle<Object> name)
2644 : HUnaryOperation(object), name_(name) { 2672 : HUnaryOperation(object), name_(name) {
2645 set_representation(Representation::Tagged()); 2673 set_representation(Representation::Tagged());
2646 SetFlagMask(AllSideEffects()); 2674 SetAllSideEffects();
2647 } 2675 }
2648 2676
2649 HValue* object() const { return OperandAt(0); } 2677 HValue* object() const { return OperandAt(0); }
2650 Handle<Object> name() const { return name_; } 2678 Handle<Object> name() const { return name_; }
2651 2679
2652 virtual Representation RequiredInputRepresentation(int index) const { 2680 virtual Representation RequiredInputRepresentation(int index) const {
2653 return Representation::Tagged(); 2681 return Representation::Tagged();
2654 } 2682 }
2655 2683
2656 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic") 2684 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic")
2657 2685
2658 protected:
2659 virtual bool DataEquals(HValue* other) const {
2660 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other);
2661 return name_.is_identical_to(b->name_);
2662 }
2663
2664 private: 2686 private:
2665 Handle<Object> name_; 2687 Handle<Object> name_;
2666 }; 2688 };
2667 2689
2668 2690
2669 class HLoadFunctionPrototype: public HUnaryOperation { 2691 class HLoadFunctionPrototype: public HUnaryOperation {
2670 public: 2692 public:
2671 explicit HLoadFunctionPrototype(HValue* function) 2693 explicit HLoadFunctionPrototype(HValue* function)
2672 : HUnaryOperation(function) { 2694 : HUnaryOperation(function) {
2673 set_representation(Representation::Tagged()); 2695 set_representation(Representation::Tagged());
2674 SetFlagMask(kDependsOnFunctionPrototypes); 2696 SetFlag(kUseGVN);
2697 SetFlag(kDependsOnCalls);
2675 } 2698 }
2676 2699
2677 HValue* function() const { return OperandAt(0); } 2700 HValue* function() const { return OperandAt(0); }
2678 2701
2679 virtual Representation RequiredInputRepresentation(int index) const { 2702 virtual Representation RequiredInputRepresentation(int index) const {
2680 return Representation::Tagged(); 2703 return Representation::Tagged();
2681 } 2704 }
2682 2705
2683 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") 2706 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype")
2684 2707
(...skipping 28 matching lines...) Expand all
2713 } 2736 }
2714 2737
2715 virtual Representation RequiredInputRepresentation(int index) const { 2738 virtual Representation RequiredInputRepresentation(int index) const {
2716 // The key is supposed to be Integer32. 2739 // The key is supposed to be Integer32.
2717 return (index == 1) ? Representation::Integer32() 2740 return (index == 1) ? Representation::Integer32()
2718 : Representation::Tagged(); 2741 : Representation::Tagged();
2719 } 2742 }
2720 2743
2721 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, 2744 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
2722 "load_keyed_fast_element") 2745 "load_keyed_fast_element")
2746
2747 protected:
2748 virtual bool DataEquals(HValue* other) const { return true; }
2723 }; 2749 };
2724 2750
2725 2751
2726 class HLoadKeyedGeneric: public HLoadKeyed { 2752 class HLoadKeyedGeneric: public HLoadKeyed {
2727 public: 2753 public:
2728 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2754 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
2729 SetFlagMask(AllSideEffects()); 2755 SetAllSideEffects();
2730 } 2756 }
2731 2757
2732 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") 2758 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
2733 }; 2759 };
2734 2760
2735 2761
2736 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { 2762 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
2737 return !value->type().IsSmi() && 2763 return !value->type().IsSmi() &&
2738 !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); 2764 !(value->IsConstant() && HConstant::cast(value)->InOldSpace());
2739 } 2765 }
(...skipping 15 matching lines...) Expand all
2755 Handle<Object> name() const { return name_; } 2781 Handle<Object> name() const { return name_; }
2756 HValue* value() const { return OperandAt(1); } 2782 HValue* value() const { return OperandAt(1); }
2757 void set_value(HValue* value) { SetOperandAt(1, value); } 2783 void set_value(HValue* value) { SetOperandAt(1, value); }
2758 2784
2759 bool NeedsWriteBarrier() const { 2785 bool NeedsWriteBarrier() const {
2760 return StoringValueNeedsWriteBarrier(value()); 2786 return StoringValueNeedsWriteBarrier(value());
2761 } 2787 }
2762 2788
2763 DECLARE_INSTRUCTION(StoreNamed) 2789 DECLARE_INSTRUCTION(StoreNamed)
2764 2790
2765 protected:
2766 virtual bool DataEquals(HValue* other) const {
2767 HStoreNamed* b = HStoreNamed::cast(other);
2768 return name_.is_identical_to(b->name_);
2769 }
2770
2771 private: 2791 private:
2772 Handle<Object> name_; 2792 Handle<Object> name_;
2773 }; 2793 };
2774 2794
2775 2795
2776 class HStoreNamedField: public HStoreNamed { 2796 class HStoreNamedField: public HStoreNamed {
2777 public: 2797 public:
2778 HStoreNamedField(HValue* obj, 2798 HStoreNamedField(HValue* obj,
2779 Handle<Object> name, 2799 Handle<Object> name,
2780 HValue* val, 2800 HValue* val,
(...skipping 25 matching lines...) Expand all
2806 bool is_in_object_; 2826 bool is_in_object_;
2807 int offset_; 2827 int offset_;
2808 Handle<Map> transition_; 2828 Handle<Map> transition_;
2809 }; 2829 };
2810 2830
2811 2831
2812 class HStoreNamedGeneric: public HStoreNamed { 2832 class HStoreNamedGeneric: public HStoreNamed {
2813 public: 2833 public:
2814 HStoreNamedGeneric(HValue* obj, Handle<Object> name, HValue* val) 2834 HStoreNamedGeneric(HValue* obj, Handle<Object> name, HValue* val)
2815 : HStoreNamed(obj, name, val) { 2835 : HStoreNamed(obj, name, val) {
2816 SetFlagMask(AllSideEffects()); 2836 SetAllSideEffects();
2817 } 2837 }
2818 2838
2819 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic") 2839 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic")
2820 }; 2840 };
2821 2841
2822 2842
2823 class HStoreKeyed: public HInstruction { 2843 class HStoreKeyed: public HInstruction {
2824 public: 2844 public:
2825 HStoreKeyed(HValue* obj, HValue* key, HValue* val) { 2845 HStoreKeyed(HValue* obj, HValue* key, HValue* val) {
2826 SetOperandAt(0, obj); 2846 SetOperandAt(0, obj);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 2891
2872 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 2892 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
2873 "store_keyed_fast_element") 2893 "store_keyed_fast_element")
2874 }; 2894 };
2875 2895
2876 2896
2877 class HStoreKeyedGeneric: public HStoreKeyed { 2897 class HStoreKeyedGeneric: public HStoreKeyed {
2878 public: 2898 public:
2879 HStoreKeyedGeneric(HValue* obj, HValue* key, HValue* val) 2899 HStoreKeyedGeneric(HValue* obj, HValue* key, HValue* val)
2880 : HStoreKeyed(obj, key, val) { 2900 : HStoreKeyed(obj, key, val) {
2881 SetFlagMask(AllSideEffects()); 2901 SetAllSideEffects();
2882 } 2902 }
2883 2903
2884 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") 2904 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic")
2885 }; 2905 };
2886 2906
2887 2907
2908 class HStringCharCodeAt: public HBinaryOperation {
2909 public:
2910 HStringCharCodeAt(HValue* string, HValue* index)
2911 : HBinaryOperation(string, index) {
2912 set_representation(Representation::Integer32());
2913 SetFlag(kUseGVN);
2914 }
2915
2916 virtual Representation RequiredInputRepresentation(int index) const {
2917 // The index is supposed to be Integer32.
2918 return (index == 1) ? Representation::Integer32()
2919 : Representation::Tagged();
2920 }
2921
2922 HValue* string() const { return OperandAt(0); }
2923 HValue* index() const { return OperandAt(1); }
2924
2925 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at")
2926
2927 protected:
2928 virtual bool DataEquals(HValue* other) const { return true; }
2929
2930 virtual Range* InferRange() {
2931 return new Range(0, String::kMaxUC16CharCode);
2932 }
2933 };
2934
2935
2936 class HStringLength: public HUnaryOperation {
2937 public:
2938 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
2939 set_representation(Representation::Tagged());
2940 SetFlag(kUseGVN);
2941 }
2942
2943 virtual Representation RequiredInputRepresentation(int index) const {
2944 return Representation::Tagged();
2945 }
2946
2947 virtual HType CalculateInferredType() const {
2948 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
2949 return HType::Smi();
2950 }
2951
2952 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length")
2953
2954 protected:
2955 virtual bool DataEquals(HValue* other) const { return true; }
2956
2957 virtual Range* InferRange() {
2958 return new Range(0, String::kMaxLength);
2959 }
2960 };
2961
2962
2888 class HMaterializedLiteral: public HInstruction { 2963 class HMaterializedLiteral: public HInstruction {
2889 public: 2964 public:
2890 HMaterializedLiteral(int index, int depth) 2965 HMaterializedLiteral(int index, int depth)
2891 : literal_index_(index), depth_(depth) { 2966 : literal_index_(index), depth_(depth) {
2892 set_representation(Representation::Tagged()); 2967 set_representation(Representation::Tagged());
2893 } 2968 }
2894 2969
2895 int literal_index() const { return literal_index_; } 2970 int literal_index() const { return literal_index_; }
2896 int depth() const { return depth_; } 2971 int depth() const { return depth_; }
2897 2972
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 3080
3006 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value_of") 3081 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value_of")
3007 }; 3082 };
3008 3083
3009 3084
3010 class HDeleteProperty: public HBinaryOperation { 3085 class HDeleteProperty: public HBinaryOperation {
3011 public: 3086 public:
3012 HDeleteProperty(HValue* obj, HValue* key) 3087 HDeleteProperty(HValue* obj, HValue* key)
3013 : HBinaryOperation(obj, key) { 3088 : HBinaryOperation(obj, key) {
3014 set_representation(Representation::Tagged()); 3089 set_representation(Representation::Tagged());
3015 SetFlagMask(AllSideEffects()); 3090 SetAllSideEffects();
3016 } 3091 }
3017 3092
3018 virtual Representation RequiredInputRepresentation(int index) const { 3093 virtual Representation RequiredInputRepresentation(int index) const {
3019 return Representation::Tagged(); 3094 return Representation::Tagged();
3020 } 3095 }
3021 3096
3022 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete_property") 3097 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete_property")
3023 3098
3024 HValue* object() const { return left(); } 3099 HValue* object() const { return left(); }
3025 HValue* key() const { return right(); } 3100 HValue* key() const { return right(); }
3026 }; 3101 };
3027 3102
3028 #undef DECLARE_INSTRUCTION 3103 #undef DECLARE_INSTRUCTION
3029 #undef DECLARE_CONCRETE_INSTRUCTION 3104 #undef DECLARE_CONCRETE_INSTRUCTION
3030 3105
3031 } } // namespace v8::internal 3106 } } // namespace v8::internal
3032 3107
3033 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3108 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698