Chromium Code Reviews| 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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2996 AllocationResult allocation = AllocateMap(EXTERNAL_ONE_BYTE_STRING_TYPE, | 2998 AllocationResult allocation = AllocateMap(EXTERNAL_ONE_BYTE_STRING_TYPE, |
| 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(FREE_SPACE_TYPE, free_space) | 3006 ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space) |
| 3005 | 3007 |
| 3006 #define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size) \ | |
| 3007 ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kSize, \ | |
| 3008 external_##type##_array) | |
| 3009 | |
| 3010 TYPED_ARRAYS(ALLOCATE_EXTERNAL_ARRAY_MAP) | |
| 3011 #undef ALLOCATE_EXTERNAL_ARRAY_MAP | |
| 3012 | |
| 3013 #define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \ | 3008 #define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \ |
| 3014 ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array) | 3009 ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array) |
| 3015 | 3010 |
| 3016 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP) | 3011 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP) |
| 3017 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP | 3012 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP |
| 3018 | 3013 |
| 3019 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) | 3014 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) |
| 3020 | 3015 |
| 3021 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) | 3016 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) |
| 3022 | 3017 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3060 #undef ALLOCATE_MAP | 3055 #undef ALLOCATE_MAP |
| 3061 } | 3056 } |
| 3062 | 3057 |
| 3063 { // Empty arrays | 3058 { // Empty arrays |
| 3064 { | 3059 { |
| 3065 ByteArray* byte_array; | 3060 ByteArray* byte_array; |
| 3066 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; | 3061 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; |
| 3067 set_empty_byte_array(byte_array); | 3062 set_empty_byte_array(byte_array); |
| 3068 } | 3063 } |
| 3069 | 3064 |
| 3070 #define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \ | |
| 3071 { \ | |
| 3072 ExternalArray* obj; \ | |
| 3073 if (!AllocateEmptyExternalArray(kExternal##Type##Array).To(&obj)) \ | |
| 3074 return false; \ | |
| 3075 set_empty_external_##type##_array(obj); \ | |
| 3076 } | |
| 3077 | |
| 3078 TYPED_ARRAYS(ALLOCATE_EMPTY_EXTERNAL_ARRAY) | |
| 3079 #undef ALLOCATE_EMPTY_EXTERNAL_ARRAY | |
| 3080 | |
| 3081 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 3065 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
| 3082 { \ | 3066 { \ |
| 3083 FixedTypedArrayBase* obj; \ | 3067 FixedTypedArrayBase* obj; \ |
| 3084 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \ | 3068 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \ |
| 3085 return false; \ | 3069 return false; \ |
| 3086 set_empty_fixed_##type##_array(obj); \ | 3070 set_empty_fixed_##type##_array(obj); \ |
| 3087 } | 3071 } |
| 3088 | 3072 |
| 3089 TYPED_ARRAYS(ALLOCATE_EMPTY_FIXED_TYPED_ARRAY) | 3073 TYPED_ARRAYS(ALLOCATE_EMPTY_FIXED_TYPED_ARRAY) |
| 3090 #undef ALLOCATE_EMPTY_FIXED_TYPED_ARRAY | 3074 #undef ALLOCATE_EMPTY_FIXED_TYPED_ARRAY |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3683 // releasing an evacuation candidate due to a slots buffer overflow | 3667 // releasing an evacuation candidate due to a slots buffer overflow |
| 3684 // results in lost pages. | 3668 // results in lost pages. |
| 3685 mark_compact_collector()->RecordSlot(slot, slot, *slot, | 3669 mark_compact_collector()->RecordSlot(slot, slot, *slot, |
| 3686 SlotsBuffer::IGNORE_OVERFLOW); | 3670 SlotsBuffer::IGNORE_OVERFLOW); |
| 3687 } | 3671 } |
| 3688 allocation_sites_scratchpad_length_++; | 3672 allocation_sites_scratchpad_length_++; |
| 3689 } | 3673 } |
| 3690 } | 3674 } |
| 3691 | 3675 |
| 3692 | 3676 |
| 3693 Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) { | |
| 3694 return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]); | |
| 3695 } | |
| 3696 | |
| 3697 | |
| 3698 Heap::RootListIndex Heap::RootIndexForExternalArrayType( | |
| 3699 ExternalArrayType array_type) { | |
| 3700 switch (array_type) { | |
| 3701 #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ | |
| 3702 case kExternal##Type##Array: \ | |
| 3703 return kExternal##Type##ArrayMapRootIndex; | |
| 3704 | |
| 3705 TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX) | |
| 3706 #undef ARRAY_TYPE_TO_ROOT_INDEX | |
| 3707 | |
| 3708 default: | |
| 3709 UNREACHABLE(); | |
| 3710 return kUndefinedValueRootIndex; | |
| 3711 } | |
| 3712 } | |
| 3713 | |
| 3714 | 3677 |
| 3715 Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) { | 3678 Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) { |
| 3716 return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]); | 3679 return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]); |
| 3717 } | 3680 } |
| 3718 | 3681 |
| 3719 | 3682 |
| 3720 Heap::RootListIndex Heap::RootIndexForFixedTypedArray( | 3683 Heap::RootListIndex Heap::RootIndexForFixedTypedArray( |
| 3721 ExternalArrayType array_type) { | 3684 ExternalArrayType array_type) { |
| 3722 switch (array_type) { | 3685 switch (array_type) { |
| 3723 #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ | 3686 #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ |
| 3724 case kExternal##Type##Array: \ | 3687 case kExternal##Type##Array: \ |
| 3725 return kFixed##Type##ArrayMapRootIndex; | 3688 return kFixed##Type##ArrayMapRootIndex; |
| 3726 | 3689 |
| 3727 TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX) | 3690 TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX) |
| 3728 #undef ARRAY_TYPE_TO_ROOT_INDEX | 3691 #undef ARRAY_TYPE_TO_ROOT_INDEX |
| 3729 | 3692 |
| 3730 default: | 3693 default: |
| 3731 UNREACHABLE(); | 3694 UNREACHABLE(); |
| 3732 return kUndefinedValueRootIndex; | 3695 return kUndefinedValueRootIndex; |
| 3733 } | 3696 } |
| 3734 } | 3697 } |
| 3735 | 3698 |
| 3736 | 3699 |
| 3737 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray( | |
| 3738 ElementsKind elementsKind) { | |
| 3739 switch (elementsKind) { | |
| 3740 #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ | |
| 3741 case EXTERNAL_##TYPE##_ELEMENTS: \ | |
| 3742 return kEmptyExternal##Type##ArrayRootIndex; | |
| 3743 | |
| 3744 TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX) | |
| 3745 #undef ELEMENT_KIND_TO_ROOT_INDEX | |
| 3746 | |
| 3747 default: | |
| 3748 UNREACHABLE(); | |
| 3749 return kUndefinedValueRootIndex; | |
| 3750 } | |
| 3751 } | |
| 3752 | |
| 3753 | |
| 3754 Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray( | 3700 Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray( |
| 3755 ElementsKind elementsKind) { | 3701 ElementsKind elementsKind) { |
| 3756 switch (elementsKind) { | 3702 switch (elementsKind) { |
| 3757 #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ | 3703 #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \ |
| 3758 case TYPE##_ELEMENTS: \ | 3704 case TYPE##_ELEMENTS: \ |
| 3759 return kEmptyFixed##Type##ArrayRootIndex; | 3705 return kEmptyFixed##Type##ArrayRootIndex; |
| 3760 | 3706 |
| 3761 TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX) | 3707 TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX) |
| 3762 #undef ELEMENT_KIND_TO_ROOT_INDEX | 3708 #undef ELEMENT_KIND_TO_ROOT_INDEX |
| 3763 default: | 3709 default: |
| 3764 UNREACHABLE(); | 3710 UNREACHABLE(); |
| 3765 return kUndefinedValueRootIndex; | 3711 return kUndefinedValueRootIndex; |
| 3766 } | 3712 } |
| 3767 } | 3713 } |
| 3768 | 3714 |
| 3769 | 3715 |
| 3770 ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) { | |
| 3771 return ExternalArray::cast( | |
| 3772 roots_[RootIndexForEmptyExternalArray(map->elements_kind())]); | |
| 3773 } | |
| 3774 | |
| 3775 | |
| 3776 FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) { | 3716 FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) { |
| 3777 return FixedTypedArrayBase::cast( | 3717 return FixedTypedArrayBase::cast( |
| 3778 roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]); | 3718 roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]); |
| 3779 } | 3719 } |
| 3780 | 3720 |
| 3781 | 3721 |
| 3782 AllocationResult Heap::AllocateForeign(Address address, | 3722 AllocationResult Heap::AllocateForeign(Address address, |
| 3783 PretenureFlag pretenure) { | 3723 PretenureFlag pretenure) { |
| 3784 // Statically ensure that it is safe to allocate foreigns in paged spaces. | 3724 // Statically ensure that it is safe to allocate foreigns in paged spaces. |
| 3785 STATIC_ASSERT(Foreign::kSize <= Page::kMaxRegularHeapObjectSize); | 3725 STATIC_ASSERT(Foreign::kSize <= Page::kMaxRegularHeapObjectSize); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3966 if (profiler->is_tracking_allocations()) { | 3906 if (profiler->is_tracking_allocations()) { |
| 3967 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); | 3907 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); |
| 3968 } | 3908 } |
| 3969 } | 3909 } |
| 3970 | 3910 |
| 3971 | 3911 |
| 3972 AllocationResult Heap::AllocateExternalArray(int length, | 3912 AllocationResult Heap::AllocateExternalArray(int length, |
| 3973 ExternalArrayType array_type, | 3913 ExternalArrayType array_type, |
| 3974 void* external_pointer, | 3914 void* external_pointer, |
| 3975 PretenureFlag pretenure) { | 3915 PretenureFlag pretenure) { |
| 3976 int size = ExternalArray::kSize; | 3916 int size = FixedTypedArrayBase::kHeaderSize; |
|
Hannes Payer (out of office)
2015/07/24 13:40:59
Can we have a kSize?
jochen (gone - plz use gerrit)
2015/07/24 16:04:36
that's misleading, because a fixed array can be on
Hannes Payer (out of office)
2015/07/27 08:40:05
Both sides are misleading. I do not have a strong
jochen (gone - plz use gerrit)
2015/07/27 08:46:16
I'll keep kHeaderSize then :)
| |
| 3977 AllocationSpace space = SelectSpace(size, pretenure); | 3917 AllocationSpace space = SelectSpace(size, pretenure); |
| 3978 HeapObject* result; | 3918 HeapObject* result; |
| 3979 { | 3919 { |
| 3980 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); | 3920 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
| 3981 if (!allocation.To(&result)) return allocation; | 3921 if (!allocation.To(&result)) return allocation; |
| 3982 } | 3922 } |
| 3983 | 3923 |
| 3984 result->set_map_no_write_barrier(MapForExternalArrayType(array_type)); | 3924 result->set_map(MapForFixedTypedArray(array_type)); |
|
Hannes Payer (out of office)
2015/07/24 13:40:59
Why not set_map_no_write_barrier?
jochen (gone - plz use gerrit)
2015/07/24 16:04:36
copied from AllocateFixedTypedArray below
Hannes Payer (out of office)
2015/07/27 08:40:05
This is part of the roots_ array. No need for a wr
jochen (gone - plz use gerrit)
2015/07/27 08:46:16
fixed both
| |
| 3985 ExternalArray::cast(result)->set_length(length); | 3925 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result); |
| 3986 ExternalArray::cast(result)->set_external_pointer(external_pointer); | 3926 elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 3987 return result; | 3927 elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER); |
| 3928 elements->set_length(length); | |
| 3929 return elements; | |
| 3988 } | 3930 } |
| 3989 | 3931 |
| 3990 static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size, | 3932 static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size, |
| 3991 ElementsKind* element_kind) { | 3933 ElementsKind* element_kind) { |
| 3992 switch (array_type) { | 3934 switch (array_type) { |
| 3993 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 3935 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 3994 case kExternal##Type##Array: \ | 3936 case kExternal##Type##Array: \ |
| 3995 *element_size = size; \ | 3937 *element_size = size; \ |
| 3996 *element_kind = TYPE##_ELEMENTS; \ | 3938 *element_kind = TYPE##_ELEMENTS; \ |
| 3997 return; | 3939 return; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4232 | 4174 |
| 4233 // Allocate the JSObject. | 4175 // Allocate the JSObject. |
| 4234 int size = map->instance_size(); | 4176 int size = map->instance_size(); |
| 4235 AllocationSpace space = SelectSpace(size, pretenure); | 4177 AllocationSpace space = SelectSpace(size, pretenure); |
| 4236 JSObject* js_obj; | 4178 JSObject* js_obj; |
| 4237 AllocationResult allocation = Allocate(map, space, allocation_site); | 4179 AllocationResult allocation = Allocate(map, space, allocation_site); |
| 4238 if (!allocation.To(&js_obj)) return allocation; | 4180 if (!allocation.To(&js_obj)) return allocation; |
| 4239 | 4181 |
| 4240 // Initialize the JSObject. | 4182 // Initialize the JSObject. |
| 4241 InitializeJSObjectFromMap(js_obj, properties, map); | 4183 InitializeJSObjectFromMap(js_obj, properties, map); |
| 4242 DCHECK(js_obj->HasFastElements() || js_obj->HasExternalArrayElements() || | 4184 DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements()); |
| 4243 js_obj->HasFixedTypedArrayElements()); | |
| 4244 return js_obj; | 4185 return js_obj; |
| 4245 } | 4186 } |
| 4246 | 4187 |
| 4247 | 4188 |
| 4248 AllocationResult Heap::AllocateJSObject(JSFunction* constructor, | 4189 AllocationResult Heap::AllocateJSObject(JSFunction* constructor, |
| 4249 PretenureFlag pretenure, | 4190 PretenureFlag pretenure, |
| 4250 AllocationSite* allocation_site) { | 4191 AllocationSite* allocation_site) { |
| 4251 DCHECK(constructor->has_initial_map()); | 4192 DCHECK(constructor->has_initial_map()); |
| 4252 | 4193 |
| 4253 // Allocate the object based on the constructors initial map. | 4194 // Allocate the object based on the constructors initial map. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4525 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); | 4466 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
| 4526 if (!allocation.To(&result)) return allocation; | 4467 if (!allocation.To(&result)) return allocation; |
| 4527 } | 4468 } |
| 4528 // Initialize the object. | 4469 // Initialize the object. |
| 4529 result->set_map_no_write_barrier(fixed_array_map()); | 4470 result->set_map_no_write_barrier(fixed_array_map()); |
| 4530 FixedArray::cast(result)->set_length(0); | 4471 FixedArray::cast(result)->set_length(0); |
| 4531 return result; | 4472 return result; |
| 4532 } | 4473 } |
| 4533 | 4474 |
| 4534 | 4475 |
| 4535 AllocationResult Heap::AllocateEmptyExternalArray( | |
| 4536 ExternalArrayType array_type) { | |
| 4537 return AllocateExternalArray(0, array_type, NULL, TENURED); | |
| 4538 } | |
| 4539 | |
| 4540 | |
| 4541 AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) { | 4476 AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) { |
| 4542 if (!InNewSpace(src)) { | 4477 if (!InNewSpace(src)) { |
| 4543 return src; | 4478 return src; |
| 4544 } | 4479 } |
| 4545 | 4480 |
| 4546 int len = src->length(); | 4481 int len = src->length(); |
| 4547 HeapObject* obj; | 4482 HeapObject* obj; |
| 4548 { | 4483 { |
| 4549 AllocationResult allocation = AllocateRawFixedArray(len, TENURED); | 4484 AllocationResult allocation = AllocateRawFixedArray(len, TENURED); |
| 4550 if (!allocation.To(&obj)) return allocation; | 4485 if (!allocation.To(&obj)) return allocation; |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6918 *object_type = "CODE_TYPE"; \ | 6853 *object_type = "CODE_TYPE"; \ |
| 6919 *object_sub_type = "CODE_AGE/" #name; \ | 6854 *object_sub_type = "CODE_AGE/" #name; \ |
| 6920 return true; | 6855 return true; |
| 6921 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6856 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6922 #undef COMPARE_AND_RETURN_NAME | 6857 #undef COMPARE_AND_RETURN_NAME |
| 6923 } | 6858 } |
| 6924 return false; | 6859 return false; |
| 6925 } | 6860 } |
| 6926 } // namespace internal | 6861 } // namespace internal |
| 6927 } // namespace v8 | 6862 } // namespace v8 |
| OLD | NEW |