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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ | 2870 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ |
2871 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) | 2871 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) |
2872 | 2872 |
2873 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) | 2873 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) |
2874 DCHECK(fixed_array_map() != fixed_cow_array_map()); | 2874 DCHECK(fixed_array_map() != fixed_cow_array_map()); |
2875 | 2875 |
2876 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) | 2876 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) |
2877 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) | 2877 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) |
2878 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, | 2878 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, |
2879 mutable_heap_number) | 2879 mutable_heap_number) |
2880 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4) | |
2881 ALLOCATE_MAP(INT32X4_TYPE, Int32x4::kSize, int32x4) | |
2882 ALLOCATE_MAP(BOOL32X4_TYPE, Bool32x4::kSize, bool32x4) | |
2883 ALLOCATE_MAP(INT16X8_TYPE, Int16x8::kSize, int16x8) | |
2884 ALLOCATE_MAP(BOOL16X8_TYPE, Bool16x8::kSize, bool16x8) | |
2885 ALLOCATE_MAP(INT8X16_TYPE, Int8x16::kSize, int8x16) | |
2886 ALLOCATE_MAP(BOOL8X16_TYPE, Bool8x16::kSize, bool8x16) | |
2887 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) | 2880 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) |
| 2881 #define ALLOCATE_SIMD128_MAP(TYPE, Type, type, lane_count, lane_type) \ |
| 2882 ALLOCATE_MAP(SIMD128_VALUE_TYPE, Type::kSize, type) |
| 2883 SIMD128_TYPES(ALLOCATE_SIMD128_MAP) |
| 2884 #undef ALLOCATE_SIMD128_MAP |
2888 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) | 2885 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) |
2889 | 2886 |
2890 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); | 2887 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); |
2891 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); | 2888 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); |
2892 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); | 2889 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); |
2893 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); | 2890 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); |
2894 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); | 2891 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); |
2895 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); | 2892 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); |
2896 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); | 2893 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); |
2897 | 2894 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3016 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned); | 3013 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned); |
3017 if (!allocation.To(&result)) return allocation; | 3014 if (!allocation.To(&result)) return allocation; |
3018 } | 3015 } |
3019 | 3016 |
3020 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); | 3017 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); |
3021 HeapObject::cast(result)->set_map_no_write_barrier(map); | 3018 HeapObject::cast(result)->set_map_no_write_barrier(map); |
3022 HeapNumber::cast(result)->set_value(value); | 3019 HeapNumber::cast(result)->set_value(value); |
3023 return result; | 3020 return result; |
3024 } | 3021 } |
3025 | 3022 |
3026 #define SIMD_ALLOCATE_DEFINITION(type, type_name, lane_count, lane_type) \ | 3023 #define SIMD_ALLOCATE_DEFINITION(TYPE, Type, type, lane_count, lane_type) \ |
3027 AllocationResult Heap::Allocate##type(lane_type lanes[lane_count], \ | 3024 AllocationResult Heap::Allocate##Type(lane_type lanes[lane_count], \ |
3028 PretenureFlag pretenure) { \ | 3025 PretenureFlag pretenure) { \ |
3029 int size = type::kSize; \ | 3026 int size = Type::kSize; \ |
3030 STATIC_ASSERT(type::kSize <= Page::kMaxRegularHeapObjectSize); \ | 3027 STATIC_ASSERT(Type::kSize <= Page::kMaxRegularHeapObjectSize); \ |
3031 \ | 3028 \ |
3032 AllocationSpace space = SelectSpace(size, pretenure); \ | 3029 AllocationSpace space = SelectSpace(size, pretenure); \ |
3033 \ | 3030 \ |
3034 HeapObject* result; \ | 3031 HeapObject* result; \ |
3035 { \ | 3032 { \ |
3036 AllocationResult allocation = \ | 3033 AllocationResult allocation = \ |
3037 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \ | 3034 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \ |
3038 if (!allocation.To(&result)) return allocation; \ | 3035 if (!allocation.To(&result)) return allocation; \ |
3039 } \ | 3036 } \ |
3040 \ | 3037 \ |
3041 result->set_map_no_write_barrier(type_name##_map()); \ | 3038 result->set_map_no_write_barrier(type##_map()); \ |
3042 type* instance = type::cast(result); \ | 3039 Type* instance = Type::cast(result); \ |
3043 for (int i = 0; i < lane_count; i++) { \ | 3040 for (int i = 0; i < lane_count; i++) { \ |
3044 instance->set_lane(i, lanes[i]); \ | 3041 instance->set_lane(i, lanes[i]); \ |
3045 } \ | 3042 } \ |
3046 return result; \ | 3043 return result; \ |
3047 } | 3044 } |
3048 | |
3049 SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION) | 3045 SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION) |
| 3046 #undef SIMD_ALLOCATE_DEFINITION |
3050 | 3047 |
3051 | 3048 |
3052 AllocationResult Heap::AllocateCell(Object* value) { | 3049 AllocationResult Heap::AllocateCell(Object* value) { |
3053 int size = Cell::kSize; | 3050 int size = Cell::kSize; |
3054 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); | 3051 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); |
3055 | 3052 |
3056 HeapObject* result; | 3053 HeapObject* result; |
3057 { | 3054 { |
3058 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); | 3055 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
3059 if (!allocation.To(&result)) return allocation; | 3056 if (!allocation.To(&result)) return allocation; |
(...skipping 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6902 *object_type = "CODE_TYPE"; \ | 6899 *object_type = "CODE_TYPE"; \ |
6903 *object_sub_type = "CODE_AGE/" #name; \ | 6900 *object_sub_type = "CODE_AGE/" #name; \ |
6904 return true; | 6901 return true; |
6905 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6902 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6906 #undef COMPARE_AND_RETURN_NAME | 6903 #undef COMPARE_AND_RETURN_NAME |
6907 } | 6904 } |
6908 return false; | 6905 return false; |
6909 } | 6906 } |
6910 } // namespace internal | 6907 } // namespace internal |
6911 } // namespace v8 | 6908 } // namespace v8 |
OLD | NEW |