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/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 | 2403 |
2404 ALLOCATE_MAP(JS_MESSAGE_OBJECT_TYPE, JSMessageObject::kSize, message_object) | 2404 ALLOCATE_MAP(JS_MESSAGE_OBJECT_TYPE, JSMessageObject::kSize, message_object) |
2405 ALLOCATE_MAP(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize, external) | 2405 ALLOCATE_MAP(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize, external) |
2406 external_map()->set_is_extensible(false); | 2406 external_map()->set_is_extensible(false); |
2407 #undef ALLOCATE_PRIMITIVE_MAP | 2407 #undef ALLOCATE_PRIMITIVE_MAP |
2408 #undef ALLOCATE_VARSIZE_MAP | 2408 #undef ALLOCATE_VARSIZE_MAP |
2409 #undef ALLOCATE_MAP | 2409 #undef ALLOCATE_MAP |
2410 } | 2410 } |
2411 | 2411 |
2412 { | 2412 { |
| 2413 AllocationResult allocation = AllocateEmptyScopeInfo(); |
| 2414 if (!allocation.To(&obj)) return false; |
| 2415 } |
| 2416 |
| 2417 set_empty_scope_info(ScopeInfo::cast(obj)); |
| 2418 { |
2413 AllocationResult allocation = Allocate(boolean_map(), OLD_SPACE); | 2419 AllocationResult allocation = Allocate(boolean_map(), OLD_SPACE); |
2414 if (!allocation.To(&obj)) return false; | 2420 if (!allocation.To(&obj)) return false; |
2415 } | 2421 } |
2416 set_true_value(Oddball::cast(obj)); | 2422 set_true_value(Oddball::cast(obj)); |
2417 Oddball::cast(obj)->set_kind(Oddball::kTrue); | 2423 Oddball::cast(obj)->set_kind(Oddball::kTrue); |
2418 | 2424 |
2419 { | 2425 { |
2420 AllocationResult allocation = Allocate(boolean_map(), OLD_SPACE); | 2426 AllocationResult allocation = Allocate(boolean_map(), OLD_SPACE); |
2421 if (!allocation.To(&obj)) return false; | 2427 if (!allocation.To(&obj)) return false; |
2422 } | 2428 } |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3802 { | 3808 { |
3803 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); | 3809 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
3804 if (!allocation.To(&result)) return allocation; | 3810 if (!allocation.To(&result)) return allocation; |
3805 } | 3811 } |
3806 // Initialize the object. | 3812 // Initialize the object. |
3807 result->set_map_no_write_barrier(fixed_array_map()); | 3813 result->set_map_no_write_barrier(fixed_array_map()); |
3808 FixedArray::cast(result)->set_length(0); | 3814 FixedArray::cast(result)->set_length(0); |
3809 return result; | 3815 return result; |
3810 } | 3816 } |
3811 | 3817 |
| 3818 AllocationResult Heap::AllocateEmptyScopeInfo() { |
| 3819 int size = FixedArray::SizeFor(0); |
| 3820 HeapObject* result = nullptr; |
| 3821 { |
| 3822 AllocationResult allocation = AllocateRaw(size, OLD_SPACE); |
| 3823 if (!allocation.To(&result)) return allocation; |
| 3824 } |
| 3825 // Initialize the object. |
| 3826 result->set_map_no_write_barrier(scope_info_map()); |
| 3827 FixedArray::cast(result)->set_length(0); |
| 3828 return result; |
| 3829 } |
3812 | 3830 |
3813 AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) { | 3831 AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) { |
3814 if (!InNewSpace(src)) { | 3832 if (!InNewSpace(src)) { |
3815 return src; | 3833 return src; |
3816 } | 3834 } |
3817 | 3835 |
3818 int len = src->length(); | 3836 int len = src->length(); |
3819 HeapObject* obj = nullptr; | 3837 HeapObject* obj = nullptr; |
3820 { | 3838 { |
3821 AllocationResult allocation = AllocateRawFixedArray(len, TENURED); | 3839 AllocationResult allocation = AllocateRawFixedArray(len, TENURED); |
(...skipping 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6538 } | 6556 } |
6539 | 6557 |
6540 | 6558 |
6541 // static | 6559 // static |
6542 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6560 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6543 return StaticVisitorBase::GetVisitorId(map); | 6561 return StaticVisitorBase::GetVisitorId(map); |
6544 } | 6562 } |
6545 | 6563 |
6546 } // namespace internal | 6564 } // namespace internal |
6547 } // namespace v8 | 6565 } // namespace v8 |
OLD | NEW |