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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 CAST_ACCESSOR(Symbol) | 3364 CAST_ACCESSOR(Symbol) |
3365 CAST_ACCESSOR(TemplateInfo) | 3365 CAST_ACCESSOR(TemplateInfo) |
3366 CAST_ACCESSOR(Uint16x8) | 3366 CAST_ACCESSOR(Uint16x8) |
3367 CAST_ACCESSOR(Uint32x4) | 3367 CAST_ACCESSOR(Uint32x4) |
3368 CAST_ACCESSOR(Uint8x16) | 3368 CAST_ACCESSOR(Uint8x16) |
3369 CAST_ACCESSOR(UnseededNumberDictionary) | 3369 CAST_ACCESSOR(UnseededNumberDictionary) |
3370 CAST_ACCESSOR(WeakCell) | 3370 CAST_ACCESSOR(WeakCell) |
3371 CAST_ACCESSOR(WeakFixedArray) | 3371 CAST_ACCESSOR(WeakFixedArray) |
3372 CAST_ACCESSOR(WeakHashTable) | 3372 CAST_ACCESSOR(WeakHashTable) |
3373 | 3373 |
| 3374 template <class T> |
| 3375 PodArray<T>* PodArray<T>::cast(Object* object) { |
| 3376 SLOW_DCHECK(object->IsByteArray()); |
| 3377 return reinterpret_cast<PodArray<T>*>(object); |
| 3378 } |
| 3379 template <class T> |
| 3380 const PodArray<T>* PodArray<T>::cast(const Object* object) { |
| 3381 SLOW_DCHECK(object->IsByteArray()); |
| 3382 return reinterpret_cast<const PodArray<T>*>(object); |
| 3383 } |
| 3384 |
| 3385 // static |
| 3386 template <class T> |
| 3387 Handle<PodArray<T>> PodArray<T>::New(Isolate* isolate, int length, |
| 3388 PretenureFlag pretenure) { |
| 3389 return Handle<PodArray<T>>::cast( |
| 3390 isolate->factory()->NewByteArray(length * sizeof(T), pretenure)); |
| 3391 } |
3374 | 3392 |
3375 // static | 3393 // static |
3376 template <class Traits> | 3394 template <class Traits> |
3377 STATIC_CONST_MEMBER_DEFINITION const InstanceType | 3395 STATIC_CONST_MEMBER_DEFINITION const InstanceType |
3378 FixedTypedArray<Traits>::kInstanceType; | 3396 FixedTypedArray<Traits>::kInstanceType; |
3379 | 3397 |
3380 | 3398 |
3381 template <class Traits> | 3399 template <class Traits> |
3382 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { | 3400 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { |
3383 SLOW_DCHECK(object->IsHeapObject() && | 3401 SLOW_DCHECK(object->IsHeapObject() && |
(...skipping 22 matching lines...) Expand all Loading... |
3406 } | 3424 } |
3407 | 3425 |
3408 DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) | 3426 DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) |
3409 DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) | 3427 DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) |
3410 DEFINE_DEOPT_ELEMENT_ACCESSORS(LiteralArray, FixedArray) | 3428 DEFINE_DEOPT_ELEMENT_ACCESSORS(LiteralArray, FixedArray) |
3411 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrAstId, Smi) | 3429 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrAstId, Smi) |
3412 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrPcOffset, Smi) | 3430 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrPcOffset, Smi) |
3413 DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi) | 3431 DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi) |
3414 DEFINE_DEOPT_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) | 3432 DEFINE_DEOPT_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) |
3415 DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object) | 3433 DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object) |
| 3434 DEFINE_DEOPT_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>) |
3416 | 3435 |
3417 #undef DEFINE_DEOPT_ELEMENT_ACCESSORS | 3436 #undef DEFINE_DEOPT_ELEMENT_ACCESSORS |
3418 | 3437 |
3419 | 3438 |
3420 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ | 3439 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ |
3421 type* DeoptimizationInputData::name(int i) { \ | 3440 type* DeoptimizationInputData::name(int i) { \ |
3422 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 3441 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
3423 } \ | 3442 } \ |
3424 void DeoptimizationInputData::Set##name(int i, type* value) { \ | 3443 void DeoptimizationInputData::Set##name(int i, type* value) { \ |
3425 set(IndexForEntry(i) + k##name##Offset, value); \ | 3444 set(IndexForEntry(i) + k##name##Offset, value); \ |
(...skipping 4994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8420 #undef WRITE_INT64_FIELD | 8439 #undef WRITE_INT64_FIELD |
8421 #undef READ_BYTE_FIELD | 8440 #undef READ_BYTE_FIELD |
8422 #undef WRITE_BYTE_FIELD | 8441 #undef WRITE_BYTE_FIELD |
8423 #undef NOBARRIER_READ_BYTE_FIELD | 8442 #undef NOBARRIER_READ_BYTE_FIELD |
8424 #undef NOBARRIER_WRITE_BYTE_FIELD | 8443 #undef NOBARRIER_WRITE_BYTE_FIELD |
8425 | 8444 |
8426 } // namespace internal | 8445 } // namespace internal |
8427 } // namespace v8 | 8446 } // namespace v8 |
8428 | 8447 |
8429 #endif // V8_OBJECTS_INL_H_ | 8448 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |