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

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

Issue 979783002: Respect accumulative old generation memory limit in all spaces. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 if ((cur <= addr) && (addr < next)) return obj; 1014 if ((cur <= addr) && (addr < next)) return obj;
1015 } 1015 }
1016 1016
1017 UNREACHABLE(); 1017 UNREACHABLE();
1018 return Smi::FromInt(0); 1018 return Smi::FromInt(0);
1019 } 1019 }
1020 1020
1021 1021
1022 bool PagedSpace::CanExpand() { 1022 bool PagedSpace::CanExpand() {
1023 DCHECK(max_capacity_ % AreaSize() == 0); 1023 DCHECK(max_capacity_ % AreaSize() == 0);
1024 1024 DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
1025 if (Capacity() == max_capacity_) return false; 1025 DCHECK(heap()->CommittedOldGenerationMemory() <=
1026 1026 heap()->MaxOldGenerationSize());
1027 DCHECK(Capacity() < max_capacity_);
1028 1027
1029 // Are we going to exceed capacity for this space? 1028 // Are we going to exceed capacity for this space?
1030 if ((Capacity() + Page::kPageSize) > max_capacity_) return false; 1029 if (!heap()->CanExpandOldGeneration(Page::kPageSize)) return false;
1031 1030
1032 return true; 1031 return true;
1033 } 1032 }
1034 1033
1035 1034
1036 bool PagedSpace::Expand() { 1035 bool PagedSpace::Expand() {
1037 if (!CanExpand()) return false; 1036 if (!CanExpand()) return false;
1038 1037
1039 intptr_t size = AreaSize(); 1038 intptr_t size = AreaSize();
1040 1039
1041 if (anchor_.next_page() == &anchor_) { 1040 if (anchor_.next_page() == &anchor_) {
1042 size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity()); 1041 size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity());
1043 } 1042 }
1044 1043
1045 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this, 1044 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this,
1046 executable()); 1045 executable());
1047 if (p == NULL) return false; 1046 if (p == NULL) return false;
1048 1047
1049 // Pages created during bootstrapping may contain immortal immovable objects. 1048 // Pages created during bootstrapping may contain immortal immovable objects.
1050 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); 1049 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate();
1051 1050
1052 DCHECK(Capacity() <= max_capacity_); 1051 DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
1052 DCHECK(heap()->CommittedOldGenerationMemory() <=
1053 heap()->MaxOldGenerationSize());
1053 1054
1054 p->InsertAfter(anchor_.prev_page()); 1055 p->InsertAfter(anchor_.prev_page());
1055 1056
1056 return true; 1057 return true;
1057 } 1058 }
1058 1059
1059 1060
1060 int PagedSpace::CountTotalPages() { 1061 int PagedSpace::CountTotalPages() {
1061 PageIterator it(this); 1062 PageIterator it(this);
1062 int count = 0; 1063 int count = 0;
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3139 object->ShortPrint(); 3140 object->ShortPrint();
3140 PrintF("\n"); 3141 PrintF("\n");
3141 } 3142 }
3142 printf(" --------------------------------------\n"); 3143 printf(" --------------------------------------\n");
3143 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3144 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3144 } 3145 }
3145 3146
3146 #endif // DEBUG 3147 #endif // DEBUG
3147 } 3148 }
3148 } // namespace v8::internal 3149 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698