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

Side by Side Diff: src/heap.cc

Issue 22601003: Out-of-line constant pool on Arm: Stage 2 - Introduce ConstantPoolArray object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | src/objects-inl.h » ('J')
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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 1889
1890 // Take another spin if there are now unswept objects in new space 1890 // Take another spin if there are now unswept objects in new space
1891 // (there are currently no more unswept promoted objects). 1891 // (there are currently no more unswept promoted objects).
1892 } while (new_space_front != new_space_.top()); 1892 } while (new_space_front != new_space_.top());
1893 1893
1894 return new_space_front; 1894 return new_space_front;
1895 } 1895 }
1896 1896
1897 1897
1898 STATIC_ASSERT((FixedDoubleArray::kHeaderSize & kDoubleAlignmentMask) == 0); 1898 STATIC_ASSERT((FixedDoubleArray::kHeaderSize & kDoubleAlignmentMask) == 0);
1899 STATIC_ASSERT((ConstantPoolArray::kHeaderSize & kDoubleAlignmentMask) == 0);
1899 1900
1900 1901
1901 INLINE(static HeapObject* EnsureDoubleAligned(Heap* heap, 1902 INLINE(static HeapObject* EnsureDoubleAligned(Heap* heap,
1902 HeapObject* object, 1903 HeapObject* object,
1903 int size)); 1904 int size));
1904 1905
1905 static HeapObject* EnsureDoubleAligned(Heap* heap, 1906 static HeapObject* EnsureDoubleAligned(Heap* heap,
1906 HeapObject* object, 1907 HeapObject* object,
1907 int size) { 1908 int size) {
1908 if ((OffsetFrom(object->address()) & kDoubleAlignmentMask) != 0) { 1909 if ((OffsetFrom(object->address()) & kDoubleAlignmentMask) != 0) {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 set_undetectable_ascii_string_map(Map::cast(obj)); 2587 set_undetectable_ascii_string_map(Map::cast(obj));
2587 Map::cast(obj)->set_is_undetectable(); 2588 Map::cast(obj)->set_is_undetectable();
2588 2589
2589 { MaybeObject* maybe_obj = 2590 { MaybeObject* maybe_obj =
2590 AllocateMap(FIXED_DOUBLE_ARRAY_TYPE, kVariableSizeSentinel); 2591 AllocateMap(FIXED_DOUBLE_ARRAY_TYPE, kVariableSizeSentinel);
2591 if (!maybe_obj->ToObject(&obj)) return false; 2592 if (!maybe_obj->ToObject(&obj)) return false;
2592 } 2593 }
2593 set_fixed_double_array_map(Map::cast(obj)); 2594 set_fixed_double_array_map(Map::cast(obj));
2594 2595
2595 { MaybeObject* maybe_obj = 2596 { MaybeObject* maybe_obj =
2597 AllocateMap(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel);
2598 if (!maybe_obj->ToObject(&obj)) return false;
2599 }
2600 set_constant_pool_array_map(Map::cast(obj));
2601
2602 { MaybeObject* maybe_obj =
2596 AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel); 2603 AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel);
2597 if (!maybe_obj->ToObject(&obj)) return false; 2604 if (!maybe_obj->ToObject(&obj)) return false;
2598 } 2605 }
2599 set_byte_array_map(Map::cast(obj)); 2606 set_byte_array_map(Map::cast(obj));
2600 2607
2601 { MaybeObject* maybe_obj = 2608 { MaybeObject* maybe_obj =
2602 AllocateMap(FREE_SPACE_TYPE, kVariableSizeSentinel); 2609 AllocateMap(FREE_SPACE_TYPE, kVariableSizeSentinel);
2603 if (!maybe_obj->ToObject(&obj)) return false; 2610 if (!maybe_obj->ToObject(&obj)) return false;
2604 } 2611 }
2605 set_free_space_map(Map::cast(obj)); 2612 set_free_space_map(Map::cast(obj));
(...skipping 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after
5498 HeapObject* dst = HeapObject::cast(obj); 5505 HeapObject* dst = HeapObject::cast(obj);
5499 dst->set_map_no_write_barrier(map); 5506 dst->set_map_no_write_barrier(map);
5500 CopyBlock( 5507 CopyBlock(
5501 dst->address() + FixedDoubleArray::kLengthOffset, 5508 dst->address() + FixedDoubleArray::kLengthOffset,
5502 src->address() + FixedDoubleArray::kLengthOffset, 5509 src->address() + FixedDoubleArray::kLengthOffset,
5503 FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset); 5510 FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset);
5504 return obj; 5511 return obj;
5505 } 5512 }
5506 5513
5507 5514
5515 MaybeObject* Heap::CopyConstantPoolArrayWithMap(ConstantPoolArray* src,
5516 Map* map) {
5517 int len = src->length();
5518 int first_int32_index = src->first_int32_index();
5519 Object* obj;
5520 { MaybeObject* maybe_obj =
5521 AllocateRawConstantPoolArray(len, first_int32_index, NOT_TENURED);
5522 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
5523 }
5524 HeapObject* dst = HeapObject::cast(obj);
5525 dst->set_map_no_write_barrier(map);
5526 CopyBlock(
5527 dst->address() + ConstantPoolArray::kLengthOffset,
5528 src->address() + ConstantPoolArray::kLengthOffset,
5529 ConstantPoolArray::SizeFor(len, first_int32_index)
5530 - ConstantPoolArray::kLengthOffset);
5531 return obj;
5532 }
5533
5534
5508 MaybeObject* Heap::AllocateFixedArray(int length) { 5535 MaybeObject* Heap::AllocateFixedArray(int length) {
5509 ASSERT(length >= 0); 5536 ASSERT(length >= 0);
5510 if (length == 0) return empty_fixed_array(); 5537 if (length == 0) return empty_fixed_array();
5511 Object* result; 5538 Object* result;
5512 { MaybeObject* maybe_result = AllocateRawFixedArray(length); 5539 { MaybeObject* maybe_result = AllocateRawFixedArray(length);
5513 if (!maybe_result->ToObject(&result)) return maybe_result; 5540 if (!maybe_result->ToObject(&result)) return maybe_result;
5514 } 5541 }
5515 // Initialize header. 5542 // Initialize header.
5516 FixedArray* array = reinterpret_cast<FixedArray*>(result); 5543 FixedArray* array = reinterpret_cast<FixedArray*>(result);
5517 array->set_map_no_write_barrier(fixed_array_map()); 5544 array->set_map_no_write_barrier(fixed_array_map());
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
5669 5696
5670 HeapObject* object; 5697 HeapObject* object;
5671 { MaybeObject* maybe_object = AllocateRaw(size, space, retry_space); 5698 { MaybeObject* maybe_object = AllocateRaw(size, space, retry_space);
5672 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; 5699 if (!maybe_object->To<HeapObject>(&object)) return maybe_object;
5673 } 5700 }
5674 5701
5675 return EnsureDoubleAligned(this, object, size); 5702 return EnsureDoubleAligned(this, object, size);
5676 } 5703 }
5677 5704
5678 5705
5706 MaybeObject* Heap::AllocateRawConstantPoolArray(int length,
5707 int first_int32_index,
5708 PretenureFlag pretenure) {
5709 if (length < 0) {
ulan 2013/08/09 08:52:54 ASSERT(length > 0), instead of this check?
rmcilroy 2013/08/16 10:27:37 I was following AllocateRawFixedArray which does t
5710 return Failure::OutOfMemoryException(0xf);
5711 }
5712 int size = ConstantPoolArray::SizeFor(length, first_int32_index);
5713 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
ulan 2013/08/09 08:52:54 It's probably better to pretenure, because code ob
rmcilroy 2013/08/16 10:27:37 Done.
5714 AllocationSpace retry_space = OLD_DATA_SPACE;
5715
5716 #ifndef V8_HOST_ARCH_64_BIT
5717 size += kPointerSize;
5718 #endif
5719
5720 if (size > Page::kMaxNonCodeHeapObjectSize) {
5721 // Allocate in large object space, retry space will be ignored.
5722 space = LO_SPACE;
5723 }
5724
5725 HeapObject* object;
5726 { MaybeObject* maybe_object = AllocateRaw(size, space, retry_space);
5727 if (!maybe_object->To<HeapObject>(&object)) return maybe_object;
5728 }
5729
5730 return EnsureDoubleAligned(this, object, size);
5731 }
5732
5733
5679 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { 5734 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
5680 Object* result; 5735 Object* result;
5681 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); 5736 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure);
5682 if (!maybe_result->ToObject(&result)) return maybe_result; 5737 if (!maybe_result->ToObject(&result)) return maybe_result;
5683 } 5738 }
5684 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( 5739 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(
5685 hash_table_map()); 5740 hash_table_map());
5686 ASSERT(result->IsHashTable()); 5741 ASSERT(result->IsHashTable());
5687 return result; 5742 return result;
5688 } 5743 }
(...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after
8028 if (FLAG_parallel_recompilation) { 8083 if (FLAG_parallel_recompilation) {
8029 heap_->relocation_mutex_->Lock(); 8084 heap_->relocation_mutex_->Lock();
8030 #ifdef DEBUG 8085 #ifdef DEBUG
8031 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8086 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8032 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8087 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8033 #endif // DEBUG 8088 #endif // DEBUG
8034 } 8089 }
8035 } 8090 }
8036 8091
8037 } } // namespace v8::internal 8092 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698