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

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

Issue 1058613003: Version 4.3.61.6 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.3
Patch Set: Created 5 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/mark-compact.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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 if ((cur <= addr) && (addr < next)) return obj; 1010 if ((cur <= addr) && (addr < next)) return obj;
1011 } 1011 }
1012 1012
1013 UNREACHABLE(); 1013 UNREACHABLE();
1014 return Smi::FromInt(0); 1014 return Smi::FromInt(0);
1015 } 1015 }
1016 1016
1017 1017
1018 bool PagedSpace::CanExpand() { 1018 bool PagedSpace::CanExpand() {
1019 DCHECK(max_capacity_ % AreaSize() == 0); 1019 DCHECK(max_capacity_ % AreaSize() == 0);
1020 DCHECK(Capacity() <= heap()->MaxOldGenerationSize()); 1020 DCHECK(heap()->mark_compact_collector()->is_compacting() ||
1021 Capacity() <= heap()->MaxOldGenerationSize());
1021 DCHECK(heap()->CommittedOldGenerationMemory() <= 1022 DCHECK(heap()->CommittedOldGenerationMemory() <=
1022 heap()->MaxOldGenerationSize() + 1023 heap()->MaxOldGenerationSize() +
1023 PagedSpace::MaxEmergencyMemoryAllocated()); 1024 PagedSpace::MaxEmergencyMemoryAllocated());
1024 1025
1025 // Are we going to exceed capacity for this space? 1026 // Are we going to exceed capacity for this space?
1026 if (!heap()->CanExpandOldGeneration(Page::kPageSize)) return false; 1027 if (!heap()->CanExpandOldGeneration(Page::kPageSize)) return false;
1027 1028
1028 return true; 1029 return true;
1029 } 1030 }
1030 1031
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 Page* page = static_cast<Page*>(emergency_memory_); 1158 Page* page = static_cast<Page*>(emergency_memory_);
1158 DCHECK(page->LiveBytes() == 0); 1159 DCHECK(page->LiveBytes() == 0);
1159 DCHECK(AreaSize() == page->area_size()); 1160 DCHECK(AreaSize() == page->area_size());
1160 DCHECK(!free_list_.ContainsPageFreeListItems(page)); 1161 DCHECK(!free_list_.ContainsPageFreeListItems(page));
1161 heap()->isolate()->memory_allocator()->Free(page); 1162 heap()->isolate()->memory_allocator()->Free(page);
1162 emergency_memory_ = NULL; 1163 emergency_memory_ = NULL;
1163 } 1164 }
1164 1165
1165 1166
1166 void PagedSpace::UseEmergencyMemory() { 1167 void PagedSpace::UseEmergencyMemory() {
1168 // Page::Initialize makes the chunk into a real page and adds it to the
1169 // accounting for this space. Unlike PagedSpace::Expand, we don't check
1170 // CanExpand first, so we can go over the limits a little here. That's OK,
1171 // because we are in the process of compacting which will free up at least as
1172 // much memory as it allocates.
1167 Page* page = Page::Initialize(heap(), emergency_memory_, executable(), this); 1173 Page* page = Page::Initialize(heap(), emergency_memory_, executable(), this);
1168 page->InsertAfter(anchor_.prev_page()); 1174 page->InsertAfter(anchor_.prev_page());
1169 emergency_memory_ = NULL; 1175 emergency_memory_ = NULL;
1170 } 1176 }
1171 1177
1172 1178
1173 #ifdef DEBUG 1179 #ifdef DEBUG
1174 void PagedSpace::Print() {} 1180 void PagedSpace::Print() {}
1175 #endif 1181 #endif
1176 1182
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 object->ShortPrint(); 3148 object->ShortPrint();
3143 PrintF("\n"); 3149 PrintF("\n");
3144 } 3150 }
3145 printf(" --------------------------------------\n"); 3151 printf(" --------------------------------------\n");
3146 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3152 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3147 } 3153 }
3148 3154
3149 #endif // DEBUG 3155 #endif // DEBUG
3150 } 3156 }
3151 } // namespace v8::internal 3157 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698