OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 PrintF("[%s]: %d pages, %d (%.1f%%) free\n", | 255 PrintF("[%s]: %d pages, %d (%.1f%%) free\n", |
256 AllocationSpaceName(space->identity()), number_of_pages, | 256 AllocationSpaceName(space->identity()), number_of_pages, |
257 static_cast<int>(free), static_cast<double>(free) * 100 / reserved); | 257 static_cast<int>(free), static_cast<double>(free) * 100 / reserved); |
258 } | 258 } |
259 | 259 |
260 | 260 |
261 bool MarkCompactCollector::StartCompaction(CompactionMode mode) { | 261 bool MarkCompactCollector::StartCompaction(CompactionMode mode) { |
262 if (!compacting_) { | 262 if (!compacting_) { |
263 DCHECK(evacuation_candidates_.length() == 0); | 263 DCHECK(evacuation_candidates_.length() == 0); |
264 | 264 |
| 265 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 266 // If GDBJIT interface is active disable compaction. |
| 267 if (FLAG_gdbjit) return false; |
| 268 #endif |
| 269 |
265 CollectEvacuationCandidates(heap()->old_pointer_space()); | 270 CollectEvacuationCandidates(heap()->old_pointer_space()); |
266 CollectEvacuationCandidates(heap()->old_data_space()); | 271 CollectEvacuationCandidates(heap()->old_data_space()); |
267 | 272 |
268 if (FLAG_compact_code_space && (mode == NON_INCREMENTAL_COMPACTION || | 273 if (FLAG_compact_code_space && (mode == NON_INCREMENTAL_COMPACTION || |
269 FLAG_incremental_code_compaction)) { | 274 FLAG_incremental_code_compaction)) { |
270 CollectEvacuationCandidates(heap()->code_space()); | 275 CollectEvacuationCandidates(heap()->code_space()); |
271 } else if (FLAG_trace_fragmentation) { | 276 } else if (FLAG_trace_fragmentation) { |
272 TraceFragmentation(heap()->code_space()); | 277 TraceFragmentation(heap()->code_space()); |
273 } | 278 } |
274 | 279 |
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 int live_index = 0; | 3216 int live_index = 0; |
3212 for (; live_objects != 0; live_objects--) { | 3217 for (; live_objects != 0; live_objects--) { |
3213 Address free_end = cell_base + offsets[live_index++] * kPointerSize; | 3218 Address free_end = cell_base + offsets[live_index++] * kPointerSize; |
3214 if (free_end != free_start) { | 3219 if (free_end != free_start) { |
3215 int size = static_cast<int>(free_end - free_start); | 3220 int size = static_cast<int>(free_end - free_start); |
3216 if (free_space_mode == ZAP_FREE_SPACE) { | 3221 if (free_space_mode == ZAP_FREE_SPACE) { |
3217 memset(free_start, 0xcc, size); | 3222 memset(free_start, 0xcc, size); |
3218 } | 3223 } |
3219 freed_bytes = Free<parallelism>(space, free_list, free_start, size); | 3224 freed_bytes = Free<parallelism>(space, free_list, free_start, size); |
3220 max_freed_bytes = Max(freed_bytes, max_freed_bytes); | 3225 max_freed_bytes = Max(freed_bytes, max_freed_bytes); |
| 3226 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 3227 if (FLAG_gdbjit && space->identity() == CODE_SPACE) { |
| 3228 GDBJITInterface::RemoveCodeRange(free_start, free_end); |
| 3229 } |
| 3230 #endif |
3221 } | 3231 } |
3222 HeapObject* live_object = HeapObject::FromAddress(free_end); | 3232 HeapObject* live_object = HeapObject::FromAddress(free_end); |
3223 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); | 3233 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); |
3224 Map* map = live_object->synchronized_map(); | 3234 Map* map = live_object->synchronized_map(); |
3225 int size = live_object->SizeFromMap(map); | 3235 int size = live_object->SizeFromMap(map); |
3226 if (sweeping_mode == SWEEP_AND_VISIT_LIVE_OBJECTS) { | 3236 if (sweeping_mode == SWEEP_AND_VISIT_LIVE_OBJECTS) { |
3227 live_object->IterateBody(map->instance_type(), size, v); | 3237 live_object->IterateBody(map->instance_type(), size, v); |
3228 } | 3238 } |
3229 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list != NULL) { | 3239 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list != NULL) { |
3230 int new_region_start = SkipList::RegionNumber(free_end); | 3240 int new_region_start = SkipList::RegionNumber(free_end); |
3231 int new_region_end = | 3241 int new_region_end = |
3232 SkipList::RegionNumber(free_end + size - kPointerSize); | 3242 SkipList::RegionNumber(free_end + size - kPointerSize); |
3233 if (new_region_start != curr_region || new_region_end != curr_region) { | 3243 if (new_region_start != curr_region || new_region_end != curr_region) { |
3234 skip_list->AddObject(free_end, size); | 3244 skip_list->AddObject(free_end, size); |
3235 curr_region = new_region_end; | 3245 curr_region = new_region_end; |
3236 } | 3246 } |
3237 } | 3247 } |
3238 free_start = free_end + size; | 3248 free_start = free_end + size; |
3239 } | 3249 } |
3240 // Clear marking bits for current cell. | 3250 // Clear marking bits for current cell. |
3241 *cell = 0; | 3251 *cell = 0; |
3242 } | 3252 } |
3243 if (free_start != p->area_end()) { | 3253 if (free_start != p->area_end()) { |
3244 int size = static_cast<int>(p->area_end() - free_start); | 3254 int size = static_cast<int>(p->area_end() - free_start); |
3245 if (free_space_mode == ZAP_FREE_SPACE) { | 3255 if (free_space_mode == ZAP_FREE_SPACE) { |
3246 memset(free_start, 0xcc, size); | 3256 memset(free_start, 0xcc, size); |
3247 } | 3257 } |
3248 freed_bytes = Free<parallelism>(space, free_list, free_start, size); | 3258 freed_bytes = Free<parallelism>(space, free_list, free_start, size); |
3249 max_freed_bytes = Max(freed_bytes, max_freed_bytes); | 3259 max_freed_bytes = Max(freed_bytes, max_freed_bytes); |
| 3260 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 3261 if (FLAG_gdbjit && space->identity() == CODE_SPACE) { |
| 3262 GDBJITInterface::RemoveCodeRange(free_start, p->area_end()); |
| 3263 } |
| 3264 #endif |
3250 } | 3265 } |
3251 p->ResetLiveBytes(); | 3266 p->ResetLiveBytes(); |
3252 | 3267 |
3253 if (parallelism == MarkCompactCollector::SWEEP_IN_PARALLEL) { | 3268 if (parallelism == MarkCompactCollector::SWEEP_IN_PARALLEL) { |
3254 // When concurrent sweeping is active, the page will be marked after | 3269 // When concurrent sweeping is active, the page will be marked after |
3255 // sweeping by the main thread. | 3270 // sweeping by the main thread. |
3256 p->set_parallel_sweeping(MemoryChunk::SWEEPING_FINALIZE); | 3271 p->set_parallel_sweeping(MemoryChunk::SWEEPING_FINALIZE); |
3257 } else { | 3272 } else { |
3258 p->SetWasSwept(); | 3273 p->SetWasSwept(); |
3259 } | 3274 } |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4415 SlotsBuffer* buffer = *buffer_address; | 4430 SlotsBuffer* buffer = *buffer_address; |
4416 while (buffer != NULL) { | 4431 while (buffer != NULL) { |
4417 SlotsBuffer* next_buffer = buffer->next(); | 4432 SlotsBuffer* next_buffer = buffer->next(); |
4418 DeallocateBuffer(buffer); | 4433 DeallocateBuffer(buffer); |
4419 buffer = next_buffer; | 4434 buffer = next_buffer; |
4420 } | 4435 } |
4421 *buffer_address = NULL; | 4436 *buffer_address = NULL; |
4422 } | 4437 } |
4423 } | 4438 } |
4424 } // namespace v8::internal | 4439 } // namespace v8::internal |
OLD | NEW |