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 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3381 CAST_ACCESSOR(Symbol) | 3381 CAST_ACCESSOR(Symbol) |
3382 CAST_ACCESSOR(TemplateInfo) | 3382 CAST_ACCESSOR(TemplateInfo) |
3383 CAST_ACCESSOR(Uint16x8) | 3383 CAST_ACCESSOR(Uint16x8) |
3384 CAST_ACCESSOR(Uint32x4) | 3384 CAST_ACCESSOR(Uint32x4) |
3385 CAST_ACCESSOR(Uint8x16) | 3385 CAST_ACCESSOR(Uint8x16) |
3386 CAST_ACCESSOR(UnseededNumberDictionary) | 3386 CAST_ACCESSOR(UnseededNumberDictionary) |
3387 CAST_ACCESSOR(WeakCell) | 3387 CAST_ACCESSOR(WeakCell) |
3388 CAST_ACCESSOR(WeakFixedArray) | 3388 CAST_ACCESSOR(WeakFixedArray) |
3389 CAST_ACCESSOR(WeakHashTable) | 3389 CAST_ACCESSOR(WeakHashTable) |
3390 | 3390 |
| 3391 template <class T> |
| 3392 PodArray<T>* PodArray<T>::cast(Object* object) { |
| 3393 SLOW_DCHECK(object->IsByteArray()); |
| 3394 return reinterpret_cast<PodArray<T>*>(object); |
| 3395 } |
| 3396 template <class T> |
| 3397 const PodArray<T>* PodArray<T>::cast(const Object* object) { |
| 3398 SLOW_DCHECK(object->IsByteArray()); |
| 3399 return reinterpret_cast<const PodArray<T>*>(object); |
| 3400 } |
| 3401 |
| 3402 // static |
| 3403 template <class T> |
| 3404 Handle<PodArray<T>> PodArray<T>::New(Isolate* isolate, int length, |
| 3405 PretenureFlag pretenure) { |
| 3406 return Handle<PodArray<T>>::cast( |
| 3407 isolate->factory()->NewByteArray(length * sizeof(T), pretenure)); |
| 3408 } |
3391 | 3409 |
3392 // static | 3410 // static |
3393 template <class Traits> | 3411 template <class Traits> |
3394 STATIC_CONST_MEMBER_DEFINITION const InstanceType | 3412 STATIC_CONST_MEMBER_DEFINITION const InstanceType |
3395 FixedTypedArray<Traits>::kInstanceType; | 3413 FixedTypedArray<Traits>::kInstanceType; |
3396 | 3414 |
3397 | 3415 |
3398 template <class Traits> | 3416 template <class Traits> |
3399 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { | 3417 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { |
3400 SLOW_DCHECK(object->IsHeapObject() && | 3418 SLOW_DCHECK(object->IsHeapObject() && |
(...skipping 22 matching lines...) Expand all Loading... |
3423 } | 3441 } |
3424 | 3442 |
3425 DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) | 3443 DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) |
3426 DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) | 3444 DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) |
3427 DEFINE_DEOPT_ELEMENT_ACCESSORS(LiteralArray, FixedArray) | 3445 DEFINE_DEOPT_ELEMENT_ACCESSORS(LiteralArray, FixedArray) |
3428 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrAstId, Smi) | 3446 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrAstId, Smi) |
3429 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrPcOffset, Smi) | 3447 DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrPcOffset, Smi) |
3430 DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi) | 3448 DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi) |
3431 DEFINE_DEOPT_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) | 3449 DEFINE_DEOPT_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) |
3432 DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object) | 3450 DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object) |
| 3451 DEFINE_DEOPT_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>) |
3433 | 3452 |
3434 #undef DEFINE_DEOPT_ELEMENT_ACCESSORS | 3453 #undef DEFINE_DEOPT_ELEMENT_ACCESSORS |
3435 | 3454 |
3436 | 3455 |
3437 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ | 3456 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ |
3438 type* DeoptimizationInputData::name(int i) { \ | 3457 type* DeoptimizationInputData::name(int i) { \ |
3439 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 3458 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
3440 } \ | 3459 } \ |
3441 void DeoptimizationInputData::Set##name(int i, type* value) { \ | 3460 void DeoptimizationInputData::Set##name(int i, type* value) { \ |
3442 set(IndexForEntry(i) + k##name##Offset, value); \ | 3461 set(IndexForEntry(i) + k##name##Offset, value); \ |
(...skipping 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8431 #undef WRITE_INT64_FIELD | 8450 #undef WRITE_INT64_FIELD |
8432 #undef READ_BYTE_FIELD | 8451 #undef READ_BYTE_FIELD |
8433 #undef WRITE_BYTE_FIELD | 8452 #undef WRITE_BYTE_FIELD |
8434 #undef NOBARRIER_READ_BYTE_FIELD | 8453 #undef NOBARRIER_READ_BYTE_FIELD |
8435 #undef NOBARRIER_WRITE_BYTE_FIELD | 8454 #undef NOBARRIER_WRITE_BYTE_FIELD |
8436 | 8455 |
8437 } // namespace internal | 8456 } // namespace internal |
8438 } // namespace v8 | 8457 } // namespace v8 |
8439 | 8458 |
8440 #endif // V8_OBJECTS_INL_H_ | 8459 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |