| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 V(InstanceOfKnownGlobal) \ | 124 V(InstanceOfKnownGlobal) \ |
| 125 V(InstanceSize) \ | 125 V(InstanceSize) \ |
| 126 V(InvokeFunction) \ | 126 V(InvokeFunction) \ |
| 127 V(IsConstructCallAndBranch) \ | 127 V(IsConstructCallAndBranch) \ |
| 128 V(IsObjectAndBranch) \ | 128 V(IsObjectAndBranch) \ |
| 129 V(IsNumberAndBranch) \ | 129 V(IsNumberAndBranch) \ |
| 130 V(IsStringAndBranch) \ | 130 V(IsStringAndBranch) \ |
| 131 V(IsSmiAndBranch) \ | 131 V(IsSmiAndBranch) \ |
| 132 V(IsUndetectableAndBranch) \ | 132 V(IsUndetectableAndBranch) \ |
| 133 V(LeaveInlined) \ | 133 V(LeaveInlined) \ |
| 134 V(LinkObjectInList) \ |
| 134 V(LoadContextSlot) \ | 135 V(LoadContextSlot) \ |
| 135 V(LoadExternalArrayPointer) \ | 136 V(LoadExternalArrayPointer) \ |
| 136 V(LoadFunctionPrototype) \ | 137 V(LoadFunctionPrototype) \ |
| 137 V(LoadGlobalCell) \ | 138 V(LoadGlobalCell) \ |
| 138 V(LoadGlobalGeneric) \ | 139 V(LoadGlobalGeneric) \ |
| 139 V(LoadKeyed) \ | 140 V(LoadKeyed) \ |
| 140 V(LoadKeyedGeneric) \ | 141 V(LoadKeyedGeneric) \ |
| 141 V(LoadNamedField) \ | 142 V(LoadNamedField) \ |
| 142 V(LoadNamedFieldPolymorphic) \ | 143 V(LoadNamedFieldPolymorphic) \ |
| 143 V(LoadNamedGeneric) \ | 144 V(LoadNamedGeneric) \ |
| (...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2830 SetFlag(kUseGVN); | 2831 SetFlag(kUseGVN); |
| 2831 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); | 2832 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); |
| 2832 } | 2833 } |
| 2833 | 2834 |
| 2834 virtual Representation RequiredInputRepresentation(int index) { | 2835 virtual Representation RequiredInputRepresentation(int index) { |
| 2835 return Representation::Tagged(); | 2836 return Representation::Tagged(); |
| 2836 } | 2837 } |
| 2837 virtual void PrintDataTo(StringStream* stream); | 2838 virtual void PrintDataTo(StringStream* stream); |
| 2838 virtual HType CalculateInferredType(); | 2839 virtual HType CalculateInferredType(); |
| 2839 | 2840 |
| 2841 virtual HValue* Canonicalize(); |
| 2842 |
| 2840 #ifdef DEBUG | 2843 #ifdef DEBUG |
| 2841 virtual void Verify(); | 2844 virtual void Verify(); |
| 2842 #endif | 2845 #endif |
| 2843 | 2846 |
| 2844 virtual void FinalizeUniqueValueId() { | 2847 virtual void FinalizeUniqueValueId() { |
| 2845 target_unique_id_ = UniqueValueId(target_); | 2848 target_unique_id_ = UniqueValueId(target_); |
| 2846 } | 2849 } |
| 2847 | 2850 |
| 2848 Handle<JSFunction> target() const { return target_; } | 2851 Handle<JSFunction> target() const { return target_; } |
| 2849 bool target_in_new_space() const { return target_in_new_space_; } | 2852 bool target_in_new_space() const { return target_in_new_space_; } |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3403 } | 3406 } |
| 3404 } | 3407 } |
| 3405 | 3408 |
| 3406 virtual void FinalizeUniqueValueId() { | 3409 virtual void FinalizeUniqueValueId() { |
| 3407 if (!has_double_value_) { | 3410 if (!has_double_value_) { |
| 3408 ASSERT(!handle_.is_null()); | 3411 ASSERT(!handle_.is_null()); |
| 3409 unique_id_ = UniqueValueId(handle_); | 3412 unique_id_ = UniqueValueId(handle_); |
| 3410 } | 3413 } |
| 3411 } | 3414 } |
| 3412 | 3415 |
| 3416 bool UniqueValueIdsMatch(UniqueValueId other) { |
| 3417 return !has_double_value_ && unique_id_ == other; |
| 3418 } |
| 3419 |
| 3413 #ifdef DEBUG | 3420 #ifdef DEBUG |
| 3414 virtual void Verify() { } | 3421 virtual void Verify() { } |
| 3415 #endif | 3422 #endif |
| 3416 | 3423 |
| 3417 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3424 DECLARE_CONCRETE_INSTRUCTION(Constant) |
| 3418 | 3425 |
| 3419 protected: | 3426 protected: |
| 3420 virtual Range* InferRange(Zone* zone); | 3427 virtual Range* InferRange(Zone* zone); |
| 3421 | 3428 |
| 3422 virtual bool DataEquals(HValue* other) { | 3429 virtual bool DataEquals(HValue* other) { |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4950 bool for_typeof_; | 4957 bool for_typeof_; |
| 4951 }; | 4958 }; |
| 4952 | 4959 |
| 4953 | 4960 |
| 4954 class HAllocate: public HTemplateInstruction<2> { | 4961 class HAllocate: public HTemplateInstruction<2> { |
| 4955 public: | 4962 public: |
| 4956 enum Flags { | 4963 enum Flags { |
| 4957 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, | 4964 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, |
| 4958 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 4965 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
| 4959 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 4966 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
| 4960 ALLOCATE_DOUBLE_ALIGNED = 1 << 3 | 4967 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
| 4968 PREFILL_WITH_FILLER = 1 << 4 |
| 4961 }; | 4969 }; |
| 4962 | 4970 |
| 4963 HAllocate(HValue* context, HValue* size, HType type, Flags flags) | 4971 HAllocate(HValue* context, HValue* size, HType type, Flags flags) |
| 4964 : type_(type), | 4972 : type_(type), |
| 4965 flags_(flags) { | 4973 flags_(flags) { |
| 4966 SetOperandAt(0, context); | 4974 SetOperandAt(0, context); |
| 4967 SetOperandAt(1, size); | 4975 SetOperandAt(1, size); |
| 4968 set_representation(Representation::Tagged()); | 4976 set_representation(Representation::Tagged()); |
| 4969 SetFlag(kTrackSideEffectDominators); | 4977 SetFlag(kTrackSideEffectDominators); |
| 4970 SetGVNFlag(kChangesNewSpacePromotion); | 4978 SetGVNFlag(kChangesNewSpacePromotion); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5027 } | 5035 } |
| 5028 | 5036 |
| 5029 bool GuaranteedInNewSpace() const { | 5037 bool GuaranteedInNewSpace() const { |
| 5030 return CanAllocateInNewSpace() && !CanAllocateInOldSpace(); | 5038 return CanAllocateInNewSpace() && !CanAllocateInOldSpace(); |
| 5031 } | 5039 } |
| 5032 | 5040 |
| 5033 bool MustAllocateDoubleAligned() const { | 5041 bool MustAllocateDoubleAligned() const { |
| 5034 return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0; | 5042 return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0; |
| 5035 } | 5043 } |
| 5036 | 5044 |
| 5045 bool MustPrefillWithFiller() const { |
| 5046 return (flags_ & PREFILL_WITH_FILLER) != 0; |
| 5047 } |
| 5048 |
| 5049 void SetFlags(Flags flags) { |
| 5050 flags_ = static_cast<HAllocate::Flags>(flags_ | flags); |
| 5051 } |
| 5052 |
| 5037 void UpdateSize(HValue* size) { | 5053 void UpdateSize(HValue* size) { |
| 5038 SetOperandAt(1, size); | 5054 SetOperandAt(1, size); |
| 5039 } | 5055 } |
| 5040 | 5056 |
| 5041 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5057 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| 5042 HValue* dominator); | 5058 HValue* dominator); |
| 5043 | 5059 |
| 5044 virtual void PrintDataTo(StringStream* stream); | 5060 virtual void PrintDataTo(StringStream* stream); |
| 5045 | 5061 |
| 5046 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5062 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5319 } | 5335 } |
| 5320 | 5336 |
| 5321 static HObjectAccess ForArrayLength() { | 5337 static HObjectAccess ForArrayLength() { |
| 5322 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); | 5338 return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); |
| 5323 } | 5339 } |
| 5324 | 5340 |
| 5325 static HObjectAccess ForAllocationSiteTransitionInfo() { | 5341 static HObjectAccess ForAllocationSiteTransitionInfo() { |
| 5326 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); | 5342 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); |
| 5327 } | 5343 } |
| 5328 | 5344 |
| 5345 static HObjectAccess ForAllocationSiteWeakNext() { |
| 5346 return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset); |
| 5347 } |
| 5348 |
| 5329 static HObjectAccess ForFixedArrayLength() { | 5349 static HObjectAccess ForFixedArrayLength() { |
| 5330 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); | 5350 return HObjectAccess(kArrayLengths, FixedArray::kLengthOffset); |
| 5331 } | 5351 } |
| 5332 | 5352 |
| 5333 static HObjectAccess ForPropertiesPointer() { | 5353 static HObjectAccess ForPropertiesPointer() { |
| 5334 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); | 5354 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); |
| 5335 } | 5355 } |
| 5336 | 5356 |
| 5337 static HObjectAccess ForPrototypeOrInitialMap() { | 5357 static HObjectAccess ForPrototypeOrInitialMap() { |
| 5338 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); | 5358 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); |
| 5339 } | 5359 } |
| 5340 | 5360 |
| 5341 static HObjectAccess ForMap() { | 5361 static HObjectAccess ForMap() { |
| 5342 return HObjectAccess(kMaps, JSObject::kMapOffset); | 5362 return HObjectAccess(kMaps, JSObject::kMapOffset); |
| 5343 } | 5363 } |
| 5344 | 5364 |
| 5345 static HObjectAccess ForPropertyCellValue() { | 5365 static HObjectAccess ForPropertyCellValue() { |
| 5346 return HObjectAccess(kInobject, PropertyCell::kValueOffset); | 5366 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
| 5347 } | 5367 } |
| 5348 | 5368 |
| 5349 static HObjectAccess ForCellValue() { | 5369 static HObjectAccess ForCellValue() { |
| 5350 return HObjectAccess(kInobject, Cell::kValueOffset); | 5370 return HObjectAccess(kInobject, Cell::kValueOffset); |
| 5351 } | 5371 } |
| 5352 | 5372 |
| 5353 static HObjectAccess ForAllocationSiteInfoSite() { | 5373 static HObjectAccess ForAllocationMementoSite() { |
| 5354 return HObjectAccess(kInobject, AllocationSiteInfo::kAllocationSiteOffset); | 5374 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
| 5355 } | 5375 } |
| 5356 | 5376 |
| 5357 // Create an access to an offset in a fixed array header. | 5377 // Create an access to an offset in a fixed array header. |
| 5358 static HObjectAccess ForFixedArrayHeader(int offset); | 5378 static HObjectAccess ForFixedArrayHeader(int offset); |
| 5359 | 5379 |
| 5360 // Create an access to an in-object property in a JSObject. | 5380 // Create an access to an in-object property in a JSObject. |
| 5361 static HObjectAccess ForJSObjectOffset(int offset); | 5381 static HObjectAccess ForJSObjectOffset(int offset); |
| 5362 | 5382 |
| 5363 // Create an access to an in-object property in a JSArray. | 5383 // Create an access to an in-object property in a JSArray. |
| 5364 static HObjectAccess ForJSArrayOffset(int offset); | 5384 static HObjectAccess ForJSArrayOffset(int offset); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5409 | 5429 |
| 5410 friend class HLoadNamedField; | 5430 friend class HLoadNamedField; |
| 5411 friend class HStoreNamedField; | 5431 friend class HStoreNamedField; |
| 5412 | 5432 |
| 5413 inline Portion portion() const { | 5433 inline Portion portion() const { |
| 5414 return PortionField::decode(value_); | 5434 return PortionField::decode(value_); |
| 5415 } | 5435 } |
| 5416 }; | 5436 }; |
| 5417 | 5437 |
| 5418 | 5438 |
| 5439 class HLinkObjectInList: public HUnaryOperation { |
| 5440 public: |
| 5441 // There needs to be a mapping from every KnownList to an external reference |
| 5442 enum KnownList { |
| 5443 ALLOCATION_SITE_LIST |
| 5444 }; |
| 5445 |
| 5446 HLinkObjectInList(HValue* object, HObjectAccess store_field, |
| 5447 KnownList known_list) |
| 5448 : HUnaryOperation(object), |
| 5449 store_field_(store_field), |
| 5450 known_list_(known_list) { |
| 5451 set_representation(Representation::Tagged()); |
| 5452 } |
| 5453 |
| 5454 HObjectAccess store_field() const { return store_field_; } |
| 5455 KnownList known_list() const { return known_list_; } |
| 5456 |
| 5457 virtual Representation RequiredInputRepresentation(int index) { |
| 5458 return Representation::Tagged(); |
| 5459 } |
| 5460 |
| 5461 virtual void PrintDataTo(StringStream* stream); |
| 5462 |
| 5463 DECLARE_CONCRETE_INSTRUCTION(LinkObjectInList) |
| 5464 |
| 5465 private: |
| 5466 HObjectAccess store_field_; |
| 5467 KnownList known_list_; |
| 5468 }; |
| 5469 |
| 5470 |
| 5419 class HLoadNamedField: public HTemplateInstruction<2> { | 5471 class HLoadNamedField: public HTemplateInstruction<2> { |
| 5420 public: | 5472 public: |
| 5421 HLoadNamedField(HValue* object, | 5473 HLoadNamedField(HValue* object, |
| 5422 HObjectAccess access, | 5474 HObjectAccess access, |
| 5423 HValue* typecheck = NULL, | 5475 HValue* typecheck = NULL, |
| 5424 Representation field_representation | 5476 Representation field_representation |
| 5425 = Representation::Tagged()) | 5477 = Representation::Tagged()) |
| 5426 : access_(access), | 5478 : access_(access), |
| 5427 field_representation_(field_representation) { | 5479 field_representation_(field_representation) { |
| 5428 ASSERT(object != NULL); | 5480 ASSERT(object != NULL); |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6131 ElementsKind from_kind_; | 6183 ElementsKind from_kind_; |
| 6132 ElementsKind to_kind_; | 6184 ElementsKind to_kind_; |
| 6133 }; | 6185 }; |
| 6134 | 6186 |
| 6135 | 6187 |
| 6136 class HStringAdd: public HBinaryOperation { | 6188 class HStringAdd: public HBinaryOperation { |
| 6137 public: | 6189 public: |
| 6138 static HInstruction* New(Zone* zone, | 6190 static HInstruction* New(Zone* zone, |
| 6139 HValue* context, | 6191 HValue* context, |
| 6140 HValue* left, | 6192 HValue* left, |
| 6141 HValue* right); | 6193 HValue* right, |
| 6194 StringAddFlags flags = STRING_ADD_CHECK_NONE); |
| 6195 |
| 6196 StringAddFlags flags() const { return flags_; } |
| 6142 | 6197 |
| 6143 virtual Representation RequiredInputRepresentation(int index) { | 6198 virtual Representation RequiredInputRepresentation(int index) { |
| 6144 return Representation::Tagged(); | 6199 return Representation::Tagged(); |
| 6145 } | 6200 } |
| 6146 | 6201 |
| 6147 virtual HType CalculateInferredType() { | 6202 virtual HType CalculateInferredType() { |
| 6148 return HType::String(); | 6203 return HType::String(); |
| 6149 } | 6204 } |
| 6150 | 6205 |
| 6151 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 6206 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
| 6152 | 6207 |
| 6153 protected: | 6208 protected: |
| 6154 virtual bool DataEquals(HValue* other) { return true; } | 6209 virtual bool DataEquals(HValue* other) { return true; } |
| 6155 | 6210 |
| 6156 | |
| 6157 private: | 6211 private: |
| 6158 HStringAdd(HValue* context, HValue* left, HValue* right) | 6212 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) |
| 6159 : HBinaryOperation(context, left, right) { | 6213 : HBinaryOperation(context, left, right), flags_(flags) { |
| 6160 set_representation(Representation::Tagged()); | 6214 set_representation(Representation::Tagged()); |
| 6161 SetFlag(kUseGVN); | 6215 SetFlag(kUseGVN); |
| 6162 SetGVNFlag(kDependsOnMaps); | 6216 SetGVNFlag(kDependsOnMaps); |
| 6163 SetGVNFlag(kChangesNewSpacePromotion); | 6217 SetGVNFlag(kChangesNewSpacePromotion); |
| 6164 } | 6218 } |
| 6165 | 6219 |
| 6166 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. | 6220 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. |
| 6167 // virtual bool IsDeletable() const { return true; } | 6221 // virtual bool IsDeletable() const { return true; } |
| 6222 |
| 6223 const StringAddFlags flags_; |
| 6168 }; | 6224 }; |
| 6169 | 6225 |
| 6170 | 6226 |
| 6171 class HStringCharCodeAt: public HTemplateInstruction<3> { | 6227 class HStringCharCodeAt: public HTemplateInstruction<3> { |
| 6172 public: | 6228 public: |
| 6173 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 6229 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| 6174 SetOperandAt(0, context); | 6230 SetOperandAt(0, context); |
| 6175 SetOperandAt(1, string); | 6231 SetOperandAt(1, string); |
| 6176 SetOperandAt(2, index); | 6232 SetOperandAt(2, index); |
| 6177 set_representation(Representation::Integer32()); | 6233 set_representation(Representation::Integer32()); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6638 virtual bool IsDeletable() const { return true; } | 6694 virtual bool IsDeletable() const { return true; } |
| 6639 }; | 6695 }; |
| 6640 | 6696 |
| 6641 | 6697 |
| 6642 #undef DECLARE_INSTRUCTION | 6698 #undef DECLARE_INSTRUCTION |
| 6643 #undef DECLARE_CONCRETE_INSTRUCTION | 6699 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6644 | 6700 |
| 6645 } } // namespace v8::internal | 6701 } } // namespace v8::internal |
| 6646 | 6702 |
| 6647 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6703 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |