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

Side by Side Diff: src/heap/mark-compact.cc

Issue 957673004: Rebase GDBJIT interface solely on JITCodeEvent (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Address nits Created 5 years, 10 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/gdb-jit.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 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
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
270 CollectEvacuationCandidates(heap()->old_pointer_space()); 265 CollectEvacuationCandidates(heap()->old_pointer_space());
271 CollectEvacuationCandidates(heap()->old_data_space()); 266 CollectEvacuationCandidates(heap()->old_data_space());
272 267
273 if (FLAG_compact_code_space && (mode == NON_INCREMENTAL_COMPACTION || 268 if (FLAG_compact_code_space && (mode == NON_INCREMENTAL_COMPACTION ||
274 FLAG_incremental_code_compaction)) { 269 FLAG_incremental_code_compaction)) {
275 CollectEvacuationCandidates(heap()->code_space()); 270 CollectEvacuationCandidates(heap()->code_space());
276 } else if (FLAG_trace_fragmentation) { 271 } else if (FLAG_trace_fragmentation) {
277 TraceFragmentation(heap()->code_space()); 272 TraceFragmentation(heap()->code_space());
278 } 273 }
279 274
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
3216 int live_index = 0; 3211 int live_index = 0;
3217 for (; live_objects != 0; live_objects--) { 3212 for (; live_objects != 0; live_objects--) {
3218 Address free_end = cell_base + offsets[live_index++] * kPointerSize; 3213 Address free_end = cell_base + offsets[live_index++] * kPointerSize;
3219 if (free_end != free_start) { 3214 if (free_end != free_start) {
3220 int size = static_cast<int>(free_end - free_start); 3215 int size = static_cast<int>(free_end - free_start);
3221 if (free_space_mode == ZAP_FREE_SPACE) { 3216 if (free_space_mode == ZAP_FREE_SPACE) {
3222 memset(free_start, 0xcc, size); 3217 memset(free_start, 0xcc, size);
3223 } 3218 }
3224 freed_bytes = Free<parallelism>(space, free_list, free_start, size); 3219 freed_bytes = Free<parallelism>(space, free_list, free_start, size);
3225 max_freed_bytes = Max(freed_bytes, max_freed_bytes); 3220 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
3231 } 3221 }
3232 HeapObject* live_object = HeapObject::FromAddress(free_end); 3222 HeapObject* live_object = HeapObject::FromAddress(free_end);
3233 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object))); 3223 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object)));
3234 Map* map = live_object->synchronized_map(); 3224 Map* map = live_object->synchronized_map();
3235 int size = live_object->SizeFromMap(map); 3225 int size = live_object->SizeFromMap(map);
3236 if (sweeping_mode == SWEEP_AND_VISIT_LIVE_OBJECTS) { 3226 if (sweeping_mode == SWEEP_AND_VISIT_LIVE_OBJECTS) {
3237 live_object->IterateBody(map->instance_type(), size, v); 3227 live_object->IterateBody(map->instance_type(), size, v);
3238 } 3228 }
3239 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list != NULL) { 3229 if ((skip_list_mode == REBUILD_SKIP_LIST) && skip_list != NULL) {
3240 int new_region_start = SkipList::RegionNumber(free_end); 3230 int new_region_start = SkipList::RegionNumber(free_end);
3241 int new_region_end = 3231 int new_region_end =
3242 SkipList::RegionNumber(free_end + size - kPointerSize); 3232 SkipList::RegionNumber(free_end + size - kPointerSize);
3243 if (new_region_start != curr_region || new_region_end != curr_region) { 3233 if (new_region_start != curr_region || new_region_end != curr_region) {
3244 skip_list->AddObject(free_end, size); 3234 skip_list->AddObject(free_end, size);
3245 curr_region = new_region_end; 3235 curr_region = new_region_end;
3246 } 3236 }
3247 } 3237 }
3248 free_start = free_end + size; 3238 free_start = free_end + size;
3249 } 3239 }
3250 // Clear marking bits for current cell. 3240 // Clear marking bits for current cell.
3251 *cell = 0; 3241 *cell = 0;
3252 } 3242 }
3253 if (free_start != p->area_end()) { 3243 if (free_start != p->area_end()) {
3254 int size = static_cast<int>(p->area_end() - free_start); 3244 int size = static_cast<int>(p->area_end() - free_start);
3255 if (free_space_mode == ZAP_FREE_SPACE) { 3245 if (free_space_mode == ZAP_FREE_SPACE) {
3256 memset(free_start, 0xcc, size); 3246 memset(free_start, 0xcc, size);
3257 } 3247 }
3258 freed_bytes = Free<parallelism>(space, free_list, free_start, size); 3248 freed_bytes = Free<parallelism>(space, free_list, free_start, size);
3259 max_freed_bytes = Max(freed_bytes, max_freed_bytes); 3249 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
3265 } 3250 }
3266 p->ResetLiveBytes(); 3251 p->ResetLiveBytes();
3267 3252
3268 if (parallelism == MarkCompactCollector::SWEEP_IN_PARALLEL) { 3253 if (parallelism == MarkCompactCollector::SWEEP_IN_PARALLEL) {
3269 // When concurrent sweeping is active, the page will be marked after 3254 // When concurrent sweeping is active, the page will be marked after
3270 // sweeping by the main thread. 3255 // sweeping by the main thread.
3271 p->set_parallel_sweeping(MemoryChunk::SWEEPING_FINALIZE); 3256 p->set_parallel_sweeping(MemoryChunk::SWEEPING_FINALIZE);
3272 } else { 3257 } else {
3273 p->SetWasSwept(); 3258 p->SetWasSwept();
3274 } 3259 }
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
4430 SlotsBuffer* buffer = *buffer_address; 4415 SlotsBuffer* buffer = *buffer_address;
4431 while (buffer != NULL) { 4416 while (buffer != NULL) {
4432 SlotsBuffer* next_buffer = buffer->next(); 4417 SlotsBuffer* next_buffer = buffer->next();
4433 DeallocateBuffer(buffer); 4418 DeallocateBuffer(buffer);
4434 buffer = next_buffer; 4419 buffer = next_buffer;
4435 } 4420 }
4436 *buffer_address = NULL; 4421 *buffer_address = NULL;
4437 } 4422 }
4438 } 4423 }
4439 } // namespace v8::internal 4424 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/gdb-jit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698