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

Side by Side Diff: src/objects-inl.h

Issue 145133013: External Array renaming and boilerplate scrapping (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE) 595 TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
596 596
597 597
598 bool Object::IsFiller() { 598 bool Object::IsFiller() {
599 if (!Object::IsHeapObject()) return false; 599 if (!Object::IsHeapObject()) return false;
600 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type(); 600 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
601 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE; 601 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE;
602 } 602 }
603 603
604 604
605 TYPE_CHECKER(ExternalPixelArray, EXTERNAL_PIXEL_ARRAY_TYPE)
606
607
608 bool Object::IsExternalArray() { 605 bool Object::IsExternalArray() {
609 if (!Object::IsHeapObject()) 606 if (!Object::IsHeapObject())
610 return false; 607 return false;
611 InstanceType instance_type = 608 InstanceType instance_type =
612 HeapObject::cast(this)->map()->instance_type(); 609 HeapObject::cast(this)->map()->instance_type();
613 return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE && 610 return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE &&
614 instance_type <= LAST_EXTERNAL_ARRAY_TYPE); 611 instance_type <= LAST_EXTERNAL_ARRAY_TYPE);
615 } 612 }
616 613
617 614
618 TYPE_CHECKER(ExternalByteArray, EXTERNAL_BYTE_ARRAY_TYPE) 615 #define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \
619 TYPE_CHECKER(ExternalUnsignedByteArray, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) 616 TYPE_CHECKER(External##Type##Array, EXTERNAL_##TYPE##_ARRAY_TYPE) \
620 TYPE_CHECKER(ExternalShortArray, EXTERNAL_SHORT_ARRAY_TYPE) 617 TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE)
621 TYPE_CHECKER(ExternalUnsignedShortArray, EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) 618
622 TYPE_CHECKER(ExternalIntArray, EXTERNAL_INT_ARRAY_TYPE) 619 TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER)
623 TYPE_CHECKER(ExternalUnsignedIntArray, EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) 620 #undef TYPED_ARRAY_TYPE_CHECKER
624 TYPE_CHECKER(ExternalFloatArray, EXTERNAL_FLOAT_ARRAY_TYPE)
625 TYPE_CHECKER(ExternalDoubleArray, EXTERNAL_DOUBLE_ARRAY_TYPE)
626 621
627 622
628 bool Object::IsFixedTypedArrayBase() { 623 bool Object::IsFixedTypedArrayBase() {
629 if (!Object::IsHeapObject()) return false; 624 if (!Object::IsHeapObject()) return false;
630 625
631 InstanceType instance_type = 626 InstanceType instance_type =
632 HeapObject::cast(this)->map()->instance_type(); 627 HeapObject::cast(this)->map()->instance_type();
633 return (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE && 628 return (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
634 instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE); 629 instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE);
635 } 630 }
636 631
637 632
638 TYPE_CHECKER(FixedUint8Array, FIXED_UINT8_ARRAY_TYPE)
639 TYPE_CHECKER(FixedInt8Array, FIXED_INT8_ARRAY_TYPE)
640 TYPE_CHECKER(FixedUint16Array, FIXED_UINT16_ARRAY_TYPE)
641 TYPE_CHECKER(FixedInt16Array, FIXED_INT16_ARRAY_TYPE)
642 TYPE_CHECKER(FixedUint32Array, FIXED_UINT32_ARRAY_TYPE)
643 TYPE_CHECKER(FixedInt32Array, FIXED_INT32_ARRAY_TYPE)
644 TYPE_CHECKER(FixedFloat32Array, FIXED_FLOAT32_ARRAY_TYPE)
645 TYPE_CHECKER(FixedFloat64Array, FIXED_FLOAT64_ARRAY_TYPE)
646 TYPE_CHECKER(FixedUint8ClampedArray, FIXED_UINT8_CLAMPED_ARRAY_TYPE)
647
648
649 bool MaybeObject::IsFailure() { 633 bool MaybeObject::IsFailure() {
650 return HAS_FAILURE_TAG(this); 634 return HAS_FAILURE_TAG(this);
651 } 635 }
652 636
653 637
654 bool MaybeObject::IsRetryAfterGC() { 638 bool MaybeObject::IsRetryAfterGC() {
655 return HAS_FAILURE_TAG(this) 639 return HAS_FAILURE_TAG(this)
656 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; 640 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC;
657 } 641 }
658 642
(...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 CAST_ACCESSOR(JSProxy) 2827 CAST_ACCESSOR(JSProxy)
2844 CAST_ACCESSOR(JSFunctionProxy) 2828 CAST_ACCESSOR(JSFunctionProxy)
2845 CAST_ACCESSOR(JSSet) 2829 CAST_ACCESSOR(JSSet)
2846 CAST_ACCESSOR(JSMap) 2830 CAST_ACCESSOR(JSMap)
2847 CAST_ACCESSOR(JSWeakMap) 2831 CAST_ACCESSOR(JSWeakMap)
2848 CAST_ACCESSOR(JSWeakSet) 2832 CAST_ACCESSOR(JSWeakSet)
2849 CAST_ACCESSOR(Foreign) 2833 CAST_ACCESSOR(Foreign)
2850 CAST_ACCESSOR(ByteArray) 2834 CAST_ACCESSOR(ByteArray)
2851 CAST_ACCESSOR(FreeSpace) 2835 CAST_ACCESSOR(FreeSpace)
2852 CAST_ACCESSOR(ExternalArray) 2836 CAST_ACCESSOR(ExternalArray)
2853 CAST_ACCESSOR(ExternalByteArray) 2837 CAST_ACCESSOR(ExternalInt8Array)
2854 CAST_ACCESSOR(ExternalUnsignedByteArray) 2838 CAST_ACCESSOR(ExternalUint8Array)
2855 CAST_ACCESSOR(ExternalShortArray) 2839 CAST_ACCESSOR(ExternalInt16Array)
2856 CAST_ACCESSOR(ExternalUnsignedShortArray) 2840 CAST_ACCESSOR(ExternalUint16Array)
2857 CAST_ACCESSOR(ExternalIntArray) 2841 CAST_ACCESSOR(ExternalInt32Array)
2858 CAST_ACCESSOR(ExternalUnsignedIntArray) 2842 CAST_ACCESSOR(ExternalUint32Array)
2859 CAST_ACCESSOR(ExternalFloatArray) 2843 CAST_ACCESSOR(ExternalFloat32Array)
2860 CAST_ACCESSOR(ExternalDoubleArray) 2844 CAST_ACCESSOR(ExternalFloat64Array)
2861 CAST_ACCESSOR(ExternalPixelArray) 2845 CAST_ACCESSOR(ExternalUint8ClampedArray)
2862 CAST_ACCESSOR(Struct) 2846 CAST_ACCESSOR(Struct)
2863 CAST_ACCESSOR(AccessorInfo) 2847 CAST_ACCESSOR(AccessorInfo)
2864 2848
2865 template <class Traits> 2849 template <class Traits>
2866 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { 2850 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) {
2867 SLOW_ASSERT(object->IsHeapObject() && 2851 SLOW_ASSERT(object->IsHeapObject() &&
2868 HeapObject::cast(object)->map()->instance_type() == 2852 HeapObject::cast(object)->map()->instance_type() ==
2869 Traits::kInstanceType); 2853 Traits::kInstanceType);
2870 return reinterpret_cast<FixedTypedArray<Traits>*>(object); 2854 return reinterpret_cast<FixedTypedArray<Traits>*>(object);
2871 } 2855 }
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3450 ASSERT_TAG_ALIGNED(address); 3434 ASSERT_TAG_ALIGNED(address);
3451 return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag); 3435 return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag);
3452 } 3436 }
3453 3437
3454 3438
3455 Address ByteArray::GetDataStartAddress() { 3439 Address ByteArray::GetDataStartAddress() {
3456 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize; 3440 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
3457 } 3441 }
3458 3442
3459 3443
3460 uint8_t* ExternalPixelArray::external_pixel_pointer() { 3444 uint8_t* ExternalUint8ClampedArray::external_uint8_clamped_pointer() {
3461 return reinterpret_cast<uint8_t*>(external_pointer()); 3445 return reinterpret_cast<uint8_t*>(external_pointer());
3462 } 3446 }
3463 3447
3464 3448
3465 uint8_t ExternalPixelArray::get_scalar(int index) { 3449 uint8_t ExternalUint8ClampedArray::get_scalar(int index) {
3466 ASSERT((index >= 0) && (index < this->length())); 3450 ASSERT((index >= 0) && (index < this->length()));
3467 uint8_t* ptr = external_pixel_pointer(); 3451 uint8_t* ptr = external_uint8_clamped_pointer();
3468 return ptr[index]; 3452 return ptr[index];
3469 } 3453 }
3470 3454
3471 3455
3472 MaybeObject* ExternalPixelArray::get(int index) { 3456 MaybeObject* ExternalUint8ClampedArray::get(int index) {
3473 return Smi::FromInt(static_cast<int>(get_scalar(index))); 3457 return Smi::FromInt(static_cast<int>(get_scalar(index)));
3474 } 3458 }
3475 3459
3476 3460
3477 void ExternalPixelArray::set(int index, uint8_t value) { 3461 void ExternalUint8ClampedArray::set(int index, uint8_t value) {
3478 ASSERT((index >= 0) && (index < this->length())); 3462 ASSERT((index >= 0) && (index < this->length()));
3479 uint8_t* ptr = external_pixel_pointer(); 3463 uint8_t* ptr = external_uint8_clamped_pointer();
3480 ptr[index] = value; 3464 ptr[index] = value;
3481 } 3465 }
3482 3466
3483 3467
3484 void* ExternalArray::external_pointer() { 3468 void* ExternalArray::external_pointer() {
3485 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset); 3469 intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
3486 return reinterpret_cast<void*>(ptr); 3470 return reinterpret_cast<void*>(ptr);
3487 } 3471 }
3488 3472
3489 3473
3490 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) { 3474 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) {
3491 intptr_t ptr = reinterpret_cast<intptr_t>(value); 3475 intptr_t ptr = reinterpret_cast<intptr_t>(value);
3492 WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr); 3476 WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr);
3493 } 3477 }
3494 3478
3495 3479
3496 int8_t ExternalByteArray::get_scalar(int index) { 3480 int8_t ExternalInt8Array::get_scalar(int index) {
3497 ASSERT((index >= 0) && (index < this->length())); 3481 ASSERT((index >= 0) && (index < this->length()));
3498 int8_t* ptr = static_cast<int8_t*>(external_pointer()); 3482 int8_t* ptr = static_cast<int8_t*>(external_pointer());
3499 return ptr[index]; 3483 return ptr[index];
3500 } 3484 }
3501 3485
3502 3486
3503 MaybeObject* ExternalByteArray::get(int index) { 3487 MaybeObject* ExternalInt8Array::get(int index) {
3504 return Smi::FromInt(static_cast<int>(get_scalar(index))); 3488 return Smi::FromInt(static_cast<int>(get_scalar(index)));
3505 } 3489 }
3506 3490
3507 3491
3508 void ExternalByteArray::set(int index, int8_t value) { 3492 void ExternalInt8Array::set(int index, int8_t value) {
3509 ASSERT((index >= 0) && (index < this->length())); 3493 ASSERT((index >= 0) && (index < this->length()));
3510 int8_t* ptr = static_cast<int8_t*>(external_pointer()); 3494 int8_t* ptr = static_cast<int8_t*>(external_pointer());
3511 ptr[index] = value; 3495 ptr[index] = value;
3512 } 3496 }
3513 3497
3514 3498
3515 uint8_t ExternalUnsignedByteArray::get_scalar(int index) { 3499 uint8_t ExternalUint8Array::get_scalar(int index) {
3516 ASSERT((index >= 0) && (index < this->length())); 3500 ASSERT((index >= 0) && (index < this->length()));
3517 uint8_t* ptr = static_cast<uint8_t*>(external_pointer()); 3501 uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
3518 return ptr[index]; 3502 return ptr[index];
3519 } 3503 }
3520 3504
3521 3505
3522 MaybeObject* ExternalUnsignedByteArray::get(int index) { 3506 MaybeObject* ExternalUint8Array::get(int index) {
3523 return Smi::FromInt(static_cast<int>(get_scalar(index))); 3507 return Smi::FromInt(static_cast<int>(get_scalar(index)));
3524 } 3508 }
3525 3509
3526 3510
3527 void ExternalUnsignedByteArray::set(int index, uint8_t value) { 3511 void ExternalUint8Array::set(int index, uint8_t value) {
3528 ASSERT((index >= 0) && (index < this->length())); 3512 ASSERT((index >= 0) && (index < this->length()));
3529 uint8_t* ptr = static_cast<uint8_t*>(external_pointer()); 3513 uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
3530 ptr[index] = value; 3514 ptr[index] = value;
3531 } 3515 }
3532 3516
3533 3517
3534 int16_t ExternalShortArray::get_scalar(int index) { 3518 int16_t ExternalInt16Array::get_scalar(int index) {
3535 ASSERT((index >= 0) && (index < this->length())); 3519 ASSERT((index >= 0) && (index < this->length()));
3536 int16_t* ptr = static_cast<int16_t*>(external_pointer()); 3520 int16_t* ptr = static_cast<int16_t*>(external_pointer());
3537 return ptr[index]; 3521 return ptr[index];
3538 } 3522 }
3539 3523
3540 3524
3541 MaybeObject* ExternalShortArray::get(int index) { 3525 MaybeObject* ExternalInt16Array::get(int index) {
3542 return Smi::FromInt(static_cast<int>(get_scalar(index))); 3526 return Smi::FromInt(static_cast<int>(get_scalar(index)));
3543 } 3527 }
3544 3528
3545 3529
3546 void ExternalShortArray::set(int index, int16_t value) { 3530 void ExternalInt16Array::set(int index, int16_t value) {
3547 ASSERT((index >= 0) && (index < this->length())); 3531 ASSERT((index >= 0) && (index < this->length()));
3548 int16_t* ptr = static_cast<int16_t*>(external_pointer()); 3532 int16_t* ptr = static_cast<int16_t*>(external_pointer());
3549 ptr[index] = value; 3533 ptr[index] = value;
3550 } 3534 }
3551 3535
3552 3536
3553 uint16_t ExternalUnsignedShortArray::get_scalar(int index) { 3537 uint16_t ExternalUint16Array::get_scalar(int index) {
3554 ASSERT((index >= 0) && (index < this->length())); 3538 ASSERT((index >= 0) && (index < this->length()));
3555 uint16_t* ptr = static_cast<uint16_t*>(external_pointer()); 3539 uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
3556 return ptr[index]; 3540 return ptr[index];
3557 } 3541 }
3558 3542
3559 3543
3560 MaybeObject* ExternalUnsignedShortArray::get(int index) { 3544 MaybeObject* ExternalUint16Array::get(int index) {
3561 return Smi::FromInt(static_cast<int>(get_scalar(index))); 3545 return Smi::FromInt(static_cast<int>(get_scalar(index)));
3562 } 3546 }
3563 3547
3564 3548
3565 void ExternalUnsignedShortArray::set(int index, uint16_t value) { 3549 void ExternalUint16Array::set(int index, uint16_t value) {
3566 ASSERT((index >= 0) && (index < this->length())); 3550 ASSERT((index >= 0) && (index < this->length()));
3567 uint16_t* ptr = static_cast<uint16_t*>(external_pointer()); 3551 uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
3568 ptr[index] = value; 3552 ptr[index] = value;
3569 } 3553 }
3570 3554
3571 3555
3572 int32_t ExternalIntArray::get_scalar(int index) { 3556 int32_t ExternalInt32Array::get_scalar(int index) {
3573 ASSERT((index >= 0) && (index < this->length())); 3557 ASSERT((index >= 0) && (index < this->length()));
3574 int32_t* ptr = static_cast<int32_t*>(external_pointer()); 3558 int32_t* ptr = static_cast<int32_t*>(external_pointer());
3575 return ptr[index]; 3559 return ptr[index];
3576 } 3560 }
3577 3561
3578 3562
3579 MaybeObject* ExternalIntArray::get(int index) { 3563 MaybeObject* ExternalInt32Array::get(int index) {
3580 return GetHeap()->NumberFromInt32(get_scalar(index)); 3564 return GetHeap()->NumberFromInt32(get_scalar(index));
3581 } 3565 }
3582 3566
3583 3567
3584 void ExternalIntArray::set(int index, int32_t value) { 3568 void ExternalInt32Array::set(int index, int32_t value) {
3585 ASSERT((index >= 0) && (index < this->length())); 3569 ASSERT((index >= 0) && (index < this->length()));
3586 int32_t* ptr = static_cast<int32_t*>(external_pointer()); 3570 int32_t* ptr = static_cast<int32_t*>(external_pointer());
3587 ptr[index] = value; 3571 ptr[index] = value;
3588 } 3572 }
3589 3573
3590 3574
3591 uint32_t ExternalUnsignedIntArray::get_scalar(int index) { 3575 uint32_t ExternalUint32Array::get_scalar(int index) {
3592 ASSERT((index >= 0) && (index < this->length())); 3576 ASSERT((index >= 0) && (index < this->length()));
3593 uint32_t* ptr = static_cast<uint32_t*>(external_pointer()); 3577 uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
3594 return ptr[index]; 3578 return ptr[index];
3595 } 3579 }
3596 3580
3597 3581
3598 MaybeObject* ExternalUnsignedIntArray::get(int index) { 3582 MaybeObject* ExternalUint32Array::get(int index) {
3599 return GetHeap()->NumberFromUint32(get_scalar(index)); 3583 return GetHeap()->NumberFromUint32(get_scalar(index));
3600 } 3584 }
3601 3585
3602 3586
3603 void ExternalUnsignedIntArray::set(int index, uint32_t value) { 3587 void ExternalUint32Array::set(int index, uint32_t value) {
3604 ASSERT((index >= 0) && (index < this->length())); 3588 ASSERT((index >= 0) && (index < this->length()));
3605 uint32_t* ptr = static_cast<uint32_t*>(external_pointer()); 3589 uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
3606 ptr[index] = value; 3590 ptr[index] = value;
3607 } 3591 }
3608 3592
3609 3593
3610 float ExternalFloatArray::get_scalar(int index) { 3594 float ExternalFloat32Array::get_scalar(int index) {
3611 ASSERT((index >= 0) && (index < this->length())); 3595 ASSERT((index >= 0) && (index < this->length()));
3612 float* ptr = static_cast<float*>(external_pointer()); 3596 float* ptr = static_cast<float*>(external_pointer());
3613 return ptr[index]; 3597 return ptr[index];
3614 } 3598 }
3615 3599
3616 3600
3617 MaybeObject* ExternalFloatArray::get(int index) { 3601 MaybeObject* ExternalFloat32Array::get(int index) {
3618 return GetHeap()->NumberFromDouble(get_scalar(index)); 3602 return GetHeap()->NumberFromDouble(get_scalar(index));
3619 } 3603 }
3620 3604
3621 3605
3622 void ExternalFloatArray::set(int index, float value) { 3606 void ExternalFloat32Array::set(int index, float value) {
3623 ASSERT((index >= 0) && (index < this->length())); 3607 ASSERT((index >= 0) && (index < this->length()));
3624 float* ptr = static_cast<float*>(external_pointer()); 3608 float* ptr = static_cast<float*>(external_pointer());
3625 ptr[index] = value; 3609 ptr[index] = value;
3626 } 3610 }
3627 3611
3628 3612
3629 double ExternalDoubleArray::get_scalar(int index) { 3613 double ExternalFloat64Array::get_scalar(int index) {
3630 ASSERT((index >= 0) && (index < this->length())); 3614 ASSERT((index >= 0) && (index < this->length()));
3631 double* ptr = static_cast<double*>(external_pointer()); 3615 double* ptr = static_cast<double*>(external_pointer());
3632 return ptr[index]; 3616 return ptr[index];
3633 } 3617 }
3634 3618
3635 3619
3636 MaybeObject* ExternalDoubleArray::get(int index) { 3620 MaybeObject* ExternalFloat64Array::get(int index) {
3637 return GetHeap()->NumberFromDouble(get_scalar(index)); 3621 return GetHeap()->NumberFromDouble(get_scalar(index));
3638 } 3622 }
3639 3623
3640 3624
3641 void ExternalDoubleArray::set(int index, double value) { 3625 void ExternalFloat64Array::set(int index, double value) {
3642 ASSERT((index >= 0) && (index < this->length())); 3626 ASSERT((index >= 0) && (index < this->length()));
3643 double* ptr = static_cast<double*>(external_pointer()); 3627 double* ptr = static_cast<double*>(external_pointer());
3644 ptr[index] = value; 3628 ptr[index] = value;
3645 } 3629 }
3646 3630
3647 3631
3648 int FixedTypedArrayBase::size() { 3632 int FixedTypedArrayBase::size() {
3649 InstanceType instance_type = map()->instance_type(); 3633 InstanceType instance_type = map()->instance_type();
3650 int element_size; 3634 int element_size;
3651 switch (instance_type) { 3635 switch (instance_type) {
(...skipping 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
5983 } 5967 }
5984 5968
5985 5969
5986 bool JSObject::HasExternalArrayElements() { 5970 bool JSObject::HasExternalArrayElements() {
5987 HeapObject* array = elements(); 5971 HeapObject* array = elements();
5988 ASSERT(array != NULL); 5972 ASSERT(array != NULL);
5989 return array->IsExternalArray(); 5973 return array->IsExternalArray();
5990 } 5974 }
5991 5975
5992 5976
5993 #define EXTERNAL_ELEMENTS_CHECK(name, type) \ 5977 #define EXTERNAL_ELEMENTS_CHECK(Type, type, TYPE, ctype, size) \
5994 bool JSObject::HasExternal##name##Elements() { \ 5978 bool JSObject::HasExternal##Type##Elements() { \
5995 HeapObject* array = elements(); \ 5979 HeapObject* array = elements(); \
5996 ASSERT(array != NULL); \ 5980 ASSERT(array != NULL); \
5997 if (!array->IsHeapObject()) \ 5981 if (!array->IsHeapObject()) \
5998 return false; \ 5982 return false; \
5999 return array->map()->instance_type() == type; \ 5983 return array->map()->instance_type() == EXTERNAL_##TYPE##_ARRAY_TYPE; \
6000 } 5984 }
6001 5985
5986 TYPED_ARRAYS(EXTERNAL_ELEMENTS_CHECK)
6002 5987
6003 EXTERNAL_ELEMENTS_CHECK(Byte, EXTERNAL_BYTE_ARRAY_TYPE) 5988 #undef EXTERNAL_ELEMENTS_CHECK
6004 EXTERNAL_ELEMENTS_CHECK(UnsignedByte, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE)
6005 EXTERNAL_ELEMENTS_CHECK(Short, EXTERNAL_SHORT_ARRAY_TYPE)
6006 EXTERNAL_ELEMENTS_CHECK(UnsignedShort,
6007 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE)
6008 EXTERNAL_ELEMENTS_CHECK(Int, EXTERNAL_INT_ARRAY_TYPE)
6009 EXTERNAL_ELEMENTS_CHECK(UnsignedInt,
6010 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE)
6011 EXTERNAL_ELEMENTS_CHECK(Float,
6012 EXTERNAL_FLOAT_ARRAY_TYPE)
6013 EXTERNAL_ELEMENTS_CHECK(Double,
6014 EXTERNAL_DOUBLE_ARRAY_TYPE)
6015 EXTERNAL_ELEMENTS_CHECK(Pixel, EXTERNAL_PIXEL_ARRAY_TYPE)
6016 5989
6017 5990
6018 bool JSObject::HasFixedTypedArrayElements() { 5991 bool JSObject::HasFixedTypedArrayElements() {
6019 HeapObject* array = elements(); 5992 HeapObject* array = elements();
6020 ASSERT(array != NULL); 5993 ASSERT(array != NULL);
6021 return array->IsFixedTypedArrayBase(); 5994 return array->IsFixedTypedArrayBase();
6022 } 5995 }
6023 5996
6024 5997
6025 bool JSObject::HasNamedInterceptor() { 5998 bool JSObject::HasNamedInterceptor() {
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
6805 #undef READ_UINT32_FIELD 6778 #undef READ_UINT32_FIELD
6806 #undef WRITE_UINT32_FIELD 6779 #undef WRITE_UINT32_FIELD
6807 #undef READ_SHORT_FIELD 6780 #undef READ_SHORT_FIELD
6808 #undef WRITE_SHORT_FIELD 6781 #undef WRITE_SHORT_FIELD
6809 #undef READ_BYTE_FIELD 6782 #undef READ_BYTE_FIELD
6810 #undef WRITE_BYTE_FIELD 6783 #undef WRITE_BYTE_FIELD
6811 6784
6812 } } // namespace v8::internal 6785 } } // namespace v8::internal
6813 6786
6814 #endif // V8_OBJECTS_INL_H_ 6787 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/api.cc ('K') | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698