| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ElementsKind elements_kind_; | 48 ElementsKind elements_kind_; |
| 49 MaybeHandle<JSObject> holder_; | 49 MaybeHandle<JSObject> holder_; |
| 50 MapList receiver_maps_; | 50 MapList receiver_maps_; |
| 51 MapTransitionList transitions_; | 51 MapTransitionList transitions_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // This class encapsulates all information required to access a certain | 54 // This class encapsulates all information required to access a certain |
| 55 // object property, either on the object itself or on the prototype chain. | 55 // object property, either on the object itself or on the prototype chain. |
| 56 class PropertyAccessInfo final { | 56 class PropertyAccessInfo final { |
| 57 public: | 57 public: |
| 58 enum Kind { kInvalid, kNotFound, kDataConstant, kDataField }; | 58 enum Kind { |
| 59 kInvalid, |
| 60 kNotFound, |
| 61 kDataConstant, |
| 62 kDataField, |
| 63 kAccessorConstant |
| 64 }; |
| 59 | 65 |
| 60 static PropertyAccessInfo NotFound(MapList const& receiver_maps, | 66 static PropertyAccessInfo NotFound(MapList const& receiver_maps, |
| 61 MaybeHandle<JSObject> holder); | 67 MaybeHandle<JSObject> holder); |
| 62 static PropertyAccessInfo DataConstant(MapList const& receiver_maps, | 68 static PropertyAccessInfo DataConstant(MapList const& receiver_maps, |
| 63 Handle<Object> constant, | 69 Handle<Object> constant, |
| 64 MaybeHandle<JSObject> holder); | 70 MaybeHandle<JSObject> holder); |
| 65 static PropertyAccessInfo DataField( | 71 static PropertyAccessInfo DataField( |
| 66 MapList const& receiver_maps, FieldIndex field_index, Type* field_type, | 72 MapList const& receiver_maps, FieldIndex field_index, Type* field_type, |
| 67 MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(), | 73 MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(), |
| 68 MaybeHandle<Map> transition_map = MaybeHandle<Map>()); | 74 MaybeHandle<Map> transition_map = MaybeHandle<Map>()); |
| 75 static PropertyAccessInfo AccessorConstant(MapList const& receiver_maps, |
| 76 Handle<Object> constant, |
| 77 MaybeHandle<JSObject> holder); |
| 69 | 78 |
| 70 PropertyAccessInfo(); | 79 PropertyAccessInfo(); |
| 71 | 80 |
| 72 bool Merge(PropertyAccessInfo const* that) WARN_UNUSED_RESULT; | 81 bool Merge(PropertyAccessInfo const* that) WARN_UNUSED_RESULT; |
| 73 | 82 |
| 74 bool IsNotFound() const { return kind() == kNotFound; } | 83 bool IsNotFound() const { return kind() == kNotFound; } |
| 75 bool IsDataConstant() const { return kind() == kDataConstant; } | 84 bool IsDataConstant() const { return kind() == kDataConstant; } |
| 76 bool IsDataField() const { return kind() == kDataField; } | 85 bool IsDataField() const { return kind() == kDataField; } |
| 86 bool IsAccessorConstant() const { return kind() == kAccessorConstant; } |
| 77 | 87 |
| 78 bool HasTransitionMap() const { return !transition_map().is_null(); } | 88 bool HasTransitionMap() const { return !transition_map().is_null(); } |
| 79 | 89 |
| 80 Kind kind() const { return kind_; } | 90 Kind kind() const { return kind_; } |
| 81 MaybeHandle<JSObject> holder() const { return holder_; } | 91 MaybeHandle<JSObject> holder() const { return holder_; } |
| 82 MaybeHandle<Map> transition_map() const { return transition_map_; } | 92 MaybeHandle<Map> transition_map() const { return transition_map_; } |
| 83 Handle<Object> constant() const { return constant_; } | 93 Handle<Object> constant() const { return constant_; } |
| 84 FieldIndex field_index() const { return field_index_; } | 94 FieldIndex field_index() const { return field_index_; } |
| 85 Type* field_type() const { return field_type_; } | 95 Type* field_type() const { return field_type_; } |
| 86 MapList const& receiver_maps() const { return receiver_maps_; } | 96 MapList const& receiver_maps() const { return receiver_maps_; } |
| 87 | 97 |
| 88 private: | 98 private: |
| 89 PropertyAccessInfo(MaybeHandle<JSObject> holder, | 99 PropertyAccessInfo(MaybeHandle<JSObject> holder, |
| 90 MapList const& receiver_maps); | 100 MapList const& receiver_maps); |
| 91 PropertyAccessInfo(MaybeHandle<JSObject> holder, Handle<Object> constant, | 101 PropertyAccessInfo(Kind kind, MaybeHandle<JSObject> holder, |
| 92 MapList const& receiver_maps); | 102 Handle<Object> constant, MapList const& receiver_maps); |
| 93 PropertyAccessInfo(MaybeHandle<JSObject> holder, | 103 PropertyAccessInfo(MaybeHandle<JSObject> holder, |
| 94 MaybeHandle<Map> transition_map, FieldIndex field_index, | 104 MaybeHandle<Map> transition_map, FieldIndex field_index, |
| 95 Type* field_type, MapList const& receiver_maps); | 105 Type* field_type, MapList const& receiver_maps); |
| 96 | 106 |
| 97 Kind kind_; | 107 Kind kind_; |
| 98 MapList receiver_maps_; | 108 MapList receiver_maps_; |
| 99 Handle<Object> constant_; | 109 Handle<Object> constant_; |
| 100 MaybeHandle<Map> transition_map_; | 110 MaybeHandle<Map> transition_map_; |
| 101 MaybeHandle<JSObject> holder_; | 111 MaybeHandle<JSObject> holder_; |
| 102 FieldIndex field_index_; | 112 FieldIndex field_index_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 Zone* const zone_; | 152 Zone* const zone_; |
| 143 | 153 |
| 144 DISALLOW_COPY_AND_ASSIGN(AccessInfoFactory); | 154 DISALLOW_COPY_AND_ASSIGN(AccessInfoFactory); |
| 145 }; | 155 }; |
| 146 | 156 |
| 147 } // namespace compiler | 157 } // namespace compiler |
| 148 } // namespace internal | 158 } // namespace internal |
| 149 } // namespace v8 | 159 } // namespace v8 |
| 150 | 160 |
| 151 #endif // V8_COMPILER_ACCESS_INFO_H_ | 161 #endif // V8_COMPILER_ACCESS_INFO_H_ |
| OLD | NEW |