| 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 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2735 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ | 2735 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ |
| 2736 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) | 2736 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) |
| 2737 | 2737 |
| 2738 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) | 2738 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) |
| 2739 DCHECK(fixed_array_map() != fixed_cow_array_map()); | 2739 DCHECK(fixed_array_map() != fixed_cow_array_map()); |
| 2740 | 2740 |
| 2741 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) | 2741 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) |
| 2742 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) | 2742 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) |
| 2743 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, | 2743 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, |
| 2744 mutable_heap_number) | 2744 mutable_heap_number) |
| 2745 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4) |
| 2745 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) | 2746 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) |
| 2746 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) | 2747 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) |
| 2747 | 2748 |
| 2748 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); | 2749 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); |
| 2749 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); | 2750 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); |
| 2750 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); | 2751 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); |
| 2751 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); | 2752 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); |
| 2752 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); | 2753 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); |
| 2753 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); | 2754 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); |
| 2754 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); | 2755 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2884 if (!allocation.To(&result)) return allocation; | 2885 if (!allocation.To(&result)) return allocation; |
| 2885 } | 2886 } |
| 2886 | 2887 |
| 2887 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); | 2888 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); |
| 2888 HeapObject::cast(result)->set_map_no_write_barrier(map); | 2889 HeapObject::cast(result)->set_map_no_write_barrier(map); |
| 2889 HeapNumber::cast(result)->set_value(value); | 2890 HeapNumber::cast(result)->set_value(value); |
| 2890 return result; | 2891 return result; |
| 2891 } | 2892 } |
| 2892 | 2893 |
| 2893 | 2894 |
| 2895 AllocationResult Heap::AllocateFloat32x4(float w, float x, float y, float z, |
| 2896 PretenureFlag pretenure) { |
| 2897 // Statically ensure that it is safe to allocate SIMD values in paged |
| 2898 // spaces. |
| 2899 int size = Float32x4::kSize; |
| 2900 STATIC_ASSERT(Float32x4::kSize <= Page::kMaxRegularHeapObjectSize); |
| 2901 |
| 2902 AllocationSpace space = SelectSpace(size, pretenure); |
| 2903 |
| 2904 HeapObject* result; |
| 2905 { |
| 2906 AllocationResult allocation = |
| 2907 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); |
| 2908 if (!allocation.To(&result)) return allocation; |
| 2909 } |
| 2910 |
| 2911 result->set_map_no_write_barrier(float32x4_map()); |
| 2912 Float32x4* float32x4 = Float32x4::cast(result); |
| 2913 float32x4->set_lane(0, w); |
| 2914 float32x4->set_lane(1, x); |
| 2915 float32x4->set_lane(2, y); |
| 2916 float32x4->set_lane(3, z); |
| 2917 return result; |
| 2918 } |
| 2919 |
| 2920 |
| 2894 AllocationResult Heap::AllocateCell(Object* value) { | 2921 AllocationResult Heap::AllocateCell(Object* value) { |
| 2895 int size = Cell::kSize; | 2922 int size = Cell::kSize; |
| 2896 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); | 2923 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); |
| 2897 | 2924 |
| 2898 HeapObject* result; | 2925 HeapObject* result; |
| 2899 { | 2926 { |
| 2900 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); | 2927 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
| 2901 if (!allocation.To(&result)) return allocation; | 2928 if (!allocation.To(&result)) return allocation; |
| 2902 } | 2929 } |
| 2903 result->set_map_no_write_barrier(cell_map()); | 2930 result->set_map_no_write_barrier(cell_map()); |
| (...skipping 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6671 *object_type = "CODE_TYPE"; \ | 6698 *object_type = "CODE_TYPE"; \ |
| 6672 *object_sub_type = "CODE_AGE/" #name; \ | 6699 *object_sub_type = "CODE_AGE/" #name; \ |
| 6673 return true; | 6700 return true; |
| 6674 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6701 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6675 #undef COMPARE_AND_RETURN_NAME | 6702 #undef COMPARE_AND_RETURN_NAME |
| 6676 } | 6703 } |
| 6677 return false; | 6704 return false; |
| 6678 } | 6705 } |
| 6679 } // namespace internal | 6706 } // namespace internal |
| 6680 } // namespace v8 | 6707 } // namespace v8 |
| OLD | NEW |