| OLD | NEW |
| 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 Page* page = static_cast<Page*>(emergency_memory_); | 1157 Page* page = static_cast<Page*>(emergency_memory_); |
| 1158 DCHECK(page->LiveBytes() == 0); | 1158 DCHECK(page->LiveBytes() == 0); |
| 1159 DCHECK(AreaSize() == page->area_size()); | 1159 DCHECK(AreaSize() == page->area_size()); |
| 1160 DCHECK(!free_list_.ContainsPageFreeListItems(page)); | 1160 DCHECK(!free_list_.ContainsPageFreeListItems(page)); |
| 1161 heap()->isolate()->memory_allocator()->Free(page); | 1161 heap()->isolate()->memory_allocator()->Free(page); |
| 1162 emergency_memory_ = NULL; | 1162 emergency_memory_ = NULL; |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 | 1165 |
| 1166 void PagedSpace::UseEmergencyMemory() { | 1166 void PagedSpace::UseEmergencyMemory() { |
| 1167 // Page::Initialize makes the chunk into a real page and adds it to the |
| 1168 // accounting for this space. Unlike PagedSpace::Expand, we don't check |
| 1169 // CanExpand first, so we can go over the limits a little here. That's OK, |
| 1170 // because we are in the process of compacting which will free up at least as |
| 1171 // much memory as it allocates. |
| 1167 Page* page = Page::Initialize(heap(), emergency_memory_, executable(), this); | 1172 Page* page = Page::Initialize(heap(), emergency_memory_, executable(), this); |
| 1168 page->InsertAfter(anchor_.prev_page()); | 1173 page->InsertAfter(anchor_.prev_page()); |
| 1169 emergency_memory_ = NULL; | 1174 emergency_memory_ = NULL; |
| 1170 } | 1175 } |
| 1171 | 1176 |
| 1172 | 1177 |
| 1173 #ifdef DEBUG | 1178 #ifdef DEBUG |
| 1174 void PagedSpace::Print() {} | 1179 void PagedSpace::Print() {} |
| 1175 #endif | 1180 #endif |
| 1176 | 1181 |
| (...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3142 object->ShortPrint(); | 3147 object->ShortPrint(); |
| 3143 PrintF("\n"); | 3148 PrintF("\n"); |
| 3144 } | 3149 } |
| 3145 printf(" --------------------------------------\n"); | 3150 printf(" --------------------------------------\n"); |
| 3146 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3151 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3147 } | 3152 } |
| 3148 | 3153 |
| 3149 #endif // DEBUG | 3154 #endif // DEBUG |
| 3150 } | 3155 } |
| 3151 } // namespace v8::internal | 3156 } // namespace v8::internal |
| OLD | NEW |