OLD | NEW |
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 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); | 2683 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
2684 if (!maybe_obj->ToObject(&obj)) return false; | 2684 if (!maybe_obj->ToObject(&obj)) return false; |
2685 } | 2685 } |
2686 set_scope_info_map(Map::cast(obj)); | 2686 set_scope_info_map(Map::cast(obj)); |
2687 | 2687 |
2688 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); | 2688 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); |
2689 if (!maybe_obj->ToObject(&obj)) return false; | 2689 if (!maybe_obj->ToObject(&obj)) return false; |
2690 } | 2690 } |
2691 set_heap_number_map(Map::cast(obj)); | 2691 set_heap_number_map(Map::cast(obj)); |
2692 | 2692 |
| 2693 { MaybeObject* maybe_obj = AllocateMap(FLOAT32x4_TYPE, Float32x4::kSize); |
| 2694 if (!maybe_obj->ToObject(&obj)) return false; |
| 2695 } |
| 2696 set_float32x4_map(Map::cast(obj)); |
| 2697 |
| 2698 { MaybeObject* maybe_obj = AllocateMap(INT32x4_TYPE, Int32x4::kSize); |
| 2699 if (!maybe_obj->ToObject(&obj)) return false; |
| 2700 } |
| 2701 set_int32x4_map(Map::cast(obj)); |
| 2702 |
2693 { MaybeObject* maybe_obj = AllocateMap(SYMBOL_TYPE, Symbol::kSize); | 2703 { MaybeObject* maybe_obj = AllocateMap(SYMBOL_TYPE, Symbol::kSize); |
2694 if (!maybe_obj->ToObject(&obj)) return false; | 2704 if (!maybe_obj->ToObject(&obj)) return false; |
2695 } | 2705 } |
2696 set_symbol_map(Map::cast(obj)); | 2706 set_symbol_map(Map::cast(obj)); |
2697 | 2707 |
2698 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); | 2708 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); |
2699 if (!maybe_obj->ToObject(&obj)) return false; | 2709 if (!maybe_obj->ToObject(&obj)) return false; |
2700 } | 2710 } |
2701 set_foreign_map(Map::cast(obj)); | 2711 set_foreign_map(Map::cast(obj)); |
2702 | 2712 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 if (!maybe_obj->ToObject(&obj)) return false; | 2801 if (!maybe_obj->ToObject(&obj)) return false; |
2792 } | 2802 } |
2793 set_external_unsigned_int_array_map(Map::cast(obj)); | 2803 set_external_unsigned_int_array_map(Map::cast(obj)); |
2794 | 2804 |
2795 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE, | 2805 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE, |
2796 ExternalArray::kAlignedSize); | 2806 ExternalArray::kAlignedSize); |
2797 if (!maybe_obj->ToObject(&obj)) return false; | 2807 if (!maybe_obj->ToObject(&obj)) return false; |
2798 } | 2808 } |
2799 set_external_float_array_map(Map::cast(obj)); | 2809 set_external_float_array_map(Map::cast(obj)); |
2800 | 2810 |
| 2811 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_FLOAT32x4_ARRAY_TYPE, |
| 2812 ExternalArray::kAlignedSize); |
| 2813 if (!maybe_obj->ToObject(&obj)) return false; |
| 2814 } |
| 2815 set_external_float32x4_array_map(Map::cast(obj)); |
| 2816 |
| 2817 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_INT32x4_ARRAY_TYPE, |
| 2818 ExternalArray::kAlignedSize); |
| 2819 if (!maybe_obj->ToObject(&obj)) return false; |
| 2820 } |
| 2821 set_external_int32x4_array_map(Map::cast(obj)); |
| 2822 |
2801 { MaybeObject* maybe_obj = | 2823 { MaybeObject* maybe_obj = |
2802 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); | 2824 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
2803 if (!maybe_obj->ToObject(&obj)) return false; | 2825 if (!maybe_obj->ToObject(&obj)) return false; |
2804 } | 2826 } |
2805 set_non_strict_arguments_elements_map(Map::cast(obj)); | 2827 set_non_strict_arguments_elements_map(Map::cast(obj)); |
2806 | 2828 |
2807 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_DOUBLE_ARRAY_TYPE, | 2829 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_DOUBLE_ARRAY_TYPE, |
2808 ExternalArray::kAlignedSize); | 2830 ExternalArray::kAlignedSize); |
2809 if (!maybe_obj->ToObject(&obj)) return false; | 2831 if (!maybe_obj->ToObject(&obj)) return false; |
2810 } | 2832 } |
(...skipping 30 matching lines...) Expand all Loading... |
2841 AllocateEmptyExternalArray(kExternalUnsignedIntArray); | 2863 AllocateEmptyExternalArray(kExternalUnsignedIntArray); |
2842 if (!maybe_obj->ToObject(&obj)) return false; | 2864 if (!maybe_obj->ToObject(&obj)) return false; |
2843 } | 2865 } |
2844 set_empty_external_unsigned_int_array(ExternalArray::cast(obj)); | 2866 set_empty_external_unsigned_int_array(ExternalArray::cast(obj)); |
2845 | 2867 |
2846 { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalFloatArray); | 2868 { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalFloatArray); |
2847 if (!maybe_obj->ToObject(&obj)) return false; | 2869 if (!maybe_obj->ToObject(&obj)) return false; |
2848 } | 2870 } |
2849 set_empty_external_float_array(ExternalArray::cast(obj)); | 2871 set_empty_external_float_array(ExternalArray::cast(obj)); |
2850 | 2872 |
| 2873 { MaybeObject* maybe_obj = |
| 2874 AllocateEmptyExternalArray(kExternalFloat32x4Array); |
| 2875 if (!maybe_obj->ToObject(&obj)) return false; |
| 2876 } |
| 2877 set_empty_external_float32x4_array(ExternalArray::cast(obj)); |
| 2878 |
| 2879 { MaybeObject* maybe_obj = |
| 2880 AllocateEmptyExternalArray(kExternalInt32x4Array); |
| 2881 if (!maybe_obj->ToObject(&obj)) return false; |
| 2882 } |
| 2883 set_empty_external_int32x4_array(ExternalArray::cast(obj)); |
| 2884 |
2851 { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalDoubleArray); | 2885 { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalDoubleArray); |
2852 if (!maybe_obj->ToObject(&obj)) return false; | 2886 if (!maybe_obj->ToObject(&obj)) return false; |
2853 } | 2887 } |
2854 set_empty_external_double_array(ExternalArray::cast(obj)); | 2888 set_empty_external_double_array(ExternalArray::cast(obj)); |
2855 | 2889 |
2856 { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalPixelArray); | 2890 { MaybeObject* maybe_obj = AllocateEmptyExternalArray(kExternalPixelArray); |
2857 if (!maybe_obj->ToObject(&obj)) return false; | 2891 if (!maybe_obj->ToObject(&obj)) return false; |
2858 } | 2892 } |
2859 set_empty_external_pixel_array(ExternalArray::cast(obj)); | 2893 set_empty_external_pixel_array(ExternalArray::cast(obj)); |
2860 | 2894 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2979 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); | 3013 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); |
2980 if (!maybe_result->ToObject(&result)) return maybe_result; | 3014 if (!maybe_result->ToObject(&result)) return maybe_result; |
2981 } | 3015 } |
2982 | 3016 |
2983 HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map()); | 3017 HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map()); |
2984 HeapNumber::cast(result)->set_value(value); | 3018 HeapNumber::cast(result)->set_value(value); |
2985 return result; | 3019 return result; |
2986 } | 3020 } |
2987 | 3021 |
2988 | 3022 |
| 3023 MaybeObject* Heap::AllocateFloat32x4(float32x4_value_t value, |
| 3024 PretenureFlag pretenure) { |
| 3025 // Statically ensure that it is safe to allocate float32x4 objects in paged |
| 3026 // spaces. |
| 3027 int size = Float32x4::kSize; |
| 3028 STATIC_ASSERT(Float32x4::kSize <= Page::kNonCodeObjectAreaSize); |
| 3029 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
| 3030 |
| 3031 Object* result; |
| 3032 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); |
| 3033 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3034 } |
| 3035 |
| 3036 HeapObject::cast(result)->set_map_no_write_barrier(float32x4_map()); |
| 3037 Float32x4::cast(result)->set_value(value); |
| 3038 return result; |
| 3039 } |
| 3040 |
| 3041 |
| 3042 MaybeObject* Heap::AllocateInt32x4(int32x4_value_t value, |
| 3043 PretenureFlag pretenure) { |
| 3044 // Statically ensure that it is safe to allocate int32x4 objects in paged |
| 3045 // spaces. |
| 3046 int size = Int32x4::kSize; |
| 3047 STATIC_ASSERT(Int32x4::kSize <= Page::kNonCodeObjectAreaSize); |
| 3048 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
| 3049 |
| 3050 Object* result; |
| 3051 { MaybeObject* maybe_result = AllocateRaw(size, space, OLD_DATA_SPACE); |
| 3052 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3053 } |
| 3054 |
| 3055 HeapObject::cast(result)->set_map_no_write_barrier(int32x4_map()); |
| 3056 Int32x4::cast(result)->set_value(value); |
| 3057 return result; |
| 3058 } |
| 3059 |
| 3060 |
2989 MaybeObject* Heap::AllocateCell(Object* value) { | 3061 MaybeObject* Heap::AllocateCell(Object* value) { |
2990 int size = Cell::kSize; | 3062 int size = Cell::kSize; |
2991 STATIC_ASSERT(Cell::kSize <= Page::kNonCodeObjectAreaSize); | 3063 STATIC_ASSERT(Cell::kSize <= Page::kNonCodeObjectAreaSize); |
2992 | 3064 |
2993 Object* result; | 3065 Object* result; |
2994 { MaybeObject* maybe_result = AllocateRaw(size, CELL_SPACE, CELL_SPACE); | 3066 { MaybeObject* maybe_result = AllocateRaw(size, CELL_SPACE, CELL_SPACE); |
2995 if (!maybe_result->ToObject(&result)) return maybe_result; | 3067 if (!maybe_result->ToObject(&result)) return maybe_result; |
2996 } | 3068 } |
2997 HeapObject::cast(result)->set_map_no_write_barrier(cell_map()); | 3069 HeapObject::cast(result)->set_map_no_write_barrier(cell_map()); |
2998 Cell::cast(result)->set_value(value); | 3070 Cell::cast(result)->set_value(value); |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 case kExternalShortArray: | 3720 case kExternalShortArray: |
3649 return kExternalShortArrayMapRootIndex; | 3721 return kExternalShortArrayMapRootIndex; |
3650 case kExternalUnsignedShortArray: | 3722 case kExternalUnsignedShortArray: |
3651 return kExternalUnsignedShortArrayMapRootIndex; | 3723 return kExternalUnsignedShortArrayMapRootIndex; |
3652 case kExternalIntArray: | 3724 case kExternalIntArray: |
3653 return kExternalIntArrayMapRootIndex; | 3725 return kExternalIntArrayMapRootIndex; |
3654 case kExternalUnsignedIntArray: | 3726 case kExternalUnsignedIntArray: |
3655 return kExternalUnsignedIntArrayMapRootIndex; | 3727 return kExternalUnsignedIntArrayMapRootIndex; |
3656 case kExternalFloatArray: | 3728 case kExternalFloatArray: |
3657 return kExternalFloatArrayMapRootIndex; | 3729 return kExternalFloatArrayMapRootIndex; |
| 3730 case kExternalFloat32x4Array: |
| 3731 return kExternalFloat32x4ArrayMapRootIndex; |
| 3732 case kExternalInt32x4Array: |
| 3733 return kExternalInt32x4ArrayMapRootIndex; |
3658 case kExternalDoubleArray: | 3734 case kExternalDoubleArray: |
3659 return kExternalDoubleArrayMapRootIndex; | 3735 return kExternalDoubleArrayMapRootIndex; |
3660 case kExternalPixelArray: | 3736 case kExternalPixelArray: |
3661 return kExternalPixelArrayMapRootIndex; | 3737 return kExternalPixelArrayMapRootIndex; |
3662 default: | 3738 default: |
3663 UNREACHABLE(); | 3739 UNREACHABLE(); |
3664 return kUndefinedValueRootIndex; | 3740 return kUndefinedValueRootIndex; |
3665 } | 3741 } |
3666 } | 3742 } |
3667 | 3743 |
3668 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray( | 3744 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray( |
3669 ElementsKind elementsKind) { | 3745 ElementsKind elementsKind) { |
3670 switch (elementsKind) { | 3746 switch (elementsKind) { |
3671 case EXTERNAL_BYTE_ELEMENTS: | 3747 case EXTERNAL_BYTE_ELEMENTS: |
3672 return kEmptyExternalByteArrayRootIndex; | 3748 return kEmptyExternalByteArrayRootIndex; |
3673 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3749 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
3674 return kEmptyExternalUnsignedByteArrayRootIndex; | 3750 return kEmptyExternalUnsignedByteArrayRootIndex; |
3675 case EXTERNAL_SHORT_ELEMENTS: | 3751 case EXTERNAL_SHORT_ELEMENTS: |
3676 return kEmptyExternalShortArrayRootIndex; | 3752 return kEmptyExternalShortArrayRootIndex; |
3677 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3753 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
3678 return kEmptyExternalUnsignedShortArrayRootIndex; | 3754 return kEmptyExternalUnsignedShortArrayRootIndex; |
3679 case EXTERNAL_INT_ELEMENTS: | 3755 case EXTERNAL_INT_ELEMENTS: |
3680 return kEmptyExternalIntArrayRootIndex; | 3756 return kEmptyExternalIntArrayRootIndex; |
3681 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3757 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
3682 return kEmptyExternalUnsignedIntArrayRootIndex; | 3758 return kEmptyExternalUnsignedIntArrayRootIndex; |
3683 case EXTERNAL_FLOAT_ELEMENTS: | 3759 case EXTERNAL_FLOAT_ELEMENTS: |
3684 return kEmptyExternalFloatArrayRootIndex; | 3760 return kEmptyExternalFloatArrayRootIndex; |
| 3761 case EXTERNAL_FLOAT32x4_ELEMENTS: |
| 3762 return kEmptyExternalFloat32x4ArrayRootIndex; |
| 3763 case EXTERNAL_INT32x4_ELEMENTS: |
| 3764 return kEmptyExternalInt32x4ArrayRootIndex; |
3685 case EXTERNAL_DOUBLE_ELEMENTS: | 3765 case EXTERNAL_DOUBLE_ELEMENTS: |
3686 return kEmptyExternalDoubleArrayRootIndex; | 3766 return kEmptyExternalDoubleArrayRootIndex; |
3687 case EXTERNAL_PIXEL_ELEMENTS: | 3767 case EXTERNAL_PIXEL_ELEMENTS: |
3688 return kEmptyExternalPixelArrayRootIndex; | 3768 return kEmptyExternalPixelArrayRootIndex; |
3689 default: | 3769 default: |
3690 UNREACHABLE(); | 3770 UNREACHABLE(); |
3691 return kUndefinedValueRootIndex; | 3771 return kUndefinedValueRootIndex; |
3692 } | 3772 } |
3693 } | 3773 } |
3694 | 3774 |
(...skipping 4268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7963 static_cast<int>(object_sizes_last_time_[index])); | 8043 static_cast<int>(object_sizes_last_time_[index])); |
7964 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 8044 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
7965 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 8045 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7966 | 8046 |
7967 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 8047 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7968 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 8048 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7969 ClearObjectStats(); | 8049 ClearObjectStats(); |
7970 } | 8050 } |
7971 | 8051 |
7972 } } // namespace v8::internal | 8052 } } // namespace v8::internal |
OLD | NEW |