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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // This class encapsulates all information required to access a certain | 56 // This class encapsulates all information required to access a certain |
57 // object property, either on the object itself or on the prototype chain. | 57 // object property, either on the object itself or on the prototype chain. |
58 class PropertyAccessInfo final { | 58 class PropertyAccessInfo final { |
59 public: | 59 public: |
60 enum Kind { | 60 enum Kind { |
61 kInvalid, | 61 kInvalid, |
62 kNotFound, | 62 kNotFound, |
63 kDataConstant, | 63 kDataConstant, |
64 kDataField, | 64 kDataField, |
65 kDataConstantField, | 65 kDataConstantField, |
66 kAccessorConstant, | 66 kAccessorConstant |
67 kGeneric | |
68 }; | 67 }; |
69 | 68 |
70 static PropertyAccessInfo NotFound(MapList const& receiver_maps, | 69 static PropertyAccessInfo NotFound(MapList const& receiver_maps, |
71 MaybeHandle<JSObject> holder); | 70 MaybeHandle<JSObject> holder); |
72 static PropertyAccessInfo DataConstant(MapList const& receiver_maps, | 71 static PropertyAccessInfo DataConstant(MapList const& receiver_maps, |
73 Handle<Object> constant, | 72 Handle<Object> constant, |
74 MaybeHandle<JSObject> holder); | 73 MaybeHandle<JSObject> holder); |
75 static PropertyAccessInfo DataField( | 74 static PropertyAccessInfo DataField( |
76 PropertyConstness constness, MapList const& receiver_maps, | 75 PropertyConstness constness, MapList const& receiver_maps, |
77 FieldIndex field_index, MachineRepresentation field_representation, | 76 FieldIndex field_index, MachineRepresentation field_representation, |
78 Type* field_type, MaybeHandle<Map> field_map = MaybeHandle<Map>(), | 77 Type* field_type, MaybeHandle<Map> field_map = MaybeHandle<Map>(), |
79 MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(), | 78 MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(), |
80 MaybeHandle<Map> transition_map = MaybeHandle<Map>()); | 79 MaybeHandle<Map> transition_map = MaybeHandle<Map>()); |
81 static PropertyAccessInfo AccessorConstant(MapList const& receiver_maps, | 80 static PropertyAccessInfo AccessorConstant(MapList const& receiver_maps, |
82 Handle<Object> constant, | 81 Handle<Object> constant, |
83 MaybeHandle<JSObject> holder); | 82 MaybeHandle<JSObject> holder); |
84 static PropertyAccessInfo Generic(MapList const& receiver_maps); | |
85 | 83 |
86 PropertyAccessInfo(); | 84 PropertyAccessInfo(); |
87 | 85 |
88 bool Merge(PropertyAccessInfo const* that) WARN_UNUSED_RESULT; | 86 bool Merge(PropertyAccessInfo const* that) WARN_UNUSED_RESULT; |
89 | 87 |
90 bool IsNotFound() const { return kind() == kNotFound; } | 88 bool IsNotFound() const { return kind() == kNotFound; } |
91 bool IsDataConstant() const { return kind() == kDataConstant; } | 89 bool IsDataConstant() const { return kind() == kDataConstant; } |
92 bool IsDataField() const { return kind() == kDataField; } | 90 bool IsDataField() const { return kind() == kDataField; } |
93 // TODO(ishell): rename to IsDataConstant() once constant field tracking | 91 // TODO(ishell): rename to IsDataConstant() once constant field tracking |
94 // is done. | 92 // is done. |
95 bool IsDataConstantField() const { return kind() == kDataConstantField; } | 93 bool IsDataConstantField() const { return kind() == kDataConstantField; } |
96 bool IsAccessorConstant() const { return kind() == kAccessorConstant; } | 94 bool IsAccessorConstant() const { return kind() == kAccessorConstant; } |
97 bool IsGeneric() const { return kind() == kGeneric; } | |
98 | 95 |
99 bool HasTransitionMap() const { return !transition_map().is_null(); } | 96 bool HasTransitionMap() const { return !transition_map().is_null(); } |
100 | 97 |
101 Kind kind() const { return kind_; } | 98 Kind kind() const { return kind_; } |
102 MaybeHandle<JSObject> holder() const { return holder_; } | 99 MaybeHandle<JSObject> holder() const { return holder_; } |
103 MaybeHandle<Map> transition_map() const { return transition_map_; } | 100 MaybeHandle<Map> transition_map() const { return transition_map_; } |
104 Handle<Object> constant() const { return constant_; } | 101 Handle<Object> constant() const { return constant_; } |
105 FieldIndex field_index() const { return field_index_; } | 102 FieldIndex field_index() const { return field_index_; } |
106 Type* field_type() const { return field_type_; } | 103 Type* field_type() const { return field_type_; } |
107 MachineRepresentation field_representation() const { | 104 MachineRepresentation field_representation() const { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 Zone* const zone_; | 168 Zone* const zone_; |
172 | 169 |
173 DISALLOW_COPY_AND_ASSIGN(AccessInfoFactory); | 170 DISALLOW_COPY_AND_ASSIGN(AccessInfoFactory); |
174 }; | 171 }; |
175 | 172 |
176 } // namespace compiler | 173 } // namespace compiler |
177 } // namespace internal | 174 } // namespace internal |
178 } // namespace v8 | 175 } // namespace v8 |
179 | 176 |
180 #endif // V8_COMPILER_ACCESS_INFO_H_ | 177 #endif // V8_COMPILER_ACCESS_INFO_H_ |
OLD | NEW |