| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 Handle<Object> GetValue() const { return value_; } | 26 Handle<Object> GetValue() const { return value_; } |
| 27 PropertyDetails GetDetails() const { return details_; } | 27 PropertyDetails GetDetails() const { return details_; } |
| 28 | 28 |
| 29 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } | 29 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } |
| 30 | 30 |
| 31 static Descriptor DataField(Handle<Name> key, int field_index, | 31 static Descriptor DataField(Handle<Name> key, int field_index, |
| 32 PropertyAttributes attributes, | 32 PropertyAttributes attributes, |
| 33 Representation representation); | 33 Representation representation); |
| 34 | 34 |
| 35 static Descriptor DataField(Handle<Name> key, int field_index, | 35 static Descriptor DataField(Handle<Name> key, int field_index, |
| 36 Handle<Object> wrapped_field_type, | |
| 37 PropertyAttributes attributes, | 36 PropertyAttributes attributes, |
| 38 Representation representation) { | 37 PropertyConstness constness, |
| 39 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); | 38 Representation representation, |
| 40 return Descriptor(key, wrapped_field_type, kData, attributes, kField, | 39 Handle<Object> wrapped_field_type); |
| 41 representation, field_index); | |
| 42 } | |
| 43 | 40 |
| 44 static Descriptor DataConstant(Handle<Name> key, Handle<Object> value, | 41 static Descriptor DataConstant(Handle<Name> key, Handle<Object> value, |
| 45 PropertyAttributes attributes) { | 42 PropertyAttributes attributes) { |
| 46 return Descriptor(key, value, kData, attributes, kDescriptor, | 43 return Descriptor(key, value, kData, attributes, kDescriptor, kConst, |
| 47 value->OptimalRepresentation()); | 44 value->OptimalRepresentation(), 0); |
| 48 } | 45 } |
| 49 | 46 |
| 50 static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign, | 47 static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign, |
| 51 PropertyAttributes attributes) { | 48 PropertyAttributes attributes) { |
| 52 return Descriptor(key, foreign, kAccessor, attributes, kDescriptor, | 49 return Descriptor(key, foreign, kAccessor, attributes, kDescriptor, kConst, |
| 53 Representation::Tagged()); | 50 Representation::Tagged(), 0); |
| 54 } | 51 } |
| 55 | 52 |
| 56 private: | 53 private: |
| 57 Handle<Name> key_; | 54 Handle<Name> key_; |
| 58 Handle<Object> value_; | 55 Handle<Object> value_; |
| 59 PropertyDetails details_; | 56 PropertyDetails details_; |
| 60 | 57 |
| 61 protected: | 58 protected: |
| 62 void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) { | 59 void Init(Handle<Name> key, Handle<Object> value, PropertyDetails details) { |
| 63 DCHECK(key->IsUniqueName()); | 60 DCHECK(key->IsUniqueName()); |
| 64 DCHECK_IMPLIES(key->IsPrivate(), !details.IsEnumerable()); | 61 DCHECK_IMPLIES(key->IsPrivate(), !details.IsEnumerable()); |
| 65 key_ = key; | 62 key_ = key; |
| 66 value_ = value; | 63 value_ = value; |
| 67 details_ = details; | 64 details_ = details; |
| 68 } | 65 } |
| 69 | 66 |
| 70 Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details) | 67 Descriptor(Handle<Name> key, Handle<Object> value, PropertyDetails details) |
| 71 : key_(key), value_(value), details_(details) { | 68 : key_(key), value_(value), details_(details) { |
| 72 DCHECK(key->IsUniqueName()); | 69 DCHECK(key->IsUniqueName()); |
| 73 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); | 70 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); |
| 74 } | 71 } |
| 75 | 72 |
| 76 Descriptor(Handle<Name> key, Handle<Object> value, PropertyKind kind, | 73 Descriptor(Handle<Name> key, Handle<Object> value, PropertyKind kind, |
| 77 PropertyAttributes attributes, PropertyLocation location, | 74 PropertyAttributes attributes, PropertyLocation location, |
| 78 Representation representation, int field_index = 0) | 75 PropertyConstness constness, Representation representation, |
| 76 int field_index) |
| 79 : key_(key), | 77 : key_(key), |
| 80 value_(value), | 78 value_(value), |
| 81 details_(kind, attributes, location, representation, field_index) { | 79 details_(kind, attributes, location, constness, representation, |
| 80 field_index) { |
| 82 DCHECK(key->IsUniqueName()); | 81 DCHECK(key->IsUniqueName()); |
| 83 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); | 82 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); |
| 84 } | 83 } |
| 85 | 84 |
| 86 friend class DescriptorArray; | 85 friend class DescriptorArray; |
| 87 friend class Map; | 86 friend class Map; |
| 88 friend class MapUpdater; | 87 friend class MapUpdater; |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 } // namespace internal | 90 } // namespace internal |
| 92 } // namespace v8 | 91 } // namespace v8 |
| 93 | 92 |
| 94 #endif // V8_PROPERTY_H_ | 93 #endif // V8_PROPERTY_H_ |
| OLD | NEW |