| 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 <cstring> | 8 #include <cstring> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| (...skipping 5894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5905 } | 5905 } |
| 5906 | 5906 |
| 5907 inline int offset() const { | 5907 inline int offset() const { |
| 5908 return OffsetField::decode(value_); | 5908 return OffsetField::decode(value_); |
| 5909 } | 5909 } |
| 5910 | 5910 |
| 5911 inline Representation representation() const { | 5911 inline Representation representation() const { |
| 5912 return Representation::FromKind(RepresentationField::decode(value_)); | 5912 return Representation::FromKind(RepresentationField::decode(value_)); |
| 5913 } | 5913 } |
| 5914 | 5914 |
| 5915 inline Handle<String> name() const { | 5915 inline Handle<Name> name() const { return name_; } |
| 5916 return name_; | |
| 5917 } | |
| 5918 | 5916 |
| 5919 inline bool immutable() const { | 5917 inline bool immutable() const { |
| 5920 return ImmutableField::decode(value_); | 5918 return ImmutableField::decode(value_); |
| 5921 } | 5919 } |
| 5922 | 5920 |
| 5923 // Returns true if access is being made to an in-object property that | 5921 // Returns true if access is being made to an in-object property that |
| 5924 // was already added to the object. | 5922 // was already added to the object. |
| 5925 inline bool existing_inobject_property() const { | 5923 inline bool existing_inobject_property() const { |
| 5926 return ExistingInobjectPropertyField::decode(value_); | 5924 return ExistingInobjectPropertyField::decode(value_); |
| 5927 } | 5925 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5970 kArrayLengths, | 5968 kArrayLengths, |
| 5971 JSArray::kLengthOffset, | 5969 JSArray::kLengthOffset, |
| 5972 IsFastElementsKind(elements_kind) | 5970 IsFastElementsKind(elements_kind) |
| 5973 ? Representation::Smi() : Representation::Tagged()); | 5971 ? Representation::Smi() : Representation::Tagged()); |
| 5974 } | 5972 } |
| 5975 | 5973 |
| 5976 static HObjectAccess ForAllocationSiteOffset(int offset); | 5974 static HObjectAccess ForAllocationSiteOffset(int offset); |
| 5977 | 5975 |
| 5978 static HObjectAccess ForAllocationSiteList() { | 5976 static HObjectAccess ForAllocationSiteList() { |
| 5979 return HObjectAccess(kExternalMemory, 0, Representation::Tagged(), | 5977 return HObjectAccess(kExternalMemory, 0, Representation::Tagged(), |
| 5980 Handle<String>::null(), false, false); | 5978 Handle<Name>::null(), false, false); |
| 5981 } | 5979 } |
| 5982 | 5980 |
| 5983 static HObjectAccess ForFixedArrayLength() { | 5981 static HObjectAccess ForFixedArrayLength() { |
| 5984 return HObjectAccess( | 5982 return HObjectAccess( |
| 5985 kArrayLengths, | 5983 kArrayLengths, |
| 5986 FixedArray::kLengthOffset, | 5984 FixedArray::kLengthOffset, |
| 5987 Representation::Smi()); | 5985 Representation::Smi()); |
| 5988 } | 5986 } |
| 5989 | 5987 |
| 5990 static HObjectAccess ForFixedTypedArrayBaseBasePointer() { | 5988 static HObjectAccess ForFixedTypedArrayBaseBasePointer() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6133 static HObjectAccess ForWeakCellNext() { | 6131 static HObjectAccess ForWeakCellNext() { |
| 6134 return HObjectAccess(kInobject, WeakCell::kNextOffset); | 6132 return HObjectAccess(kInobject, WeakCell::kNextOffset); |
| 6135 } | 6133 } |
| 6136 | 6134 |
| 6137 static HObjectAccess ForAllocationMementoSite() { | 6135 static HObjectAccess ForAllocationMementoSite() { |
| 6138 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); | 6136 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
| 6139 } | 6137 } |
| 6140 | 6138 |
| 6141 static HObjectAccess ForCounter() { | 6139 static HObjectAccess ForCounter() { |
| 6142 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), | 6140 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), |
| 6143 Handle<String>::null(), false, false); | 6141 Handle<Name>::null(), false, false); |
| 6144 } | 6142 } |
| 6145 | 6143 |
| 6146 static HObjectAccess ForExternalUInteger8() { | 6144 static HObjectAccess ForExternalUInteger8() { |
| 6147 return HObjectAccess(kExternalMemory, 0, Representation::UInteger8(), | 6145 return HObjectAccess(kExternalMemory, 0, Representation::UInteger8(), |
| 6148 Handle<String>::null(), false, false); | 6146 Handle<Name>::null(), false, false); |
| 6149 } | 6147 } |
| 6150 | 6148 |
| 6151 // Create an access to an offset in a fixed array header. | 6149 // Create an access to an offset in a fixed array header. |
| 6152 static HObjectAccess ForFixedArrayHeader(int offset); | 6150 static HObjectAccess ForFixedArrayHeader(int offset); |
| 6153 | 6151 |
| 6154 // Create an access to an in-object property in a JSObject. | 6152 // Create an access to an in-object property in a JSObject. |
| 6155 // This kind of access must be used when the object |map| is known and | 6153 // This kind of access must be used when the object |map| is known and |
| 6156 // in-object properties are being accessed. Accesses of the in-object | 6154 // in-object properties are being accessed. Accesses of the in-object |
| 6157 // properties can have different semantics depending on whether corresponding | 6155 // properties can have different semantics depending on whether corresponding |
| 6158 // property was added to the map or not. | 6156 // property was added to the map or not. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6174 | 6172 |
| 6175 static HObjectAccess ForScriptContext(int index); | 6173 static HObjectAccess ForScriptContext(int index); |
| 6176 | 6174 |
| 6177 // Create an access to the backing store of an object. | 6175 // Create an access to the backing store of an object. |
| 6178 static HObjectAccess ForBackingStoreOffset(int offset, | 6176 static HObjectAccess ForBackingStoreOffset(int offset, |
| 6179 Representation representation = Representation::Tagged()); | 6177 Representation representation = Representation::Tagged()); |
| 6180 | 6178 |
| 6181 // Create an access to a resolved field (in-object or backing store). | 6179 // Create an access to a resolved field (in-object or backing store). |
| 6182 static HObjectAccess ForField(Handle<Map> map, int index, | 6180 static HObjectAccess ForField(Handle<Map> map, int index, |
| 6183 Representation representation, | 6181 Representation representation, |
| 6184 Handle<String> name); | 6182 Handle<Name> name); |
| 6185 | 6183 |
| 6186 static HObjectAccess ForJSTypedArrayLength() { | 6184 static HObjectAccess ForJSTypedArrayLength() { |
| 6187 return HObjectAccess::ForObservableJSObjectOffset( | 6185 return HObjectAccess::ForObservableJSObjectOffset( |
| 6188 JSTypedArray::kLengthOffset); | 6186 JSTypedArray::kLengthOffset); |
| 6189 } | 6187 } |
| 6190 | 6188 |
| 6191 static HObjectAccess ForJSArrayBufferBackingStore() { | 6189 static HObjectAccess ForJSArrayBufferBackingStore() { |
| 6192 return HObjectAccess::ForObservableJSObjectOffset( | 6190 return HObjectAccess::ForObservableJSObjectOffset( |
| 6193 JSArrayBuffer::kBackingStoreOffset, Representation::External()); | 6191 JSArrayBuffer::kBackingStoreOffset, Representation::External()); |
| 6194 } | 6192 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6289 kBackingStore, // some field in the backing store | 6287 kBackingStore, // some field in the backing store |
| 6290 kDouble, // some double field | 6288 kDouble, // some double field |
| 6291 kInobject, // some other in-object field | 6289 kInobject, // some other in-object field |
| 6292 kExternalMemory // some field in external memory | 6290 kExternalMemory // some field in external memory |
| 6293 }; | 6291 }; |
| 6294 | 6292 |
| 6295 HObjectAccess() : value_(0) {} | 6293 HObjectAccess() : value_(0) {} |
| 6296 | 6294 |
| 6297 HObjectAccess(Portion portion, int offset, | 6295 HObjectAccess(Portion portion, int offset, |
| 6298 Representation representation = Representation::Tagged(), | 6296 Representation representation = Representation::Tagged(), |
| 6299 Handle<String> name = Handle<String>::null(), | 6297 Handle<Name> name = Handle<Name>::null(), |
| 6300 bool immutable = false, | 6298 bool immutable = false, bool existing_inobject_property = true) |
| 6301 bool existing_inobject_property = true) | 6299 : value_(PortionField::encode(portion) | |
| 6302 : value_(PortionField::encode(portion) | | 6300 RepresentationField::encode(representation.kind()) | |
| 6303 RepresentationField::encode(representation.kind()) | | 6301 ImmutableField::encode(immutable ? 1 : 0) | |
| 6304 ImmutableField::encode(immutable ? 1 : 0) | | 6302 ExistingInobjectPropertyField::encode( |
| 6305 ExistingInobjectPropertyField::encode( | 6303 existing_inobject_property ? 1 : 0) | |
| 6306 existing_inobject_property ? 1 : 0) | | 6304 OffsetField::encode(offset)), |
| 6307 OffsetField::encode(offset)), | 6305 name_(name) { |
| 6308 name_(name) { | |
| 6309 // assert that the fields decode correctly | 6306 // assert that the fields decode correctly |
| 6310 DCHECK(this->offset() == offset); | 6307 DCHECK(this->offset() == offset); |
| 6311 DCHECK(this->portion() == portion); | 6308 DCHECK(this->portion() == portion); |
| 6312 DCHECK(this->immutable() == immutable); | 6309 DCHECK(this->immutable() == immutable); |
| 6313 DCHECK(this->existing_inobject_property() == existing_inobject_property); | 6310 DCHECK(this->existing_inobject_property() == existing_inobject_property); |
| 6314 DCHECK(RepresentationField::decode(value_) == representation.kind()); | 6311 DCHECK(RepresentationField::decode(value_) == representation.kind()); |
| 6315 DCHECK(!this->existing_inobject_property() || IsInobject()); | 6312 DCHECK(!this->existing_inobject_property() || IsInobject()); |
| 6316 } | 6313 } |
| 6317 | 6314 |
| 6318 class PortionField : public BitField<Portion, 0, 3> {}; | 6315 class PortionField : public BitField<Portion, 0, 3> {}; |
| 6319 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; | 6316 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
| 6320 class ImmutableField : public BitField<bool, 7, 1> {}; | 6317 class ImmutableField : public BitField<bool, 7, 1> {}; |
| 6321 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; | 6318 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; |
| 6322 class OffsetField : public BitField<int, 9, 23> {}; | 6319 class OffsetField : public BitField<int, 9, 23> {}; |
| 6323 | 6320 |
| 6324 uint32_t value_; // encodes portion, representation, immutable, and offset | 6321 uint32_t value_; // encodes portion, representation, immutable, and offset |
| 6325 Handle<String> name_; | 6322 Handle<Name> name_; |
| 6326 | 6323 |
| 6327 friend class HLoadNamedField; | 6324 friend class HLoadNamedField; |
| 6328 friend class HStoreNamedField; | 6325 friend class HStoreNamedField; |
| 6329 friend class SideEffectsTracker; | 6326 friend class SideEffectsTracker; |
| 6330 friend std::ostream& operator<<(std::ostream& os, | 6327 friend std::ostream& operator<<(std::ostream& os, |
| 6331 const HObjectAccess& access); | 6328 const HObjectAccess& access); |
| 6332 | 6329 |
| 6333 inline Portion portion() const { | 6330 inline Portion portion() const { |
| 6334 return PortionField::decode(value_); | 6331 return PortionField::decode(value_); |
| 6335 } | 6332 } |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7972 }; | 7969 }; |
| 7973 | 7970 |
| 7974 | 7971 |
| 7975 | 7972 |
| 7976 #undef DECLARE_INSTRUCTION | 7973 #undef DECLARE_INSTRUCTION |
| 7977 #undef DECLARE_CONCRETE_INSTRUCTION | 7974 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7978 | 7975 |
| 7979 } } // namespace v8::internal | 7976 } } // namespace v8::internal |
| 7980 | 7977 |
| 7981 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7978 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |