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

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: Don't run downloaded SIMD value type tests. 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
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2967 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) 2967 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name)
2968 2968
2969 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) 2969 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array)
2970 DCHECK(fixed_array_map() != fixed_cow_array_map()); 2970 DCHECK(fixed_array_map() != fixed_cow_array_map());
2971 2971
2972 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info) 2972 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info)
2973 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number) 2973 ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number)
2974 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, 2974 ALLOCATE_MAP(MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize,
2975 mutable_heap_number) 2975 mutable_heap_number)
2976 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4) 2976 ALLOCATE_MAP(FLOAT32X4_TYPE, Float32x4::kSize, float32x4)
2977 ALLOCATE_MAP(INT32X4_TYPE, Int32x4::kSize, int32x4)
2978 ALLOCATE_MAP(BOOL32X4_TYPE, Bool32x4::kSize, bool32x4)
2979 ALLOCATE_MAP(INT16X8_TYPE, Int16x8::kSize, int16x8)
2980 ALLOCATE_MAP(BOOL16X8_TYPE, Bool16x8::kSize, bool16x8)
2981 ALLOCATE_MAP(INT8X16_TYPE, Int8x16::kSize, int8x16)
2982 ALLOCATE_MAP(BOOL8X16_TYPE, Bool8x16::kSize, bool8x16)
2977 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol) 2983 ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol)
2978 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign) 2984 ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign)
2979 2985
2980 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole); 2986 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, the_hole);
2981 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean); 2987 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, boolean);
2982 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized); 2988 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, uninitialized);
2983 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker); 2989 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, arguments_marker);
2984 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel); 2990 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, no_interceptor_result_sentinel);
2985 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception); 2991 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception);
2986 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception); 2992 ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned); 3112 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned);
3107 if (!allocation.To(&result)) return allocation; 3113 if (!allocation.To(&result)) return allocation;
3108 } 3114 }
3109 3115
3110 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); 3116 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map();
3111 HeapObject::cast(result)->set_map_no_write_barrier(map); 3117 HeapObject::cast(result)->set_map_no_write_barrier(map);
3112 HeapNumber::cast(result)->set_value(value); 3118 HeapNumber::cast(result)->set_value(value);
3113 return result; 3119 return result;
3114 } 3120 }
3115 3121
3116 3122 #define SIMD_ALLOCATE_DEFINITION(type, type_name, lane_count, lane_type) \
3117 AllocationResult Heap::AllocateFloat32x4(float w, float x, float y, float z, 3123 AllocationResult Heap::Allocate##type(lane_type lanes[lane_count], \
3118 PretenureFlag pretenure) { 3124 PretenureFlag pretenure) { \
3119 // Statically ensure that it is safe to allocate SIMD values in paged 3125 int size = type::kSize; \
3120 // spaces. 3126 STATIC_ASSERT(type::kSize <= Page::kMaxRegularHeapObjectSize); \
3121 int size = Float32x4::kSize; 3127 \
3122 STATIC_ASSERT(Float32x4::kSize <= Page::kMaxRegularHeapObjectSize); 3128 AllocationSpace space = SelectSpace(size, pretenure); \
3123 3129 \
3124 AllocationSpace space = SelectSpace(size, pretenure); 3130 HeapObject* result; \
3125 3131 { \
3126 HeapObject* result; 3132 AllocationResult allocation = \
3127 { 3133 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \
3128 AllocationResult allocation = 3134 if (!allocation.To(&result)) return allocation; \
3129 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); 3135 } \
3130 if (!allocation.To(&result)) return allocation; 3136 \
3137 result->set_map_no_write_barrier(type_name##_map()); \
3138 type* instance = type::cast(result); \
3139 for (int i = 0; i < lane_count; i++) { \
3140 instance->set_lane(i, lanes[i]); \
3141 } \
3142 return result; \
3131 } 3143 }
3132 3144
3133 result->set_map_no_write_barrier(float32x4_map()); 3145 SIMD128_TYPES(SIMD_ALLOCATE_DEFINITION)
3134 Float32x4* float32x4 = Float32x4::cast(result);
3135 float32x4->set_lane(0, w);
3136 float32x4->set_lane(1, x);
3137 float32x4->set_lane(2, y);
3138 float32x4->set_lane(3, z);
3139 return result;
3140 }
3141 3146
3142 3147
3143 AllocationResult Heap::AllocateCell(Object* value) { 3148 AllocationResult Heap::AllocateCell(Object* value) {
3144 int size = Cell::kSize; 3149 int size = Cell::kSize;
3145 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize); 3150 STATIC_ASSERT(Cell::kSize <= Page::kMaxRegularHeapObjectSize);
3146 3151
3147 HeapObject* result; 3152 HeapObject* result;
3148 { 3153 {
3149 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); 3154 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
3150 if (!allocation.To(&result)) return allocation; 3155 if (!allocation.To(&result)) return allocation;
(...skipping 3792 matching lines...) Expand 10 before | Expand all | Expand 10 after
6943 *object_type = "CODE_TYPE"; \ 6948 *object_type = "CODE_TYPE"; \
6944 *object_sub_type = "CODE_AGE/" #name; \ 6949 *object_sub_type = "CODE_AGE/" #name; \
6945 return true; 6950 return true;
6946 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6951 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6947 #undef COMPARE_AND_RETURN_NAME 6952 #undef COMPARE_AND_RETURN_NAME
6948 } 6953 }
6949 return false; 6954 return false;
6950 } 6955 }
6951 } // namespace internal 6956 } // namespace internal
6952 } // namespace v8 6957 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698