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/field-index.h" | |
12 #include "src/field-type.h" | |
13 #include "src/isolate.h" | 11 #include "src/isolate.h" |
14 | 12 |
15 namespace v8 { | 13 namespace v8 { |
16 namespace internal { | 14 namespace internal { |
17 | 15 |
18 // Abstraction for elements in instance-descriptor arrays. | 16 // Abstraction for elements in instance-descriptor arrays. |
19 // | 17 // |
20 // Each descriptor has a key, property attributes, property type, | 18 // Each descriptor has a key, property attributes, property type, |
21 // property index (in the actual instance-descriptor array) and | 19 // property index (in the actual instance-descriptor array) and |
22 // optionally a piece of data. | 20 // optionally a piece of data. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 friend class Map; | 66 friend class Map; |
69 }; | 67 }; |
70 | 68 |
71 | 69 |
72 std::ostream& operator<<(std::ostream& os, const Descriptor& d); | 70 std::ostream& operator<<(std::ostream& os, const Descriptor& d); |
73 | 71 |
74 | 72 |
75 class DataDescriptor final : public Descriptor { | 73 class DataDescriptor final : public Descriptor { |
76 public: | 74 public: |
77 DataDescriptor(Handle<Name> key, int field_index, | 75 DataDescriptor(Handle<Name> key, int field_index, |
78 PropertyAttributes attributes, Representation representation) | 76 PropertyAttributes attributes, Representation representation); |
79 : Descriptor(key, FieldType::Any(key->GetIsolate()), attributes, DATA, | |
80 representation, field_index) {} | |
81 // The field type is either a simple type or a map wrapped in a weak cell. | 77 // The field type is either a simple type or a map wrapped in a weak cell. |
82 DataDescriptor(Handle<Name> key, int field_index, | 78 DataDescriptor(Handle<Name> key, int field_index, |
83 Handle<Object> wrapped_field_type, | 79 Handle<Object> wrapped_field_type, |
84 PropertyAttributes attributes, Representation representation) | 80 PropertyAttributes attributes, Representation representation) |
85 : Descriptor(key, wrapped_field_type, attributes, DATA, representation, | 81 : Descriptor(key, wrapped_field_type, attributes, DATA, representation, |
86 field_index) { | 82 field_index) { |
87 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); | 83 DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell()); |
88 } | 84 } |
89 }; | 85 }; |
90 | 86 |
(...skipping 13 matching lines...) Expand all Loading... |
104 PropertyAttributes attributes) | 100 PropertyAttributes attributes) |
105 : Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT, | 101 : Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT, |
106 Representation::Tagged()) {} | 102 Representation::Tagged()) {} |
107 }; | 103 }; |
108 | 104 |
109 | 105 |
110 } // namespace internal | 106 } // namespace internal |
111 } // namespace v8 | 107 } // namespace v8 |
112 | 108 |
113 #endif // V8_PROPERTY_H_ | 109 #endif // V8_PROPERTY_H_ |
OLD | NEW |