OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_COMPILER_ACCESS_INFO_H_ | 5 #ifndef V8_COMPILER_ACCESS_INFO_H_ |
6 #define V8_COMPILER_ACCESS_INFO_H_ | 6 #define V8_COMPILER_ACCESS_INFO_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/field-index.h" | 10 #include "src/field-index.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // This class encapsulates all information required to access a certain | 55 // This class encapsulates all information required to access a certain |
56 // object property, either on the object itself or on the prototype chain. | 56 // object property, either on the object itself or on the prototype chain. |
57 class PropertyAccessInfo final { | 57 class PropertyAccessInfo final { |
58 public: | 58 public: |
59 enum Kind { | 59 enum Kind { |
60 kInvalid, | 60 kInvalid, |
61 kNotFound, | 61 kNotFound, |
62 kDataConstant, | 62 kDataConstant, |
63 kDataField, | 63 kDataField, |
64 kAccessorConstant | 64 kAccessorConstant, |
| 65 kGeneric |
65 }; | 66 }; |
66 | 67 |
67 static PropertyAccessInfo NotFound(MapList const& receiver_maps, | 68 static PropertyAccessInfo NotFound(MapList const& receiver_maps, |
68 MaybeHandle<JSObject> holder); | 69 MaybeHandle<JSObject> holder); |
69 static PropertyAccessInfo DataConstant(MapList const& receiver_maps, | 70 static PropertyAccessInfo DataConstant(MapList const& receiver_maps, |
70 Handle<Object> constant, | 71 Handle<Object> constant, |
71 MaybeHandle<JSObject> holder); | 72 MaybeHandle<JSObject> holder); |
72 static PropertyAccessInfo DataField( | 73 static PropertyAccessInfo DataField( |
73 MapList const& receiver_maps, FieldIndex field_index, | 74 MapList const& receiver_maps, FieldIndex field_index, |
74 MachineRepresentation field_representation, Type* field_type, | 75 MachineRepresentation field_representation, Type* field_type, |
75 MaybeHandle<Map> field_map = MaybeHandle<Map>(), | 76 MaybeHandle<Map> field_map = MaybeHandle<Map>(), |
76 MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(), | 77 MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(), |
77 MaybeHandle<Map> transition_map = MaybeHandle<Map>()); | 78 MaybeHandle<Map> transition_map = MaybeHandle<Map>()); |
78 static PropertyAccessInfo AccessorConstant(MapList const& receiver_maps, | 79 static PropertyAccessInfo AccessorConstant(MapList const& receiver_maps, |
79 Handle<Object> constant, | 80 Handle<Object> constant, |
80 MaybeHandle<JSObject> holder); | 81 MaybeHandle<JSObject> holder); |
| 82 static PropertyAccessInfo Generic(MapList const& receiver_maps); |
81 | 83 |
82 PropertyAccessInfo(); | 84 PropertyAccessInfo(); |
83 | 85 |
84 bool Merge(PropertyAccessInfo const* that) WARN_UNUSED_RESULT; | 86 bool Merge(PropertyAccessInfo const* that) WARN_UNUSED_RESULT; |
85 | 87 |
86 bool IsNotFound() const { return kind() == kNotFound; } | 88 bool IsNotFound() const { return kind() == kNotFound; } |
87 bool IsDataConstant() const { return kind() == kDataConstant; } | 89 bool IsDataConstant() const { return kind() == kDataConstant; } |
88 bool IsDataField() const { return kind() == kDataField; } | 90 bool IsDataField() const { return kind() == kDataField; } |
89 bool IsAccessorConstant() const { return kind() == kAccessorConstant; } | 91 bool IsAccessorConstant() const { return kind() == kAccessorConstant; } |
| 92 bool IsGeneric() const { return kind() == kGeneric; } |
90 | 93 |
91 bool HasTransitionMap() const { return !transition_map().is_null(); } | 94 bool HasTransitionMap() const { return !transition_map().is_null(); } |
92 | 95 |
93 Kind kind() const { return kind_; } | 96 Kind kind() const { return kind_; } |
94 MaybeHandle<JSObject> holder() const { return holder_; } | 97 MaybeHandle<JSObject> holder() const { return holder_; } |
95 MaybeHandle<Map> transition_map() const { return transition_map_; } | 98 MaybeHandle<Map> transition_map() const { return transition_map_; } |
96 Handle<Object> constant() const { return constant_; } | 99 Handle<Object> constant() const { return constant_; } |
97 FieldIndex field_index() const { return field_index_; } | 100 FieldIndex field_index() const { return field_index_; } |
98 Type* field_type() const { return field_type_; } | 101 Type* field_type() const { return field_type_; } |
99 MachineRepresentation field_representation() const { | 102 MachineRepresentation field_representation() const { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 Zone* const zone_; | 166 Zone* const zone_; |
164 | 167 |
165 DISALLOW_COPY_AND_ASSIGN(AccessInfoFactory); | 168 DISALLOW_COPY_AND_ASSIGN(AccessInfoFactory); |
166 }; | 169 }; |
167 | 170 |
168 } // namespace compiler | 171 } // namespace compiler |
169 } // namespace internal | 172 } // namespace internal |
170 } // namespace v8 | 173 } // namespace v8 |
171 | 174 |
172 #endif // V8_COMPILER_ACCESS_INFO_H_ | 175 #endif // V8_COMPILER_ACCESS_INFO_H_ |
OLD | NEW |