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

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

Issue 581223004: Support large objects in the serializer/deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 6 years, 2 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/full-codegen.h" 9 #include "src/full-codegen.h"
10 #include "src/heap/mark-compact.h" 10 #include "src/heap/mark-compact.h"
(...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 2833
2834 AllocationResult LargeObjectSpace::AllocateRaw(int object_size, 2834 AllocationResult LargeObjectSpace::AllocateRaw(int object_size,
2835 Executability executable) { 2835 Executability executable) {
2836 // Check if we want to force a GC before growing the old space further. 2836 // Check if we want to force a GC before growing the old space further.
2837 // If so, fail the allocation. 2837 // If so, fail the allocation.
2838 if (!heap()->always_allocate() && 2838 if (!heap()->always_allocate() &&
2839 heap()->OldGenerationAllocationLimitReached()) { 2839 heap()->OldGenerationAllocationLimitReached()) {
2840 return AllocationResult::Retry(identity()); 2840 return AllocationResult::Retry(identity());
2841 } 2841 }
2842 2842
2843 if (Size() + object_size > max_capacity_) { 2843 if (!CanAllocateSize(object_size)) return AllocationResult::Retry(identity());
2844 return AllocationResult::Retry(identity());
2845 }
2846 2844
2847 LargePage* page = heap()->isolate()->memory_allocator()->AllocateLargePage( 2845 LargePage* page = heap()->isolate()->memory_allocator()->AllocateLargePage(
2848 object_size, this, executable); 2846 object_size, this, executable);
2849 if (page == NULL) return AllocationResult::Retry(identity()); 2847 if (page == NULL) return AllocationResult::Retry(identity());
2850 DCHECK(page->area_size() >= object_size); 2848 DCHECK(page->area_size() >= object_size);
2851 2849
2852 size_ += static_cast<int>(page->size()); 2850 size_ += static_cast<int>(page->size());
2853 objects_size_ += object_size; 2851 objects_size_ += object_size;
2854 page_count_++; 2852 page_count_++;
2855 page->set_next_page(first_page_); 2853 page->set_next_page(first_page_);
(...skipping 24 matching lines...) Expand all
2880 reinterpret_cast<Object**>(object->address())[0] = 2878 reinterpret_cast<Object**>(object->address())[0] =
2881 heap()->fixed_array_map(); 2879 heap()->fixed_array_map();
2882 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0); 2880 reinterpret_cast<Object**>(object->address())[1] = Smi::FromInt(0);
2883 } 2881 }
2884 2882
2885 heap()->incremental_marking()->OldSpaceStep(object_size); 2883 heap()->incremental_marking()->OldSpaceStep(object_size);
2886 return object; 2884 return object;
2887 } 2885 }
2888 2886
2889 2887
2888 void LargeObjectSpace::PrepareForDeserialization(int large_objects_total_size) {
Hannes Payer (out of office) 2014/09/24 21:27:51 Please delete this method.
2889 if (CanAllocateSize(large_objects_total_size)) return;
2890 heap()->CollectAllAvailableGarbage("prepare for deserialization");
2891 if (!CanAllocateSize(large_objects_total_size)) FatalProcessOutOfMemory();
2892 }
2893
2894
2890 size_t LargeObjectSpace::CommittedPhysicalMemory() { 2895 size_t LargeObjectSpace::CommittedPhysicalMemory() {
2891 if (!base::VirtualMemory::HasLazyCommits()) return CommittedMemory(); 2896 if (!base::VirtualMemory::HasLazyCommits()) return CommittedMemory();
2892 size_t size = 0; 2897 size_t size = 0;
2893 LargePage* current = first_page_; 2898 LargePage* current = first_page_;
2894 while (current != NULL) { 2899 while (current != NULL) {
2895 size += current->CommittedPhysicalMemory(); 2900 size += current->CommittedPhysicalMemory();
2896 current = current->next_page(); 2901 current = current->next_page();
2897 } 2902 }
2898 return size; 2903 return size;
2899 } 2904 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 object->ShortPrint(); 3103 object->ShortPrint();
3099 PrintF("\n"); 3104 PrintF("\n");
3100 } 3105 }
3101 printf(" --------------------------------------\n"); 3106 printf(" --------------------------------------\n");
3102 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3107 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3103 } 3108 }
3104 3109
3105 #endif // DEBUG 3110 #endif // DEBUG
3106 } 3111 }
3107 } // namespace v8::internal 3112 } // namespace v8::internal
OLDNEW
« src/heap/spaces.h ('K') | « src/heap/spaces.h ('k') | src/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698