| 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 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ | 2711 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ |
| 2712 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) | 2712 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) |
| 2713 | 2713 |
| 2714 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) | 2714 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) |
| 2715 DCHECK(fixed_array_map() != fixed_cow_array_map()); | 2715 DCHECK(fixed_array_map() != fixed_cow_array_map()); |
| 2716 | 2716 |
| 2717 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) | 2717 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) |
| 2718 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) | 2718 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) |
| 2719 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, | 2719 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, |
| 2720 mutable_heap_number) | 2720 mutable_heap_number) |
| 2721 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4) |
| 2721 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) | 2722 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) |
| 2722 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) | 2723 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) |
| 2723 | 2724 |
| 2724 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); | 2725 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); |
| 2725 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); | 2726 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); |
| 2726 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); | 2727 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); |
| 2727 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); | 2728 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); |
| 2728 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); | 2729 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); |
| 2729 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); | 2730 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); |
| 2730 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); | 2731 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2860 if (!allocation.To(&result)) return allocation; | 2861 if (!allocation.To(&result)) return allocation; |
| 2861 } | 2862 } |
| 2862 | 2863 |
| 2863 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); | 2864 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); |
| 2864 HeapObject::cast(result)->set_map_no_write_barrier(map); | 2865 HeapObject::cast(result)->set_map_no_write_barrier(map); |
| 2865 HeapNumber::cast(result)->set_value(value); | 2866 HeapNumber::cast(result)->set_value(value); |
| 2866 return result; | 2867 return result; |
| 2867 } | 2868 } |
| 2868 | 2869 |
| 2869 | 2870 |
| 2871 AllocationResult Heap::AllocateFloat32x4(double w, double x, double y, double z, |
| 2872 PretenureFlag pretenure) { |
| 2873 // Statically ensure that it is safe to allocate SIMD values in paged |
| 2874 // spaces. |
| 2875 int size = Float32x4::kSize; |
| 2876 STATIC_ASSERT(Float32x4::kSize <= Page::kMaxRegularHeapObjectSize); |
| 2877 |
| 2878 AllocationSpace space = SelectSpace(size, pretenure); |
| 2879 |
| 2880 HeapObject* result; |
| 2881 { |
| 2882 AllocationResult allocation = |
| 2883 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); |
| 2884 if (!allocation.To(&result)) return allocation; |
| 2885 } |
| 2886 |
| 2887 result->set_map_no_write_barrier(float32x4_map()); |
| 2888 Float32x4::cast(result)->set_lane(0, w); |
| 2889 Float32x4::cast(result)->set_lane(1, x); |
| 2890 Float32x4::cast(result)->set_lane(2, y); |
| 2891 Float32x4::cast(result)->set_lane(3, z); |
| 2892 return result; |
| 2893 } |
| 2894 |
| 2895 |
| 2870 AllocationResult Heap::AllocateCell(Object* value) { | 2896 AllocationResult Heap::AllocateCell(Object* value) { |
| 2871 int size = Cell::kSize; | 2897 int size = Cell::kSize; |
| 2872 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); | 2898 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); |
| 2873 | 2899 |
| 2874 HeapObject* result; | 2900 HeapObject* result; |
| 2875 { | 2901 { |
| 2876 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); | 2902 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
| 2877 if (!allocation.To(&result)) return allocation; | 2903 if (!allocation.To(&result)) return allocation; |
| 2878 } | 2904 } |
| 2879 result->set_map_no_write_barrier(cell_map()); | 2905 result->set_map_no_write_barrier(cell_map()); |
| (...skipping 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6537 *object_type = "CODE_TYPE"; \ | 6563 *object_type = "CODE_TYPE"; \ |
| 6538 *object_sub_type = "CODE_AGE/" #name; \ | 6564 *object_sub_type = "CODE_AGE/" #name; \ |
| 6539 return true; | 6565 return true; |
| 6540 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6566 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6541 #undef COMPARE_AND_RETURN_NAME | 6567 #undef COMPARE_AND_RETURN_NAME |
| 6542 } | 6568 } |
| 6543 return false; | 6569 return false; |
| 6544 } | 6570 } |
| 6545 } // namespace internal | 6571 } // namespace internal |
| 6546 } // namespace v8 | 6572 } // namespace v8 |
| OLD | NEW |