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 5895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5906 } | 5906 } |
5907 | 5907 |
5908 inline Representation representation() const { | 5908 inline Representation representation() const { |
5909 return Representation::FromKind(RepresentationField::decode(value_)); | 5909 return Representation::FromKind(RepresentationField::decode(value_)); |
5910 } | 5910 } |
5911 | 5911 |
5912 inline Handle<String> name() const { | 5912 inline Handle<String> name() const { |
5913 return name_; | 5913 return name_; |
5914 } | 5914 } |
5915 | 5915 |
5916 inline bool immutable() const { | |
5917 return ImmutableField::decode(value_); | |
5918 } | |
5919 | |
5916 inline HObjectAccess WithRepresentation(Representation representation) { | 5920 inline HObjectAccess WithRepresentation(Representation representation) { |
5917 return HObjectAccess(portion(), offset(), representation, name()); | 5921 return HObjectAccess(portion(), offset(), representation, name()); |
5918 } | 5922 } |
5919 | 5923 |
5920 static HObjectAccess ForHeapNumberValue() { | 5924 static HObjectAccess ForHeapNumberValue() { |
5921 return HObjectAccess( | 5925 return HObjectAccess( |
5922 kDouble, HeapNumber::kValueOffset, Representation::Double()); | 5926 kDouble, HeapNumber::kValueOffset, Representation::Double()); |
5923 } | 5927 } |
5924 | 5928 |
5925 static HObjectAccess ForHeapNumberValueLowestBits() { | 5929 static HObjectAccess ForHeapNumberValueLowestBits() { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6136 kStringLengths, // the length of a string | 6140 kStringLengths, // the length of a string |
6137 kElementsPointer, // elements pointer | 6141 kElementsPointer, // elements pointer |
6138 kBackingStore, // some field in the backing store | 6142 kBackingStore, // some field in the backing store |
6139 kDouble, // some double field | 6143 kDouble, // some double field |
6140 kInobject, // some other in-object field | 6144 kInobject, // some other in-object field |
6141 kExternalMemory // some field in external memory | 6145 kExternalMemory // some field in external memory |
6142 }; | 6146 }; |
6143 | 6147 |
6144 HObjectAccess(Portion portion, int offset, | 6148 HObjectAccess(Portion portion, int offset, |
6145 Representation representation = Representation::Tagged(), | 6149 Representation representation = Representation::Tagged(), |
6146 Handle<String> name = Handle<String>::null()) | 6150 Handle<String> name = Handle<String>::null(), |
6151 bool immutable = false) | |
6147 : value_(PortionField::encode(portion) | | 6152 : value_(PortionField::encode(portion) | |
6148 RepresentationField::encode(representation.kind()) | | 6153 RepresentationField::encode(representation.kind()) | |
6154 ImmutableField::encode(immutable ? 1 : 0) | | |
6149 OffsetField::encode(offset)), | 6155 OffsetField::encode(offset)), |
6150 name_(name) { | 6156 name_(name) { |
6151 // assert that the fields decode correctly | 6157 // assert that the fields decode correctly |
6152 ASSERT(this->offset() == offset); | 6158 ASSERT(this->offset() == offset); |
6153 ASSERT(this->portion() == portion); | 6159 ASSERT(this->portion() == portion); |
6160 ASSERT(this->immutable() == immutable); | |
6154 ASSERT(RepresentationField::decode(value_) == representation.kind()); | 6161 ASSERT(RepresentationField::decode(value_) == representation.kind()); |
6155 } | 6162 } |
6156 | 6163 |
6157 class PortionField : public BitField<Portion, 0, 3> {}; | 6164 class PortionField : public BitField<Portion, 0, 3> {}; |
6158 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; | 6165 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
6159 class OffsetField : public BitField<int, 7, 25> {}; | 6166 class ImmutableField : public BitField<int, 7, 1> {}; |
Igor Sheludko
2013/12/06 09:18:54
Wouldn't it be better to define it as a BitField<b
| |
6167 class OffsetField : public BitField<int, 8, 24> {}; | |
6160 | 6168 |
6161 uint32_t value_; // encodes portion, representation, and offset | 6169 uint32_t value_; // encodes portion, representation, and offset |
6162 Handle<String> name_; | 6170 Handle<String> name_; |
6163 | 6171 |
6164 friend class HLoadNamedField; | 6172 friend class HLoadNamedField; |
6165 friend class HStoreNamedField; | 6173 friend class HStoreNamedField; |
6166 | 6174 |
6167 inline Portion portion() const { | 6175 inline Portion portion() const { |
6168 return PortionField::decode(value_); | 6176 return PortionField::decode(value_); |
6169 } | 6177 } |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7489 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7497 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7490 }; | 7498 }; |
7491 | 7499 |
7492 | 7500 |
7493 #undef DECLARE_INSTRUCTION | 7501 #undef DECLARE_INSTRUCTION |
7494 #undef DECLARE_CONCRETE_INSTRUCTION | 7502 #undef DECLARE_CONCRETE_INSTRUCTION |
7495 | 7503 |
7496 } } // namespace v8::internal | 7504 } } // namespace v8::internal |
7497 | 7505 |
7498 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7506 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |