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 5842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5853 return HObjectAccess(kInobject, JSFunction::kContextOffset); | 5853 return HObjectAccess(kInobject, JSFunction::kContextOffset); |
5854 } | 5854 } |
5855 | 5855 |
5856 static HObjectAccess ForMap() { | 5856 static HObjectAccess ForMap() { |
5857 return HObjectAccess(kMaps, JSObject::kMapOffset); | 5857 return HObjectAccess(kMaps, JSObject::kMapOffset); |
5858 } | 5858 } |
5859 | 5859 |
5860 static HObjectAccess ForMapInstanceSize() { | 5860 static HObjectAccess ForMapInstanceSize() { |
5861 return HObjectAccess(kInobject, | 5861 return HObjectAccess(kInobject, |
5862 Map::kInstanceSizeOffset, | 5862 Map::kInstanceSizeOffset, |
5863 Representation::Byte()); | 5863 Representation::UInteger8()); |
5864 } | 5864 } |
5865 | 5865 |
5866 static HObjectAccess ForPropertyCellValue() { | 5866 static HObjectAccess ForPropertyCellValue() { |
5867 return HObjectAccess(kInobject, PropertyCell::kValueOffset); | 5867 return HObjectAccess(kInobject, PropertyCell::kValueOffset); |
5868 } | 5868 } |
5869 | 5869 |
5870 static HObjectAccess ForCellValue() { | 5870 static HObjectAccess ForCellValue() { |
5871 return HObjectAccess(kInobject, Cell::kValueOffset); | 5871 return HObjectAccess(kInobject, Cell::kValueOffset); |
5872 } | 5872 } |
5873 | 5873 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5931 RepresentationField::encode(representation.kind()) | | 5931 RepresentationField::encode(representation.kind()) | |
5932 OffsetField::encode(offset)), | 5932 OffsetField::encode(offset)), |
5933 name_(name) { | 5933 name_(name) { |
5934 // assert that the fields decode correctly | 5934 // assert that the fields decode correctly |
5935 ASSERT(this->offset() == offset); | 5935 ASSERT(this->offset() == offset); |
5936 ASSERT(this->portion() == portion); | 5936 ASSERT(this->portion() == portion); |
5937 ASSERT(RepresentationField::decode(value_) == representation.kind()); | 5937 ASSERT(RepresentationField::decode(value_) == representation.kind()); |
5938 } | 5938 } |
5939 | 5939 |
5940 class PortionField : public BitField<Portion, 0, 3> {}; | 5940 class PortionField : public BitField<Portion, 0, 3> {}; |
5941 class RepresentationField : public BitField<Representation::Kind, 3, 3> {}; | 5941 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
5942 class OffsetField : public BitField<int, 6, 26> {}; | 5942 class OffsetField : public BitField<int, 7, 25> {}; |
5943 | 5943 |
5944 uint32_t value_; // encodes portion, representation, and offset | 5944 uint32_t value_; // encodes portion, representation, and offset |
5945 Handle<String> name_; | 5945 Handle<String> name_; |
5946 | 5946 |
5947 friend class HLoadNamedField; | 5947 friend class HLoadNamedField; |
5948 friend class HStoreNamedField; | 5948 friend class HStoreNamedField; |
5949 | 5949 |
5950 inline Portion portion() const { | 5950 inline Portion portion() const { |
5951 return PortionField::decode(value_); | 5951 return PortionField::decode(value_); |
5952 } | 5952 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5985 HLoadNamedField* b = HLoadNamedField::cast(other); | 5985 HLoadNamedField* b = HLoadNamedField::cast(other); |
5986 return access_.Equals(b->access_); | 5986 return access_.Equals(b->access_); |
5987 } | 5987 } |
5988 | 5988 |
5989 private: | 5989 private: |
5990 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { | 5990 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { |
5991 ASSERT(object != NULL); | 5991 ASSERT(object != NULL); |
5992 SetOperandAt(0, object); | 5992 SetOperandAt(0, object); |
5993 | 5993 |
5994 Representation representation = access.representation(); | 5994 Representation representation = access.representation(); |
5995 if (representation.IsByte()) { | 5995 if (representation.IsInteger8() || |
| 5996 representation.IsUInteger8() || |
| 5997 representation.IsInteger16() || |
| 5998 representation.IsUInteger16()) { |
5996 set_representation(Representation::Integer32()); | 5999 set_representation(Representation::Integer32()); |
5997 } else if (representation.IsSmi()) { | 6000 } else if (representation.IsSmi()) { |
5998 set_type(HType::Smi()); | 6001 set_type(HType::Smi()); |
5999 set_representation(representation); | 6002 set_representation(representation); |
6000 } else if (representation.IsDouble() || | 6003 } else if (representation.IsDouble() || |
6001 representation.IsExternal() || | 6004 representation.IsExternal() || |
6002 representation.IsInteger32()) { | 6005 representation.IsInteger32()) { |
6003 set_representation(representation); | 6006 set_representation(representation); |
6004 } else if (FLAG_track_heap_object_fields && | 6007 } else if (FLAG_track_heap_object_fields && |
6005 representation.IsHeapObject()) { | 6008 representation.IsHeapObject()) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6295 return index == 1; | 6298 return index == 1; |
6296 } | 6299 } |
6297 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { | 6300 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
6298 return !access().IsInobject() || access().offset() >= size; | 6301 return !access().IsInobject() || access().offset() >= size; |
6299 } | 6302 } |
6300 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6303 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6301 if (index == 0 && access().IsExternalMemory()) { | 6304 if (index == 0 && access().IsExternalMemory()) { |
6302 // object must be external in case of external memory access | 6305 // object must be external in case of external memory access |
6303 return Representation::External(); | 6306 return Representation::External(); |
6304 } else if (index == 1) { | 6307 } else if (index == 1) { |
6305 if (field_representation().IsByte() || | 6308 if (field_representation().IsInteger8() || |
| 6309 field_representation().IsUInteger8() || |
| 6310 field_representation().IsInteger16() || |
| 6311 field_representation().IsUInteger16() || |
6306 field_representation().IsInteger32()) { | 6312 field_representation().IsInteger32()) { |
6307 return Representation::Integer32(); | 6313 return Representation::Integer32(); |
6308 } else if (field_representation().IsDouble() || | 6314 } else if (field_representation().IsDouble() || |
6309 field_representation().IsSmi()) { | 6315 field_representation().IsSmi()) { |
6310 return field_representation(); | 6316 return field_representation(); |
6311 } | 6317 } |
6312 } | 6318 } |
6313 return Representation::Tagged(); | 6319 return Representation::Tagged(); |
6314 } | 6320 } |
6315 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6321 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7248 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7254 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7249 }; | 7255 }; |
7250 | 7256 |
7251 | 7257 |
7252 #undef DECLARE_INSTRUCTION | 7258 #undef DECLARE_INSTRUCTION |
7253 #undef DECLARE_CONCRETE_INSTRUCTION | 7259 #undef DECLARE_CONCRETE_INSTRUCTION |
7254 | 7260 |
7255 } } // namespace v8::internal | 7261 } } // namespace v8::internal |
7256 | 7262 |
7257 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7263 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |