| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PROPERTY_H_ | 5 #ifndef V8_PROPERTY_H_ |
| 6 #define V8_PROPERTY_H_ | 6 #define V8_PROPERTY_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| 11 #include "src/isolate.h" | 11 #include "src/isolate.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 // Abstraction for elements in instance-descriptor arrays. | 16 // Abstraction for elements in instance-descriptor arrays. |
| 17 // | 17 // |
| 18 // Each descriptor has a key, property attributes, property type, | 18 // Each descriptor has a key, property attributes, property type, |
| 19 // property index (in the actual instance-descriptor array) and | 19 // property index (in the actual instance-descriptor array) and |
| 20 // optionally a piece of data. | 20 // optionally a piece of data. |
| 21 class Descriptor final BASE_EMBEDDED { | 21 class Descriptor final BASE_EMBEDDED { |
| 22 public: | 22 public: |
| 23 Descriptor() : details_(Smi::kZero) {} |
| 24 |
| 23 Handle<Name> GetKey() const { return key_; } | 25 Handle<Name> GetKey() const { return key_; } |
| 24 Handle<Object> GetValue() const { return value_; } | 26 Handle<Object> GetValue() const { return value_; } |
| 25 PropertyDetails GetDetails() const { return details_; } | 27 PropertyDetails GetDetails() const { return details_; } |
| 26 | 28 |
| 27 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } | 29 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } |
| 28 | 30 |
| 29 static Descriptor DataField(Handle<Name> key, int field_index, | 31 static Descriptor DataField(Handle<Name> key, int field_index, |
| 30 PropertyAttributes attributes, | 32 PropertyAttributes attributes, |
| 31 Representation representation); | 33 Representation representation); |
| 32 | 34 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 50 return Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT, | 52 return Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT, |
| 51 Representation::Tagged()); | 53 Representation::Tagged()); |
| 52 } | 54 } |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 Handle<Name> key_; | 57 Handle<Name> key_; |
| 56 Handle<Object> value_; | 58 Handle<Object> value_; |
| 57 PropertyDetails details_; | 59 PropertyDetails details_; |
| 58 | 60 |
| 59 protected: | 61 protected: |
| 60 Descriptor() : details_(Smi::kZero) {} | |
| 61 | |
| 62 void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) { | 62 void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) { |
| 63 DCHECK(key->IsUniqueName()); | 63 DCHECK(key->IsUniqueName()); |
| 64 DCHECK_IMPLIES(key->IsPrivate(), !details.IsEnumerable()); | 64 DCHECK_IMPLIES(key->IsPrivate(), !details.IsEnumerable()); |
| 65 key_ = key; | 65 key_ = key; |
| 66 value_ = value; | 66 value_ = value; |
| 67 details_ = details; | 67 details_ = details; |
| 68 } | 68 } |
| 69 | 69 |
| 70 Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details) | 70 Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details) |
| 71 : key_(key), value_(value), details_(details) { | 71 : key_(key), value_(value), details_(details) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 friend class Map; | 87 friend class Map; |
| 88 friend class MapUpdater; | 88 friend class MapUpdater; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 std::ostream& operator<<(std::ostream& os, const Descriptor& d); | 91 std::ostream& operator<<(std::ostream& os, const Descriptor& d); |
| 92 | 92 |
| 93 } // namespace internal | 93 } // namespace internal |
| 94 } // namespace v8 | 94 } // namespace v8 |
| 95 | 95 |
| 96 #endif // V8_PROPERTY_H_ | 96 #endif // V8_PROPERTY_H_ |
| OLD | NEW |