| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 V(CheckInstanceType) \ | 93 V(CheckInstanceType) \ |
| 94 V(CheckMaps) \ | 94 V(CheckMaps) \ |
| 95 V(CheckMapValue) \ | 95 V(CheckMapValue) \ |
| 96 V(CheckSmi) \ | 96 V(CheckSmi) \ |
| 97 V(CheckValue) \ | 97 V(CheckValue) \ |
| 98 V(ClampToUint8) \ | 98 V(ClampToUint8) \ |
| 99 V(ClassOfTestAndBranch) \ | 99 V(ClassOfTestAndBranch) \ |
| 100 V(CompareNumericAndBranch) \ | 100 V(CompareNumericAndBranch) \ |
| 101 V(CompareHoleAndBranch) \ | 101 V(CompareHoleAndBranch) \ |
| 102 V(CompareGeneric) \ | 102 V(CompareGeneric) \ |
| 103 V(CompareMinusZeroAndBranch) \ |
| 103 V(CompareObjectEqAndBranch) \ | 104 V(CompareObjectEqAndBranch) \ |
| 104 V(CompareMap) \ | 105 V(CompareMap) \ |
| 105 V(Constant) \ | 106 V(Constant) \ |
| 106 V(Context) \ | 107 V(Context) \ |
| 107 V(DateField) \ | 108 V(DateField) \ |
| 108 V(DebugBreak) \ | 109 V(DebugBreak) \ |
| 109 V(DeclareGlobals) \ | 110 V(DeclareGlobals) \ |
| 110 V(Deoptimize) \ | 111 V(Deoptimize) \ |
| 111 V(Div) \ | 112 V(Div) \ |
| 112 V(DummyUse) \ | 113 V(DummyUse) \ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 V(OsrEntry) \ | 153 V(OsrEntry) \ |
| 153 V(OuterContext) \ | 154 V(OuterContext) \ |
| 154 V(Parameter) \ | 155 V(Parameter) \ |
| 155 V(Power) \ | 156 V(Power) \ |
| 156 V(PushArgument) \ | 157 V(PushArgument) \ |
| 157 V(Random) \ | 158 V(Random) \ |
| 158 V(RegExpLiteral) \ | 159 V(RegExpLiteral) \ |
| 159 V(Return) \ | 160 V(Return) \ |
| 160 V(Ror) \ | 161 V(Ror) \ |
| 161 V(Sar) \ | 162 V(Sar) \ |
| 163 V(SeqStringGetChar) \ |
| 162 V(SeqStringSetChar) \ | 164 V(SeqStringSetChar) \ |
| 163 V(Shl) \ | 165 V(Shl) \ |
| 164 V(Shr) \ | 166 V(Shr) \ |
| 165 V(Simulate) \ | 167 V(Simulate) \ |
| 166 V(StackCheck) \ | 168 V(StackCheck) \ |
| 167 V(StoreCodeEntry) \ | 169 V(StoreCodeEntry) \ |
| 168 V(StoreContextSlot) \ | 170 V(StoreContextSlot) \ |
| 169 V(StoreGlobalCell) \ | 171 V(StoreGlobalCell) \ |
| 170 V(StoreGlobalGeneric) \ | 172 V(StoreGlobalGeneric) \ |
| 171 V(StoreKeyed) \ | 173 V(StoreKeyed) \ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 201 V(BackingStoreFields) \ | 203 V(BackingStoreFields) \ |
| 202 V(Calls) \ | 204 V(Calls) \ |
| 203 V(ContextSlots) \ | 205 V(ContextSlots) \ |
| 204 V(DoubleArrayElements) \ | 206 V(DoubleArrayElements) \ |
| 205 V(DoubleFields) \ | 207 V(DoubleFields) \ |
| 206 V(ElementsKind) \ | 208 V(ElementsKind) \ |
| 207 V(ElementsPointer) \ | 209 V(ElementsPointer) \ |
| 208 V(GlobalVars) \ | 210 V(GlobalVars) \ |
| 209 V(InobjectFields) \ | 211 V(InobjectFields) \ |
| 210 V(OsrEntries) \ | 212 V(OsrEntries) \ |
| 211 V(ExternalMemory) | 213 V(ExternalMemory) \ |
| 214 V(StringChars) |
| 212 | 215 |
| 213 | 216 |
| 214 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 217 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
| 215 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ | 218 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ |
| 216 static H##type* cast(HValue* value) { \ | 219 static H##type* cast(HValue* value) { \ |
| 217 ASSERT(value->Is##type()); \ | 220 ASSERT(value->Is##type()); \ |
| 218 return reinterpret_cast<H##type*>(value); \ | 221 return reinterpret_cast<H##type*>(value); \ |
| 219 } | 222 } |
| 220 | 223 |
| 221 | 224 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 *a = *b; | 538 *a = *b; |
| 536 *b = c; | 539 *b = c; |
| 537 } | 540 } |
| 538 | 541 |
| 539 HValue* base_; | 542 HValue* base_; |
| 540 int offset_; | 543 int offset_; |
| 541 int scale_; | 544 int scale_; |
| 542 }; | 545 }; |
| 543 | 546 |
| 544 | 547 |
| 545 typedef EnumSet<GVNFlag> GVNFlagSet; | 548 typedef EnumSet<GVNFlag, int64_t> GVNFlagSet; |
| 546 | 549 |
| 547 | 550 |
| 548 class HValue : public ZoneObject { | 551 class HValue : public ZoneObject { |
| 549 public: | 552 public: |
| 550 static const int kNoNumber = -1; | 553 static const int kNoNumber = -1; |
| 551 | 554 |
| 552 enum Flag { | 555 enum Flag { |
| 553 kFlexibleRepresentation, | 556 kFlexibleRepresentation, |
| 554 kCannotBeTagged, | 557 kCannotBeTagged, |
| 555 // Participate in Global Value Numbering, i.e. elimination of | 558 // Participate in Global Value Numbering, i.e. elimination of |
| (...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3250 } | 3253 } |
| 3251 | 3254 |
| 3252 protected: | 3255 protected: |
| 3253 virtual void InternalSetOperandAt(int index, | 3256 virtual void InternalSetOperandAt(int index, |
| 3254 HValue* value) V8_FINAL V8_OVERRIDE { | 3257 HValue* value) V8_FINAL V8_OVERRIDE { |
| 3255 values_[index] = value; | 3258 values_[index] = value; |
| 3256 } | 3259 } |
| 3257 | 3260 |
| 3258 // List of values tracked by this marker. | 3261 // List of values tracked by this marker. |
| 3259 ZoneList<HValue*> values_; | 3262 ZoneList<HValue*> values_; |
| 3260 | |
| 3261 private: | |
| 3262 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } | |
| 3263 }; | 3263 }; |
| 3264 | 3264 |
| 3265 | 3265 |
| 3266 class HArgumentsObject V8_FINAL : public HDematerializedObject { | 3266 class HArgumentsObject V8_FINAL : public HDematerializedObject { |
| 3267 public: | 3267 public: |
| 3268 static HArgumentsObject* New(Zone* zone, HValue* context, int count) { | 3268 static HArgumentsObject* New(Zone* zone, HValue* context, int count) { |
| 3269 return new(zone) HArgumentsObject(count, zone); | 3269 return new(zone) HArgumentsObject(count, zone); |
| 3270 } | 3270 } |
| 3271 | 3271 |
| 3272 // The values contain a list of all elements in the arguments object | 3272 // The values contain a list of all elements in the arguments object |
| 3273 // including the receiver object, which is skipped when materializing. | 3273 // including the receiver object, which is skipped when materializing. |
| 3274 const ZoneList<HValue*>* arguments_values() const { return &values_; } | 3274 const ZoneList<HValue*>* arguments_values() const { return &values_; } |
| 3275 int arguments_count() const { return values_.length(); } | 3275 int arguments_count() const { return values_.length(); } |
| 3276 | 3276 |
| 3277 void AddArgument(HValue* argument, Zone* zone) { | 3277 void AddArgument(HValue* argument, Zone* zone) { |
| 3278 values_.Add(NULL, zone); // Resize list. | 3278 values_.Add(NULL, zone); // Resize list. |
| 3279 SetOperandAt(values_.length() - 1, argument); | 3279 SetOperandAt(values_.length() - 1, argument); |
| 3280 } | 3280 } |
| 3281 | 3281 |
| 3282 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3282 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
| 3283 | 3283 |
| 3284 private: | 3284 private: |
| 3285 HArgumentsObject(int count, Zone* zone) | 3285 HArgumentsObject(int count, Zone* zone) |
| 3286 : HDematerializedObject(count, zone) { | 3286 : HDematerializedObject(count, zone) { |
| 3287 set_representation(Representation::Tagged()); | 3287 set_representation(Representation::Tagged()); |
| 3288 SetFlag(kIsArguments); | 3288 SetFlag(kIsArguments); |
| 3289 } | 3289 } |
| 3290 |
| 3291 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return true; } |
| 3290 }; | 3292 }; |
| 3291 | 3293 |
| 3292 | 3294 |
| 3293 class HCapturedObject V8_FINAL : public HDematerializedObject { | 3295 class HCapturedObject V8_FINAL : public HDematerializedObject { |
| 3294 public: | 3296 public: |
| 3295 HCapturedObject(int length, int id, Zone* zone) | 3297 HCapturedObject(int length, int id, Zone* zone) |
| 3296 : HDematerializedObject(length, zone), capture_id_(id) { | 3298 : HDematerializedObject(length, zone), capture_id_(id) { |
| 3297 set_representation(Representation::Tagged()); | 3299 set_representation(Representation::Tagged()); |
| 3298 values_.AddBlock(NULL, length, zone); // Resize list. | 3300 values_.AddBlock(NULL, length, zone); // Resize list. |
| 3299 } | 3301 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3316 | 3318 |
| 3317 // Replay effects of this instruction on the given environment. | 3319 // Replay effects of this instruction on the given environment. |
| 3318 void ReplayEnvironment(HEnvironment* env); | 3320 void ReplayEnvironment(HEnvironment* env); |
| 3319 | 3321 |
| 3320 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3322 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 3321 | 3323 |
| 3322 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) | 3324 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
| 3323 | 3325 |
| 3324 private: | 3326 private: |
| 3325 int capture_id_; | 3327 int capture_id_; |
| 3328 |
| 3329 // Note that we cannot DCE captured objects as they are used to replay |
| 3330 // the environment. This method is here as an explicit reminder. |
| 3331 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? |
| 3332 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return false; } |
| 3326 }; | 3333 }; |
| 3327 | 3334 |
| 3328 | 3335 |
| 3329 class HConstant V8_FINAL : public HTemplateInstruction<0> { | 3336 class HConstant V8_FINAL : public HTemplateInstruction<0> { |
| 3330 public: | 3337 public: |
| 3331 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); | 3338 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
| 3332 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); | 3339 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); |
| 3333 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); | 3340 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
| 3334 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); | 3341 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
| 3335 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); | 3342 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 HCompareHoleAndBranch(HValue* value, | 4159 HCompareHoleAndBranch(HValue* value, |
| 4153 HBasicBlock* true_target = NULL, | 4160 HBasicBlock* true_target = NULL, |
| 4154 HBasicBlock* false_target = NULL) | 4161 HBasicBlock* false_target = NULL) |
| 4155 : HUnaryControlInstruction(value, true_target, false_target) { | 4162 : HUnaryControlInstruction(value, true_target, false_target) { |
| 4156 SetFlag(kFlexibleRepresentation); | 4163 SetFlag(kFlexibleRepresentation); |
| 4157 SetFlag(kAllowUndefinedAsNaN); | 4164 SetFlag(kAllowUndefinedAsNaN); |
| 4158 } | 4165 } |
| 4159 }; | 4166 }; |
| 4160 | 4167 |
| 4161 | 4168 |
| 4169 class HCompareMinusZeroAndBranch V8_FINAL : public HUnaryControlInstruction { |
| 4170 public: |
| 4171 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); |
| 4172 |
| 4173 virtual void InferRepresentation( |
| 4174 HInferRepresentationPhase* h_infer) V8_OVERRIDE; |
| 4175 |
| 4176 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 4177 return representation(); |
| 4178 } |
| 4179 |
| 4180 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4181 |
| 4182 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) |
| 4183 |
| 4184 private: |
| 4185 explicit HCompareMinusZeroAndBranch(HValue* value) |
| 4186 : HUnaryControlInstruction(value, NULL, NULL) { |
| 4187 } |
| 4188 }; |
| 4189 |
| 4190 |
| 4162 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 4191 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { |
| 4163 public: | 4192 public: |
| 4164 HCompareObjectEqAndBranch(HValue* left, | 4193 HCompareObjectEqAndBranch(HValue* left, |
| 4165 HValue* right, | 4194 HValue* right, |
| 4166 HBasicBlock* true_target = NULL, | 4195 HBasicBlock* true_target = NULL, |
| 4167 HBasicBlock* false_target = NULL) { | 4196 HBasicBlock* false_target = NULL) { |
| 4168 // TODO(danno): make this private when the IfBuilder properly constructs | 4197 // TODO(danno): make this private when the IfBuilder properly constructs |
| 4169 // control flow instructions. | 4198 // control flow instructions. |
| 4170 ASSERT(!left->IsConstant() || | 4199 ASSERT(!left->IsConstant() || |
| 4171 (!HConstant::cast(left)->HasInteger32Value() || | 4200 (!HConstant::cast(left)->HasInteger32Value() || |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5779 | 5808 |
| 5780 static HObjectAccess ForArrayLength(ElementsKind elements_kind) { | 5809 static HObjectAccess ForArrayLength(ElementsKind elements_kind) { |
| 5781 return HObjectAccess( | 5810 return HObjectAccess( |
| 5782 kArrayLengths, | 5811 kArrayLengths, |
| 5783 JSArray::kLengthOffset, | 5812 JSArray::kLengthOffset, |
| 5784 IsFastElementsKind(elements_kind) && | 5813 IsFastElementsKind(elements_kind) && |
| 5785 FLAG_track_fields | 5814 FLAG_track_fields |
| 5786 ? Representation::Smi() : Representation::Tagged()); | 5815 ? Representation::Smi() : Representation::Tagged()); |
| 5787 } | 5816 } |
| 5788 | 5817 |
| 5789 static HObjectAccess ForAllocationSiteTransitionInfo() { | 5818 static HObjectAccess ForAllocationSiteOffset(int offset) { |
| 5790 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); | 5819 ASSERT(offset >= HeapObject::kHeaderSize && offset < AllocationSite::kSize); |
| 5791 } | 5820 return HObjectAccess(kInobject, offset); |
| 5792 | |
| 5793 static HObjectAccess ForAllocationSiteNestedSite() { | |
| 5794 return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset); | |
| 5795 } | |
| 5796 | |
| 5797 static HObjectAccess ForAllocationSiteDependentCode() { | |
| 5798 return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset); | |
| 5799 } | |
| 5800 | |
| 5801 static HObjectAccess ForAllocationSiteWeakNext() { | |
| 5802 return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset); | |
| 5803 } | 5821 } |
| 5804 | 5822 |
| 5805 static HObjectAccess ForAllocationSiteList() { | 5823 static HObjectAccess ForAllocationSiteList() { |
| 5806 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); | 5824 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); |
| 5807 } | 5825 } |
| 5808 | 5826 |
| 5809 static HObjectAccess ForFixedArrayLength() { | 5827 static HObjectAccess ForFixedArrayLength() { |
| 5810 return HObjectAccess( | 5828 return HObjectAccess( |
| 5811 kArrayLengths, | 5829 kArrayLengths, |
| 5812 FixedArray::kLengthOffset, | 5830 FixedArray::kLengthOffset, |
| 5813 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); | 5831 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); |
| 5814 } | 5832 } |
| 5815 | 5833 |
| 5834 static HObjectAccess ForStringHashField() { |
| 5835 return HObjectAccess(kInobject, |
| 5836 String::kHashFieldOffset, |
| 5837 Representation::Integer32()); |
| 5838 } |
| 5839 |
| 5816 static HObjectAccess ForStringLength() { | 5840 static HObjectAccess ForStringLength() { |
| 5817 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 5841 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
| 5818 return HObjectAccess( | 5842 return HObjectAccess( |
| 5819 kStringLengths, | 5843 kStringLengths, |
| 5820 String::kLengthOffset, | 5844 String::kLengthOffset, |
| 5821 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); | 5845 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); |
| 5822 } | 5846 } |
| 5823 | 5847 |
| 5848 static HObjectAccess ForConsStringFirst() { |
| 5849 return HObjectAccess(kInobject, ConsString::kFirstOffset); |
| 5850 } |
| 5851 |
| 5852 static HObjectAccess ForConsStringSecond() { |
| 5853 return HObjectAccess(kInobject, ConsString::kSecondOffset); |
| 5854 } |
| 5855 |
| 5824 static HObjectAccess ForPropertiesPointer() { | 5856 static HObjectAccess ForPropertiesPointer() { |
| 5825 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); | 5857 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); |
| 5826 } | 5858 } |
| 5827 | 5859 |
| 5828 static HObjectAccess ForPrototypeOrInitialMap() { | 5860 static HObjectAccess ForPrototypeOrInitialMap() { |
| 5829 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); | 5861 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); |
| 5830 } | 5862 } |
| 5831 | 5863 |
| 5832 static HObjectAccess ForSharedFunctionInfoPointer() { | 5864 static HObjectAccess ForSharedFunctionInfoPointer() { |
| 5833 return HObjectAccess(kInobject, JSFunction::kSharedFunctionInfoOffset); | 5865 return HObjectAccess(kInobject, JSFunction::kSharedFunctionInfoOffset); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5858 return HObjectAccess(kInobject, JSFunction::kContextOffset); | 5890 return HObjectAccess(kInobject, JSFunction::kContextOffset); |
| 5859 } | 5891 } |
| 5860 | 5892 |
| 5861 static HObjectAccess ForMap() { | 5893 static HObjectAccess ForMap() { |
| 5862 return HObjectAccess(kMaps, JSObject::kMapOffset); | 5894 return HObjectAccess(kMaps, JSObject::kMapOffset); |
| 5863 } | 5895 } |
| 5864 | 5896 |
| 5865 static HObjectAccess ForMapInstanceSize() { | 5897 static HObjectAccess ForMapInstanceSize() { |
| 5866 return HObjectAccess(kInobject, | 5898 return HObjectAccess(kInobject, |
| 5867 Map::kInstanceSizeOffset, | 5899 Map::kInstanceSizeOffset, |
| 5868 Representation::Byte()); | 5900 Representation::UInteger8()); |
| 5901 } |
| 5902 |
| 5903 static HObjectAccess ForMapInstanceType() { |
| 5904 return HObjectAccess(kInobject, |
| 5905 Map::kInstanceTypeOffset, |
| 5906 Representation::UInteger8()); |
| 5869 } | 5907 } |
| 5870 | 5908 |
| 5871 static HObjectAccess ForPropertyCellValue() { | 5909 static HObjectAccess ForPropertyCellValue() { |
| 5872 return HObjectAccess(kInobject, PropertyCell::kValueOffset); | 5910 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
| 5873 } | 5911 } |
| 5874 | 5912 |
| 5875 static HObjectAccess ForCellValue() { | 5913 static HObjectAccess ForCellValue() { |
| 5876 return HObjectAccess(kInobject, Cell::kValueOffset); | 5914 return HObjectAccess(kInobject, Cell::kValueOffset); |
| 5877 } | 5915 } |
| 5878 | 5916 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5936 RepresentationField::encode(representation.kind()) | | 5974 RepresentationField::encode(representation.kind()) | |
| 5937 OffsetField::encode(offset)), | 5975 OffsetField::encode(offset)), |
| 5938 name_(name) { | 5976 name_(name) { |
| 5939 // assert that the fields decode correctly | 5977 // assert that the fields decode correctly |
| 5940 ASSERT(this->offset() == offset); | 5978 ASSERT(this->offset() == offset); |
| 5941 ASSERT(this->portion() == portion); | 5979 ASSERT(this->portion() == portion); |
| 5942 ASSERT(RepresentationField::decode(value_) == representation.kind()); | 5980 ASSERT(RepresentationField::decode(value_) == representation.kind()); |
| 5943 } | 5981 } |
| 5944 | 5982 |
| 5945 class PortionField : public BitField<Portion, 0, 3> {}; | 5983 class PortionField : public BitField<Portion, 0, 3> {}; |
| 5946 class RepresentationField : public BitField<Representation::Kind, 3, 3> {}; | 5984 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
| 5947 class OffsetField : public BitField<int, 6, 26> {}; | 5985 class OffsetField : public BitField<int, 7, 25> {}; |
| 5948 | 5986 |
| 5949 uint32_t value_; // encodes portion, representation, and offset | 5987 uint32_t value_; // encodes portion, representation, and offset |
| 5950 Handle<String> name_; | 5988 Handle<String> name_; |
| 5951 | 5989 |
| 5952 friend class HLoadNamedField; | 5990 friend class HLoadNamedField; |
| 5953 friend class HStoreNamedField; | 5991 friend class HStoreNamedField; |
| 5954 | 5992 |
| 5955 inline Portion portion() const { | 5993 inline Portion portion() const { |
| 5956 return PortionField::decode(value_); | 5994 return PortionField::decode(value_); |
| 5957 } | 5995 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5990 HLoadNamedField* b = HLoadNamedField::cast(other); | 6028 HLoadNamedField* b = HLoadNamedField::cast(other); |
| 5991 return access_.Equals(b->access_); | 6029 return access_.Equals(b->access_); |
| 5992 } | 6030 } |
| 5993 | 6031 |
| 5994 private: | 6032 private: |
| 5995 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { | 6033 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { |
| 5996 ASSERT(object != NULL); | 6034 ASSERT(object != NULL); |
| 5997 SetOperandAt(0, object); | 6035 SetOperandAt(0, object); |
| 5998 | 6036 |
| 5999 Representation representation = access.representation(); | 6037 Representation representation = access.representation(); |
| 6000 if (representation.IsByte()) { | 6038 if (representation.IsInteger8() || |
| 6039 representation.IsUInteger8() || |
| 6040 representation.IsInteger16() || |
| 6041 representation.IsUInteger16()) { |
| 6001 set_representation(Representation::Integer32()); | 6042 set_representation(Representation::Integer32()); |
| 6002 } else if (representation.IsSmi()) { | 6043 } else if (representation.IsSmi()) { |
| 6003 set_type(HType::Smi()); | 6044 set_type(HType::Smi()); |
| 6004 set_representation(representation); | 6045 set_representation(representation); |
| 6005 } else if (representation.IsDouble() || | 6046 } else if (representation.IsDouble() || |
| 6006 representation.IsExternal() || | 6047 representation.IsExternal() || |
| 6007 representation.IsInteger32()) { | 6048 representation.IsInteger32()) { |
| 6008 set_representation(representation); | 6049 set_representation(representation); |
| 6009 } else if (FLAG_track_heap_object_fields && | 6050 } else if (FLAG_track_heap_object_fields && |
| 6010 representation.IsHeapObject()) { | 6051 representation.IsHeapObject()) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6300 return index == 1; | 6341 return index == 1; |
| 6301 } | 6342 } |
| 6302 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { | 6343 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
| 6303 return !access().IsInobject() || access().offset() >= size; | 6344 return !access().IsInobject() || access().offset() >= size; |
| 6304 } | 6345 } |
| 6305 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6346 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6306 if (index == 0 && access().IsExternalMemory()) { | 6347 if (index == 0 && access().IsExternalMemory()) { |
| 6307 // object must be external in case of external memory access | 6348 // object must be external in case of external memory access |
| 6308 return Representation::External(); | 6349 return Representation::External(); |
| 6309 } else if (index == 1) { | 6350 } else if (index == 1) { |
| 6310 if (field_representation().IsByte() || | 6351 if (field_representation().IsInteger8() || |
| 6352 field_representation().IsUInteger8() || |
| 6353 field_representation().IsInteger16() || |
| 6354 field_representation().IsUInteger16() || |
| 6311 field_representation().IsInteger32()) { | 6355 field_representation().IsInteger32()) { |
| 6312 return Representation::Integer32(); | 6356 return Representation::Integer32(); |
| 6313 } else if (field_representation().IsDouble() || | 6357 } else if (field_representation().IsDouble() || |
| 6314 field_representation().IsSmi()) { | 6358 field_representation().IsSmi()) { |
| 6315 return field_representation(); | 6359 return field_representation(); |
| 6316 } | 6360 } |
| 6317 } | 6361 } |
| 6318 return Representation::Tagged(); | 6362 return Representation::Tagged(); |
| 6319 } | 6363 } |
| 6320 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6364 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6754 } | 6798 } |
| 6755 | 6799 |
| 6756 private: | 6800 private: |
| 6757 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 6801 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| 6758 SetOperandAt(0, context); | 6802 SetOperandAt(0, context); |
| 6759 SetOperandAt(1, string); | 6803 SetOperandAt(1, string); |
| 6760 SetOperandAt(2, index); | 6804 SetOperandAt(2, index); |
| 6761 set_representation(Representation::Integer32()); | 6805 set_representation(Representation::Integer32()); |
| 6762 SetFlag(kUseGVN); | 6806 SetFlag(kUseGVN); |
| 6763 SetGVNFlag(kDependsOnMaps); | 6807 SetGVNFlag(kDependsOnMaps); |
| 6808 SetGVNFlag(kDependsOnStringChars); |
| 6764 SetGVNFlag(kChangesNewSpacePromotion); | 6809 SetGVNFlag(kChangesNewSpacePromotion); |
| 6765 } | 6810 } |
| 6766 | 6811 |
| 6767 // No side effects: runtime function assumes string + number inputs. | 6812 // No side effects: runtime function assumes string + number inputs. |
| 6768 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6813 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 6769 }; | 6814 }; |
| 6770 | 6815 |
| 6771 | 6816 |
| 6772 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { | 6817 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { |
| 6773 public: | 6818 public: |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7025 private: | 7070 private: |
| 7026 HDateField(HValue* date, Smi* index) | 7071 HDateField(HValue* date, Smi* index) |
| 7027 : HUnaryOperation(date), index_(index) { | 7072 : HUnaryOperation(date), index_(index) { |
| 7028 set_representation(Representation::Tagged()); | 7073 set_representation(Representation::Tagged()); |
| 7029 } | 7074 } |
| 7030 | 7075 |
| 7031 Smi* index_; | 7076 Smi* index_; |
| 7032 }; | 7077 }; |
| 7033 | 7078 |
| 7034 | 7079 |
| 7080 class HSeqStringGetChar V8_FINAL : public HTemplateInstruction<2> { |
| 7081 public: |
| 7082 static HInstruction* New(Zone* zone, |
| 7083 HValue* context, |
| 7084 String::Encoding encoding, |
| 7085 HValue* string, |
| 7086 HValue* index); |
| 7087 |
| 7088 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 7089 return (index == 0) ? Representation::Tagged() |
| 7090 : Representation::Integer32(); |
| 7091 } |
| 7092 |
| 7093 String::Encoding encoding() const { return encoding_; } |
| 7094 HValue* string() const { return OperandAt(0); } |
| 7095 HValue* index() const { return OperandAt(1); } |
| 7096 |
| 7097 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar) |
| 7098 |
| 7099 protected: |
| 7100 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 7101 return encoding() == HSeqStringGetChar::cast(other)->encoding(); |
| 7102 } |
| 7103 |
| 7104 virtual Range* InferRange(Zone* zone) V8_OVERRIDE { |
| 7105 if (encoding() == String::ONE_BYTE_ENCODING) { |
| 7106 return new(zone) Range(0, String::kMaxOneByteCharCode); |
| 7107 } else { |
| 7108 ASSERT_EQ(String::TWO_BYTE_ENCODING, encoding()); |
| 7109 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
| 7110 } |
| 7111 } |
| 7112 |
| 7113 private: |
| 7114 HSeqStringGetChar(String::Encoding encoding, |
| 7115 HValue* string, |
| 7116 HValue* index) : encoding_(encoding) { |
| 7117 SetOperandAt(0, string); |
| 7118 SetOperandAt(1, index); |
| 7119 set_representation(Representation::Integer32()); |
| 7120 SetFlag(kUseGVN); |
| 7121 SetGVNFlag(kDependsOnStringChars); |
| 7122 } |
| 7123 |
| 7124 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7125 |
| 7126 String::Encoding encoding_; |
| 7127 }; |
| 7128 |
| 7129 |
| 7035 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { | 7130 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { |
| 7036 public: | 7131 public: |
| 7037 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding, | 7132 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding, |
| 7038 HValue*, HValue*, HValue*); | 7133 HValue*, HValue*, HValue*); |
| 7039 | 7134 |
| 7040 String::Encoding encoding() { return encoding_; } | 7135 String::Encoding encoding() { return encoding_; } |
| 7041 HValue* string() { return OperandAt(0); } | 7136 HValue* string() { return OperandAt(0); } |
| 7042 HValue* index() { return OperandAt(1); } | 7137 HValue* index() { return OperandAt(1); } |
| 7043 HValue* value() { return OperandAt(2); } | 7138 HValue* value() { return OperandAt(2); } |
| 7044 | 7139 |
| 7045 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 7140 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 7046 return (index == 0) ? Representation::Tagged() | 7141 return (index == 0) ? Representation::Tagged() |
| 7047 : Representation::Integer32(); | 7142 : Representation::Integer32(); |
| 7048 } | 7143 } |
| 7049 | 7144 |
| 7050 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) | 7145 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) |
| 7051 | 7146 |
| 7052 private: | 7147 private: |
| 7053 HSeqStringSetChar(String::Encoding encoding, | 7148 HSeqStringSetChar(String::Encoding encoding, |
| 7054 HValue* string, | 7149 HValue* string, |
| 7055 HValue* index, | 7150 HValue* index, |
| 7056 HValue* value) : encoding_(encoding) { | 7151 HValue* value) : encoding_(encoding) { |
| 7057 SetOperandAt(0, string); | 7152 SetOperandAt(0, string); |
| 7058 SetOperandAt(1, index); | 7153 SetOperandAt(1, index); |
| 7059 SetOperandAt(2, value); | 7154 SetOperandAt(2, value); |
| 7060 set_representation(Representation::Tagged()); | 7155 set_representation(Representation::Tagged()); |
| 7156 SetGVNFlag(kChangesStringChars); |
| 7061 } | 7157 } |
| 7062 | 7158 |
| 7063 String::Encoding encoding_; | 7159 String::Encoding encoding_; |
| 7064 }; | 7160 }; |
| 7065 | 7161 |
| 7066 | 7162 |
| 7067 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { | 7163 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { |
| 7068 public: | 7164 public: |
| 7069 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); | 7165 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); |
| 7070 | 7166 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7201 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7297 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7202 }; | 7298 }; |
| 7203 | 7299 |
| 7204 | 7300 |
| 7205 #undef DECLARE_INSTRUCTION | 7301 #undef DECLARE_INSTRUCTION |
| 7206 #undef DECLARE_CONCRETE_INSTRUCTION | 7302 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7207 | 7303 |
| 7208 } } // namespace v8::internal | 7304 } } // namespace v8::internal |
| 7209 | 7305 |
| 7210 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7306 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |