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

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

Issue 1131783003: Embedded constant pools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix debug-mode Arm issue. Created 5 years, 6 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/heap-inl.h » ('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 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 // Take another spin if there are now unswept objects in new space 1969 // Take another spin if there are now unswept objects in new space
1970 // (there are currently no more unswept promoted objects). 1970 // (there are currently no more unswept promoted objects).
1971 } while (new_space_front != new_space_.top()); 1971 } while (new_space_front != new_space_.top());
1972 1972
1973 return new_space_front; 1973 return new_space_front;
1974 } 1974 }
1975 1975
1976 1976
1977 STATIC_ASSERT((FixedDoubleArray::kHeaderSize & kDoubleAlignmentMask) == 1977 STATIC_ASSERT((FixedDoubleArray::kHeaderSize & kDoubleAlignmentMask) ==
1978 0); // NOLINT 1978 0); // NOLINT
1979 STATIC_ASSERT((ConstantPoolArray::kFirstEntryOffset & kDoubleAlignmentMask) ==
1980 0); // NOLINT
1981 STATIC_ASSERT((ConstantPoolArray::kExtendedFirstOffset &
1982 kDoubleAlignmentMask) == 0); // NOLINT
1983 STATIC_ASSERT((FixedTypedArrayBase::kDataOffset & kDoubleAlignmentMask) == 1979 STATIC_ASSERT((FixedTypedArrayBase::kDataOffset & kDoubleAlignmentMask) ==
1984 0); // NOLINT 1980 0); // NOLINT
1985 #ifdef V8_HOST_ARCH_32_BIT 1981 #ifdef V8_HOST_ARCH_32_BIT
1986 STATIC_ASSERT((HeapNumber::kValueOffset & kDoubleAlignmentMask) != 1982 STATIC_ASSERT((HeapNumber::kValueOffset & kDoubleAlignmentMask) !=
1987 0); // NOLINT 1983 0); // NOLINT
1988 #endif 1984 #endif
1989 1985
1990 1986
1991 int Heap::GetMaximumFillToAlign(AllocationAlignment alignment) { 1987 int Heap::GetMaximumFillToAlign(AllocationAlignment alignment) {
1992 switch (alignment) { 1988 switch (alignment) {
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 #define ALLOCATE_PARTIAL_MAP(instance_type, size, field_name) \ 2602 #define ALLOCATE_PARTIAL_MAP(instance_type, size, field_name) \
2607 { \ 2603 { \
2608 Map* map; \ 2604 Map* map; \
2609 if (!AllocatePartialMap((instance_type), (size)).To(&map)) return false; \ 2605 if (!AllocatePartialMap((instance_type), (size)).To(&map)) return false; \
2610 set_##field_name##_map(map); \ 2606 set_##field_name##_map(map); \
2611 } 2607 }
2612 2608
2613 ALLOCATE_PARTIAL_MAP(FIXED_ARRAY_TYPE, kVariableSizeSentinel, fixed_array); 2609 ALLOCATE_PARTIAL_MAP(FIXED_ARRAY_TYPE, kVariableSizeSentinel, fixed_array);
2614 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, undefined); 2610 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, undefined);
2615 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, null); 2611 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, null);
2616 ALLOCATE_PARTIAL_MAP(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel,
2617 constant_pool_array);
2618 2612
2619 #undef ALLOCATE_PARTIAL_MAP 2613 #undef ALLOCATE_PARTIAL_MAP
2620 } 2614 }
2621 2615
2622 // Allocate the empty array. 2616 // Allocate the empty array.
2623 { 2617 {
2624 AllocationResult allocation = AllocateEmptyFixedArray(); 2618 AllocationResult allocation = AllocateEmptyFixedArray();
2625 if (!allocation.To(&obj)) return false; 2619 if (!allocation.To(&obj)) return false;
2626 } 2620 }
2627 set_empty_fixed_array(FixedArray::cast(obj)); 2621 set_empty_fixed_array(FixedArray::cast(obj));
(...skipping 16 matching lines...) Expand all
2644 // Set preliminary exception sentinel value before actually initializing it. 2638 // Set preliminary exception sentinel value before actually initializing it.
2645 set_exception(null_value()); 2639 set_exception(null_value());
2646 2640
2647 // Allocate the empty descriptor array. 2641 // Allocate the empty descriptor array.
2648 { 2642 {
2649 AllocationResult allocation = AllocateEmptyFixedArray(); 2643 AllocationResult allocation = AllocateEmptyFixedArray();
2650 if (!allocation.To(&obj)) return false; 2644 if (!allocation.To(&obj)) return false;
2651 } 2645 }
2652 set_empty_descriptor_array(DescriptorArray::cast(obj)); 2646 set_empty_descriptor_array(DescriptorArray::cast(obj));
2653 2647
2654 // Allocate the constant pool array.
2655 {
2656 AllocationResult allocation = AllocateEmptyConstantPoolArray();
2657 if (!allocation.To(&obj)) return false;
2658 }
2659 set_empty_constant_pool_array(ConstantPoolArray::cast(obj));
2660
2661 // Fix the instance_descriptors for the existing maps. 2648 // Fix the instance_descriptors for the existing maps.
2662 meta_map()->set_code_cache(empty_fixed_array()); 2649 meta_map()->set_code_cache(empty_fixed_array());
2663 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2650 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2664 meta_map()->set_raw_transitions(Smi::FromInt(0)); 2651 meta_map()->set_raw_transitions(Smi::FromInt(0));
2665 meta_map()->set_instance_descriptors(empty_descriptor_array()); 2652 meta_map()->set_instance_descriptors(empty_descriptor_array());
2666 if (FLAG_unbox_double_fields) { 2653 if (FLAG_unbox_double_fields) {
2667 meta_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); 2654 meta_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2668 } 2655 }
2669 2656
2670 fixed_array_map()->set_code_cache(empty_fixed_array()); 2657 fixed_array_map()->set_code_cache(empty_fixed_array());
(...skipping 16 matching lines...) Expand all
2687 } 2674 }
2688 2675
2689 null_map()->set_code_cache(empty_fixed_array()); 2676 null_map()->set_code_cache(empty_fixed_array());
2690 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2677 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2691 null_map()->set_raw_transitions(Smi::FromInt(0)); 2678 null_map()->set_raw_transitions(Smi::FromInt(0));
2692 null_map()->set_instance_descriptors(empty_descriptor_array()); 2679 null_map()->set_instance_descriptors(empty_descriptor_array());
2693 if (FLAG_unbox_double_fields) { 2680 if (FLAG_unbox_double_fields) {
2694 null_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); 2681 null_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2695 } 2682 }
2696 2683
2697 constant_pool_array_map()->set_code_cache(empty_fixed_array());
2698 constant_pool_array_map()->set_dependent_code(
2699 DependentCode::cast(empty_fixed_array()));
2700 constant_pool_array_map()->set_raw_transitions(Smi::FromInt(0));
2701 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array());
2702 if (FLAG_unbox_double_fields) {
2703 constant_pool_array_map()->set_layout_descriptor(
2704 LayoutDescriptor::FastPointerLayout());
2705 }
2706
2707 // Fix prototype object for existing maps. 2684 // Fix prototype object for existing maps.
2708 meta_map()->set_prototype(null_value()); 2685 meta_map()->set_prototype(null_value());
2709 meta_map()->set_constructor_or_backpointer(null_value()); 2686 meta_map()->set_constructor_or_backpointer(null_value());
2710 2687
2711 fixed_array_map()->set_prototype(null_value()); 2688 fixed_array_map()->set_prototype(null_value());
2712 fixed_array_map()->set_constructor_or_backpointer(null_value()); 2689 fixed_array_map()->set_constructor_or_backpointer(null_value());
2713 2690
2714 undefined_map()->set_prototype(null_value()); 2691 undefined_map()->set_prototype(null_value());
2715 undefined_map()->set_constructor_or_backpointer(null_value()); 2692 undefined_map()->set_constructor_or_backpointer(null_value());
2716 2693
2717 null_map()->set_prototype(null_value()); 2694 null_map()->set_prototype(null_value());
2718 null_map()->set_constructor_or_backpointer(null_value()); 2695 null_map()->set_constructor_or_backpointer(null_value());
2719 2696
2720 constant_pool_array_map()->set_prototype(null_value());
2721 constant_pool_array_map()->set_constructor_or_backpointer(null_value());
2722
2723 { // Map allocation 2697 { // Map allocation
2724 #define ALLOCATE_MAP(instance_type, size, field_name) \ 2698 #define ALLOCATE_MAP(instance_type, size, field_name) \
2725 { \ 2699 { \
2726 Map* map; \ 2700 Map* map; \
2727 if (!AllocateMap((instance_type), size).To(&map)) return false; \ 2701 if (!AllocateMap((instance_type), size).To(&map)) return false; \
2728 set_##field_name##_map(map); \ 2702 set_##field_name##_map(map); \
2729 } 2703 }
2730 2704
2731 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ 2705 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \
2732 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) 2706 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name)
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3783 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || 3757 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() ||
3784 isolate_->code_range()->contains(code->address())); 3758 isolate_->code_range()->contains(code->address()));
3785 code->set_gc_metadata(Smi::FromInt(0)); 3759 code->set_gc_metadata(Smi::FromInt(0));
3786 code->set_ic_age(global_ic_age_); 3760 code->set_ic_age(global_ic_age_);
3787 return code; 3761 return code;
3788 } 3762 }
3789 3763
3790 3764
3791 AllocationResult Heap::CopyCode(Code* code) { 3765 AllocationResult Heap::CopyCode(Code* code) {
3792 AllocationResult allocation; 3766 AllocationResult allocation;
3793 HeapObject* new_constant_pool;
3794 if (FLAG_enable_ool_constant_pool &&
3795 code->constant_pool() != empty_constant_pool_array()) {
3796 // Copy the constant pool, since edits to the copied code may modify
3797 // the constant pool.
3798 allocation = CopyConstantPoolArray(code->constant_pool());
3799 if (!allocation.To(&new_constant_pool)) return allocation;
3800 } else {
3801 new_constant_pool = empty_constant_pool_array();
3802 }
3803 3767
3804 HeapObject* result = NULL; 3768 HeapObject* result = NULL;
3805 // Allocate an object the same size as the code object. 3769 // Allocate an object the same size as the code object.
3806 int obj_size = code->Size(); 3770 int obj_size = code->Size();
3807 allocation = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE); 3771 allocation = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE);
3808 if (!allocation.To(&result)) return allocation; 3772 if (!allocation.To(&result)) return allocation;
3809 3773
3810 // Copy code object. 3774 // Copy code object.
3811 Address old_addr = code->address(); 3775 Address old_addr = code->address();
3812 Address new_addr = result->address(); 3776 Address new_addr = result->address();
3813 CopyBlock(new_addr, old_addr, obj_size); 3777 CopyBlock(new_addr, old_addr, obj_size);
3814 Code* new_code = Code::cast(result); 3778 Code* new_code = Code::cast(result);
3815 3779
3816 // Update the constant pool.
3817 new_code->set_constant_pool(new_constant_pool);
3818
3819 // Relocate the copy. 3780 // Relocate the copy.
3820 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); 3781 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment));
3821 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || 3782 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() ||
3822 isolate_->code_range()->contains(code->address())); 3783 isolate_->code_range()->contains(code->address()));
3823 new_code->Relocate(new_addr - old_addr); 3784 new_code->Relocate(new_addr - old_addr);
3824 return new_code; 3785 return new_code;
3825 } 3786 }
3826 3787
3827 3788
3828 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { 3789 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
3829 // Allocate ByteArray and ConstantPoolArray before the Code object, so that we 3790 // Allocate ByteArray before the Code object, so that we do not risk
3830 // do not risk leaving uninitialized Code object (and breaking the heap). 3791 // leaving uninitialized Code object (and breaking the heap).
3831 ByteArray* reloc_info_array; 3792 ByteArray* reloc_info_array;
3832 { 3793 {
3833 AllocationResult allocation = 3794 AllocationResult allocation =
3834 AllocateByteArray(reloc_info.length(), TENURED); 3795 AllocateByteArray(reloc_info.length(), TENURED);
3835 if (!allocation.To(&reloc_info_array)) return allocation; 3796 if (!allocation.To(&reloc_info_array)) return allocation;
3836 } 3797 }
3837 HeapObject* new_constant_pool;
3838 if (FLAG_enable_ool_constant_pool &&
3839 code->constant_pool() != empty_constant_pool_array()) {
3840 // Copy the constant pool, since edits to the copied code may modify
3841 // the constant pool.
3842 AllocationResult allocation = CopyConstantPoolArray(code->constant_pool());
3843 if (!allocation.To(&new_constant_pool)) return allocation;
3844 } else {
3845 new_constant_pool = empty_constant_pool_array();
3846 }
3847 3798
3848 int new_body_size = RoundUp(code->instruction_size(), kObjectAlignment); 3799 int new_body_size = RoundUp(code->instruction_size(), kObjectAlignment);
3849 3800
3850 int new_obj_size = Code::SizeFor(new_body_size); 3801 int new_obj_size = Code::SizeFor(new_body_size);
3851 3802
3852 Address old_addr = code->address(); 3803 Address old_addr = code->address();
3853 3804
3854 size_t relocation_offset = 3805 size_t relocation_offset =
3855 static_cast<size_t>(code->instruction_end() - old_addr); 3806 static_cast<size_t>(code->instruction_end() - old_addr);
3856 3807
3857 HeapObject* result; 3808 HeapObject* result;
3858 AllocationResult allocation = 3809 AllocationResult allocation =
3859 AllocateRaw(new_obj_size, CODE_SPACE, CODE_SPACE); 3810 AllocateRaw(new_obj_size, CODE_SPACE, CODE_SPACE);
3860 if (!allocation.To(&result)) return allocation; 3811 if (!allocation.To(&result)) return allocation;
3861 3812
3862 // Copy code object. 3813 // Copy code object.
3863 Address new_addr = result->address(); 3814 Address new_addr = result->address();
3864 3815
3865 // Copy header and instructions. 3816 // Copy header and instructions.
3866 CopyBytes(new_addr, old_addr, relocation_offset); 3817 CopyBytes(new_addr, old_addr, relocation_offset);
3867 3818
3868 Code* new_code = Code::cast(result); 3819 Code* new_code = Code::cast(result);
3869 new_code->set_relocation_info(reloc_info_array); 3820 new_code->set_relocation_info(reloc_info_array);
3870 3821
3871 // Update constant pool.
3872 new_code->set_constant_pool(new_constant_pool);
3873
3874 // Copy patched rinfo. 3822 // Copy patched rinfo.
3875 CopyBytes(new_code->relocation_start(), reloc_info.start(), 3823 CopyBytes(new_code->relocation_start(), reloc_info.start(),
3876 static_cast<size_t>(reloc_info.length())); 3824 static_cast<size_t>(reloc_info.length()));
3877 3825
3878 // Relocate the copy. 3826 // Relocate the copy.
3879 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); 3827 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment));
3880 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || 3828 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() ||
3881 isolate_->code_range()->contains(code->address())); 3829 isolate_->code_range()->contains(code->address()));
3882 new_code->Relocate(new_addr - old_addr); 3830 new_code->Relocate(new_addr - old_addr);
3883 3831
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4356 if (!allocation.To(&obj)) return allocation; 4304 if (!allocation.To(&obj)) return allocation;
4357 } 4305 }
4358 obj->set_map_no_write_barrier(map); 4306 obj->set_map_no_write_barrier(map);
4359 CopyBlock(obj->address() + FixedDoubleArray::kLengthOffset, 4307 CopyBlock(obj->address() + FixedDoubleArray::kLengthOffset,
4360 src->address() + FixedDoubleArray::kLengthOffset, 4308 src->address() + FixedDoubleArray::kLengthOffset,
4361 FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset); 4309 FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset);
4362 return obj; 4310 return obj;
4363 } 4311 }
4364 4312
4365 4313
4366 AllocationResult Heap::CopyConstantPoolArrayWithMap(ConstantPoolArray* src,
4367 Map* map) {
4368 HeapObject* obj;
4369 if (src->is_extended_layout()) {
4370 ConstantPoolArray::NumberOfEntries small(src,
4371 ConstantPoolArray::SMALL_SECTION);
4372 ConstantPoolArray::NumberOfEntries extended(
4373 src, ConstantPoolArray::EXTENDED_SECTION);
4374 AllocationResult allocation =
4375 AllocateExtendedConstantPoolArray(small, extended);
4376 if (!allocation.To(&obj)) return allocation;
4377 } else {
4378 ConstantPoolArray::NumberOfEntries small(src,
4379 ConstantPoolArray::SMALL_SECTION);
4380 AllocationResult allocation = AllocateConstantPoolArray(small);
4381 if (!allocation.To(&obj)) return allocation;
4382 }
4383 obj->set_map_no_write_barrier(map);
4384 CopyBlock(obj->address() + ConstantPoolArray::kFirstEntryOffset,
4385 src->address() + ConstantPoolArray::kFirstEntryOffset,
4386 src->size() - ConstantPoolArray::kFirstEntryOffset);
4387 return obj;
4388 }
4389
4390
4391 AllocationResult Heap::AllocateRawFixedArray(int length, 4314 AllocationResult Heap::AllocateRawFixedArray(int length,
4392 PretenureFlag pretenure) { 4315 PretenureFlag pretenure) {
4393 if (length < 0 || length > FixedArray::kMaxLength) { 4316 if (length < 0 || length > FixedArray::kMaxLength) {
4394 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); 4317 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
4395 } 4318 }
4396 int size = FixedArray::SizeFor(length); 4319 int size = FixedArray::SizeFor(length);
4397 AllocationSpace space = SelectSpace(size, pretenure); 4320 AllocationSpace space = SelectSpace(size, pretenure);
4398 4321
4399 return AllocateRaw(size, space, OLD_SPACE); 4322 return AllocateRaw(size, space, OLD_SPACE);
4400 } 4323 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4469 { 4392 {
4470 AllocationResult allocation = 4393 AllocationResult allocation =
4471 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned); 4394 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned);
4472 if (!allocation.To(&object)) return allocation; 4395 if (!allocation.To(&object)) return allocation;
4473 } 4396 }
4474 4397
4475 return object; 4398 return object;
4476 } 4399 }
4477 4400
4478 4401
4479 AllocationResult Heap::AllocateConstantPoolArray(
4480 const ConstantPoolArray::NumberOfEntries& small) {
4481 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType));
4482 int size = ConstantPoolArray::SizeFor(small);
4483 AllocationSpace space = SelectSpace(size, TENURED);
4484
4485 HeapObject* object = nullptr;
4486 {
4487 AllocationResult allocation =
4488 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned);
4489 if (!allocation.To(&object)) return allocation;
4490 }
4491 object->set_map_no_write_barrier(constant_pool_array_map());
4492
4493 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object);
4494 constant_pool->Init(small);
4495 constant_pool->ClearPtrEntries(isolate());
4496 return constant_pool;
4497 }
4498
4499
4500 AllocationResult Heap::AllocateExtendedConstantPoolArray(
4501 const ConstantPoolArray::NumberOfEntries& small,
4502 const ConstantPoolArray::NumberOfEntries& extended) {
4503 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType));
4504 CHECK(extended.are_in_range(0, kMaxInt));
4505 int size = ConstantPoolArray::SizeForExtended(small, extended);
4506 AllocationSpace space = SelectSpace(size, TENURED);
4507
4508 HeapObject* object;
4509 {
4510 AllocationResult allocation =
4511 AllocateRaw(size, space, OLD_SPACE, kDoubleAligned);
4512 if (!allocation.To(&object)) return allocation;
4513 }
4514 object->set_map_no_write_barrier(constant_pool_array_map());
4515
4516 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object);
4517 constant_pool->InitExtended(small, extended);
4518 constant_pool->ClearPtrEntries(isolate());
4519 return constant_pool;
4520 }
4521
4522
4523 AllocationResult Heap::AllocateEmptyConstantPoolArray() {
4524 ConstantPoolArray::NumberOfEntries small(0, 0, 0, 0);
4525 int size = ConstantPoolArray::SizeFor(small);
4526 HeapObject* result = NULL;
4527 {
4528 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
4529 if (!allocation.To(&result)) return allocation;
4530 }
4531 result->set_map_no_write_barrier(constant_pool_array_map());
4532 ConstantPoolArray::cast(result)->Init(small);
4533 return result;
4534 }
4535
4536
4537 AllocationResult Heap::AllocateSymbol() { 4402 AllocationResult Heap::AllocateSymbol() {
4538 // Statically ensure that it is safe to allocate symbols in paged spaces. 4403 // Statically ensure that it is safe to allocate symbols in paged spaces.
4539 STATIC_ASSERT(Symbol::kSize <= Page::kMaxRegularHeapObjectSize); 4404 STATIC_ASSERT(Symbol::kSize <= Page::kMaxRegularHeapObjectSize);
4540 4405
4541 HeapObject* result = NULL; 4406 HeapObject* result = NULL;
4542 AllocationResult allocation = 4407 AllocationResult allocation =
4543 AllocateRaw(Symbol::kSize, OLD_SPACE, OLD_SPACE); 4408 AllocateRaw(Symbol::kSize, OLD_SPACE, OLD_SPACE);
4544 if (!allocation.To(&result)) return allocation; 4409 if (!allocation.To(&result)) return allocation;
4545 4410
4546 result->set_map_no_write_barrier(symbol_map()); 4411 result->set_map_no_write_barrier(symbol_map());
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
6666 *object_type = "CODE_TYPE"; \ 6531 *object_type = "CODE_TYPE"; \
6667 *object_sub_type = "CODE_AGE/" #name; \ 6532 *object_sub_type = "CODE_AGE/" #name; \
6668 return true; 6533 return true;
6669 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6534 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6670 #undef COMPARE_AND_RETURN_NAME 6535 #undef COMPARE_AND_RETURN_NAME
6671 } 6536 }
6672 return false; 6537 return false;
6673 } 6538 }
6674 } // namespace internal 6539 } // namespace internal
6675 } // namespace v8 6540 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698