OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 V(Maps) \ | 184 V(Maps) \ |
185 V(OsrEntries) \ | 185 V(OsrEntries) \ |
186 V(ExternalMemory) \ | 186 V(ExternalMemory) \ |
187 V(StringChars) \ | 187 V(StringChars) \ |
188 V(TypedArrayElements) | 188 V(TypedArrayElements) |
189 | 189 |
190 | 190 |
191 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 191 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
192 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ | 192 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ |
193 static H##type* cast(HValue* value) { \ | 193 static H##type* cast(HValue* value) { \ |
194 ASSERT(value->Is##type()); \ | 194 DCHECK(value->Is##type()); \ |
195 return reinterpret_cast<H##type*>(value); \ | 195 return reinterpret_cast<H##type*>(value); \ |
196 } | 196 } |
197 | 197 |
198 | 198 |
199 #define DECLARE_CONCRETE_INSTRUCTION(type) \ | 199 #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
200 virtual LInstruction* CompileToLithium( \ | 200 virtual LInstruction* CompileToLithium( \ |
201 LChunkBuilder* builder) V8_FINAL V8_OVERRIDE; \ | 201 LChunkBuilder* builder) V8_FINAL V8_OVERRIDE; \ |
202 static H##type* cast(HValue* value) { \ | 202 static H##type* cast(HValue* value) { \ |
203 ASSERT(value->Is##type()); \ | 203 DCHECK(value->Is##type()); \ |
204 return reinterpret_cast<H##type*>(value); \ | 204 return reinterpret_cast<H##type*>(value); \ |
205 } \ | 205 } \ |
206 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ | 206 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \ |
207 return HValue::k##type; \ | 207 return HValue::k##type; \ |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 enum PropertyAccessType { LOAD, STORE }; | 211 enum PropertyAccessType { LOAD, STORE }; |
212 | 212 |
213 | 213 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 | 315 |
316 // We reuse use list nodes behind the scenes as uses are added and deleted. | 316 // We reuse use list nodes behind the scenes as uses are added and deleted. |
317 // This class is the safe way to iterate uses while deleting them. | 317 // This class is the safe way to iterate uses while deleting them. |
318 class HUseIterator V8_FINAL BASE_EMBEDDED { | 318 class HUseIterator V8_FINAL BASE_EMBEDDED { |
319 public: | 319 public: |
320 bool Done() { return current_ == NULL; } | 320 bool Done() { return current_ == NULL; } |
321 void Advance(); | 321 void Advance(); |
322 | 322 |
323 HValue* value() { | 323 HValue* value() { |
324 ASSERT(!Done()); | 324 DCHECK(!Done()); |
325 return value_; | 325 return value_; |
326 } | 326 } |
327 | 327 |
328 int index() { | 328 int index() { |
329 ASSERT(!Done()); | 329 DCHECK(!Done()); |
330 return index_; | 330 return index_; |
331 } | 331 } |
332 | 332 |
333 private: | 333 private: |
334 explicit HUseIterator(HUseListNode* head); | 334 explicit HUseIterator(HUseListNode* head); |
335 | 335 |
336 HUseListNode* current_; | 336 HUseListNode* current_; |
337 HUseListNode* next_; | 337 HUseListNode* next_; |
338 HValue* value_; | 338 HValue* value_; |
339 int index_; | 339 int index_; |
(...skipping 11 matching lines...) Expand all Loading... |
351 #undef DECLARE_FLAG | 351 #undef DECLARE_FLAG |
352 #define COUNT_FLAG(Type) + 1 | 352 #define COUNT_FLAG(Type) + 1 |
353 kNumberOfTrackedSideEffects = 0 GVN_TRACKED_FLAG_LIST(COUNT_FLAG), | 353 kNumberOfTrackedSideEffects = 0 GVN_TRACKED_FLAG_LIST(COUNT_FLAG), |
354 kNumberOfUntrackedSideEffects = 0 GVN_UNTRACKED_FLAG_LIST(COUNT_FLAG), | 354 kNumberOfUntrackedSideEffects = 0 GVN_UNTRACKED_FLAG_LIST(COUNT_FLAG), |
355 #undef COUNT_FLAG | 355 #undef COUNT_FLAG |
356 kNumberOfFlags = kNumberOfTrackedSideEffects + kNumberOfUntrackedSideEffects | 356 kNumberOfFlags = kNumberOfTrackedSideEffects + kNumberOfUntrackedSideEffects |
357 }; | 357 }; |
358 | 358 |
359 | 359 |
360 static inline GVNFlag GVNFlagFromInt(int i) { | 360 static inline GVNFlag GVNFlagFromInt(int i) { |
361 ASSERT(i >= 0); | 361 DCHECK(i >= 0); |
362 ASSERT(i < kNumberOfFlags); | 362 DCHECK(i < kNumberOfFlags); |
363 return static_cast<GVNFlag>(i); | 363 return static_cast<GVNFlag>(i); |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 class DecompositionResult V8_FINAL BASE_EMBEDDED { | 367 class DecompositionResult V8_FINAL BASE_EMBEDDED { |
368 public: | 368 public: |
369 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} | 369 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} |
370 | 370 |
371 HValue* base() { return base_; } | 371 HValue* base() { return base_; } |
372 int offset() { return offset_; } | 372 int offset() { return offset_; } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 int id() const { return id_; } | 579 int id() const { return id_; } |
580 void set_id(int id) { id_ = id; } | 580 void set_id(int id) { id_ = id; } |
581 | 581 |
582 HUseIterator uses() const { return HUseIterator(use_list_); } | 582 HUseIterator uses() const { return HUseIterator(use_list_); } |
583 | 583 |
584 virtual bool EmitAtUses() { return false; } | 584 virtual bool EmitAtUses() { return false; } |
585 | 585 |
586 Representation representation() const { return representation_; } | 586 Representation representation() const { return representation_; } |
587 void ChangeRepresentation(Representation r) { | 587 void ChangeRepresentation(Representation r) { |
588 ASSERT(CheckFlag(kFlexibleRepresentation)); | 588 DCHECK(CheckFlag(kFlexibleRepresentation)); |
589 ASSERT(!CheckFlag(kCannotBeTagged) || !r.IsTagged()); | 589 DCHECK(!CheckFlag(kCannotBeTagged) || !r.IsTagged()); |
590 RepresentationChanged(r); | 590 RepresentationChanged(r); |
591 representation_ = r; | 591 representation_ = r; |
592 if (r.IsTagged()) { | 592 if (r.IsTagged()) { |
593 // Tagged is the bottom of the lattice, don't go any further. | 593 // Tagged is the bottom of the lattice, don't go any further. |
594 ClearFlag(kFlexibleRepresentation); | 594 ClearFlag(kFlexibleRepresentation); |
595 } | 595 } |
596 } | 596 } |
597 virtual void AssumeRepresentation(Representation r); | 597 virtual void AssumeRepresentation(Representation r); |
598 | 598 |
599 virtual Representation KnownOptimalRepresentation() { | 599 virtual Representation KnownOptimalRepresentation() { |
600 Representation r = representation(); | 600 Representation r = representation(); |
601 if (r.IsTagged()) { | 601 if (r.IsTagged()) { |
602 HType t = type(); | 602 HType t = type(); |
603 if (t.IsSmi()) return Representation::Smi(); | 603 if (t.IsSmi()) return Representation::Smi(); |
604 if (t.IsHeapNumber()) return Representation::Double(); | 604 if (t.IsHeapNumber()) return Representation::Double(); |
605 if (t.IsHeapObject()) return r; | 605 if (t.IsHeapObject()) return r; |
606 return Representation::None(); | 606 return Representation::None(); |
607 } | 607 } |
608 return r; | 608 return r; |
609 } | 609 } |
610 | 610 |
611 HType type() const { return type_; } | 611 HType type() const { return type_; } |
612 void set_type(HType new_type) { | 612 void set_type(HType new_type) { |
613 ASSERT(new_type.IsSubtypeOf(type_)); | 613 DCHECK(new_type.IsSubtypeOf(type_)); |
614 type_ = new_type; | 614 type_ = new_type; |
615 } | 615 } |
616 | 616 |
617 // There are HInstructions that do not really change a value, they | 617 // There are HInstructions that do not really change a value, they |
618 // only add pieces of information to it (like bounds checks, map checks, | 618 // only add pieces of information to it (like bounds checks, map checks, |
619 // smi checks...). | 619 // smi checks...). |
620 // We call these instructions "informative definitions", or "iDef". | 620 // We call these instructions "informative definitions", or "iDef". |
621 // One of the iDef operands is special because it is the value that is | 621 // One of the iDef operands is special because it is the value that is |
622 // "transferred" to the output, we call it the "redefined operand". | 622 // "transferred" to the output, we call it the "redefined operand". |
623 // If an HValue is an iDef it must override RedefinedOperandIndex() so that | 623 // If an HValue is an iDef it must override RedefinedOperandIndex() so that |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 return result; | 723 return result; |
724 } | 724 } |
725 | 725 |
726 GVNFlagSet ObservableChangesFlags() const { | 726 GVNFlagSet ObservableChangesFlags() const { |
727 GVNFlagSet result = ChangesFlags(); | 727 GVNFlagSet result = ChangesFlags(); |
728 result.Intersect(AllObservableSideEffectsFlagSet()); | 728 result.Intersect(AllObservableSideEffectsFlagSet()); |
729 return result; | 729 return result; |
730 } | 730 } |
731 | 731 |
732 Range* range() const { | 732 Range* range() const { |
733 ASSERT(!range_poisoned_); | 733 DCHECK(!range_poisoned_); |
734 return range_; | 734 return range_; |
735 } | 735 } |
736 bool HasRange() const { | 736 bool HasRange() const { |
737 ASSERT(!range_poisoned_); | 737 DCHECK(!range_poisoned_); |
738 return range_ != NULL; | 738 return range_ != NULL; |
739 } | 739 } |
740 #ifdef DEBUG | 740 #ifdef DEBUG |
741 void PoisonRange() { range_poisoned_ = true; } | 741 void PoisonRange() { range_poisoned_ = true; } |
742 #endif | 742 #endif |
743 void AddNewRange(Range* r, Zone* zone); | 743 void AddNewRange(Range* r, Zone* zone); |
744 void RemoveLastAddedRange(); | 744 void RemoveLastAddedRange(); |
745 void ComputeInitialRange(Zone* zone); | 745 void ComputeInitialRange(Zone* zone); |
746 | 746 |
747 // Escape analysis helpers. | 747 // Escape analysis helpers. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 HInferRepresentationPhase* h_infer, | 854 HInferRepresentationPhase* h_infer, |
855 const char* reason); | 855 const char* reason); |
856 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer); | 856 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer); |
857 | 857 |
858 virtual void RepresentationChanged(Representation to) { } | 858 virtual void RepresentationChanged(Representation to) { } |
859 | 859 |
860 virtual Range* InferRange(Zone* zone); | 860 virtual Range* InferRange(Zone* zone); |
861 virtual void DeleteFromGraph() = 0; | 861 virtual void DeleteFromGraph() = 0; |
862 virtual void InternalSetOperandAt(int index, HValue* value) = 0; | 862 virtual void InternalSetOperandAt(int index, HValue* value) = 0; |
863 void clear_block() { | 863 void clear_block() { |
864 ASSERT(block_ != NULL); | 864 DCHECK(block_ != NULL); |
865 block_ = NULL; | 865 block_ = NULL; |
866 } | 866 } |
867 | 867 |
868 void set_representation(Representation r) { | 868 void set_representation(Representation r) { |
869 ASSERT(representation_.IsNone() && !r.IsNone()); | 869 DCHECK(representation_.IsNone() && !r.IsNone()); |
870 representation_ = r; | 870 representation_ = r; |
871 } | 871 } |
872 | 872 |
873 static GVNFlagSet AllFlagSet() { | 873 static GVNFlagSet AllFlagSet() { |
874 GVNFlagSet result; | 874 GVNFlagSet result; |
875 #define ADD_FLAG(Type) result.Add(k##Type); | 875 #define ADD_FLAG(Type) result.Add(k##Type); |
876 GVN_TRACKED_FLAG_LIST(ADD_FLAG) | 876 GVN_TRACKED_FLAG_LIST(ADD_FLAG) |
877 GVN_UNTRACKED_FLAG_LIST(ADD_FLAG) | 877 GVN_UNTRACKED_FLAG_LIST(ADD_FLAG) |
878 #undef ADD_FLAG | 878 #undef ADD_FLAG |
879 return result; | 879 return result; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 HSourcePosition* positions = | 1082 HSourcePosition* positions = |
1083 zone->NewArray<HSourcePosition>(length); | 1083 zone->NewArray<HSourcePosition>(length); |
1084 for (int i = 0; i < length; i++) { | 1084 for (int i = 0; i < length; i++) { |
1085 positions[i] = HSourcePosition::Unknown(); | 1085 positions[i] = HSourcePosition::Unknown(); |
1086 } | 1086 } |
1087 | 1087 |
1088 const HSourcePosition pos = position(); | 1088 const HSourcePosition pos = position(); |
1089 data_ = reinterpret_cast<intptr_t>(positions); | 1089 data_ = reinterpret_cast<intptr_t>(positions); |
1090 set_position(pos); | 1090 set_position(pos); |
1091 | 1091 |
1092 ASSERT(has_operand_positions()); | 1092 DCHECK(has_operand_positions()); |
1093 } | 1093 } |
1094 | 1094 |
1095 HSourcePosition operand_position(int idx) const { | 1095 HSourcePosition operand_position(int idx) const { |
1096 if (!has_operand_positions()) { | 1096 if (!has_operand_positions()) { |
1097 return position(); | 1097 return position(); |
1098 } | 1098 } |
1099 return *operand_position_slot(idx); | 1099 return *operand_position_slot(idx); |
1100 } | 1100 } |
1101 | 1101 |
1102 void set_operand_position(int idx, HSourcePosition pos) { | 1102 void set_operand_position(int idx, HSourcePosition pos) { |
1103 *operand_position_slot(idx) = pos; | 1103 *operand_position_slot(idx) = pos; |
1104 } | 1104 } |
1105 | 1105 |
1106 private: | 1106 private: |
1107 static const intptr_t kInstructionPosIndex = 0; | 1107 static const intptr_t kInstructionPosIndex = 0; |
1108 static const intptr_t kFirstOperandPosIndex = 1; | 1108 static const intptr_t kFirstOperandPosIndex = 1; |
1109 | 1109 |
1110 HSourcePosition* operand_position_slot(int idx) const { | 1110 HSourcePosition* operand_position_slot(int idx) const { |
1111 ASSERT(has_operand_positions()); | 1111 DCHECK(has_operand_positions()); |
1112 return &(operand_positions()[kFirstOperandPosIndex + idx]); | 1112 return &(operand_positions()[kFirstOperandPosIndex + idx]); |
1113 } | 1113 } |
1114 | 1114 |
1115 bool has_operand_positions() const { | 1115 bool has_operand_positions() const { |
1116 return !IsTaggedPosition(data_); | 1116 return !IsTaggedPosition(data_); |
1117 } | 1117 } |
1118 | 1118 |
1119 HSourcePosition* operand_positions() const { | 1119 HSourcePosition* operand_positions() const { |
1120 ASSERT(has_operand_positions()); | 1120 DCHECK(has_operand_positions()); |
1121 return reinterpret_cast<HSourcePosition*>(data_); | 1121 return reinterpret_cast<HSourcePosition*>(data_); |
1122 } | 1122 } |
1123 | 1123 |
1124 static const intptr_t kPositionTag = 1; | 1124 static const intptr_t kPositionTag = 1; |
1125 static const intptr_t kPositionShift = 1; | 1125 static const intptr_t kPositionShift = 1; |
1126 static bool IsTaggedPosition(intptr_t val) { | 1126 static bool IsTaggedPosition(intptr_t val) { |
1127 return (val & kPositionTag) != 0; | 1127 return (val & kPositionTag) != 0; |
1128 } | 1128 } |
1129 static intptr_t UntagPosition(intptr_t val) { | 1129 static intptr_t UntagPosition(intptr_t val) { |
1130 ASSERT(IsTaggedPosition(val)); | 1130 DCHECK(IsTaggedPosition(val)); |
1131 return val >> kPositionShift; | 1131 return val >> kPositionShift; |
1132 } | 1132 } |
1133 static intptr_t TagPosition(intptr_t val) { | 1133 static intptr_t TagPosition(intptr_t val) { |
1134 const intptr_t result = (val << kPositionShift) | kPositionTag; | 1134 const intptr_t result = (val << kPositionShift) | kPositionTag; |
1135 ASSERT(UntagPosition(result) == val); | 1135 DCHECK(UntagPosition(result) == val); |
1136 return result; | 1136 return result; |
1137 } | 1137 } |
1138 | 1138 |
1139 intptr_t data_; | 1139 intptr_t data_; |
1140 }; | 1140 }; |
1141 | 1141 |
1142 | 1142 |
1143 class HInstruction : public HValue { | 1143 class HInstruction : public HValue { |
1144 public: | 1144 public: |
1145 HInstruction* next() const { return next_; } | 1145 HInstruction* next() const { return next_; } |
(...skipping 20 matching lines...) Expand all Loading... |
1166 } | 1166 } |
1167 | 1167 |
1168 // The position is a write-once variable. | 1168 // The position is a write-once variable. |
1169 virtual HSourcePosition position() const V8_OVERRIDE { | 1169 virtual HSourcePosition position() const V8_OVERRIDE { |
1170 return HSourcePosition(position_.position()); | 1170 return HSourcePosition(position_.position()); |
1171 } | 1171 } |
1172 bool has_position() const { | 1172 bool has_position() const { |
1173 return !position().IsUnknown(); | 1173 return !position().IsUnknown(); |
1174 } | 1174 } |
1175 void set_position(HSourcePosition position) { | 1175 void set_position(HSourcePosition position) { |
1176 ASSERT(!has_position()); | 1176 DCHECK(!has_position()); |
1177 ASSERT(!position.IsUnknown()); | 1177 DCHECK(!position.IsUnknown()); |
1178 position_.set_position(position); | 1178 position_.set_position(position); |
1179 } | 1179 } |
1180 | 1180 |
1181 virtual HSourcePosition operand_position(int index) const V8_OVERRIDE { | 1181 virtual HSourcePosition operand_position(int index) const V8_OVERRIDE { |
1182 const HSourcePosition pos = position_.operand_position(index); | 1182 const HSourcePosition pos = position_.operand_position(index); |
1183 return pos.IsUnknown() ? position() : pos; | 1183 return pos.IsUnknown() ? position() : pos; |
1184 } | 1184 } |
1185 void set_operand_position(Zone* zone, int index, HSourcePosition pos) { | 1185 void set_operand_position(Zone* zone, int index, HSourcePosition pos) { |
1186 ASSERT(0 <= index && index < OperandCount()); | 1186 DCHECK(0 <= index && index < OperandCount()); |
1187 position_.ensure_storage_for_operand_positions(zone, OperandCount()); | 1187 position_.ensure_storage_for_operand_positions(zone, OperandCount()); |
1188 position_.set_operand_position(index, pos); | 1188 position_.set_operand_position(index, pos); |
1189 } | 1189 } |
1190 | 1190 |
1191 bool Dominates(HInstruction* other); | 1191 bool Dominates(HInstruction* other); |
1192 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } | 1192 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } |
1193 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1193 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
1194 | 1194 |
1195 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 1195 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
1196 | 1196 |
(...skipping 13 matching lines...) Expand all Loading... |
1210 next_(NULL), | 1210 next_(NULL), |
1211 previous_(NULL), | 1211 previous_(NULL), |
1212 position_(RelocInfo::kNoPosition) { | 1212 position_(RelocInfo::kNoPosition) { |
1213 SetDependsOnFlag(kOsrEntries); | 1213 SetDependsOnFlag(kOsrEntries); |
1214 } | 1214 } |
1215 | 1215 |
1216 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } | 1216 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } |
1217 | 1217 |
1218 private: | 1218 private: |
1219 void InitializeAsFirst(HBasicBlock* block) { | 1219 void InitializeAsFirst(HBasicBlock* block) { |
1220 ASSERT(!IsLinked()); | 1220 DCHECK(!IsLinked()); |
1221 SetBlock(block); | 1221 SetBlock(block); |
1222 } | 1222 } |
1223 | 1223 |
1224 HInstruction* next_; | 1224 HInstruction* next_; |
1225 HInstruction* previous_; | 1225 HInstruction* previous_; |
1226 HPositionInfo position_; | 1226 HPositionInfo position_; |
1227 | 1227 |
1228 friend class HBasicBlock; | 1228 friend class HBasicBlock; |
1229 }; | 1229 }; |
1230 | 1230 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 }; | 1650 }; |
1651 | 1651 |
1652 | 1652 |
1653 class HChange V8_FINAL : public HUnaryOperation { | 1653 class HChange V8_FINAL : public HUnaryOperation { |
1654 public: | 1654 public: |
1655 HChange(HValue* value, | 1655 HChange(HValue* value, |
1656 Representation to, | 1656 Representation to, |
1657 bool is_truncating_to_smi, | 1657 bool is_truncating_to_smi, |
1658 bool is_truncating_to_int32) | 1658 bool is_truncating_to_int32) |
1659 : HUnaryOperation(value) { | 1659 : HUnaryOperation(value) { |
1660 ASSERT(!value->representation().IsNone()); | 1660 DCHECK(!value->representation().IsNone()); |
1661 ASSERT(!to.IsNone()); | 1661 DCHECK(!to.IsNone()); |
1662 ASSERT(!value->representation().Equals(to)); | 1662 DCHECK(!value->representation().Equals(to)); |
1663 set_representation(to); | 1663 set_representation(to); |
1664 SetFlag(kUseGVN); | 1664 SetFlag(kUseGVN); |
1665 SetFlag(kCanOverflow); | 1665 SetFlag(kCanOverflow); |
1666 if (is_truncating_to_smi && to.IsSmi()) { | 1666 if (is_truncating_to_smi && to.IsSmi()) { |
1667 SetFlag(kTruncatingToSmi); | 1667 SetFlag(kTruncatingToSmi); |
1668 SetFlag(kTruncatingToInt32); | 1668 SetFlag(kTruncatingToInt32); |
1669 } | 1669 } |
1670 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); | 1670 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
1671 if (value->representation().IsSmi() || value->type().IsSmi()) { | 1671 if (value->representation().IsSmi() || value->type().IsSmi()) { |
1672 set_type(HType::Smi()); | 1672 set_type(HType::Smi()); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 zone_(zone), | 1811 zone_(zone), |
1812 removable_(removable), | 1812 removable_(removable), |
1813 done_with_replay_(false) {} | 1813 done_with_replay_(false) {} |
1814 ~HSimulate() {} | 1814 ~HSimulate() {} |
1815 | 1815 |
1816 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 1816 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
1817 | 1817 |
1818 bool HasAstId() const { return !ast_id_.IsNone(); } | 1818 bool HasAstId() const { return !ast_id_.IsNone(); } |
1819 BailoutId ast_id() const { return ast_id_; } | 1819 BailoutId ast_id() const { return ast_id_; } |
1820 void set_ast_id(BailoutId id) { | 1820 void set_ast_id(BailoutId id) { |
1821 ASSERT(!HasAstId()); | 1821 DCHECK(!HasAstId()); |
1822 ast_id_ = id; | 1822 ast_id_ = id; |
1823 } | 1823 } |
1824 | 1824 |
1825 int pop_count() const { return pop_count_; } | 1825 int pop_count() const { return pop_count_; } |
1826 const ZoneList<HValue*>* values() const { return &values_; } | 1826 const ZoneList<HValue*>* values() const { return &values_; } |
1827 int GetAssignedIndexAt(int index) const { | 1827 int GetAssignedIndexAt(int index) const { |
1828 ASSERT(HasAssignedIndexAt(index)); | 1828 DCHECK(HasAssignedIndexAt(index)); |
1829 return assigned_indexes_[index]; | 1829 return assigned_indexes_[index]; |
1830 } | 1830 } |
1831 bool HasAssignedIndexAt(int index) const { | 1831 bool HasAssignedIndexAt(int index) const { |
1832 return assigned_indexes_[index] != kNoIndex; | 1832 return assigned_indexes_[index] != kNoIndex; |
1833 } | 1833 } |
1834 void AddAssignedValue(int index, HValue* value) { | 1834 void AddAssignedValue(int index, HValue* value) { |
1835 AddValue(index, value); | 1835 AddValue(index, value); |
1836 } | 1836 } |
1837 void AddPushedValue(HValue* value) { | 1837 void AddPushedValue(HValue* value) { |
1838 AddValue(kNoIndex, value); | 1838 AddValue(kNoIndex, value); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 } | 1916 } |
1917 | 1917 |
1918 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1918 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
1919 return Representation::None(); | 1919 return Representation::None(); |
1920 } | 1920 } |
1921 | 1921 |
1922 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 1922 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
1923 | 1923 |
1924 #ifdef DEBUG | 1924 #ifdef DEBUG |
1925 void set_closure(Handle<JSFunction> closure) { | 1925 void set_closure(Handle<JSFunction> closure) { |
1926 ASSERT(closure_.is_null()); | 1926 DCHECK(closure_.is_null()); |
1927 ASSERT(!closure.is_null()); | 1927 DCHECK(!closure.is_null()); |
1928 closure_ = closure; | 1928 closure_ = closure; |
1929 } | 1929 } |
1930 Handle<JSFunction> closure() const { return closure_; } | 1930 Handle<JSFunction> closure() const { return closure_; } |
1931 #endif | 1931 #endif |
1932 | 1932 |
1933 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); | 1933 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); |
1934 | 1934 |
1935 private: | 1935 private: |
1936 HEnvironmentMarker(Kind kind, int index) | 1936 HEnvironmentMarker(Kind kind, int index) |
1937 : kind_(kind), index_(index), next_simulate_(NULL) { } | 1937 : kind_(kind), index_(index), next_simulate_(NULL) { } |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 HValue* function, | 2282 HValue* function, |
2283 int argument_count, | 2283 int argument_count, |
2284 bool pass_argument_count); | 2284 bool pass_argument_count); |
2285 | 2285 |
2286 HValue* function() const { return OperandAt(0); } | 2286 HValue* function() const { return OperandAt(0); } |
2287 | 2287 |
2288 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 2288 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
2289 | 2289 |
2290 virtual Representation RequiredInputRepresentation( | 2290 virtual Representation RequiredInputRepresentation( |
2291 int index) V8_FINAL V8_OVERRIDE { | 2291 int index) V8_FINAL V8_OVERRIDE { |
2292 ASSERT(index == 0); | 2292 DCHECK(index == 0); |
2293 return Representation::Tagged(); | 2293 return Representation::Tagged(); |
2294 } | 2294 } |
2295 | 2295 |
2296 bool pass_argument_count() const { return pass_argument_count_; } | 2296 bool pass_argument_count() const { return pass_argument_count_; } |
2297 | 2297 |
2298 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { | 2298 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { |
2299 return has_stack_check_; | 2299 return has_stack_check_; |
2300 } | 2300 } |
2301 | 2301 |
2302 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) | 2302 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) |
(...skipping 15 matching lines...) Expand all Loading... |
2318 }; | 2318 }; |
2319 | 2319 |
2320 | 2320 |
2321 class HCallWithDescriptor V8_FINAL : public HInstruction { | 2321 class HCallWithDescriptor V8_FINAL : public HInstruction { |
2322 public: | 2322 public: |
2323 static HCallWithDescriptor* New(Zone* zone, HValue* context, | 2323 static HCallWithDescriptor* New(Zone* zone, HValue* context, |
2324 HValue* target, | 2324 HValue* target, |
2325 int argument_count, | 2325 int argument_count, |
2326 const InterfaceDescriptor* descriptor, | 2326 const InterfaceDescriptor* descriptor, |
2327 const Vector<HValue*>& operands) { | 2327 const Vector<HValue*>& operands) { |
2328 ASSERT(operands.length() == descriptor->GetEnvironmentLength()); | 2328 DCHECK(operands.length() == descriptor->GetEnvironmentLength()); |
2329 HCallWithDescriptor* res = | 2329 HCallWithDescriptor* res = |
2330 new(zone) HCallWithDescriptor(target, argument_count, | 2330 new(zone) HCallWithDescriptor(target, argument_count, |
2331 descriptor, operands, zone); | 2331 descriptor, operands, zone); |
2332 return res; | 2332 return res; |
2333 } | 2333 } |
2334 | 2334 |
2335 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { | 2335 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { |
2336 return values_.length(); | 2336 return values_.length(); |
2337 } | 2337 } |
2338 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { | 2338 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { |
2339 return values_[index]; | 2339 return values_[index]; |
2340 } | 2340 } |
2341 | 2341 |
2342 virtual Representation RequiredInputRepresentation( | 2342 virtual Representation RequiredInputRepresentation( |
2343 int index) V8_FINAL V8_OVERRIDE { | 2343 int index) V8_FINAL V8_OVERRIDE { |
2344 if (index == 0) { | 2344 if (index == 0) { |
2345 return Representation::Tagged(); | 2345 return Representation::Tagged(); |
2346 } else { | 2346 } else { |
2347 int par_index = index - 1; | 2347 int par_index = index - 1; |
2348 ASSERT(par_index < descriptor_->GetEnvironmentLength()); | 2348 DCHECK(par_index < descriptor_->GetEnvironmentLength()); |
2349 return descriptor_->GetParameterRepresentation(par_index); | 2349 return descriptor_->GetParameterRepresentation(par_index); |
2350 } | 2350 } |
2351 } | 2351 } |
2352 | 2352 |
2353 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) | 2353 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
2354 | 2354 |
2355 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { | 2355 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { |
2356 return HType::Tagged(); | 2356 return HType::Tagged(); |
2357 } | 2357 } |
2358 | 2358 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2805 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); | 2805 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); |
2806 } | 2806 } |
2807 | 2807 |
2808 virtual int RedefinedOperandIndex() { return 0; } | 2808 virtual int RedefinedOperandIndex() { return 0; } |
2809 | 2809 |
2810 private: | 2810 private: |
2811 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) | 2811 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) |
2812 : HTemplateInstruction<2>(HType::HeapObject()), maps_(maps), | 2812 : HTemplateInstruction<2>(HType::HeapObject()), maps_(maps), |
2813 has_migration_target_(false), is_stability_check_(false), | 2813 has_migration_target_(false), is_stability_check_(false), |
2814 maps_are_stable_(maps_are_stable) { | 2814 maps_are_stable_(maps_are_stable) { |
2815 ASSERT_NE(0, maps->size()); | 2815 DCHECK_NE(0, maps->size()); |
2816 SetOperandAt(0, value); | 2816 SetOperandAt(0, value); |
2817 // Use the object value for the dependency. | 2817 // Use the object value for the dependency. |
2818 SetOperandAt(1, value); | 2818 SetOperandAt(1, value); |
2819 set_representation(Representation::Tagged()); | 2819 set_representation(Representation::Tagged()); |
2820 SetFlag(kUseGVN); | 2820 SetFlag(kUseGVN); |
2821 SetDependsOnFlag(kMaps); | 2821 SetDependsOnFlag(kMaps); |
2822 SetDependsOnFlag(kElementsKind); | 2822 SetDependsOnFlag(kElementsKind); |
2823 } | 2823 } |
2824 | 2824 |
2825 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, HValue* typecheck) | 2825 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, HValue* typecheck) |
2826 : HTemplateInstruction<2>(HType::HeapObject()), maps_(maps), | 2826 : HTemplateInstruction<2>(HType::HeapObject()), maps_(maps), |
2827 has_migration_target_(false), is_stability_check_(false), | 2827 has_migration_target_(false), is_stability_check_(false), |
2828 maps_are_stable_(true) { | 2828 maps_are_stable_(true) { |
2829 ASSERT_NE(0, maps->size()); | 2829 DCHECK_NE(0, maps->size()); |
2830 SetOperandAt(0, value); | 2830 SetOperandAt(0, value); |
2831 // Use the object value for the dependency if NULL is passed. | 2831 // Use the object value for the dependency if NULL is passed. |
2832 SetOperandAt(1, typecheck ? typecheck : value); | 2832 SetOperandAt(1, typecheck ? typecheck : value); |
2833 set_representation(Representation::Tagged()); | 2833 set_representation(Representation::Tagged()); |
2834 SetFlag(kUseGVN); | 2834 SetFlag(kUseGVN); |
2835 SetDependsOnFlag(kMaps); | 2835 SetDependsOnFlag(kMaps); |
2836 SetDependsOnFlag(kElementsKind); | 2836 SetDependsOnFlag(kElementsKind); |
2837 for (int i = 0; i < maps->size(); ++i) { | 2837 for (int i = 0; i < maps->size(); ++i) { |
2838 Handle<Map> map = maps->at(i).handle(); | 2838 Handle<Map> map = maps->at(i).handle(); |
2839 if (map->is_migration_target()) has_migration_target_ = true; | 2839 if (map->is_migration_target()) has_migration_target_ = true; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3058 | 3058 |
3059 | 3059 |
3060 class InductionVariableData V8_FINAL : public ZoneObject { | 3060 class InductionVariableData V8_FINAL : public ZoneObject { |
3061 public: | 3061 public: |
3062 class InductionVariableCheck : public ZoneObject { | 3062 class InductionVariableCheck : public ZoneObject { |
3063 public: | 3063 public: |
3064 HBoundsCheck* check() { return check_; } | 3064 HBoundsCheck* check() { return check_; } |
3065 InductionVariableCheck* next() { return next_; } | 3065 InductionVariableCheck* next() { return next_; } |
3066 bool HasUpperLimit() { return upper_limit_ >= 0; } | 3066 bool HasUpperLimit() { return upper_limit_ >= 0; } |
3067 int32_t upper_limit() { | 3067 int32_t upper_limit() { |
3068 ASSERT(HasUpperLimit()); | 3068 DCHECK(HasUpperLimit()); |
3069 return upper_limit_; | 3069 return upper_limit_; |
3070 } | 3070 } |
3071 void set_upper_limit(int32_t upper_limit) { | 3071 void set_upper_limit(int32_t upper_limit) { |
3072 upper_limit_ = upper_limit; | 3072 upper_limit_ = upper_limit; |
3073 } | 3073 } |
3074 | 3074 |
3075 bool processed() { return processed_; } | 3075 bool processed() { return processed_; } |
3076 void set_processed() { processed_ = true; } | 3076 void set_processed() { processed_ = true; } |
3077 | 3077 |
3078 InductionVariableCheck(HBoundsCheck* check, | 3078 InductionVariableCheck(HBoundsCheck* check, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 public: | 3261 public: |
3262 HPhi(int merged_index, Zone* zone) | 3262 HPhi(int merged_index, Zone* zone) |
3263 : inputs_(2, zone), | 3263 : inputs_(2, zone), |
3264 merged_index_(merged_index), | 3264 merged_index_(merged_index), |
3265 phi_id_(-1), | 3265 phi_id_(-1), |
3266 induction_variable_data_(NULL) { | 3266 induction_variable_data_(NULL) { |
3267 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 3267 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
3268 non_phi_uses_[i] = 0; | 3268 non_phi_uses_[i] = 0; |
3269 indirect_uses_[i] = 0; | 3269 indirect_uses_[i] = 0; |
3270 } | 3270 } |
3271 ASSERT(merged_index >= 0 || merged_index == kInvalidMergedIndex); | 3271 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
3272 SetFlag(kFlexibleRepresentation); | 3272 SetFlag(kFlexibleRepresentation); |
3273 SetFlag(kAllowUndefinedAsNaN); | 3273 SetFlag(kAllowUndefinedAsNaN); |
3274 } | 3274 } |
3275 | 3275 |
3276 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | 3276 virtual Representation RepresentationFromInputs() V8_OVERRIDE; |
3277 | 3277 |
3278 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 3278 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
3279 virtual void InferRepresentation( | 3279 virtual void InferRepresentation( |
3280 HInferRepresentationPhase* h_infer) V8_OVERRIDE; | 3280 HInferRepresentationPhase* h_infer) V8_OVERRIDE; |
3281 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3281 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
(...skipping 22 matching lines...) Expand all Loading... |
3304 return induction_variable_data_; | 3304 return induction_variable_data_; |
3305 } | 3305 } |
3306 bool IsInductionVariable() { | 3306 bool IsInductionVariable() { |
3307 return induction_variable_data_ != NULL; | 3307 return induction_variable_data_ != NULL; |
3308 } | 3308 } |
3309 bool IsLimitedInductionVariable() { | 3309 bool IsLimitedInductionVariable() { |
3310 return IsInductionVariable() && | 3310 return IsInductionVariable() && |
3311 induction_variable_data_->limit() != NULL; | 3311 induction_variable_data_->limit() != NULL; |
3312 } | 3312 } |
3313 void DetectInductionVariable() { | 3313 void DetectInductionVariable() { |
3314 ASSERT(induction_variable_data_ == NULL); | 3314 DCHECK(induction_variable_data_ == NULL); |
3315 induction_variable_data_ = InductionVariableData::ExaminePhi(this); | 3315 induction_variable_data_ = InductionVariableData::ExaminePhi(this); |
3316 } | 3316 } |
3317 | 3317 |
3318 virtual OStream& PrintTo(OStream& os) const V8_OVERRIDE; // NOLINT | 3318 virtual OStream& PrintTo(OStream& os) const V8_OVERRIDE; // NOLINT |
3319 | 3319 |
3320 #ifdef DEBUG | 3320 #ifdef DEBUG |
3321 virtual void Verify() V8_OVERRIDE; | 3321 virtual void Verify() V8_OVERRIDE; |
3322 #endif | 3322 #endif |
3323 | 3323 |
3324 void InitRealUses(int id); | 3324 void InitRealUses(int id); |
(...skipping 20 matching lines...) Expand all Loading... |
3345 } | 3345 } |
3346 int int32_indirect_uses() const { | 3346 int int32_indirect_uses() const { |
3347 return indirect_uses_[Representation::kInteger32]; | 3347 return indirect_uses_[Representation::kInteger32]; |
3348 } | 3348 } |
3349 int double_indirect_uses() const { | 3349 int double_indirect_uses() const { |
3350 return indirect_uses_[Representation::kDouble]; | 3350 return indirect_uses_[Representation::kDouble]; |
3351 } | 3351 } |
3352 int phi_id() { return phi_id_; } | 3352 int phi_id() { return phi_id_; } |
3353 | 3353 |
3354 static HPhi* cast(HValue* value) { | 3354 static HPhi* cast(HValue* value) { |
3355 ASSERT(value->IsPhi()); | 3355 DCHECK(value->IsPhi()); |
3356 return reinterpret_cast<HPhi*>(value); | 3356 return reinterpret_cast<HPhi*>(value); |
3357 } | 3357 } |
3358 virtual Opcode opcode() const V8_OVERRIDE { return HValue::kPhi; } | 3358 virtual Opcode opcode() const V8_OVERRIDE { return HValue::kPhi; } |
3359 | 3359 |
3360 void SimplifyConstantInputs(); | 3360 void SimplifyConstantInputs(); |
3361 | 3361 |
3362 // Marker value representing an invalid merge index. | 3362 // Marker value representing an invalid merge index. |
3363 static const int kInvalidMergedIndex = -1; | 3363 static const int kInvalidMergedIndex = -1; |
3364 | 3364 |
3365 protected: | 3365 protected: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3452 // captured object and is index by field index. Properties in the | 3452 // captured object and is index by field index. Properties in the |
3453 // properties or elements backing store are not tracked here. | 3453 // properties or elements backing store are not tracked here. |
3454 const ZoneList<HValue*>* values() const { return &values_; } | 3454 const ZoneList<HValue*>* values() const { return &values_; } |
3455 int length() const { return values_.length(); } | 3455 int length() const { return values_.length(); } |
3456 int capture_id() const { return capture_id_; } | 3456 int capture_id() const { return capture_id_; } |
3457 | 3457 |
3458 // Shortcut for the map value of this captured object. | 3458 // Shortcut for the map value of this captured object. |
3459 HValue* map_value() const { return values()->first(); } | 3459 HValue* map_value() const { return values()->first(); } |
3460 | 3460 |
3461 void ReuseSideEffectsFromStore(HInstruction* store) { | 3461 void ReuseSideEffectsFromStore(HInstruction* store) { |
3462 ASSERT(store->HasObservableSideEffects()); | 3462 DCHECK(store->HasObservableSideEffects()); |
3463 ASSERT(store->IsStoreNamedField()); | 3463 DCHECK(store->IsStoreNamedField()); |
3464 changes_flags_.Add(store->ChangesFlags()); | 3464 changes_flags_.Add(store->ChangesFlags()); |
3465 } | 3465 } |
3466 | 3466 |
3467 // Replay effects of this instruction on the given environment. | 3467 // Replay effects of this instruction on the given environment. |
3468 void ReplayEnvironment(HEnvironment* env); | 3468 void ReplayEnvironment(HEnvironment* env); |
3469 | 3469 |
3470 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 3470 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
3471 | 3471 |
3472 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) | 3472 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
3473 | 3473 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3528 } | 3528 } |
3529 | 3529 |
3530 Handle<Object> handle(Isolate* isolate) { | 3530 Handle<Object> handle(Isolate* isolate) { |
3531 if (object_.handle().is_null()) { | 3531 if (object_.handle().is_null()) { |
3532 // Default arguments to is_not_in_new_space depend on this heap number | 3532 // Default arguments to is_not_in_new_space depend on this heap number |
3533 // to be tenured so that it's guaranteed not to be located in new space. | 3533 // to be tenured so that it's guaranteed not to be located in new space. |
3534 object_ = Unique<Object>::CreateUninitialized( | 3534 object_ = Unique<Object>::CreateUninitialized( |
3535 isolate->factory()->NewNumber(double_value_, TENURED)); | 3535 isolate->factory()->NewNumber(double_value_, TENURED)); |
3536 } | 3536 } |
3537 AllowDeferredHandleDereference smi_check; | 3537 AllowDeferredHandleDereference smi_check; |
3538 ASSERT(has_int32_value_ || !object_.handle()->IsSmi()); | 3538 DCHECK(has_int32_value_ || !object_.handle()->IsSmi()); |
3539 return object_.handle(); | 3539 return object_.handle(); |
3540 } | 3540 } |
3541 | 3541 |
3542 bool IsSpecialDouble() const { | 3542 bool IsSpecialDouble() const { |
3543 return has_double_value_ && | 3543 return has_double_value_ && |
3544 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || | 3544 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
3545 FixedDoubleArray::is_the_hole_nan(double_value_) || | 3545 FixedDoubleArray::is_the_hole_nan(double_value_) || |
3546 std::isnan(double_value_)); | 3546 std::isnan(double_value_)); |
3547 } | 3547 } |
3548 | 3548 |
(...skipping 23 matching lines...) Expand all Loading... |
3572 return Representation::Tagged(); | 3572 return Representation::Tagged(); |
3573 } | 3573 } |
3574 | 3574 |
3575 virtual bool EmitAtUses() V8_OVERRIDE; | 3575 virtual bool EmitAtUses() V8_OVERRIDE; |
3576 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 3576 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
3577 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3577 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
3578 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); | 3578 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); |
3579 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); | 3579 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); |
3580 bool HasInteger32Value() const { return has_int32_value_; } | 3580 bool HasInteger32Value() const { return has_int32_value_; } |
3581 int32_t Integer32Value() const { | 3581 int32_t Integer32Value() const { |
3582 ASSERT(HasInteger32Value()); | 3582 DCHECK(HasInteger32Value()); |
3583 return int32_value_; | 3583 return int32_value_; |
3584 } | 3584 } |
3585 bool HasSmiValue() const { return has_smi_value_; } | 3585 bool HasSmiValue() const { return has_smi_value_; } |
3586 bool HasDoubleValue() const { return has_double_value_; } | 3586 bool HasDoubleValue() const { return has_double_value_; } |
3587 double DoubleValue() const { | 3587 double DoubleValue() const { |
3588 ASSERT(HasDoubleValue()); | 3588 DCHECK(HasDoubleValue()); |
3589 return double_value_; | 3589 return double_value_; |
3590 } | 3590 } |
3591 bool IsTheHole() const { | 3591 bool IsTheHole() const { |
3592 if (HasDoubleValue() && FixedDoubleArray::is_the_hole_nan(double_value_)) { | 3592 if (HasDoubleValue() && FixedDoubleArray::is_the_hole_nan(double_value_)) { |
3593 return true; | 3593 return true; |
3594 } | 3594 } |
3595 return object_.IsKnownGlobal(isolate()->heap()->the_hole_value()); | 3595 return object_.IsKnownGlobal(isolate()->heap()->the_hole_value()); |
3596 } | 3596 } |
3597 bool HasNumberValue() const { return has_double_value_; } | 3597 bool HasNumberValue() const { return has_double_value_; } |
3598 int32_t NumberValueAsInteger32() const { | 3598 int32_t NumberValueAsInteger32() const { |
3599 ASSERT(HasNumberValue()); | 3599 DCHECK(HasNumberValue()); |
3600 // Irrespective of whether a numeric HConstant can be safely | 3600 // Irrespective of whether a numeric HConstant can be safely |
3601 // represented as an int32, we store the (in some cases lossy) | 3601 // represented as an int32, we store the (in some cases lossy) |
3602 // representation of the number in int32_value_. | 3602 // representation of the number in int32_value_. |
3603 return int32_value_; | 3603 return int32_value_; |
3604 } | 3604 } |
3605 bool HasStringValue() const { | 3605 bool HasStringValue() const { |
3606 if (has_double_value_ || has_int32_value_) return false; | 3606 if (has_double_value_ || has_int32_value_) return false; |
3607 ASSERT(!object_.handle().is_null()); | 3607 DCHECK(!object_.handle().is_null()); |
3608 return instance_type_ < FIRST_NONSTRING_TYPE; | 3608 return instance_type_ < FIRST_NONSTRING_TYPE; |
3609 } | 3609 } |
3610 Handle<String> StringValue() const { | 3610 Handle<String> StringValue() const { |
3611 ASSERT(HasStringValue()); | 3611 DCHECK(HasStringValue()); |
3612 return Handle<String>::cast(object_.handle()); | 3612 return Handle<String>::cast(object_.handle()); |
3613 } | 3613 } |
3614 bool HasInternalizedStringValue() const { | 3614 bool HasInternalizedStringValue() const { |
3615 return HasStringValue() && StringShape(instance_type_).IsInternalized(); | 3615 return HasStringValue() && StringShape(instance_type_).IsInternalized(); |
3616 } | 3616 } |
3617 | 3617 |
3618 bool HasExternalReferenceValue() const { | 3618 bool HasExternalReferenceValue() const { |
3619 return has_external_reference_value_; | 3619 return has_external_reference_value_; |
3620 } | 3620 } |
3621 ExternalReference ExternalReferenceValue() const { | 3621 ExternalReference ExternalReferenceValue() const { |
3622 return external_reference_value_; | 3622 return external_reference_value_; |
3623 } | 3623 } |
3624 | 3624 |
3625 bool HasBooleanValue() const { return type_.IsBoolean(); } | 3625 bool HasBooleanValue() const { return type_.IsBoolean(); } |
3626 bool BooleanValue() const { return boolean_value_; } | 3626 bool BooleanValue() const { return boolean_value_; } |
3627 bool IsUndetectable() const { return is_undetectable_; } | 3627 bool IsUndetectable() const { return is_undetectable_; } |
3628 InstanceType GetInstanceType() const { return instance_type_; } | 3628 InstanceType GetInstanceType() const { return instance_type_; } |
3629 | 3629 |
3630 bool HasMapValue() const { return instance_type_ == MAP_TYPE; } | 3630 bool HasMapValue() const { return instance_type_ == MAP_TYPE; } |
3631 Unique<Map> MapValue() const { | 3631 Unique<Map> MapValue() const { |
3632 ASSERT(HasMapValue()); | 3632 DCHECK(HasMapValue()); |
3633 return Unique<Map>::cast(GetUnique()); | 3633 return Unique<Map>::cast(GetUnique()); |
3634 } | 3634 } |
3635 bool HasStableMapValue() const { | 3635 bool HasStableMapValue() const { |
3636 ASSERT(HasMapValue() || !has_stable_map_value_); | 3636 DCHECK(HasMapValue() || !has_stable_map_value_); |
3637 return has_stable_map_value_; | 3637 return has_stable_map_value_; |
3638 } | 3638 } |
3639 | 3639 |
3640 bool HasObjectMap() const { return !object_map_.IsNull(); } | 3640 bool HasObjectMap() const { return !object_map_.IsNull(); } |
3641 Unique<Map> ObjectMap() const { | 3641 Unique<Map> ObjectMap() const { |
3642 ASSERT(HasObjectMap()); | 3642 DCHECK(HasObjectMap()); |
3643 return object_map_; | 3643 return object_map_; |
3644 } | 3644 } |
3645 | 3645 |
3646 virtual intptr_t Hashcode() V8_OVERRIDE { | 3646 virtual intptr_t Hashcode() V8_OVERRIDE { |
3647 if (has_int32_value_) { | 3647 if (has_int32_value_) { |
3648 return static_cast<intptr_t>(int32_value_); | 3648 return static_cast<intptr_t>(int32_value_); |
3649 } else if (has_double_value_) { | 3649 } else if (has_double_value_) { |
3650 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); | 3650 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
3651 } else if (has_external_reference_value_) { | 3651 } else if (has_external_reference_value_) { |
3652 return reinterpret_cast<intptr_t>(external_reference_value_.address()); | 3652 return reinterpret_cast<intptr_t>(external_reference_value_.address()); |
3653 } else { | 3653 } else { |
3654 ASSERT(!object_.handle().is_null()); | 3654 DCHECK(!object_.handle().is_null()); |
3655 return object_.Hashcode(); | 3655 return object_.Hashcode(); |
3656 } | 3656 } |
3657 } | 3657 } |
3658 | 3658 |
3659 virtual void FinalizeUniqueness() V8_OVERRIDE { | 3659 virtual void FinalizeUniqueness() V8_OVERRIDE { |
3660 if (!has_double_value_ && !has_external_reference_value_) { | 3660 if (!has_double_value_ && !has_external_reference_value_) { |
3661 ASSERT(!object_.handle().is_null()); | 3661 DCHECK(!object_.handle().is_null()); |
3662 object_ = Unique<Object>(object_.handle()); | 3662 object_ = Unique<Object>(object_.handle()); |
3663 } | 3663 } |
3664 } | 3664 } |
3665 | 3665 |
3666 Unique<Object> GetUnique() const { | 3666 Unique<Object> GetUnique() const { |
3667 return object_; | 3667 return object_; |
3668 } | 3668 } |
3669 | 3669 |
3670 bool EqualsUnique(Unique<Object> other) const { | 3670 bool EqualsUnique(Unique<Object> other) const { |
3671 return object_.IsInitialized() && object_ == other; | 3671 return object_.IsInitialized() && object_ == other; |
(...skipping 11 matching lines...) Expand all Loading... |
3683 } else if (has_external_reference_value_) { | 3683 } else if (has_external_reference_value_) { |
3684 return other_constant->has_external_reference_value_ && | 3684 return other_constant->has_external_reference_value_ && |
3685 external_reference_value_ == | 3685 external_reference_value_ == |
3686 other_constant->external_reference_value_; | 3686 other_constant->external_reference_value_; |
3687 } else { | 3687 } else { |
3688 if (other_constant->has_int32_value_ || | 3688 if (other_constant->has_int32_value_ || |
3689 other_constant->has_double_value_ || | 3689 other_constant->has_double_value_ || |
3690 other_constant->has_external_reference_value_) { | 3690 other_constant->has_external_reference_value_) { |
3691 return false; | 3691 return false; |
3692 } | 3692 } |
3693 ASSERT(!object_.handle().is_null()); | 3693 DCHECK(!object_.handle().is_null()); |
3694 return other_constant->object_ == object_; | 3694 return other_constant->object_ == object_; |
3695 } | 3695 } |
3696 } | 3696 } |
3697 | 3697 |
3698 #ifdef DEBUG | 3698 #ifdef DEBUG |
3699 virtual void Verify() V8_OVERRIDE { } | 3699 virtual void Verify() V8_OVERRIDE { } |
3700 #endif | 3700 #endif |
3701 | 3701 |
3702 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3702 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3703 | 3703 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3763 InstanceType instance_type_; | 3763 InstanceType instance_type_; |
3764 }; | 3764 }; |
3765 | 3765 |
3766 | 3766 |
3767 class HBinaryOperation : public HTemplateInstruction<3> { | 3767 class HBinaryOperation : public HTemplateInstruction<3> { |
3768 public: | 3768 public: |
3769 HBinaryOperation(HValue* context, HValue* left, HValue* right, | 3769 HBinaryOperation(HValue* context, HValue* left, HValue* right, |
3770 HType type = HType::Tagged()) | 3770 HType type = HType::Tagged()) |
3771 : HTemplateInstruction<3>(type), | 3771 : HTemplateInstruction<3>(type), |
3772 observed_output_representation_(Representation::None()) { | 3772 observed_output_representation_(Representation::None()) { |
3773 ASSERT(left != NULL && right != NULL); | 3773 DCHECK(left != NULL && right != NULL); |
3774 SetOperandAt(0, context); | 3774 SetOperandAt(0, context); |
3775 SetOperandAt(1, left); | 3775 SetOperandAt(1, left); |
3776 SetOperandAt(2, right); | 3776 SetOperandAt(2, right); |
3777 observed_input_representation_[0] = Representation::None(); | 3777 observed_input_representation_[0] = Representation::None(); |
3778 observed_input_representation_[1] = Representation::None(); | 3778 observed_input_representation_[1] = Representation::None(); |
3779 } | 3779 } |
3780 | 3780 |
3781 HValue* context() const { return OperandAt(0); } | 3781 HValue* context() const { return OperandAt(0); } |
3782 HValue* left() const { return OperandAt(1); } | 3782 HValue* left() const { return OperandAt(1); } |
3783 HValue* right() const { return OperandAt(2); } | 3783 HValue* right() const { return OperandAt(2); } |
(...skipping 15 matching lines...) Expand all Loading... |
3799 | 3799 |
3800 HValue* BetterLeftOperand() { | 3800 HValue* BetterLeftOperand() { |
3801 return AreOperandsBetterSwitched() ? right() : left(); | 3801 return AreOperandsBetterSwitched() ? right() : left(); |
3802 } | 3802 } |
3803 | 3803 |
3804 HValue* BetterRightOperand() { | 3804 HValue* BetterRightOperand() { |
3805 return AreOperandsBetterSwitched() ? left() : right(); | 3805 return AreOperandsBetterSwitched() ? left() : right(); |
3806 } | 3806 } |
3807 | 3807 |
3808 void set_observed_input_representation(int index, Representation rep) { | 3808 void set_observed_input_representation(int index, Representation rep) { |
3809 ASSERT(index >= 1 && index <= 2); | 3809 DCHECK(index >= 1 && index <= 2); |
3810 observed_input_representation_[index - 1] = rep; | 3810 observed_input_representation_[index - 1] = rep; |
3811 } | 3811 } |
3812 | 3812 |
3813 virtual void initialize_output_representation(Representation observed) { | 3813 virtual void initialize_output_representation(Representation observed) { |
3814 observed_output_representation_ = observed; | 3814 observed_output_representation_ = observed; |
3815 } | 3815 } |
3816 | 3816 |
3817 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 3817 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
3818 if (index == 0) return Representation::Tagged(); | 3818 if (index == 0) return Representation::Tagged(); |
3819 return observed_input_representation_[index - 1]; | 3819 return observed_input_representation_[index - 1]; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 | 4026 |
4027 bool skip_check() const { return skip_check_; } | 4027 bool skip_check() const { return skip_check_; } |
4028 void set_skip_check() { skip_check_ = true; } | 4028 void set_skip_check() { skip_check_ = true; } |
4029 | 4029 |
4030 HValue* base() const { return base_; } | 4030 HValue* base() const { return base_; } |
4031 int offset() const { return offset_; } | 4031 int offset() const { return offset_; } |
4032 int scale() const { return scale_; } | 4032 int scale() const { return scale_; } |
4033 | 4033 |
4034 void ApplyIndexChange(); | 4034 void ApplyIndexChange(); |
4035 bool DetectCompoundIndex() { | 4035 bool DetectCompoundIndex() { |
4036 ASSERT(base() == NULL); | 4036 DCHECK(base() == NULL); |
4037 | 4037 |
4038 DecompositionResult decomposition; | 4038 DecompositionResult decomposition; |
4039 if (index()->TryDecompose(&decomposition)) { | 4039 if (index()->TryDecompose(&decomposition)) { |
4040 base_ = decomposition.base(); | 4040 base_ = decomposition.base(); |
4041 offset_ = decomposition.offset(); | 4041 offset_ = decomposition.offset(); |
4042 scale_ = decomposition.scale(); | 4042 scale_ = decomposition.scale(); |
4043 return true; | 4043 return true; |
4044 } else { | 4044 } else { |
4045 base_ = index(); | 4045 base_ = index(); |
4046 offset_ = 0; | 4046 offset_ = 0; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4254 | 4254 |
4255 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 4255 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
4256 | 4256 |
4257 private: | 4257 private: |
4258 HCompareGeneric(HValue* context, | 4258 HCompareGeneric(HValue* context, |
4259 HValue* left, | 4259 HValue* left, |
4260 HValue* right, | 4260 HValue* right, |
4261 Token::Value token) | 4261 Token::Value token) |
4262 : HBinaryOperation(context, left, right, HType::Boolean()), | 4262 : HBinaryOperation(context, left, right, HType::Boolean()), |
4263 token_(token) { | 4263 token_(token) { |
4264 ASSERT(Token::IsCompareOp(token)); | 4264 DCHECK(Token::IsCompareOp(token)); |
4265 set_representation(Representation::Tagged()); | 4265 set_representation(Representation::Tagged()); |
4266 SetAllSideEffects(); | 4266 SetAllSideEffects(); |
4267 } | 4267 } |
4268 | 4268 |
4269 Token::Value token_; | 4269 Token::Value token_; |
4270 }; | 4270 }; |
4271 | 4271 |
4272 | 4272 |
4273 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { | 4273 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { |
4274 public: | 4274 public: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) | 4312 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
4313 | 4313 |
4314 private: | 4314 private: |
4315 HCompareNumericAndBranch(HValue* left, | 4315 HCompareNumericAndBranch(HValue* left, |
4316 HValue* right, | 4316 HValue* right, |
4317 Token::Value token, | 4317 Token::Value token, |
4318 HBasicBlock* true_target = NULL, | 4318 HBasicBlock* true_target = NULL, |
4319 HBasicBlock* false_target = NULL) | 4319 HBasicBlock* false_target = NULL) |
4320 : token_(token) { | 4320 : token_(token) { |
4321 SetFlag(kFlexibleRepresentation); | 4321 SetFlag(kFlexibleRepresentation); |
4322 ASSERT(Token::IsCompareOp(token)); | 4322 DCHECK(Token::IsCompareOp(token)); |
4323 SetOperandAt(0, left); | 4323 SetOperandAt(0, left); |
4324 SetOperandAt(1, right); | 4324 SetOperandAt(1, right); |
4325 SetSuccessorAt(0, true_target); | 4325 SetSuccessorAt(0, true_target); |
4326 SetSuccessorAt(1, false_target); | 4326 SetSuccessorAt(1, false_target); |
4327 } | 4327 } |
4328 | 4328 |
4329 Representation observed_input_representation_[2]; | 4329 Representation observed_input_representation_[2]; |
4330 Token::Value token_; | 4330 Token::Value token_; |
4331 }; | 4331 }; |
4332 | 4332 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4551 } | 4551 } |
4552 | 4552 |
4553 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) | 4553 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) |
4554 | 4554 |
4555 private: | 4555 private: |
4556 HStringCompareAndBranch(HValue* context, | 4556 HStringCompareAndBranch(HValue* context, |
4557 HValue* left, | 4557 HValue* left, |
4558 HValue* right, | 4558 HValue* right, |
4559 Token::Value token) | 4559 Token::Value token) |
4560 : token_(token) { | 4560 : token_(token) { |
4561 ASSERT(Token::IsCompareOp(token)); | 4561 DCHECK(Token::IsCompareOp(token)); |
4562 SetOperandAt(0, context); | 4562 SetOperandAt(0, context); |
4563 SetOperandAt(1, left); | 4563 SetOperandAt(1, left); |
4564 SetOperandAt(2, right); | 4564 SetOperandAt(2, right); |
4565 set_representation(Representation::Tagged()); | 4565 set_representation(Representation::Tagged()); |
4566 SetChangesFlag(kNewSpacePromotion); | 4566 SetChangesFlag(kNewSpacePromotion); |
4567 } | 4567 } |
4568 | 4568 |
4569 Token::Value token_; | 4569 Token::Value token_; |
4570 }; | 4570 }; |
4571 | 4571 |
(...skipping 30 matching lines...) Expand all Loading... |
4602 | 4602 |
4603 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; | 4603 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
4604 | 4604 |
4605 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) | 4605 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
4606 | 4606 |
4607 private: | 4607 private: |
4608 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) | 4608 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
4609 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } | 4609 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
4610 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) | 4610 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
4611 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { | 4611 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
4612 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 4612 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend. |
4613 } | 4613 } |
4614 | 4614 |
4615 InstanceType from_; | 4615 InstanceType from_; |
4616 InstanceType to_; // Inclusive range, not all combinations work. | 4616 InstanceType to_; // Inclusive range, not all combinations work. |
4617 }; | 4617 }; |
4618 | 4618 |
4619 | 4619 |
4620 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction { | 4620 class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction { |
4621 public: | 4621 public: |
4622 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); | 4622 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5085 | 5085 |
5086 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 5086 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
5087 | 5087 |
5088 private: | 5088 private: |
5089 HBitwise(HValue* context, | 5089 HBitwise(HValue* context, |
5090 Token::Value op, | 5090 Token::Value op, |
5091 HValue* left, | 5091 HValue* left, |
5092 HValue* right) | 5092 HValue* right) |
5093 : HBitwiseBinaryOperation(context, left, right), | 5093 : HBitwiseBinaryOperation(context, left, right), |
5094 op_(op) { | 5094 op_(op) { |
5095 ASSERT(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 5095 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
5096 // BIT_AND with a smi-range positive value will always unset the | 5096 // BIT_AND with a smi-range positive value will always unset the |
5097 // entire sign-extension of the smi-sign. | 5097 // entire sign-extension of the smi-sign. |
5098 if (op == Token::BIT_AND && | 5098 if (op == Token::BIT_AND && |
5099 ((left->IsConstant() && | 5099 ((left->IsConstant() && |
5100 left->representation().IsSmi() && | 5100 left->representation().IsSmi() && |
5101 HConstant::cast(left)->Integer32Value() >= 0) || | 5101 HConstant::cast(left)->Integer32Value() >= 0) || |
5102 (right->IsConstant() && | 5102 (right->IsConstant() && |
5103 right->representation().IsSmi() && | 5103 right->representation().IsSmi() && |
5104 HConstant::cast(right)->Integer32Value() >= 0))) { | 5104 HConstant::cast(right)->Integer32Value() >= 0))) { |
5105 SetFlag(kTruncatingToSmi); | 5105 SetFlag(kTruncatingToSmi); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5430 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { | 5430 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { |
5431 public: | 5431 public: |
5432 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, | 5432 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, |
5433 Handle<String>, bool); | 5433 Handle<String>, bool); |
5434 | 5434 |
5435 HValue* context() { return OperandAt(0); } | 5435 HValue* context() { return OperandAt(0); } |
5436 HValue* global_object() { return OperandAt(1); } | 5436 HValue* global_object() { return OperandAt(1); } |
5437 Handle<String> name() const { return name_; } | 5437 Handle<String> name() const { return name_; } |
5438 bool for_typeof() const { return for_typeof_; } | 5438 bool for_typeof() const { return for_typeof_; } |
5439 int slot() const { | 5439 int slot() const { |
5440 ASSERT(FLAG_vector_ics && | 5440 DCHECK(FLAG_vector_ics && |
5441 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); | 5441 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); |
5442 return slot_; | 5442 return slot_; |
5443 } | 5443 } |
5444 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } | 5444 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } |
5445 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { | 5445 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { |
5446 ASSERT(FLAG_vector_ics); | 5446 DCHECK(FLAG_vector_ics); |
5447 feedback_vector_ = vector; | 5447 feedback_vector_ = vector; |
5448 slot_ = slot; | 5448 slot_ = slot; |
5449 } | 5449 } |
5450 | 5450 |
5451 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 5451 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
5452 | 5452 |
5453 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5453 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
5454 return Representation::Tagged(); | 5454 return Representation::Tagged(); |
5455 } | 5455 } |
5456 | 5456 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5496 | 5496 |
5497 // Maximum instance size for which allocations will be inlined. | 5497 // Maximum instance size for which allocations will be inlined. |
5498 static const int kMaxInlineSize = 64 * kPointerSize; | 5498 static const int kMaxInlineSize = 64 * kPointerSize; |
5499 | 5499 |
5500 HValue* context() const { return OperandAt(0); } | 5500 HValue* context() const { return OperandAt(0); } |
5501 HValue* size() const { return OperandAt(1); } | 5501 HValue* size() const { return OperandAt(1); } |
5502 | 5502 |
5503 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } | 5503 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } |
5504 HConstant* size_upper_bound() { return size_upper_bound_; } | 5504 HConstant* size_upper_bound() { return size_upper_bound_; } |
5505 void set_size_upper_bound(HConstant* value) { | 5505 void set_size_upper_bound(HConstant* value) { |
5506 ASSERT(size_upper_bound_ == NULL); | 5506 DCHECK(size_upper_bound_ == NULL); |
5507 size_upper_bound_ = value; | 5507 size_upper_bound_ = value; |
5508 } | 5508 } |
5509 | 5509 |
5510 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5510 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
5511 if (index == 0) { | 5511 if (index == 0) { |
5512 return Representation::Tagged(); | 5512 return Representation::Tagged(); |
5513 } else { | 5513 } else { |
5514 return Representation::Integer32(); | 5514 return Representation::Integer32(); |
5515 } | 5515 } |
5516 } | 5516 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5706 } | 5706 } |
5707 | 5707 |
5708 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 5708 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
5709 | 5709 |
5710 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) | 5710 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) |
5711 | 5711 |
5712 private: | 5712 private: |
5713 HInnerAllocatedObject(HValue* value, | 5713 HInnerAllocatedObject(HValue* value, |
5714 HValue* offset, | 5714 HValue* offset, |
5715 HType type) : HTemplateInstruction<2>(type) { | 5715 HType type) : HTemplateInstruction<2>(type) { |
5716 ASSERT(value->IsAllocate()); | 5716 DCHECK(value->IsAllocate()); |
5717 ASSERT(type.IsHeapObject()); | 5717 DCHECK(type.IsHeapObject()); |
5718 SetOperandAt(0, value); | 5718 SetOperandAt(0, value); |
5719 SetOperandAt(1, offset); | 5719 SetOperandAt(1, offset); |
5720 set_representation(Representation::Tagged()); | 5720 set_representation(Representation::Tagged()); |
5721 } | 5721 } |
5722 }; | 5722 }; |
5723 | 5723 |
5724 | 5724 |
5725 inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 5725 inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
5726 return !value->type().IsSmi() | 5726 return !value->type().IsSmi() |
5727 && !value->type().IsNull() | 5727 && !value->type().IsNull() |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6273 bool immutable = false, | 6273 bool immutable = false, |
6274 bool existing_inobject_property = true) | 6274 bool existing_inobject_property = true) |
6275 : value_(PortionField::encode(portion) | | 6275 : value_(PortionField::encode(portion) | |
6276 RepresentationField::encode(representation.kind()) | | 6276 RepresentationField::encode(representation.kind()) | |
6277 ImmutableField::encode(immutable ? 1 : 0) | | 6277 ImmutableField::encode(immutable ? 1 : 0) | |
6278 ExistingInobjectPropertyField::encode( | 6278 ExistingInobjectPropertyField::encode( |
6279 existing_inobject_property ? 1 : 0) | | 6279 existing_inobject_property ? 1 : 0) | |
6280 OffsetField::encode(offset)), | 6280 OffsetField::encode(offset)), |
6281 name_(name) { | 6281 name_(name) { |
6282 // assert that the fields decode correctly | 6282 // assert that the fields decode correctly |
6283 ASSERT(this->offset() == offset); | 6283 DCHECK(this->offset() == offset); |
6284 ASSERT(this->portion() == portion); | 6284 DCHECK(this->portion() == portion); |
6285 ASSERT(this->immutable() == immutable); | 6285 DCHECK(this->immutable() == immutable); |
6286 ASSERT(this->existing_inobject_property() == existing_inobject_property); | 6286 DCHECK(this->existing_inobject_property() == existing_inobject_property); |
6287 ASSERT(RepresentationField::decode(value_) == representation.kind()); | 6287 DCHECK(RepresentationField::decode(value_) == representation.kind()); |
6288 ASSERT(!this->existing_inobject_property() || IsInobject()); | 6288 DCHECK(!this->existing_inobject_property() || IsInobject()); |
6289 } | 6289 } |
6290 | 6290 |
6291 class PortionField : public BitField<Portion, 0, 3> {}; | 6291 class PortionField : public BitField<Portion, 0, 3> {}; |
6292 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; | 6292 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
6293 class ImmutableField : public BitField<bool, 7, 1> {}; | 6293 class ImmutableField : public BitField<bool, 7, 1> {}; |
6294 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; | 6294 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; |
6295 class OffsetField : public BitField<int, 9, 23> {}; | 6295 class OffsetField : public BitField<int, 9, 23> {}; |
6296 | 6296 |
6297 uint32_t value_; // encodes portion, representation, immutable, and offset | 6297 uint32_t value_; // encodes portion, representation, immutable, and offset |
6298 Handle<String> name_; | 6298 Handle<String> name_; |
(...skipping 14 matching lines...) Expand all Loading... |
6313 | 6313 |
6314 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { | 6314 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { |
6315 public: | 6315 public: |
6316 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, | 6316 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, |
6317 HValue*, HObjectAccess); | 6317 HValue*, HObjectAccess); |
6318 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*, | 6318 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*, |
6319 HObjectAccess, const UniqueSet<Map>*, HType); | 6319 HObjectAccess, const UniqueSet<Map>*, HType); |
6320 | 6320 |
6321 HValue* object() const { return OperandAt(0); } | 6321 HValue* object() const { return OperandAt(0); } |
6322 HValue* dependency() const { | 6322 HValue* dependency() const { |
6323 ASSERT(HasDependency()); | 6323 DCHECK(HasDependency()); |
6324 return OperandAt(1); | 6324 return OperandAt(1); |
6325 } | 6325 } |
6326 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } | 6326 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } |
6327 HObjectAccess access() const { return access_; } | 6327 HObjectAccess access() const { return access_; } |
6328 Representation field_representation() const { | 6328 Representation field_representation() const { |
6329 return access_.representation(); | 6329 return access_.representation(); |
6330 } | 6330 } |
6331 | 6331 |
6332 const UniqueSet<Map>* maps() const { return maps_; } | 6332 const UniqueSet<Map>* maps() const { return maps_; } |
6333 | 6333 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6366 return (this->maps_ != NULL && | 6366 return (this->maps_ != NULL && |
6367 that->maps_ != NULL && | 6367 that->maps_ != NULL && |
6368 this->maps_->Equals(that->maps_)); | 6368 this->maps_->Equals(that->maps_)); |
6369 } | 6369 } |
6370 | 6370 |
6371 private: | 6371 private: |
6372 HLoadNamedField(HValue* object, | 6372 HLoadNamedField(HValue* object, |
6373 HValue* dependency, | 6373 HValue* dependency, |
6374 HObjectAccess access) | 6374 HObjectAccess access) |
6375 : access_(access), maps_(NULL) { | 6375 : access_(access), maps_(NULL) { |
6376 ASSERT_NOT_NULL(object); | 6376 DCHECK_NOT_NULL(object); |
6377 SetOperandAt(0, object); | 6377 SetOperandAt(0, object); |
6378 SetOperandAt(1, dependency ? dependency : object); | 6378 SetOperandAt(1, dependency ? dependency : object); |
6379 | 6379 |
6380 Representation representation = access.representation(); | 6380 Representation representation = access.representation(); |
6381 if (representation.IsInteger8() || | 6381 if (representation.IsInteger8() || |
6382 representation.IsUInteger8() || | 6382 representation.IsUInteger8() || |
6383 representation.IsInteger16() || | 6383 representation.IsInteger16() || |
6384 representation.IsUInteger16()) { | 6384 representation.IsUInteger16()) { |
6385 set_representation(Representation::Integer32()); | 6385 set_representation(Representation::Integer32()); |
6386 } else if (representation.IsSmi()) { | 6386 } else if (representation.IsSmi()) { |
(...skipping 15 matching lines...) Expand all Loading... |
6402 } | 6402 } |
6403 access.SetGVNFlags(this, LOAD); | 6403 access.SetGVNFlags(this, LOAD); |
6404 } | 6404 } |
6405 | 6405 |
6406 HLoadNamedField(HValue* object, | 6406 HLoadNamedField(HValue* object, |
6407 HValue* dependency, | 6407 HValue* dependency, |
6408 HObjectAccess access, | 6408 HObjectAccess access, |
6409 const UniqueSet<Map>* maps, | 6409 const UniqueSet<Map>* maps, |
6410 HType type) | 6410 HType type) |
6411 : HTemplateInstruction<2>(type), access_(access), maps_(maps) { | 6411 : HTemplateInstruction<2>(type), access_(access), maps_(maps) { |
6412 ASSERT_NOT_NULL(maps); | 6412 DCHECK_NOT_NULL(maps); |
6413 ASSERT_NE(0, maps->size()); | 6413 DCHECK_NE(0, maps->size()); |
6414 | 6414 |
6415 ASSERT_NOT_NULL(object); | 6415 DCHECK_NOT_NULL(object); |
6416 SetOperandAt(0, object); | 6416 SetOperandAt(0, object); |
6417 SetOperandAt(1, dependency ? dependency : object); | 6417 SetOperandAt(1, dependency ? dependency : object); |
6418 | 6418 |
6419 ASSERT(access.representation().IsHeapObject()); | 6419 DCHECK(access.representation().IsHeapObject()); |
6420 ASSERT(type.IsHeapObject()); | 6420 DCHECK(type.IsHeapObject()); |
6421 set_representation(Representation::Tagged()); | 6421 set_representation(Representation::Tagged()); |
6422 | 6422 |
6423 access.SetGVNFlags(this, LOAD); | 6423 access.SetGVNFlags(this, LOAD); |
6424 } | 6424 } |
6425 | 6425 |
6426 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6426 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
6427 | 6427 |
6428 HObjectAccess access_; | 6428 HObjectAccess access_; |
6429 const UniqueSet<Map>* maps_; | 6429 const UniqueSet<Map>* maps_; |
6430 }; | 6430 }; |
6431 | 6431 |
6432 | 6432 |
6433 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { | 6433 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { |
6434 public: | 6434 public: |
6435 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, | 6435 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, |
6436 Handle<Object>); | 6436 Handle<Object>); |
6437 | 6437 |
6438 HValue* context() const { return OperandAt(0); } | 6438 HValue* context() const { return OperandAt(0); } |
6439 HValue* object() const { return OperandAt(1); } | 6439 HValue* object() const { return OperandAt(1); } |
6440 Handle<Object> name() const { return name_; } | 6440 Handle<Object> name() const { return name_; } |
6441 | 6441 |
6442 int slot() const { | 6442 int slot() const { |
6443 ASSERT(FLAG_vector_ics && | 6443 DCHECK(FLAG_vector_ics && |
6444 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); | 6444 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); |
6445 return slot_; | 6445 return slot_; |
6446 } | 6446 } |
6447 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } | 6447 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } |
6448 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { | 6448 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { |
6449 ASSERT(FLAG_vector_ics); | 6449 DCHECK(FLAG_vector_ics); |
6450 feedback_vector_ = vector; | 6450 feedback_vector_ = vector; |
6451 slot_ = slot; | 6451 slot_ = slot; |
6452 } | 6452 } |
6453 | 6453 |
6454 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6454 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6455 return Representation::Tagged(); | 6455 return Representation::Tagged(); |
6456 } | 6456 } |
6457 | 6457 |
6458 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 6458 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
6459 | 6459 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6540 } | 6540 } |
6541 bool is_fixed_typed_array() const { | 6541 bool is_fixed_typed_array() const { |
6542 return IsFixedTypedArrayElementsKind(elements_kind()); | 6542 return IsFixedTypedArrayElementsKind(elements_kind()); |
6543 } | 6543 } |
6544 bool is_typed_elements() const { | 6544 bool is_typed_elements() const { |
6545 return is_external() || is_fixed_typed_array(); | 6545 return is_external() || is_fixed_typed_array(); |
6546 } | 6546 } |
6547 HValue* elements() const { return OperandAt(0); } | 6547 HValue* elements() const { return OperandAt(0); } |
6548 HValue* key() const { return OperandAt(1); } | 6548 HValue* key() const { return OperandAt(1); } |
6549 HValue* dependency() const { | 6549 HValue* dependency() const { |
6550 ASSERT(HasDependency()); | 6550 DCHECK(HasDependency()); |
6551 return OperandAt(2); | 6551 return OperandAt(2); |
6552 } | 6552 } |
6553 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6553 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
6554 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } | 6554 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } |
6555 bool TryIncreaseBaseOffset(uint32_t increase_by_value); | 6555 bool TryIncreaseBaseOffset(uint32_t increase_by_value); |
6556 HValue* GetKey() { return key(); } | 6556 HValue* GetKey() { return key(); } |
6557 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6557 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6558 bool IsDehoisted() const { return IsDehoistedField::decode(bit_field_); } | 6558 bool IsDehoisted() const { return IsDehoistedField::decode(bit_field_); } |
6559 void SetDehoisted(bool is_dehoisted) { | 6559 void SetDehoisted(bool is_dehoisted) { |
6560 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6560 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6621 HoleModeField::encode(mode) | | 6621 HoleModeField::encode(mode) | |
6622 BaseOffsetField::encode(offset); | 6622 BaseOffsetField::encode(offset); |
6623 | 6623 |
6624 SetOperandAt(0, obj); | 6624 SetOperandAt(0, obj); |
6625 SetOperandAt(1, key); | 6625 SetOperandAt(1, key); |
6626 SetOperandAt(2, dependency != NULL ? dependency : obj); | 6626 SetOperandAt(2, dependency != NULL ? dependency : obj); |
6627 | 6627 |
6628 if (!is_typed_elements()) { | 6628 if (!is_typed_elements()) { |
6629 // I can detect the case between storing double (holey and fast) and | 6629 // I can detect the case between storing double (holey and fast) and |
6630 // smi/object by looking at elements_kind_. | 6630 // smi/object by looking at elements_kind_. |
6631 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | 6631 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind) || |
6632 IsFastDoubleElementsKind(elements_kind)); | 6632 IsFastDoubleElementsKind(elements_kind)); |
6633 | 6633 |
6634 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | 6634 if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
6635 if (IsFastSmiElementsKind(elements_kind) && | 6635 if (IsFastSmiElementsKind(elements_kind) && |
6636 (!IsHoleyElementsKind(elements_kind) || | 6636 (!IsHoleyElementsKind(elements_kind) || |
6637 mode == NEVER_RETURN_HOLE)) { | 6637 mode == NEVER_RETURN_HOLE)) { |
6638 set_type(HType::Smi()); | 6638 set_type(HType::Smi()); |
6639 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { | 6639 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { |
6640 set_representation(Representation::Integer32()); | 6640 set_representation(Representation::Integer32()); |
6641 } else { | 6641 } else { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6711 | 6711 |
6712 | 6712 |
6713 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6713 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { |
6714 public: | 6714 public: |
6715 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*, | 6715 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*, |
6716 HValue*); | 6716 HValue*); |
6717 HValue* object() const { return OperandAt(0); } | 6717 HValue* object() const { return OperandAt(0); } |
6718 HValue* key() const { return OperandAt(1); } | 6718 HValue* key() const { return OperandAt(1); } |
6719 HValue* context() const { return OperandAt(2); } | 6719 HValue* context() const { return OperandAt(2); } |
6720 int slot() const { | 6720 int slot() const { |
6721 ASSERT(FLAG_vector_ics && | 6721 DCHECK(FLAG_vector_ics && |
6722 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); | 6722 slot_ != FeedbackSlotInterface::kInvalidFeedbackSlot); |
6723 return slot_; | 6723 return slot_; |
6724 } | 6724 } |
6725 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } | 6725 Handle<FixedArray> feedback_vector() const { return feedback_vector_; } |
6726 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { | 6726 void SetVectorAndSlot(Handle<FixedArray> vector, int slot) { |
6727 ASSERT(FLAG_vector_ics); | 6727 DCHECK(FLAG_vector_ics); |
6728 feedback_vector_ = vector; | 6728 feedback_vector_ = vector; |
6729 slot_ = slot; | 6729 slot_ = slot; |
6730 } | 6730 } |
6731 | 6731 |
6732 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 6732 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
6733 | 6733 |
6734 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6734 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6735 // tagged[tagged] | 6735 // tagged[tagged] |
6736 return Representation::Tagged(); | 6736 return Representation::Tagged(); |
6737 } | 6737 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6800 } | 6800 } |
6801 return field_representation(); | 6801 return field_representation(); |
6802 } else if (field_representation().IsExternal()) { | 6802 } else if (field_representation().IsExternal()) { |
6803 return Representation::External(); | 6803 return Representation::External(); |
6804 } | 6804 } |
6805 } | 6805 } |
6806 return Representation::Tagged(); | 6806 return Representation::Tagged(); |
6807 } | 6807 } |
6808 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6808 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
6809 HValue* dominator) V8_OVERRIDE { | 6809 HValue* dominator) V8_OVERRIDE { |
6810 ASSERT(side_effect == kNewSpacePromotion); | 6810 DCHECK(side_effect == kNewSpacePromotion); |
6811 if (!FLAG_use_write_barrier_elimination) return false; | 6811 if (!FLAG_use_write_barrier_elimination) return false; |
6812 dominator_ = dominator; | 6812 dominator_ = dominator; |
6813 return false; | 6813 return false; |
6814 } | 6814 } |
6815 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 6815 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
6816 | 6816 |
6817 HValue* object() const { return OperandAt(0); } | 6817 HValue* object() const { return OperandAt(0); } |
6818 HValue* value() const { return OperandAt(1); } | 6818 HValue* value() const { return OperandAt(1); } |
6819 HValue* transition() const { return OperandAt(2); } | 6819 HValue* transition() const { return OperandAt(2); } |
6820 | 6820 |
6821 HObjectAccess access() const { return access_; } | 6821 HObjectAccess access() const { return access_; } |
6822 HValue* dominator() const { return dominator_; } | 6822 HValue* dominator() const { return dominator_; } |
6823 bool has_transition() const { return has_transition_; } | 6823 bool has_transition() const { return has_transition_; } |
6824 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6824 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
6825 | 6825 |
6826 Handle<Map> transition_map() const { | 6826 Handle<Map> transition_map() const { |
6827 if (has_transition()) { | 6827 if (has_transition()) { |
6828 return Handle<Map>::cast( | 6828 return Handle<Map>::cast( |
6829 HConstant::cast(transition())->handle(Isolate::Current())); | 6829 HConstant::cast(transition())->handle(Isolate::Current())); |
6830 } else { | 6830 } else { |
6831 return Handle<Map>(); | 6831 return Handle<Map>(); |
6832 } | 6832 } |
6833 } | 6833 } |
6834 | 6834 |
6835 void SetTransition(HConstant* transition) { | 6835 void SetTransition(HConstant* transition) { |
6836 ASSERT(!has_transition()); // Only set once. | 6836 DCHECK(!has_transition()); // Only set once. |
6837 SetOperandAt(2, transition); | 6837 SetOperandAt(2, transition); |
6838 has_transition_ = true; | 6838 has_transition_ = true; |
6839 SetChangesFlag(kMaps); | 6839 SetChangesFlag(kMaps); |
6840 } | 6840 } |
6841 | 6841 |
6842 bool NeedsWriteBarrier() const { | 6842 bool NeedsWriteBarrier() const { |
6843 ASSERT(!field_representation().IsDouble() || !has_transition()); | 6843 DCHECK(!field_representation().IsDouble() || !has_transition()); |
6844 if (field_representation().IsDouble()) return false; | 6844 if (field_representation().IsDouble()) return false; |
6845 if (field_representation().IsSmi()) return false; | 6845 if (field_representation().IsSmi()) return false; |
6846 if (field_representation().IsInteger32()) return false; | 6846 if (field_representation().IsInteger32()) return false; |
6847 if (field_representation().IsExternal()) return false; | 6847 if (field_representation().IsExternal()) return false; |
6848 return StoringValueNeedsWriteBarrier(value()) && | 6848 return StoringValueNeedsWriteBarrier(value()) && |
6849 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator()); | 6849 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator()); |
6850 } | 6850 } |
6851 | 6851 |
6852 bool NeedsWriteBarrierForMap() { | 6852 bool NeedsWriteBarrierForMap() { |
6853 return ReceiverObjectNeedsWriteBarrier(object(), transition(), | 6853 return ReceiverObjectNeedsWriteBarrier(object(), transition(), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6889 HStoreNamedField(HValue* obj, | 6889 HStoreNamedField(HValue* obj, |
6890 HObjectAccess access, | 6890 HObjectAccess access, |
6891 HValue* val, | 6891 HValue* val, |
6892 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6892 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
6893 : access_(access), | 6893 : access_(access), |
6894 dominator_(NULL), | 6894 dominator_(NULL), |
6895 has_transition_(false), | 6895 has_transition_(false), |
6896 store_mode_(store_mode) { | 6896 store_mode_(store_mode) { |
6897 // Stores to a non existing in-object property are allowed only to the | 6897 // Stores to a non existing in-object property are allowed only to the |
6898 // newly allocated objects (via HAllocate or HInnerAllocatedObject). | 6898 // newly allocated objects (via HAllocate or HInnerAllocatedObject). |
6899 ASSERT(!access.IsInobject() || access.existing_inobject_property() || | 6899 DCHECK(!access.IsInobject() || access.existing_inobject_property() || |
6900 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | 6900 obj->IsAllocate() || obj->IsInnerAllocatedObject()); |
6901 SetOperandAt(0, obj); | 6901 SetOperandAt(0, obj); |
6902 SetOperandAt(1, val); | 6902 SetOperandAt(1, val); |
6903 SetOperandAt(2, obj); | 6903 SetOperandAt(2, obj); |
6904 access.SetGVNFlags(this, STORE); | 6904 access.SetGVNFlags(this, STORE); |
6905 } | 6905 } |
6906 | 6906 |
6907 HObjectAccess access_; | 6907 HObjectAccess access_; |
6908 HValue* dominator_; | 6908 HValue* dominator_; |
6909 bool has_transition_ : 1; | 6909 bool has_transition_ : 1; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6966 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 6966 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
6967 // kind_external: external[int32] = (double | int32) | 6967 // kind_external: external[int32] = (double | int32) |
6968 if (index == 0) { | 6968 if (index == 0) { |
6969 return is_external() ? Representation::External() | 6969 return is_external() ? Representation::External() |
6970 : Representation::Tagged(); | 6970 : Representation::Tagged(); |
6971 } else if (index == 1) { | 6971 } else if (index == 1) { |
6972 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6972 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
6973 OperandAt(1)->representation()); | 6973 OperandAt(1)->representation()); |
6974 } | 6974 } |
6975 | 6975 |
6976 ASSERT_EQ(index, 2); | 6976 DCHECK_EQ(index, 2); |
6977 return RequiredValueRepresentation(elements_kind_, store_mode_); | 6977 return RequiredValueRepresentation(elements_kind_, store_mode_); |
6978 } | 6978 } |
6979 | 6979 |
6980 static Representation RequiredValueRepresentation( | 6980 static Representation RequiredValueRepresentation( |
6981 ElementsKind kind, StoreFieldOrKeyedMode mode) { | 6981 ElementsKind kind, StoreFieldOrKeyedMode mode) { |
6982 if (IsDoubleOrFloatElementsKind(kind)) { | 6982 if (IsDoubleOrFloatElementsKind(kind)) { |
6983 return Representation::Double(); | 6983 return Representation::Double(); |
6984 } | 6984 } |
6985 | 6985 |
6986 if (kind == FAST_SMI_ELEMENTS && SmiValuesAre32Bits() && | 6986 if (kind == FAST_SMI_ELEMENTS && SmiValuesAre32Bits() && |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7039 void SetUninitialized(bool is_uninitialized) { | 7039 void SetUninitialized(bool is_uninitialized) { |
7040 is_uninitialized_ = is_uninitialized; | 7040 is_uninitialized_ = is_uninitialized; |
7041 } | 7041 } |
7042 | 7042 |
7043 bool IsConstantHoleStore() { | 7043 bool IsConstantHoleStore() { |
7044 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 7044 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
7045 } | 7045 } |
7046 | 7046 |
7047 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 7047 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
7048 HValue* dominator) V8_OVERRIDE { | 7048 HValue* dominator) V8_OVERRIDE { |
7049 ASSERT(side_effect == kNewSpacePromotion); | 7049 DCHECK(side_effect == kNewSpacePromotion); |
7050 dominator_ = dominator; | 7050 dominator_ = dominator; |
7051 return false; | 7051 return false; |
7052 } | 7052 } |
7053 | 7053 |
7054 HValue* dominator() const { return dominator_; } | 7054 HValue* dominator() const { return dominator_; } |
7055 | 7055 |
7056 bool NeedsWriteBarrier() { | 7056 bool NeedsWriteBarrier() { |
7057 if (value_is_smi()) { | 7057 if (value_is_smi()) { |
7058 return false; | 7058 return false; |
7059 } else { | 7059 } else { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7530 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 7530 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
7531 | 7531 |
7532 private: | 7532 private: |
7533 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 7533 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
7534 set_representation(Representation::Tagged()); | 7534 set_representation(Representation::Tagged()); |
7535 SetChangesFlag(kNewSpacePromotion); | 7535 SetChangesFlag(kNewSpacePromotion); |
7536 | 7536 |
7537 // This instruction is not marked as kChangesMaps, but does | 7537 // This instruction is not marked as kChangesMaps, but does |
7538 // change the map of the input operand. Use it only when creating | 7538 // change the map of the input operand. Use it only when creating |
7539 // object literals via a runtime call. | 7539 // object literals via a runtime call. |
7540 ASSERT(value->IsCallRuntime()); | 7540 DCHECK(value->IsCallRuntime()); |
7541 #ifdef DEBUG | 7541 #ifdef DEBUG |
7542 const Runtime::Function* function = HCallRuntime::cast(value)->function(); | 7542 const Runtime::Function* function = HCallRuntime::cast(value)->function(); |
7543 ASSERT(function->function_id == Runtime::kCreateObjectLiteral); | 7543 DCHECK(function->function_id == Runtime::kCreateObjectLiteral); |
7544 #endif | 7544 #endif |
7545 } | 7545 } |
7546 | 7546 |
7547 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7547 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7548 }; | 7548 }; |
7549 | 7549 |
7550 | 7550 |
7551 class HDateField V8_FINAL : public HUnaryOperation { | 7551 class HDateField V8_FINAL : public HUnaryOperation { |
7552 public: | 7552 public: |
7553 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); | 7553 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7591 | 7591 |
7592 protected: | 7592 protected: |
7593 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 7593 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
7594 return encoding() == HSeqStringGetChar::cast(other)->encoding(); | 7594 return encoding() == HSeqStringGetChar::cast(other)->encoding(); |
7595 } | 7595 } |
7596 | 7596 |
7597 virtual Range* InferRange(Zone* zone) V8_OVERRIDE { | 7597 virtual Range* InferRange(Zone* zone) V8_OVERRIDE { |
7598 if (encoding() == String::ONE_BYTE_ENCODING) { | 7598 if (encoding() == String::ONE_BYTE_ENCODING) { |
7599 return new(zone) Range(0, String::kMaxOneByteCharCode); | 7599 return new(zone) Range(0, String::kMaxOneByteCharCode); |
7600 } else { | 7600 } else { |
7601 ASSERT_EQ(String::TWO_BYTE_ENCODING, encoding()); | 7601 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding()); |
7602 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 7602 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
7603 } | 7603 } |
7604 } | 7604 } |
7605 | 7605 |
7606 private: | 7606 private: |
7607 HSeqStringGetChar(String::Encoding encoding, | 7607 HSeqStringGetChar(String::Encoding encoding, |
7608 HValue* string, | 7608 HValue* string, |
7609 HValue* index) : encoding_(encoding) { | 7609 HValue* index) : encoding_(encoding) { |
7610 SetOperandAt(0, string); | 7610 SetOperandAt(0, string); |
7611 SetOperandAt(1, index); | 7611 SetOperandAt(1, index); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7857 }; | 7857 }; |
7858 | 7858 |
7859 | 7859 |
7860 | 7860 |
7861 #undef DECLARE_INSTRUCTION | 7861 #undef DECLARE_INSTRUCTION |
7862 #undef DECLARE_CONCRETE_INSTRUCTION | 7862 #undef DECLARE_CONCRETE_INSTRUCTION |
7863 | 7863 |
7864 } } // namespace v8::internal | 7864 } } // namespace v8::internal |
7865 | 7865 |
7866 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7866 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |