OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_IC_HANDLER_CONFIGURATION_H_ | 5 #ifndef V8_IC_HANDLER_CONFIGURATION_H_ |
6 #define V8_IC_HANDLER_CONFIGURATION_H_ | 6 #define V8_IC_HANDLER_CONFIGURATION_H_ |
7 | 7 |
8 #include "src/elements-kind.h" | 8 #include "src/elements-kind.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool convert_hole_to_undefined, | 114 bool convert_hole_to_undefined, |
115 bool is_js_array); | 115 bool is_js_array); |
116 }; | 116 }; |
117 | 117 |
118 // A set of bit fields representing Smi handlers for stores. | 118 // A set of bit fields representing Smi handlers for stores. |
119 class StoreHandler { | 119 class StoreHandler { |
120 public: | 120 public: |
121 enum Kind { | 121 enum Kind { |
122 kStoreElement, | 122 kStoreElement, |
123 kStoreField, | 123 kStoreField, |
| 124 kStoreConstField, |
124 kTransitionToField, | 125 kTransitionToField, |
125 kTransitionToConstant | 126 // TODO(ishell): remove once constant field tracking is done. |
| 127 kTransitionToConstant = kStoreConstField |
126 }; | 128 }; |
127 class KindBits : public BitField<Kind, 0, 2> {}; | 129 class KindBits : public BitField<Kind, 0, 2> {}; |
128 | 130 |
129 enum FieldRepresentation { kSmi, kDouble, kHeapObject, kTagged }; | 131 enum FieldRepresentation { kSmi, kDouble, kHeapObject, kTagged }; |
130 | 132 |
131 // Applicable to kStoreField, kTransitionToField and kTransitionToConstant | 133 // Applicable to kStoreField, kTransitionToField and kTransitionToConstant |
132 // kinds. | 134 // kinds. |
133 | 135 |
134 // Index of a value entry in the descriptor array. | 136 // Index of a value entry in the descriptor array. |
135 // +2 here is because each descriptor entry occupies 3 slots in array. | 137 // +2 here is because each descriptor entry occupies 3 slots in array. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // The layout of an array handler representing a transitioning store | 170 // The layout of an array handler representing a transitioning store |
169 // when prototype chain checks include non-existing lookups and access checks. | 171 // when prototype chain checks include non-existing lookups and access checks. |
170 static const int kSmiHandlerIndex = 0; | 172 static const int kSmiHandlerIndex = 0; |
171 static const int kValidityCellIndex = 1; | 173 static const int kValidityCellIndex = 1; |
172 static const int kTransitionCellIndex = 2; | 174 static const int kTransitionCellIndex = 2; |
173 static const int kFirstPrototypeIndex = 3; | 175 static const int kFirstPrototypeIndex = 3; |
174 | 176 |
175 // Creates a Smi-handler for storing a field to fast object. | 177 // Creates a Smi-handler for storing a field to fast object. |
176 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, | 178 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, |
177 FieldIndex field_index, | 179 FieldIndex field_index, |
| 180 PropertyConstness constness, |
178 Representation representation); | 181 Representation representation); |
179 | 182 |
180 // Creates a Smi-handler for transitioning store to a field. | 183 // Creates a Smi-handler for transitioning store to a field. |
181 static inline Handle<Object> TransitionToField(Isolate* isolate, | 184 static inline Handle<Object> TransitionToField(Isolate* isolate, |
182 int descriptor, | 185 int descriptor, |
183 FieldIndex field_index, | 186 FieldIndex field_index, |
184 Representation representation, | 187 Representation representation, |
185 bool extend_storage); | 188 bool extend_storage); |
186 | 189 |
187 // Creates a Smi-handler for transitioning store to a constant field (in this | 190 // Creates a Smi-handler for transitioning store to a constant field (in this |
188 // case the only thing that needs to be done is an update of a map). | 191 // case the only thing that needs to be done is an update of a map). |
189 static inline Handle<Object> TransitionToConstant(Isolate* isolate, | 192 static inline Handle<Object> TransitionToConstant(Isolate* isolate, |
190 int descriptor); | 193 int descriptor); |
191 | 194 |
192 private: | 195 private: |
193 static inline Handle<Object> StoreField(Isolate* isolate, Kind kind, | 196 static inline Handle<Object> StoreField(Isolate* isolate, Kind kind, |
194 int descriptor, | 197 int descriptor, |
195 FieldIndex field_index, | 198 FieldIndex field_index, |
196 Representation representation, | 199 Representation representation, |
197 bool extend_storage); | 200 bool extend_storage); |
198 }; | 201 }; |
199 | 202 |
200 } // namespace internal | 203 } // namespace internal |
201 } // namespace v8 | 204 } // namespace v8 |
202 | 205 |
203 #endif // V8_IC_HANDLER_CONFIGURATION_H_ | 206 #endif // V8_IC_HANDLER_CONFIGURATION_H_ |
OLD | NEW |