| 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 6017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6028 inline bool immutable() const { | 6028 inline bool immutable() const { |
| 6029 return ImmutableField::decode(value_); | 6029 return ImmutableField::decode(value_); |
| 6030 } | 6030 } |
| 6031 | 6031 |
| 6032 // Returns true if access is being made to an in-object property that | 6032 // Returns true if access is being made to an in-object property that |
| 6033 // was already added to the object. | 6033 // was already added to the object. |
| 6034 inline bool existing_inobject_property() const { | 6034 inline bool existing_inobject_property() const { |
| 6035 return ExistingInobjectPropertyField::decode(value_); | 6035 return ExistingInobjectPropertyField::decode(value_); |
| 6036 } | 6036 } |
| 6037 | 6037 |
| 6038 inline bool read_barrier() const { return ReadBarrierField::decode(value_); } |
| 6039 |
| 6038 inline HObjectAccess WithRepresentation(Representation representation) { | 6040 inline HObjectAccess WithRepresentation(Representation representation) { |
| 6039 return HObjectAccess(portion(), offset(), representation, name(), | 6041 return HObjectAccess(portion(), offset(), representation, name(), |
| 6040 immutable(), existing_inobject_property()); | 6042 immutable(), existing_inobject_property()); |
| 6041 } | 6043 } |
| 6042 | 6044 |
| 6043 static HObjectAccess ForHeapNumberValue() { | 6045 static HObjectAccess ForHeapNumberValue() { |
| 6044 return HObjectAccess( | 6046 return HObjectAccess( |
| 6045 kDouble, HeapNumber::kValueOffset, Representation::Double()); | 6047 kDouble, HeapNumber::kValueOffset, Representation::Double()); |
| 6046 } | 6048 } |
| 6047 | 6049 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6194 static HObjectAccess ForMapInstanceTypeAndBitField() { | 6196 static HObjectAccess ForMapInstanceTypeAndBitField() { |
| 6195 STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0); | 6197 STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0); |
| 6196 // Ensure the two fields share one 16-bit word, endian-independent. | 6198 // Ensure the two fields share one 16-bit word, endian-independent. |
| 6197 STATIC_ASSERT((Map::kBitFieldOffset & ~1) == | 6199 STATIC_ASSERT((Map::kBitFieldOffset & ~1) == |
| 6198 (Map::kInstanceTypeOffset & ~1)); | 6200 (Map::kInstanceTypeOffset & ~1)); |
| 6199 return HObjectAccess(kInobject, | 6201 return HObjectAccess(kInobject, |
| 6200 Map::kInstanceTypeAndBitFieldOffset, | 6202 Map::kInstanceTypeAndBitFieldOffset, |
| 6201 Representation::UInteger16()); | 6203 Representation::UInteger16()); |
| 6202 } | 6204 } |
| 6203 | 6205 |
| 6204 static HObjectAccess ForPropertyCellValue() { | |
| 6205 return HObjectAccess(kInobject, PropertyCell::kValueOffset); | |
| 6206 } | |
| 6207 | |
| 6208 static HObjectAccess ForCellValue() { | |
| 6209 return HObjectAccess(kInobject, Cell::kValueOffset); | |
| 6210 } | |
| 6211 | |
| 6212 static HObjectAccess ForWeakCellValue() { | 6206 static HObjectAccess ForWeakCellValue() { |
| 6213 return HObjectAccess(kInobject, WeakCell::kValueOffset); | 6207 return HObjectAccess( |
| 6208 kInobject, WeakCell::kValueOffsetDontForgetTheReadBarrier, |
| 6209 Representation::Tagged(), Handle<String>::null(), false, true, true); |
| 6214 } | 6210 } |
| 6215 | 6211 |
| 6216 static HObjectAccess ForAllocationMementoSite() { | 6212 static HObjectAccess ForAllocationMementoSite() { |
| 6217 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); | 6213 return HObjectAccess(kInobject, AllocationMemento::kAllocationSiteOffset); |
| 6218 } | 6214 } |
| 6219 | 6215 |
| 6220 static HObjectAccess ForCounter() { | 6216 static HObjectAccess ForCounter() { |
| 6221 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), | 6217 return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), |
| 6222 Handle<String>::null(), false, false); | 6218 Handle<String>::null(), false, false); |
| 6223 } | 6219 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6377 kDouble, // some double field | 6373 kDouble, // some double field |
| 6378 kInobject, // some other in-object field | 6374 kInobject, // some other in-object field |
| 6379 kExternalMemory // some field in external memory | 6375 kExternalMemory // some field in external memory |
| 6380 }; | 6376 }; |
| 6381 | 6377 |
| 6382 HObjectAccess() : value_(0) {} | 6378 HObjectAccess() : value_(0) {} |
| 6383 | 6379 |
| 6384 HObjectAccess(Portion portion, int offset, | 6380 HObjectAccess(Portion portion, int offset, |
| 6385 Representation representation = Representation::Tagged(), | 6381 Representation representation = Representation::Tagged(), |
| 6386 Handle<String> name = Handle<String>::null(), | 6382 Handle<String> name = Handle<String>::null(), |
| 6387 bool immutable = false, | 6383 bool immutable = false, bool existing_inobject_property = true, |
| 6388 bool existing_inobject_property = true) | 6384 bool read_barrier = false) |
| 6389 : value_(PortionField::encode(portion) | | 6385 : value_(PortionField::encode(portion) | |
| 6390 RepresentationField::encode(representation.kind()) | | 6386 RepresentationField::encode(representation.kind()) | |
| 6391 ImmutableField::encode(immutable ? 1 : 0) | | 6387 ImmutableField::encode(immutable ? 1 : 0) | |
| 6392 ExistingInobjectPropertyField::encode( | 6388 ExistingInobjectPropertyField::encode( |
| 6393 existing_inobject_property ? 1 : 0) | | 6389 existing_inobject_property ? 1 : 0) | |
| 6394 OffsetField::encode(offset)), | 6390 ReadBarrierField::encode(read_barrier ? 1 : 0) | |
| 6395 name_(name) { | 6391 OffsetField::encode(offset)), |
| 6392 name_(name) { |
| 6396 // assert that the fields decode correctly | 6393 // assert that the fields decode correctly |
| 6397 DCHECK(this->offset() == offset); | 6394 DCHECK(this->offset() == offset); |
| 6398 DCHECK(this->portion() == portion); | 6395 DCHECK(this->portion() == portion); |
| 6399 DCHECK(this->immutable() == immutable); | 6396 DCHECK(this->immutable() == immutable); |
| 6400 DCHECK(this->existing_inobject_property() == existing_inobject_property); | 6397 DCHECK(this->existing_inobject_property() == existing_inobject_property); |
| 6401 DCHECK(RepresentationField::decode(value_) == representation.kind()); | 6398 DCHECK(RepresentationField::decode(value_) == representation.kind()); |
| 6402 DCHECK(!this->existing_inobject_property() || IsInobject()); | 6399 DCHECK(!this->existing_inobject_property() || IsInobject()); |
| 6403 } | 6400 } |
| 6404 | 6401 |
| 6405 class PortionField : public BitField<Portion, 0, 3> {}; | 6402 class PortionField : public BitField<Portion, 0, 3> {}; |
| 6406 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; | 6403 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
| 6407 class ImmutableField : public BitField<bool, 7, 1> {}; | 6404 class ImmutableField : public BitField<bool, 7, 1> {}; |
| 6408 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; | 6405 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; |
| 6409 class OffsetField : public BitField<int, 9, 23> {}; | 6406 class ReadBarrierField : public BitField<bool, 9, 1> {}; |
| 6407 class OffsetField : public BitField<int, 10, 22> {}; |
| 6410 | 6408 |
| 6411 uint32_t value_; // encodes portion, representation, immutable, and offset | 6409 uint32_t value_; // encodes portion, representation, immutable, and offset |
| 6412 Handle<String> name_; | 6410 Handle<String> name_; |
| 6413 | 6411 |
| 6414 friend class HLoadNamedField; | 6412 friend class HLoadNamedField; |
| 6415 friend class HStoreNamedField; | 6413 friend class HStoreNamedField; |
| 6416 friend class SideEffectsTracker; | 6414 friend class SideEffectsTracker; |
| 6417 friend std::ostream& operator<<(std::ostream& os, | 6415 friend std::ostream& operator<<(std::ostream& os, |
| 6418 const HObjectAccess& access); | 6416 const HObjectAccess& access); |
| 6419 | 6417 |
| (...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7975 }; | 7973 }; |
| 7976 | 7974 |
| 7977 | 7975 |
| 7978 | 7976 |
| 7979 #undef DECLARE_INSTRUCTION | 7977 #undef DECLARE_INSTRUCTION |
| 7980 #undef DECLARE_CONCRETE_INSTRUCTION | 7978 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7981 | 7979 |
| 7982 } } // namespace v8::internal | 7980 } } // namespace v8::internal |
| 7983 | 7981 |
| 7984 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7982 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |