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

Side by Side Diff: src/heap/heap.cc

Issue 1250733005: SIMD.js Add the other SIMD Phase 1 types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make _IsSimdObject an assembly intrinsic in fullcodegen. Created 5 years, 4 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
OLDNEW
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 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) 2963 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name)
2964 2964
2965 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) 2965 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array)
2966 DCHECK(fixed_array_map() != fixed_cow_array_map()); 2966 DCHECK(fixed_array_map() != fixed_cow_array_map());
2967 2967
2968 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) 2968 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info)
2969 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) 2969 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number)
2970 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, 2970 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize,
2971 mutable_heap_number) 2971 mutable_heap_number)
2972 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4) 2972 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4)
2973 ALLOCATE_MAP(INT32X4_TYPE, Int32x4::kSize, int32x4)
2974 ALLOCATE_MAP(BOOL32X4_TYPE, Bool32x4::kSize, bool32x4)
2975 ALLOCATE_MAP(INT16X8_TYPE, Int16x8::kSize, int16x8)
2976 ALLOCATE_MAP(BOOL16X8_TYPE, Bool16x8::kSize, bool16x8)
2977 ALLOCATE_MAP(INT8X16_TYPE, Int8x16::kSize, int8x16)
2978 ALLOCATE_MAP(BOOL8X16_TYPE, Bool8x16::kSize, bool8x16)
2973 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) 2979 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol)
2974 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) 2980 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign)
2975 2981
2976 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); 2982 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole);
2977 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); 2983 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean);
2978 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); 2984 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized);
2979 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); 2985 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker);
2980 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); 2986 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel);
2981 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); 2987 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception);
2982 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); 2988 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned); 3108 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned);
3103 if (!allocation.To(&result)) return allocation; 3109 if (!allocation.To(&result)) return allocation;
3104 } 3110 }
3105 3111
3106 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); 3112 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map();
3107 HeapObject::cast(result)->set_map_no_write_barrier(map); 3113 HeapObject::cast(result)->set_map_no_write_barrier(map);
3108 HeapNumber::cast(result)->set_value(value); 3114 HeapNumber::cast(result)->set_value(value);
3109 return result; 3115 return result;
3110 } 3116 }
3111 3117
3112 3118 #define SIMD_ALLOCATE_DEFINITION(type, type_name, lane_count, lane_type) \
3113 AllocationResult Heap::AllocateFloat32x4(float w, float x, float y, float z, 3119 AllocationResult Heap::Allocate##type(lane_type lanes[lane_count], \
3114 PretenureFlag pretenure) { 3120 PretenureFlag pretenure) { \
3115 // Statically ensure that it is safe to allocate SIMD values in paged 3121 int size = type::kSize; \
3116 // spaces. 3122 STATIC_ASSERT(type::kSize <= Page::kMaxRegularHeapObjectSize); \
3117 int size = Float32x4::kSize; 3123 \
3118 STATIC_ASSERT(Float32x4::kSize <= Page::kMaxRegularHeapObjectSize); 3124 AllocationSpace space = SelectSpace(size, pretenure); \
3119 3125 \
3120 AllocationSpace space = SelectSpace(size, pretenure); 3126 HeapObject* result; \
3121 3127 { \
3122 HeapObject* result; 3128 AllocationResult allocation = \
3123 { 3129 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \
3124 AllocationResult allocation = 3130 if (!allocation.To(&result)) return allocation; \
3125 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); 3131 } \
3126 if (!allocation.To(&result)) return allocation; 3132 \
3133 result->set_map_no_write_barrier(type_name##_map()); \
3134 type* instance = type::cast(result); \
3135 for (int i = 0; i < lane_count; i++) { \
3136 instance->set_lane(i, lanes[i]); \
3137 } \
3138 return result; \
3127 } 3139 }
3128 3140
3129 result->set_map_no_write_barrier(float32x4_map()); 3141 SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION)
3130 Float32x4* float32x4 = Float32x4::cast(result);
3131 float32x4->set_lane(0, w);
3132 float32x4->set_lane(1, x);
3133 float32x4->set_lane(2, y);
3134 float32x4->set_lane(3, z);
3135 return result;
3136 }
3137 3142
3138 3143
3139 AllocationResult Heap::AllocateCell(Object* value) { 3144 AllocationResult Heap::AllocateCell(Object* value) {
3140 int size = Cell::kSize; 3145 int size = Cell::kSize;
3141 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); 3146 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize);
3142 3147
3143 HeapObject* result; 3148 HeapObject* result;
3144 { 3149 {
3145 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); 3150 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
3146 if (!allocation.To(&result)) return allocation; 3151 if (!allocation.To(&result)) return allocation;
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 *object_type = "CODE_TYPE"; \ 6929 *object_type = "CODE_TYPE"; \
6925 *object_sub_type = "CODE_AGE/" #name; \ 6930 *object_sub_type = "CODE_AGE/" #name; \
6926 return true; 6931 return true;
6927 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6932 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6928 #undef COMPARE_AND_RETURN_NAME 6933 #undef COMPARE_AND_RETURN_NAME
6929 } 6934 }
6930 return false; 6935 return false;
6931 } 6936 }
6932 } // namespace internal 6937 } // namespace internal
6933 } // namespace v8 6938 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | src/macros.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698