| 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 19 matching lines...) Expand all Loading... |
| 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, | 36 Handle<Object> wrapped_field_type, |
| 37 PropertyAttributes attributes, | 37 PropertyAttributes attributes, |
| 38 Representation representation) { | 38 Representation representation) { |
| 39 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); | 39 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); |
| 40 return Descriptor(key, wrapped_field_type, attributes, DATA, representation, | 40 return Descriptor(key, wrapped_field_type, kData, attributes, kField, |
| 41 field_index); | 41 representation, field_index); |
| 42 } | 42 } |
| 43 | 43 |
| 44 static Descriptor DataConstant(Handle<Name> key, Handle<Object> value, | 44 static Descriptor DataConstant(Handle<Name> key, Handle<Object> value, |
| 45 PropertyAttributes attributes) { | 45 PropertyAttributes attributes) { |
| 46 return Descriptor(key, value, attributes, DATA_CONSTANT, | 46 return Descriptor(key, value, kData, attributes, kDescriptor, |
| 47 value->OptimalRepresentation()); | 47 value->OptimalRepresentation()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign, | 50 static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign, |
| 51 PropertyAttributes attributes) { | 51 PropertyAttributes attributes) { |
| 52 return Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT, | 52 return Descriptor(key, foreign, kAccessor, attributes, kDescriptor, |
| 53 Representation::Tagged()); | 53 Representation::Tagged()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 Handle<Name> key_; | 57 Handle<Name> key_; |
| 58 Handle<Object> value_; | 58 Handle<Object> value_; |
| 59 PropertyDetails details_; | 59 PropertyDetails details_; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 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) { |
| 72 DCHECK(key->IsUniqueName()); | 72 DCHECK(key->IsUniqueName()); |
| 73 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); | 73 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 Descriptor(Handle<Name> key, Handle<Object> value, | 76 Descriptor(Handle<Name> key, Handle<Object> value, PropertyKind kind, |
| 77 PropertyAttributes attributes, PropertyType type, | 77 PropertyAttributes attributes, PropertyLocation location, |
| 78 Representation representation, int field_index = 0) | 78 Representation representation, int field_index = 0) |
| 79 : key_(key), | 79 : key_(key), |
| 80 value_(value), | 80 value_(value), |
| 81 details_(attributes, type, representation, field_index) { | 81 details_(kind, attributes, location, representation, field_index) { |
| 82 DCHECK(key->IsUniqueName()); | 82 DCHECK(key->IsUniqueName()); |
| 83 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); | 83 DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 friend class DescriptorArray; | 86 friend class DescriptorArray; |
| 87 friend class Map; | 87 friend class Map; |
| 88 friend class MapUpdater; | 88 friend class MapUpdater; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace internal | 91 } // namespace internal |
| 92 } // namespace v8 | 92 } // namespace v8 |
| 93 | 93 |
| 94 #endif // V8_PROPERTY_H_ | 94 #endif // V8_PROPERTY_H_ |
| OLD | NEW |