| 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/heap/heap.h" | 5 #include "src/heap/heap.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 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 | 2359 |
| 2360 AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode, | 2360 AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode, |
| 2361 PretenureFlag pretenure) { | 2361 PretenureFlag pretenure) { |
| 2362 // Statically ensure that it is safe to allocate heap numbers in paged | 2362 // Statically ensure that it is safe to allocate heap numbers in paged |
| 2363 // spaces. | 2363 // spaces. |
| 2364 int size = HeapNumber::kSize; | 2364 int size = HeapNumber::kSize; |
| 2365 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxRegularHeapObjectSize); | 2365 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxRegularHeapObjectSize); |
| 2366 | 2366 |
| 2367 AllocationSpace space = SelectSpace(size, pretenure); | 2367 AllocationSpace space = SelectSpace(pretenure); |
| 2368 | 2368 |
| 2369 HeapObject* result = nullptr; | 2369 HeapObject* result = nullptr; |
| 2370 { | 2370 { |
| 2371 AllocationResult allocation = | 2371 AllocationResult allocation = |
| 2372 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned); | 2372 AllocateRaw(size, space, OLD_SPACE, kDoubleUnaligned); |
| 2373 if (!allocation.To(&result)) return allocation; | 2373 if (!allocation.To(&result)) return allocation; |
| 2374 } | 2374 } |
| 2375 | 2375 |
| 2376 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); | 2376 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); |
| 2377 HeapObject::cast(result)->set_map_no_write_barrier(map); | 2377 HeapObject::cast(result)->set_map_no_write_barrier(map); |
| 2378 HeapNumber::cast(result)->set_value(value); | 2378 HeapNumber::cast(result)->set_value(value); |
| 2379 return result; | 2379 return result; |
| 2380 } | 2380 } |
| 2381 | 2381 |
| 2382 #define SIMD_ALLOCATE_DEFINITION(TYPE, Type, type, lane_count, lane_type) \ | 2382 #define SIMD_ALLOCATE_DEFINITION(TYPE, Type, type, lane_count, lane_type) \ |
| 2383 AllocationResult Heap::Allocate##Type(lane_type lanes[lane_count], \ | 2383 AllocationResult Heap::Allocate##Type(lane_type lanes[lane_count], \ |
| 2384 PretenureFlag pretenure) { \ | 2384 PretenureFlag pretenure) { \ |
| 2385 int size = Type::kSize; \ | 2385 int size = Type::kSize; \ |
| 2386 STATIC_ASSERT(Type::kSize <= Page::kMaxRegularHeapObjectSize); \ | 2386 STATIC_ASSERT(Type::kSize <= Page::kMaxRegularHeapObjectSize); \ |
| 2387 \ | 2387 \ |
| 2388 AllocationSpace space = SelectSpace(size, pretenure); \ | 2388 AllocationSpace space = SelectSpace(pretenure); \ |
| 2389 \ | 2389 \ |
| 2390 HeapObject* result = nullptr; \ | 2390 HeapObject* result = nullptr; \ |
| 2391 { \ | 2391 { \ |
| 2392 AllocationResult allocation = \ | 2392 AllocationResult allocation = \ |
| 2393 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \ | 2393 AllocateRaw(size, space, OLD_SPACE, kSimd128Unaligned); \ |
| 2394 if (!allocation.To(&result)) return allocation; \ | 2394 if (!allocation.To(&result)) return allocation; \ |
| 2395 } \ | 2395 } \ |
| 2396 \ | 2396 \ |
| 2397 result->set_map_no_write_barrier(type##_map()); \ | 2397 result->set_map_no_write_barrier(type##_map()); \ |
| 2398 Type* instance = Type::cast(result); \ | 2398 Type* instance = Type::cast(result); \ |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 result->set_foreign_address(address); | 2916 result->set_foreign_address(address); |
| 2917 return result; | 2917 return result; |
| 2918 } | 2918 } |
| 2919 | 2919 |
| 2920 | 2920 |
| 2921 AllocationResult Heap::AllocateByteArray(int length, PretenureFlag pretenure) { | 2921 AllocationResult Heap::AllocateByteArray(int length, PretenureFlag pretenure) { |
| 2922 if (length < 0 || length > ByteArray::kMaxLength) { | 2922 if (length < 0 || length > ByteArray::kMaxLength) { |
| 2923 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); | 2923 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); |
| 2924 } | 2924 } |
| 2925 int size = ByteArray::SizeFor(length); | 2925 int size = ByteArray::SizeFor(length); |
| 2926 AllocationSpace space = SelectSpace(size, pretenure); | 2926 AllocationSpace space = SelectSpace(pretenure); |
| 2927 HeapObject* result = nullptr; | 2927 HeapObject* result = nullptr; |
| 2928 { | 2928 { |
| 2929 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); | 2929 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
| 2930 if (!allocation.To(&result)) return allocation; | 2930 if (!allocation.To(&result)) return allocation; |
| 2931 } | 2931 } |
| 2932 | 2932 |
| 2933 result->set_map_no_write_barrier(byte_array_map()); | 2933 result->set_map_no_write_barrier(byte_array_map()); |
| 2934 ByteArray::cast(result)->set_length(length); | 2934 ByteArray::cast(result)->set_length(length); |
| 2935 return result; | 2935 return result; |
| 2936 } | 2936 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 if (profiler->is_tracking_allocations()) { | 3127 if (profiler->is_tracking_allocations()) { |
| 3128 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); | 3128 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); |
| 3129 } | 3129 } |
| 3130 } | 3130 } |
| 3131 | 3131 |
| 3132 | 3132 |
| 3133 AllocationResult Heap::AllocateFixedTypedArrayWithExternalPointer( | 3133 AllocationResult Heap::AllocateFixedTypedArrayWithExternalPointer( |
| 3134 int length, ExternalArrayType array_type, void* external_pointer, | 3134 int length, ExternalArrayType array_type, void* external_pointer, |
| 3135 PretenureFlag pretenure) { | 3135 PretenureFlag pretenure) { |
| 3136 int size = FixedTypedArrayBase::kHeaderSize; | 3136 int size = FixedTypedArrayBase::kHeaderSize; |
| 3137 AllocationSpace space = SelectSpace(size, pretenure); | 3137 AllocationSpace space = SelectSpace(pretenure); |
| 3138 HeapObject* result = nullptr; | 3138 HeapObject* result = nullptr; |
| 3139 { | 3139 { |
| 3140 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); | 3140 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
| 3141 if (!allocation.To(&result)) return allocation; | 3141 if (!allocation.To(&result)) return allocation; |
| 3142 } | 3142 } |
| 3143 | 3143 |
| 3144 result->set_map_no_write_barrier(MapForFixedTypedArray(array_type)); | 3144 result->set_map_no_write_barrier(MapForFixedTypedArray(array_type)); |
| 3145 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result); | 3145 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result); |
| 3146 elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER); | 3146 elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 3147 elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER); | 3147 elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3171 | 3171 |
| 3172 AllocationResult Heap::AllocateFixedTypedArray(int length, | 3172 AllocationResult Heap::AllocateFixedTypedArray(int length, |
| 3173 ExternalArrayType array_type, | 3173 ExternalArrayType array_type, |
| 3174 bool initialize, | 3174 bool initialize, |
| 3175 PretenureFlag pretenure) { | 3175 PretenureFlag pretenure) { |
| 3176 int element_size; | 3176 int element_size; |
| 3177 ElementsKind elements_kind; | 3177 ElementsKind elements_kind; |
| 3178 ForFixedTypedArray(array_type, &element_size, &elements_kind); | 3178 ForFixedTypedArray(array_type, &element_size, &elements_kind); |
| 3179 int size = OBJECT_POINTER_ALIGN(length * element_size + | 3179 int size = OBJECT_POINTER_ALIGN(length * element_size + |
| 3180 FixedTypedArrayBase::kDataOffset); | 3180 FixedTypedArrayBase::kDataOffset); |
| 3181 AllocationSpace space = SelectSpace(size, pretenure); | 3181 AllocationSpace space = SelectSpace(pretenure); |
| 3182 | 3182 |
| 3183 HeapObject* object = nullptr; | 3183 HeapObject* object = nullptr; |
| 3184 AllocationResult allocation = AllocateRaw( | 3184 AllocationResult allocation = AllocateRaw( |
| 3185 size, space, OLD_SPACE, | 3185 size, space, OLD_SPACE, |
| 3186 array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned); | 3186 array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned); |
| 3187 if (!allocation.To(&object)) return allocation; | 3187 if (!allocation.To(&object)) return allocation; |
| 3188 | 3188 |
| 3189 object->set_map_no_write_barrier(MapForFixedTypedArray(array_type)); | 3189 object->set_map_no_write_barrier(MapForFixedTypedArray(array_type)); |
| 3190 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object); | 3190 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object); |
| 3191 elements->set_base_pointer(elements, SKIP_WRITE_BARRIER); | 3191 elements->set_base_pointer(elements, SKIP_WRITE_BARRIER); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 | 3386 |
| 3387 // Both types of global objects should be allocated using | 3387 // Both types of global objects should be allocated using |
| 3388 // AllocateGlobalObject to be properly initialized. | 3388 // AllocateGlobalObject to be properly initialized. |
| 3389 DCHECK(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 3389 DCHECK(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 3390 DCHECK(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 3390 DCHECK(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 3391 | 3391 |
| 3392 // Allocate the backing storage for the properties. | 3392 // Allocate the backing storage for the properties. |
| 3393 FixedArray* properties = empty_fixed_array(); | 3393 FixedArray* properties = empty_fixed_array(); |
| 3394 | 3394 |
| 3395 // Allocate the JSObject. | 3395 // Allocate the JSObject. |
| 3396 int size = map->instance_size(); | 3396 AllocationSpace space = SelectSpace(pretenure); |
| 3397 AllocationSpace space = SelectSpace(size, pretenure); | |
| 3398 JSObject* js_obj = nullptr; | 3397 JSObject* js_obj = nullptr; |
| 3399 AllocationResult allocation = Allocate(map, space, allocation_site); | 3398 AllocationResult allocation = Allocate(map, space, allocation_site); |
| 3400 if (!allocation.To(&js_obj)) return allocation; | 3399 if (!allocation.To(&js_obj)) return allocation; |
| 3401 | 3400 |
| 3402 // Initialize the JSObject. | 3401 // Initialize the JSObject. |
| 3403 InitializeJSObjectFromMap(js_obj, properties, map); | 3402 InitializeJSObjectFromMap(js_obj, properties, map); |
| 3404 DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements()); | 3403 DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements()); |
| 3405 return js_obj; | 3404 return js_obj; |
| 3406 } | 3405 } |
| 3407 | 3406 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 | 3587 |
| 3589 DCHECK_LE(0, chars); | 3588 DCHECK_LE(0, chars); |
| 3590 DCHECK_GE(String::kMaxLength, chars); | 3589 DCHECK_GE(String::kMaxLength, chars); |
| 3591 if (is_one_byte) { | 3590 if (is_one_byte) { |
| 3592 map = one_byte_internalized_string_map(); | 3591 map = one_byte_internalized_string_map(); |
| 3593 size = SeqOneByteString::SizeFor(chars); | 3592 size = SeqOneByteString::SizeFor(chars); |
| 3594 } else { | 3593 } else { |
| 3595 map = internalized_string_map(); | 3594 map = internalized_string_map(); |
| 3596 size = SeqTwoByteString::SizeFor(chars); | 3595 size = SeqTwoByteString::SizeFor(chars); |
| 3597 } | 3596 } |
| 3598 AllocationSpace space = SelectSpace(size, TENURED); | |
| 3599 | 3597 |
| 3600 // Allocate string. | 3598 // Allocate string. |
| 3601 HeapObject* result = nullptr; | 3599 HeapObject* result = nullptr; |
| 3602 { | 3600 { |
| 3603 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); | 3601 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
| 3604 if (!allocation.To(&result)) return allocation; | 3602 if (!allocation.To(&result)) return allocation; |
| 3605 } | 3603 } |
| 3606 | 3604 |
| 3607 result->set_map_no_write_barrier(map); | 3605 result->set_map_no_write_barrier(map); |
| 3608 // Set length and hash fields of the allocated string. | 3606 // Set length and hash fields of the allocated string. |
| 3609 String* answer = String::cast(result); | 3607 String* answer = String::cast(result); |
| 3610 answer->set_length(chars); | 3608 answer->set_length(chars); |
| 3611 answer->set_hash_field(hash_field); | 3609 answer->set_hash_field(hash_field); |
| 3612 | 3610 |
| 3613 DCHECK_EQ(size, answer->Size()); | 3611 DCHECK_EQ(size, answer->Size()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3631 template AllocationResult Heap::AllocateInternalizedStringImpl<false>( | 3629 template AllocationResult Heap::AllocateInternalizedStringImpl<false>( |
| 3632 Vector<const char>, int, uint32_t); | 3630 Vector<const char>, int, uint32_t); |
| 3633 | 3631 |
| 3634 | 3632 |
| 3635 AllocationResult Heap::AllocateRawOneByteString(int length, | 3633 AllocationResult Heap::AllocateRawOneByteString(int length, |
| 3636 PretenureFlag pretenure) { | 3634 PretenureFlag pretenure) { |
| 3637 DCHECK_LE(0, length); | 3635 DCHECK_LE(0, length); |
| 3638 DCHECK_GE(String::kMaxLength, length); | 3636 DCHECK_GE(String::kMaxLength, length); |
| 3639 int size = SeqOneByteString::SizeFor(length); | 3637 int size = SeqOneByteString::SizeFor(length); |
| 3640 DCHECK(size <= SeqOneByteString::kMaxSize); | 3638 DCHECK(size <= SeqOneByteString::kMaxSize); |
| 3641 AllocationSpace space = SelectSpace(size, pretenure); | 3639 AllocationSpace space = SelectSpace(pretenure); |
| 3642 | 3640 |
| 3643 HeapObject* result = nullptr; | 3641 HeapObject* result = nullptr; |
| 3644 { | 3642 { |
| 3645 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); | 3643 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
| 3646 if (!allocation.To(&result)) return allocation; | 3644 if (!allocation.To(&result)) return allocation; |
| 3647 } | 3645 } |
| 3648 | 3646 |
| 3649 // Partially initialize the object. | 3647 // Partially initialize the object. |
| 3650 result->set_map_no_write_barrier(one_byte_string_map()); | 3648 result->set_map_no_write_barrier(one_byte_string_map()); |
| 3651 String::cast(result)->set_length(length); | 3649 String::cast(result)->set_length(length); |
| 3652 String::cast(result)->set_hash_field(String::kEmptyHashField); | 3650 String::cast(result)->set_hash_field(String::kEmptyHashField); |
| 3653 DCHECK_EQ(size, HeapObject::cast(result)->Size()); | 3651 DCHECK_EQ(size, HeapObject::cast(result)->Size()); |
| 3654 | 3652 |
| 3655 return result; | 3653 return result; |
| 3656 } | 3654 } |
| 3657 | 3655 |
| 3658 | 3656 |
| 3659 AllocationResult Heap::AllocateRawTwoByteString(int length, | 3657 AllocationResult Heap::AllocateRawTwoByteString(int length, |
| 3660 PretenureFlag pretenure) { | 3658 PretenureFlag pretenure) { |
| 3661 DCHECK_LE(0, length); | 3659 DCHECK_LE(0, length); |
| 3662 DCHECK_GE(String::kMaxLength, length); | 3660 DCHECK_GE(String::kMaxLength, length); |
| 3663 int size = SeqTwoByteString::SizeFor(length); | 3661 int size = SeqTwoByteString::SizeFor(length); |
| 3664 DCHECK(size <= SeqTwoByteString::kMaxSize); | 3662 DCHECK(size <= SeqTwoByteString::kMaxSize); |
| 3665 AllocationSpace space = SelectSpace(size, pretenure); | 3663 AllocationSpace space = SelectSpace(pretenure); |
| 3666 | 3664 |
| 3667 HeapObject* result = nullptr; | 3665 HeapObject* result = nullptr; |
| 3668 { | 3666 { |
| 3669 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); | 3667 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
| 3670 if (!allocation.To(&result)) return allocation; | 3668 if (!allocation.To(&result)) return allocation; |
| 3671 } | 3669 } |
| 3672 | 3670 |
| 3673 // Partially initialize the object. | 3671 // Partially initialize the object. |
| 3674 result->set_map_no_write_barrier(string_map()); | 3672 result->set_map_no_write_barrier(string_map()); |
| 3675 String::cast(result)->set_length(length); | 3673 String::cast(result)->set_length(length); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3790 return obj; | 3788 return obj; |
| 3791 } | 3789 } |
| 3792 | 3790 |
| 3793 | 3791 |
| 3794 AllocationResult Heap::AllocateRawFixedArray(int length, | 3792 AllocationResult Heap::AllocateRawFixedArray(int length, |
| 3795 PretenureFlag pretenure) { | 3793 PretenureFlag pretenure) { |
| 3796 if (length < 0 || length > FixedArray::kMaxLength) { | 3794 if (length < 0 || length > FixedArray::kMaxLength) { |
| 3797 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); | 3795 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); |
| 3798 } | 3796 } |
| 3799 int size = FixedArray::SizeFor(length); | 3797 int size = FixedArray::SizeFor(length); |
| 3800 AllocationSpace space = SelectSpace(size, pretenure); | 3798 AllocationSpace space = SelectSpace(pretenure); |
| 3801 | 3799 |
| 3802 return AllocateRaw(size, space, OLD_SPACE); | 3800 return AllocateRaw(size, space, OLD_SPACE); |
| 3803 } | 3801 } |
| 3804 | 3802 |
| 3805 | 3803 |
| 3806 AllocationResult Heap::AllocateFixedArrayWithFiller(int length, | 3804 AllocationResult Heap::AllocateFixedArrayWithFiller(int length, |
| 3807 PretenureFlag pretenure, | 3805 PretenureFlag pretenure, |
| 3808 Object* filler) { | 3806 Object* filler) { |
| 3809 DCHECK(length >= 0); | 3807 DCHECK(length >= 0); |
| 3810 DCHECK(empty_fixed_array()->IsFixedArray()); | 3808 DCHECK(empty_fixed_array()->IsFixedArray()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3859 } | 3857 } |
| 3860 | 3858 |
| 3861 | 3859 |
| 3862 AllocationResult Heap::AllocateRawFixedDoubleArray(int length, | 3860 AllocationResult Heap::AllocateRawFixedDoubleArray(int length, |
| 3863 PretenureFlag pretenure) { | 3861 PretenureFlag pretenure) { |
| 3864 if (length < 0 || length > FixedDoubleArray::kMaxLength) { | 3862 if (length < 0 || length > FixedDoubleArray::kMaxLength) { |
| 3865 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", | 3863 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", |
| 3866 kDoubleAligned); | 3864 kDoubleAligned); |
| 3867 } | 3865 } |
| 3868 int size = FixedDoubleArray::SizeFor(length); | 3866 int size = FixedDoubleArray::SizeFor(length); |
| 3869 AllocationSpace space = SelectSpace(size, pretenure); | 3867 AllocationSpace space = SelectSpace(pretenure); |
| 3870 | 3868 |
| 3871 HeapObject* object = nullptr; | 3869 HeapObject* object = nullptr; |
| 3872 { | 3870 { |
| 3873 AllocationResult allocation = | 3871 AllocationResult allocation = |
| 3874 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned); | 3872 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned); |
| 3875 if (!allocation.To(&object)) return allocation; | 3873 if (!allocation.To(&object)) return allocation; |
| 3876 } | 3874 } |
| 3877 | 3875 |
| 3878 return object; | 3876 return object; |
| 3879 } | 3877 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3916 case NAME##_TYPE: \ | 3914 case NAME##_TYPE: \ |
| 3917 map = name##_map(); \ | 3915 map = name##_map(); \ |
| 3918 break; | 3916 break; |
| 3919 STRUCT_LIST(MAKE_CASE) | 3917 STRUCT_LIST(MAKE_CASE) |
| 3920 #undef MAKE_CASE | 3918 #undef MAKE_CASE |
| 3921 default: | 3919 default: |
| 3922 UNREACHABLE(); | 3920 UNREACHABLE(); |
| 3923 return exception(); | 3921 return exception(); |
| 3924 } | 3922 } |
| 3925 int size = map->instance_size(); | 3923 int size = map->instance_size(); |
| 3926 AllocationSpace space = SelectSpace(size, TENURED); | |
| 3927 Struct* result = nullptr; | 3924 Struct* result = nullptr; |
| 3928 { | 3925 { |
| 3929 AllocationResult allocation = Allocate(map, space); | 3926 AllocationResult allocation = Allocate(map, OLD_SPACE); |
| 3930 if (!allocation.To(&result)) return allocation; | 3927 if (!allocation.To(&result)) return allocation; |
| 3931 } | 3928 } |
| 3932 result->InitializeBody(size); | 3929 result->InitializeBody(size); |
| 3933 return result; | 3930 return result; |
| 3934 } | 3931 } |
| 3935 | 3932 |
| 3936 | 3933 |
| 3937 bool Heap::IsHeapIterable() { | 3934 bool Heap::IsHeapIterable() { |
| 3938 // TODO(hpayer): This function is not correct. Allocation folding in old | 3935 // TODO(hpayer): This function is not correct. Allocation folding in old |
| 3939 // space breaks the iterability. | 3936 // space breaks the iterability. |
| (...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6105 } | 6102 } |
| 6106 | 6103 |
| 6107 | 6104 |
| 6108 // static | 6105 // static |
| 6109 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6106 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6110 return StaticVisitorBase::GetVisitorId(map); | 6107 return StaticVisitorBase::GetVisitorId(map); |
| 6111 } | 6108 } |
| 6112 | 6109 |
| 6113 } // namespace internal | 6110 } // namespace internal |
| 6114 } // namespace v8 | 6111 } // namespace v8 |
| OLD | NEW |