Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/ic/handler-configuration.h

Issue 2488673004: [ic] Support data handlers that represent transitioning stores. (Closed)
Patch Set: Rebasing again Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/counters.h ('k') | src/ic/handler-configuration-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 // loading value from prototype chain. Ignored when loading from holder. 30 // loading value from prototype chain. Ignored when loading from holder.
31 class DoNegativeLookupOnReceiverBits 31 class DoNegativeLookupOnReceiverBits
32 : public BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1> {}; 32 : public BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1> {};
33 33
34 // 34 //
35 // Encoding when KindBits contains kForConstants. 35 // Encoding when KindBits contains kForConstants.
36 // 36 //
37 37
38 class IsAccessorInfoBits 38 class IsAccessorInfoBits
39 : public BitField<bool, DoNegativeLookupOnReceiverBits::kNext, 1> {}; 39 : public BitField<bool, DoNegativeLookupOnReceiverBits::kNext, 1> {};
40 // Index of a value entry in the descriptor array.
40 // +2 here is because each descriptor entry occupies 3 slots in array. 41 // +2 here is because each descriptor entry occupies 3 slots in array.
41 class DescriptorValueIndexBits 42 class DescriptorValueIndexBits
42 : public BitField<unsigned, IsAccessorInfoBits::kNext, 43 : public BitField<unsigned, IsAccessorInfoBits::kNext,
43 kDescriptorIndexBitCount + 2> {}; 44 kDescriptorIndexBitCount + 2> {};
44 // Make sure we don't overflow the smi. 45 // Make sure we don't overflow the smi.
45 STATIC_ASSERT(DescriptorValueIndexBits::kNext <= kSmiValueSize); 46 STATIC_ASSERT(DescriptorValueIndexBits::kNext <= kSmiValueSize);
46 47
47 // 48 //
48 // Encoding when KindBits contains kForFields. 49 // Encoding when KindBits contains kForFields.
49 // 50 //
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Creates a Smi-handler for loading an element. 111 // Creates a Smi-handler for loading an element.
111 static inline Handle<Object> LoadElement(Isolate* isolate, 112 static inline Handle<Object> LoadElement(Isolate* isolate,
112 ElementsKind elements_kind, 113 ElementsKind elements_kind,
113 bool convert_hole_to_undefined, 114 bool convert_hole_to_undefined,
114 bool is_js_array); 115 bool is_js_array);
115 }; 116 };
116 117
117 // A set of bit fields representing Smi handlers for stores. 118 // A set of bit fields representing Smi handlers for stores.
118 class StoreHandler { 119 class StoreHandler {
119 public: 120 public:
120 enum Kind { kForElements, kForFields }; 121 enum Kind {
121 class KindBits : public BitField<Kind, 0, 1> {}; 122 kStoreElement,
123 kStoreField,
124 kTransitionToField,
125 kTransitionToConstant
126 };
127 class KindBits : public BitField<Kind, 0, 2> {};
122 128
123 enum FieldRepresentation { kSmi, kDouble, kHeapObject, kTagged }; 129 enum FieldRepresentation { kSmi, kDouble, kHeapObject, kTagged };
124 130
131 // Applicable to kStoreField, kTransitionToField and kTransitionToConstant
132 // kinds.
133
134 // Index of a value entry in the descriptor array.
135 // +2 here is because each descriptor entry occupies 3 slots in array.
136 class DescriptorValueIndexBits
137 : public BitField<unsigned, KindBits::kNext,
138 kDescriptorIndexBitCount + 2> {};
125 // 139 //
126 // Encoding when KindBits contains kForFields. 140 // Encoding when KindBits contains kTransitionToConstant.
127 // 141 //
128 class IsInobjectBits : public BitField<bool, KindBits::kNext, 1> {}; 142
143 // Make sure we don't overflow the smi.
144 STATIC_ASSERT(DescriptorValueIndexBits::kNext <= kSmiValueSize);
145
146 //
147 // Encoding when KindBits contains kStoreField or kTransitionToField.
148 //
149 class ExtendStorageBits
150 : public BitField<bool, DescriptorValueIndexBits::kNext, 1> {};
151 class IsInobjectBits : public BitField<bool, ExtendStorageBits::kNext, 1> {};
129 class FieldRepresentationBits 152 class FieldRepresentationBits
130 : public BitField<FieldRepresentation, IsInobjectBits::kNext, 2> {}; 153 : public BitField<FieldRepresentation, IsInobjectBits::kNext, 2> {};
131 // +2 here is because each descriptor entry occupies 3 slots in array.
132 class DescriptorValueIndexBits
133 : public BitField<unsigned, FieldRepresentationBits::kNext,
134 kDescriptorIndexBitCount + 2> {};
135 // +1 here is to cover all possible JSObject header sizes. 154 // +1 here is to cover all possible JSObject header sizes.
136 class FieldOffsetBits 155 class FieldOffsetBits
137 : public BitField<unsigned, DescriptorValueIndexBits::kNext, 156 : public BitField<unsigned, FieldRepresentationBits::kNext,
138 kDescriptorIndexBitCount + 1 + kPointerSizeLog2> {}; 157 kDescriptorIndexBitCount + 1 + kPointerSizeLog2> {};
139 // Make sure we don't overflow the smi. 158 // Make sure we don't overflow the smi.
140 STATIC_ASSERT(FieldOffsetBits::kNext <= kSmiValueSize); 159 STATIC_ASSERT(FieldOffsetBits::kNext <= kSmiValueSize);
141 160
161 // The layout of an Tuple3 handler representing a transitioning store
162 // when prototype chain checks do not include non-existing lookups or access
163 // checks.
164 static const int kTransitionCellOffset = Tuple3::kValue1Offset;
165 static const int kSmiHandlerOffset = Tuple3::kValue2Offset;
166 static const int kValidityCellOffset = Tuple3::kValue3Offset;
167
168 // The layout of an array handler representing a transitioning store
169 // when prototype chain checks include non-existing lookups and access checks.
170 static const int kSmiHandlerIndex = 0;
171 static const int kValidityCellIndex = 1;
172 static const int kTransitionCellIndex = 2;
173 static const int kFirstPrototypeIndex = 3;
174
142 // Creates a Smi-handler for storing a field to fast object. 175 // Creates a Smi-handler for storing a field to fast object.
143 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor, 176 static inline Handle<Object> StoreField(Isolate* isolate, int descriptor,
144 FieldIndex field_index, 177 FieldIndex field_index,
145 Representation representation); 178 Representation representation);
179
180 // Creates a Smi-handler for transitioning store to a field.
181 static inline Handle<Object> TransitionToField(Isolate* isolate,
182 int descriptor,
183 FieldIndex field_index,
184 Representation representation,
185 bool extend_storage);
186
187 // 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).
189 static inline Handle<Object> TransitionToConstant(Isolate* isolate,
190 int descriptor);
191
192 private:
193 static inline Handle<Object> StoreField(Isolate* isolate, Kind kind,
194 int descriptor,
195 FieldIndex field_index,
196 Representation representation,
197 bool extend_storage);
146 }; 198 };
147 199
148 } // namespace internal 200 } // namespace internal
149 } // namespace v8 201 } // namespace v8
150 202
151 #endif // V8_IC_HANDLER_CONFIGURATION_H_ 203 #endif // V8_IC_HANDLER_CONFIGURATION_H_
OLDNEW
« no previous file with comments | « src/counters.h ('k') | src/ic/handler-configuration-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698