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

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

Issue 1864433003: [heap] Old generation limit is based on capacity. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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') | test/cctest/heap/test-heap.cc » ('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 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/heap/spaces.h" 5 #include "src/heap/spaces.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/full-codegen.h" 9 #include "src/full-codegen/full-codegen.h"
10 #include "src/heap/slot-set.h" 10 #include "src/heap/slot-set.h"
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 Address cur = obj->address(); 1131 Address cur = obj->address();
1132 Address next = cur + obj->Size(); 1132 Address next = cur + obj->Size();
1133 if ((cur <= addr) && (addr < next)) return obj; 1133 if ((cur <= addr) && (addr < next)) return obj;
1134 } 1134 }
1135 1135
1136 UNREACHABLE(); 1136 UNREACHABLE();
1137 return Smi::FromInt(0); 1137 return Smi::FromInt(0);
1138 } 1138 }
1139 1139
1140 1140
1141 bool PagedSpace::CanExpand(size_t size) {
1142 DCHECK(heap()->mark_compact_collector()->is_compacting() ||
1143 Capacity() <= heap()->MaxOldGenerationSize());
1144
1145 // Are we going to exceed capacity for this space? At this point we can be
1146 // way over the maximum size because of AlwaysAllocate scopes and large
1147 // objects.
1148 if (!heap()->CanExpandOldGeneration(static_cast<int>(size))) return false;
1149
1150 return true;
1151 }
1152
1153
1154 bool PagedSpace::Expand() { 1141 bool PagedSpace::Expand() {
1155 intptr_t size = AreaSize(); 1142 int size = AreaSize();
1156 if (snapshotable() && !HasPages()) { 1143 if (snapshotable() && !HasPages()) {
1157 size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity()); 1144 size = Snapshot::SizeOfFirstPage(heap()->isolate(), identity());
1158 } 1145 }
1159 1146
1160 if (!CanExpand(size)) return false; 1147 if (!heap()->CanExpandOldGeneration(size)) return false;
1161 1148
1162 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this, 1149 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(size, this,
1163 executable()); 1150 executable());
1164 if (p == NULL) return false; 1151 if (p == NULL) return false;
1165 1152
1166 AccountCommitted(static_cast<intptr_t>(p->size())); 1153 AccountCommitted(static_cast<intptr_t>(p->size()));
1167 1154
1168 // Pages created during bootstrapping may contain immortal immovable objects. 1155 // Pages created during bootstrapping may contain immortal immovable objects.
1169 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate(); 1156 if (!heap()->deserialization_complete()) p->MarkNeverEvacuate();
1170 1157
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after
3162 object->ShortPrint(); 3149 object->ShortPrint();
3163 PrintF("\n"); 3150 PrintF("\n");
3164 } 3151 }
3165 printf(" --------------------------------------\n"); 3152 printf(" --------------------------------------\n");
3166 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3153 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3167 } 3154 }
3168 3155
3169 #endif // DEBUG 3156 #endif // DEBUG
3170 } // namespace internal 3157 } // namespace internal
3171 } // namespace v8 3158 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698