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

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

Issue 1254623002: Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates 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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 2493
2494 static inline void EvacuateFixedTypedArray(Map* map, HeapObject** slot, 2494 static inline void EvacuateFixedTypedArray(Map* map, HeapObject** slot,
2495 HeapObject* object) { 2495 HeapObject* object) {
2496 int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size(); 2496 int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size();
2497 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size); 2497 EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size);
2498 2498
2499 MapWord map_word = object->map_word(); 2499 MapWord map_word = object->map_word();
2500 DCHECK(map_word.IsForwardingAddress()); 2500 DCHECK(map_word.IsForwardingAddress());
2501 FixedTypedArrayBase* target = 2501 FixedTypedArrayBase* target =
2502 reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress()); 2502 reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
2503 target->set_base_pointer(target, SKIP_WRITE_BARRIER); 2503 if (target->base_pointer() != Smi::FromInt(0))
2504 target->set_base_pointer(target, SKIP_WRITE_BARRIER);
2504 } 2505 }
2505 2506
2506 2507
2507 static inline void EvacuateFixedFloat64Array(Map* map, HeapObject** slot, 2508 static inline void EvacuateFixedFloat64Array(Map* map, HeapObject** slot,
2508 HeapObject* object) { 2509 HeapObject* object) {
2509 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size(); 2510 int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size();
2510 EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size); 2511 EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size);
2511 2512
2512 MapWord map_word = object->map_word(); 2513 MapWord map_word = object->map_word();
2513 DCHECK(map_word.IsForwardingAddress()); 2514 DCHECK(map_word.IsForwardingAddress());
2514 FixedTypedArrayBase* target = 2515 FixedTypedArrayBase* target =
2515 reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress()); 2516 reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
2516 target->set_base_pointer(target, SKIP_WRITE_BARRIER); 2517 if (target->base_pointer() != Smi::FromInt(0))
2518 target->set_base_pointer(target, SKIP_WRITE_BARRIER);
2517 } 2519 }
2518 2520
2519 2521
2520 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot, 2522 static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot,
2521 HeapObject* object) { 2523 HeapObject* object) {
2522 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); 2524 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object);
2523 2525
2524 Heap* heap = map->GetHeap(); 2526 Heap* heap = map->GetHeap();
2525 MapWord map_word = object->map_word(); 2527 MapWord map_word = object->map_word();
2526 DCHECK(map_word.IsForwardingAddress()); 2528 DCHECK(map_word.IsForwardingAddress());
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 ExternalOneByteString::kSize); 2999 ExternalOneByteString::kSize);
2998 if (!allocation.To(&obj)) return false; 3000 if (!allocation.To(&obj)) return false;
2999 set_native_source_string_map(Map::cast(obj)); 3001 set_native_source_string_map(Map::cast(obj));
3000 } 3002 }
3001 3003
3002 ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array) 3004 ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array)
3003 ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array) 3005 ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array)
3004 ALLOCATE_VARSIZE_MAP(BYTECODE_ARRAY_TYPE, bytecode_array) 3006 ALLOCATE_VARSIZE_MAP(BYTECODE_ARRAY_TYPE, bytecode_array)
3005 ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space) 3007 ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space)
3006 3008
3007 #define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size) \
3008 ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kSize, \
3009 external_##type##_array)
3010
3011 TYPED_ARRAYS(ALLOCATE_EXTERNAL_ARRAY_MAP)
3012 #undef ALLOCATE_EXTERNAL_ARRAY_MAP
3013
3014 #define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \ 3009 #define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \
3015 ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array) 3010 ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array)
3016 3011
3017 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP) 3012 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP)
3018 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP 3013 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP
3019 3014
3020 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) 3015 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements)
3021 3016
3022 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) 3017 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code)
3023 3018
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3069 3064
3070 BytecodeArray* bytecode_array; 3065 BytecodeArray* bytecode_array;
3071 AllocationResult allocation = 3066 AllocationResult allocation =
3072 AllocateBytecodeArray(0, nullptr, kPointerSize); 3067 AllocateBytecodeArray(0, nullptr, kPointerSize);
3073 if (!allocation.To(&bytecode_array)) { 3068 if (!allocation.To(&bytecode_array)) {
3074 return false; 3069 return false;
3075 } 3070 }
3076 set_empty_bytecode_array(bytecode_array); 3071 set_empty_bytecode_array(bytecode_array);
3077 } 3072 }
3078 3073
3079 #define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
3080 { \
3081 ExternalArray* obj; \
3082 if (!AllocateEmptyExternalArray(kExternal##Type##Array).To(&obj)) \
3083 return false; \
3084 set_empty_external_##type##_array(obj); \
3085 }
3086
3087 TYPED_ARRAYS(ALLOCATE_EMPTY_EXTERNAL_ARRAY)
3088 #undef ALLOCATE_EMPTY_EXTERNAL_ARRAY
3089
3090 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ 3074 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
3091 { \ 3075 { \
3092 FixedTypedArrayBase* obj; \ 3076 FixedTypedArrayBase* obj; \
3093 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \ 3077 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \
3094 return false; \ 3078 return false; \
3095 set_empty_fixed_##type##_array(obj); \ 3079 set_empty_fixed_##type##_array(obj); \
3096 } 3080 }
3097 3081
3098 TYPED_ARRAYS(ALLOCATE_EMPTY_FIXED_TYPED_ARRAY) 3082 TYPED_ARRAYS(ALLOCATE_EMPTY_FIXED_TYPED_ARRAY)
3099 #undef ALLOCATE_EMPTY_FIXED_TYPED_ARRAY 3083 #undef ALLOCATE_EMPTY_FIXED_TYPED_ARRAY
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3695 // releasing an evacuation candidate due to a slots buffer overflow 3679 // releasing an evacuation candidate due to a slots buffer overflow
3696 // results in lost pages. 3680 // results in lost pages.
3697 mark_compact_collector()->RecordSlot(slot, slot, *slot, 3681 mark_compact_collector()->RecordSlot(slot, slot, *slot,
3698 SlotsBuffer::IGNORE_OVERFLOW); 3682 SlotsBuffer::IGNORE_OVERFLOW);
3699 } 3683 }
3700 allocation_sites_scratchpad_length_++; 3684 allocation_sites_scratchpad_length_++;
3701 } 3685 }
3702 } 3686 }
3703 3687
3704 3688
3705 Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) {
3706 return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]);
3707 }
3708
3709
3710 Heap::RootListIndex Heap::RootIndexForExternalArrayType(
3711 ExternalArrayType array_type) {
3712 switch (array_type) {
3713 #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
3714 case kExternal##Type##Array: \
3715 return kExternal##Type##ArrayMapRootIndex;
3716
3717 TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
3718 #undef ARRAY_TYPE_TO_ROOT_INDEX
3719
3720 default:
3721 UNREACHABLE();
3722 return kUndefinedValueRootIndex;
3723 }
3724 }
3725
3726 3689
3727 Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) { 3690 Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) {
3728 return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]); 3691 return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]);
3729 } 3692 }
3730 3693
3731 3694
3732 Heap::RootListIndex Heap::RootIndexForFixedTypedArray( 3695 Heap::RootListIndex Heap::RootIndexForFixedTypedArray(
3733 ExternalArrayType array_type) { 3696 ExternalArrayType array_type) {
3734 switch (array_type) { 3697 switch (array_type) {
3735 #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ 3698 #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
3736 case kExternal##Type##Array: \ 3699 case kExternal##Type##Array: \
3737 return kFixed##Type##ArrayMapRootIndex; 3700 return kFixed##Type##ArrayMapRootIndex;
3738 3701
3739 TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX) 3702 TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
3740 #undef ARRAY_TYPE_TO_ROOT_INDEX 3703 #undef ARRAY_TYPE_TO_ROOT_INDEX
3741 3704
3742 default: 3705 default:
3743 UNREACHABLE(); 3706 UNREACHABLE();
3744 return kUndefinedValueRootIndex; 3707 return kUndefinedValueRootIndex;
3745 } 3708 }
3746 } 3709 }
3747 3710
3748 3711
3749 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray(
3750 ElementsKind elementsKind) {
3751 switch (elementsKind) {
3752 #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
3753 case EXTERNAL_##TYPE##_ELEMENTS: \
3754 return kEmptyExternal##Type##ArrayRootIndex;
3755
3756 TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX)
3757 #undef ELEMENT_KIND_TO_ROOT_INDEX
3758
3759 default:
3760 UNREACHABLE();
3761 return kUndefinedValueRootIndex;
3762 }
3763 }
3764
3765
3766 Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray( 3712 Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray(
3767 ElementsKind elementsKind) { 3713 ElementsKind elementsKind) {
3768 switch (elementsKind) { 3714 switch (elementsKind) {
3769 #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ 3715 #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
3770 case TYPE##_ELEMENTS: \ 3716 case TYPE##_ELEMENTS: \
3771 return kEmptyFixed##Type##ArrayRootIndex; 3717 return kEmptyFixed##Type##ArrayRootIndex;
3772 3718
3773 TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX) 3719 TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX)
3774 #undef ELEMENT_KIND_TO_ROOT_INDEX 3720 #undef ELEMENT_KIND_TO_ROOT_INDEX
3775 default: 3721 default:
3776 UNREACHABLE(); 3722 UNREACHABLE();
3777 return kUndefinedValueRootIndex; 3723 return kUndefinedValueRootIndex;
3778 } 3724 }
3779 } 3725 }
3780 3726
3781 3727
3782 ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) {
3783 return ExternalArray::cast(
3784 roots_[RootIndexForEmptyExternalArray(map->elements_kind())]);
3785 }
3786
3787
3788 FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) { 3728 FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) {
3789 return FixedTypedArrayBase::cast( 3729 return FixedTypedArrayBase::cast(
3790 roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]); 3730 roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]);
3791 } 3731 }
3792 3732
3793 3733
3794 AllocationResult Heap::AllocateForeign(Address address, 3734 AllocationResult Heap::AllocateForeign(Address address,
3795 PretenureFlag pretenure) { 3735 PretenureFlag pretenure) {
3796 // Statically ensure that it is safe to allocate foreigns in paged spaces. 3736 // Statically ensure that it is safe to allocate foreigns in paged spaces.
3797 STATIC_ASSERT(Foreign::kSize <= Page::kMaxRegularHeapObjectSize); 3737 STATIC_ASSERT(Foreign::kSize <= Page::kMaxRegularHeapObjectSize);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 3938
3999 // Notify the heap profiler of change in object layout. The array may not be 3939 // Notify the heap profiler of change in object layout. The array may not be
4000 // moved during GC, and size has to be adjusted nevertheless. 3940 // moved during GC, and size has to be adjusted nevertheless.
4001 HeapProfiler* profiler = isolate()->heap_profiler(); 3941 HeapProfiler* profiler = isolate()->heap_profiler();
4002 if (profiler->is_tracking_allocations()) { 3942 if (profiler->is_tracking_allocations()) {
4003 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); 3943 profiler->UpdateObjectSizeEvent(object->address(), object->Size());
4004 } 3944 }
4005 } 3945 }
4006 3946
4007 3947
4008 AllocationResult Heap::AllocateExternalArray(int length, 3948 AllocationResult Heap::AllocateFixedTypedArrayWithExternalPointer(
4009 ExternalArrayType array_type, 3949 int length, ExternalArrayType array_type, void* external_pointer,
4010 void* external_pointer, 3950 PretenureFlag pretenure) {
4011 PretenureFlag pretenure) { 3951 int size = FixedTypedArrayBase::kHeaderSize;
4012 int size = ExternalArray::kSize;
4013 AllocationSpace space = SelectSpace(size, pretenure); 3952 AllocationSpace space = SelectSpace(size, pretenure);
4014 HeapObject* result; 3953 HeapObject* result;
4015 { 3954 {
4016 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); 3955 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
4017 if (!allocation.To(&result)) return allocation; 3956 if (!allocation.To(&result)) return allocation;
4018 } 3957 }
4019 3958
4020 result->set_map_no_write_barrier(MapForExternalArrayType(array_type)); 3959 result->set_map_no_write_barrier(MapForFixedTypedArray(array_type));
4021 ExternalArray::cast(result)->set_length(length); 3960 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result);
4022 ExternalArray::cast(result)->set_external_pointer(external_pointer); 3961 elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER);
4023 return result; 3962 elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER);
3963 elements->set_length(length);
3964 return elements;
4024 } 3965 }
4025 3966
4026 static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size, 3967 static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size,
4027 ElementsKind* element_kind) { 3968 ElementsKind* element_kind) {
4028 switch (array_type) { 3969 switch (array_type) {
4029 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ 3970 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
4030 case kExternal##Type##Array: \ 3971 case kExternal##Type##Array: \
4031 *element_size = size; \ 3972 *element_size = size; \
4032 *element_kind = TYPE##_ELEMENTS; \ 3973 *element_kind = TYPE##_ELEMENTS; \
4033 return; 3974 return;
(...skipping 19 matching lines...) Expand all
4053 int size = OBJECT_POINTER_ALIGN(length * element_size + 3994 int size = OBJECT_POINTER_ALIGN(length * element_size +
4054 FixedTypedArrayBase::kDataOffset); 3995 FixedTypedArrayBase::kDataOffset);
4055 AllocationSpace space = SelectSpace(size, pretenure); 3996 AllocationSpace space = SelectSpace(size, pretenure);
4056 3997
4057 HeapObject* object; 3998 HeapObject* object;
4058 AllocationResult allocation = AllocateRaw( 3999 AllocationResult allocation = AllocateRaw(
4059 size, space, OLD_SPACE, 4000 size, space, OLD_SPACE,
4060 array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned); 4001 array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned);
4061 if (!allocation.To(&object)) return allocation; 4002 if (!allocation.To(&object)) return allocation;
4062 4003
4063 object->set_map(MapForFixedTypedArray(array_type)); 4004 object->set_map_no_write_barrier(MapForFixedTypedArray(array_type));
4064 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object); 4005 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
4065 elements->set_base_pointer(elements, SKIP_WRITE_BARRIER); 4006 elements->set_base_pointer(elements, SKIP_WRITE_BARRIER);
4066 elements->set_external_pointer( 4007 elements->set_external_pointer(
4067 ExternalReference::fixed_typed_array_base_data_offset().address(), 4008 ExternalReference::fixed_typed_array_base_data_offset().address(),
4068 SKIP_WRITE_BARRIER); 4009 SKIP_WRITE_BARRIER);
4069 elements->set_length(length); 4010 elements->set_length(length);
4070 if (initialize) memset(elements->DataPtr(), 0, elements->DataSize()); 4011 if (initialize) memset(elements->DataPtr(), 0, elements->DataSize());
4071 return elements; 4012 return elements;
4072 } 4013 }
4073 4014
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 4209
4269 // Allocate the JSObject. 4210 // Allocate the JSObject.
4270 int size = map->instance_size(); 4211 int size = map->instance_size();
4271 AllocationSpace space = SelectSpace(size, pretenure); 4212 AllocationSpace space = SelectSpace(size, pretenure);
4272 JSObject* js_obj; 4213 JSObject* js_obj;
4273 AllocationResult allocation = Allocate(map, space, allocation_site); 4214 AllocationResult allocation = Allocate(map, space, allocation_site);
4274 if (!allocation.To(&js_obj)) return allocation; 4215 if (!allocation.To(&js_obj)) return allocation;
4275 4216
4276 // Initialize the JSObject. 4217 // Initialize the JSObject.
4277 InitializeJSObjectFromMap(js_obj, properties, map); 4218 InitializeJSObjectFromMap(js_obj, properties, map);
4278 DCHECK(js_obj->HasFastElements() || js_obj->HasExternalArrayElements() || 4219 DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements());
4279 js_obj->HasFixedTypedArrayElements());
4280 return js_obj; 4220 return js_obj;
4281 } 4221 }
4282 4222
4283 4223
4284 AllocationResult Heap::AllocateJSObject(JSFunction* constructor, 4224 AllocationResult Heap::AllocateJSObject(JSFunction* constructor,
4285 PretenureFlag pretenure, 4225 PretenureFlag pretenure,
4286 AllocationSite* allocation_site) { 4226 AllocationSite* allocation_site) {
4287 DCHECK(constructor->has_initial_map()); 4227 DCHECK(constructor->has_initial_map());
4288 4228
4289 // Allocate the object based on the constructors initial map. 4229 // Allocate the object based on the constructors initial map.
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); 4501 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
4562 if (!allocation.To(&result)) return allocation; 4502 if (!allocation.To(&result)) return allocation;
4563 } 4503 }
4564 // Initialize the object. 4504 // Initialize the object.
4565 result->set_map_no_write_barrier(fixed_array_map()); 4505 result->set_map_no_write_barrier(fixed_array_map());
4566 FixedArray::cast(result)->set_length(0); 4506 FixedArray::cast(result)->set_length(0);
4567 return result; 4507 return result;
4568 } 4508 }
4569 4509
4570 4510
4571 AllocationResult Heap::AllocateEmptyExternalArray(
4572 ExternalArrayType array_type) {
4573 return AllocateExternalArray(0, array_type, NULL, TENURED);
4574 }
4575
4576
4577 AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) { 4511 AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) {
4578 if (!InNewSpace(src)) { 4512 if (!InNewSpace(src)) {
4579 return src; 4513 return src;
4580 } 4514 }
4581 4515
4582 int len = src->length(); 4516 int len = src->length();
4583 HeapObject* obj; 4517 HeapObject* obj;
4584 { 4518 {
4585 AllocationResult allocation = AllocateRawFixedArray(len, TENURED); 4519 AllocationResult allocation = AllocateRawFixedArray(len, TENURED);
4586 if (!allocation.To(&obj)) return allocation; 4520 if (!allocation.To(&obj)) return allocation;
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
6989 *object_type = "CODE_TYPE"; \ 6923 *object_type = "CODE_TYPE"; \
6990 *object_sub_type = "CODE_AGE/" #name; \ 6924 *object_sub_type = "CODE_AGE/" #name; \
6991 return true; 6925 return true;
6992 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6926 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6993 #undef COMPARE_AND_RETURN_NAME 6927 #undef COMPARE_AND_RETURN_NAME
6994 } 6928 }
6995 return false; 6929 return false;
6996 } 6930 }
6997 } // namespace internal 6931 } // namespace internal
6998 } // namespace v8 6932 } // 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