OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // | 148 // |
149 // Formats of Object*: | 149 // Formats of Object*: |
150 // Smi: [31 bit signed int] 0 | 150 // Smi: [31 bit signed int] 0 |
151 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 | 151 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
152 | 152 |
153 namespace v8 { | 153 namespace v8 { |
154 namespace internal { | 154 namespace internal { |
155 | 155 |
156 enum KeyedAccessStoreMode { | 156 enum KeyedAccessStoreMode { |
157 STANDARD_STORE, | 157 STANDARD_STORE, |
158 STORE_TRANSITION_SMI_TO_OBJECT, | 158 STORE_TRANSITION_TO_OBJECT, |
159 STORE_TRANSITION_SMI_TO_DOUBLE, | 159 STORE_TRANSITION_TO_DOUBLE, |
160 STORE_TRANSITION_DOUBLE_TO_OBJECT, | |
161 STORE_TRANSITION_HOLEY_SMI_TO_OBJECT, | |
162 STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE, | |
163 STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, | |
164 STORE_AND_GROW_NO_TRANSITION, | 160 STORE_AND_GROW_NO_TRANSITION, |
165 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT, | 161 STORE_AND_GROW_TRANSITION_TO_OBJECT, |
166 STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE, | 162 STORE_AND_GROW_TRANSITION_TO_DOUBLE, |
167 STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT, | |
168 STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT, | |
169 STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE, | |
170 STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, | |
171 STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, | 163 STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, |
172 STORE_NO_TRANSITION_HANDLE_COW | 164 STORE_NO_TRANSITION_HANDLE_COW |
173 }; | 165 }; |
174 | 166 |
175 | 167 |
176 enum TypeofMode { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; | 168 enum TypeofMode { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; |
177 | 169 |
178 | 170 |
179 enum MutableMode { | 171 enum MutableMode { |
180 MUTABLE, | 172 MUTABLE, |
181 IMMUTABLE | 173 IMMUTABLE |
182 }; | 174 }; |
183 | 175 |
184 | 176 |
185 enum ExternalArrayType { | 177 enum ExternalArrayType { |
186 kExternalInt8Array = 1, | 178 kExternalInt8Array = 1, |
187 kExternalUint8Array, | 179 kExternalUint8Array, |
188 kExternalInt16Array, | 180 kExternalInt16Array, |
189 kExternalUint16Array, | 181 kExternalUint16Array, |
190 kExternalInt32Array, | 182 kExternalInt32Array, |
191 kExternalUint32Array, | 183 kExternalUint32Array, |
192 kExternalFloat32Array, | 184 kExternalFloat32Array, |
193 kExternalFloat64Array, | 185 kExternalFloat64Array, |
194 kExternalUint8ClampedArray, | 186 kExternalUint8ClampedArray, |
195 }; | 187 }; |
196 | 188 |
197 | 189 |
198 static const int kGrowICDelta = STORE_AND_GROW_NO_TRANSITION - | 190 static inline bool IsTransitionStoreMode(KeyedAccessStoreMode store_mode) { |
199 STANDARD_STORE; | 191 return store_mode == STORE_TRANSITION_TO_OBJECT || |
200 STATIC_ASSERT(STANDARD_STORE == 0); | 192 store_mode == STORE_TRANSITION_TO_DOUBLE || |
201 STATIC_ASSERT(kGrowICDelta == | 193 store_mode == STORE_AND_GROW_TRANSITION_TO_OBJECT || |
202 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT - | 194 store_mode == STORE_AND_GROW_TRANSITION_TO_DOUBLE; |
203 STORE_TRANSITION_SMI_TO_OBJECT); | |
204 STATIC_ASSERT(kGrowICDelta == | |
205 STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE - | |
206 STORE_TRANSITION_SMI_TO_DOUBLE); | |
207 STATIC_ASSERT(kGrowICDelta == | |
208 STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT - | |
209 STORE_TRANSITION_DOUBLE_TO_OBJECT); | |
210 | |
211 | |
212 static inline KeyedAccessStoreMode GetGrowStoreMode( | |
213 KeyedAccessStoreMode store_mode) { | |
214 if (store_mode < STORE_AND_GROW_NO_TRANSITION) { | |
215 store_mode = static_cast<KeyedAccessStoreMode>( | |
216 static_cast<int>(store_mode) + kGrowICDelta); | |
217 } | |
218 return store_mode; | |
219 } | 195 } |
220 | 196 |
221 | 197 |
222 static inline bool IsTransitionStoreMode(KeyedAccessStoreMode store_mode) { | |
223 return store_mode > STANDARD_STORE && | |
224 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT && | |
225 store_mode != STORE_AND_GROW_NO_TRANSITION; | |
226 } | |
227 | |
228 | |
229 static inline KeyedAccessStoreMode GetNonTransitioningStoreMode( | 198 static inline KeyedAccessStoreMode GetNonTransitioningStoreMode( |
230 KeyedAccessStoreMode store_mode) { | 199 KeyedAccessStoreMode store_mode) { |
231 if (store_mode >= STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { | 200 if (store_mode >= STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
232 return store_mode; | 201 return store_mode; |
233 } | 202 } |
234 if (store_mode >= STORE_AND_GROW_NO_TRANSITION) { | 203 if (store_mode >= STORE_AND_GROW_NO_TRANSITION) { |
235 return STORE_AND_GROW_NO_TRANSITION; | 204 return STORE_AND_GROW_NO_TRANSITION; |
236 } | 205 } |
237 return STANDARD_STORE; | 206 return STANDARD_STORE; |
238 } | 207 } |
239 | 208 |
240 | 209 |
241 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { | 210 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { |
242 return store_mode >= STORE_AND_GROW_NO_TRANSITION && | 211 return store_mode >= STORE_AND_GROW_NO_TRANSITION && |
243 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; | 212 store_mode <= STORE_AND_GROW_TRANSITION_TO_DOUBLE; |
244 } | 213 } |
245 | 214 |
246 | 215 |
247 enum IcCheckType { ELEMENT, PROPERTY }; | 216 enum IcCheckType { ELEMENT, PROPERTY }; |
248 | 217 |
249 | 218 |
250 // SKIP_WRITE_BARRIER skips the write barrier. | 219 // SKIP_WRITE_BARRIER skips the write barrier. |
251 // UPDATE_WEAK_WRITE_BARRIER skips the marking part of the write barrier and | 220 // UPDATE_WEAK_WRITE_BARRIER skips the marking part of the write barrier and |
252 // only performs the generational part. | 221 // only performs the generational part. |
253 // UPDATE_WRITE_BARRIER is doing the full barrier, marking and generational. | 222 // UPDATE_WRITE_BARRIER is doing the full barrier, marking and generational. |
(...skipping 9981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10235 } else { | 10204 } else { |
10236 value &= ~(1 << bit_position); | 10205 value &= ~(1 << bit_position); |
10237 } | 10206 } |
10238 return value; | 10207 return value; |
10239 } | 10208 } |
10240 }; | 10209 }; |
10241 | 10210 |
10242 } } // namespace v8::internal | 10211 } } // namespace v8::internal |
10243 | 10212 |
10244 #endif // V8_OBJECTS_H_ | 10213 #endif // V8_OBJECTS_H_ |
OLD | NEW |