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/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2808 } | 2808 } |
2809 | 2809 |
2810 { | 2810 { |
2811 Handle<FixedArray> empty_literals_array = | 2811 Handle<FixedArray> empty_literals_array = |
2812 factory->NewFixedArray(1, TENURED); | 2812 factory->NewFixedArray(1, TENURED); |
2813 empty_literals_array->set(0, *factory->empty_fixed_array()); | 2813 empty_literals_array->set(0, *factory->empty_fixed_array()); |
2814 set_empty_literals_array(*empty_literals_array); | 2814 set_empty_literals_array(*empty_literals_array); |
2815 } | 2815 } |
2816 | 2816 |
2817 { | 2817 { |
| 2818 Handle<FixedArray> empty_sloppy_arguments_elements = |
| 2819 factory->NewFixedArray(2, TENURED); |
| 2820 empty_sloppy_arguments_elements->set_map(sloppy_arguments_elements_map()); |
| 2821 set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements); |
| 2822 } |
| 2823 |
| 2824 { |
2818 Handle<WeakCell> cell = factory->NewWeakCell(factory->undefined_value()); | 2825 Handle<WeakCell> cell = factory->NewWeakCell(factory->undefined_value()); |
2819 set_empty_weak_cell(*cell); | 2826 set_empty_weak_cell(*cell); |
2820 cell->clear(); | 2827 cell->clear(); |
2821 | 2828 |
2822 Handle<FixedArray> cleared_optimized_code_map = | 2829 Handle<FixedArray> cleared_optimized_code_map = |
2823 factory->NewFixedArray(SharedFunctionInfo::kEntriesStart, TENURED); | 2830 factory->NewFixedArray(SharedFunctionInfo::kEntriesStart, TENURED); |
2824 cleared_optimized_code_map->set(SharedFunctionInfo::kSharedCodeIndex, | 2831 cleared_optimized_code_map->set(SharedFunctionInfo::kSharedCodeIndex, |
2825 *cell); | 2832 *cell); |
2826 STATIC_ASSERT(SharedFunctionInfo::kEntriesStart == 1 && | 2833 STATIC_ASSERT(SharedFunctionInfo::kEntriesStart == 1 && |
2827 SharedFunctionInfo::kSharedCodeIndex == 0); | 2834 SharedFunctionInfo::kSharedCodeIndex == 0); |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 | 3555 |
3549 // Allocate the JSObject. | 3556 // Allocate the JSObject. |
3550 AllocationSpace space = SelectSpace(pretenure); | 3557 AllocationSpace space = SelectSpace(pretenure); |
3551 JSObject* js_obj = nullptr; | 3558 JSObject* js_obj = nullptr; |
3552 AllocationResult allocation = Allocate(map, space, allocation_site); | 3559 AllocationResult allocation = Allocate(map, space, allocation_site); |
3553 if (!allocation.To(&js_obj)) return allocation; | 3560 if (!allocation.To(&js_obj)) return allocation; |
3554 | 3561 |
3555 // Initialize the JSObject. | 3562 // Initialize the JSObject. |
3556 InitializeJSObjectFromMap(js_obj, properties, map); | 3563 InitializeJSObjectFromMap(js_obj, properties, map); |
3557 DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements() || | 3564 DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements() || |
3558 js_obj->HasFastStringWrapperElements()); | 3565 js_obj->HasFastStringWrapperElements() || |
| 3566 js_obj->HasFastArgumentsElements()); |
3559 return js_obj; | 3567 return js_obj; |
3560 } | 3568 } |
3561 | 3569 |
3562 | 3570 |
3563 AllocationResult Heap::AllocateJSObject(JSFunction* constructor, | 3571 AllocationResult Heap::AllocateJSObject(JSFunction* constructor, |
3564 PretenureFlag pretenure, | 3572 PretenureFlag pretenure, |
3565 AllocationSite* allocation_site) { | 3573 AllocationSite* allocation_site) { |
3566 DCHECK(constructor->has_initial_map()); | 3574 DCHECK(constructor->has_initial_map()); |
3567 | 3575 |
3568 // Allocate the object based on the constructors initial map. | 3576 // Allocate the object based on the constructors initial map. |
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6383 } | 6391 } |
6384 | 6392 |
6385 | 6393 |
6386 // static | 6394 // static |
6387 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6395 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6388 return StaticVisitorBase::GetVisitorId(map); | 6396 return StaticVisitorBase::GetVisitorId(map); |
6389 } | 6397 } |
6390 | 6398 |
6391 } // namespace internal | 6399 } // namespace internal |
6392 } // namespace v8 | 6400 } // namespace v8 |
OLD | NEW |