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

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

Issue 8060053: Enable code flushing for full (non-incremental) collections. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: update test and remove FLAG_flush_code = false Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | test/cctest/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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 compacting_ = false; 461 compacting_ = false;
462 evacuation_candidates_.Rewind(0); 462 evacuation_candidates_.Rewind(0);
463 invalidated_code_.Rewind(0); 463 invalidated_code_.Rewind(0);
464 } 464 }
465 ASSERT_EQ(0, evacuation_candidates_.length()); 465 ASSERT_EQ(0, evacuation_candidates_.length());
466 } 466 }
467 467
468 468
469 void MarkCompactCollector::Prepare(GCTracer* tracer) { 469 void MarkCompactCollector::Prepare(GCTracer* tracer) {
470 FLAG_flush_code = false;
471
472 was_marked_incrementally_ = heap()->incremental_marking()->IsMarking(); 470 was_marked_incrementally_ = heap()->incremental_marking()->IsMarking();
473 471
474 // Disable collection of maps if incremental marking is enabled. 472 // Disable collection of maps if incremental marking is enabled.
475 // Map collection algorithm relies on a special map transition tree traversal 473 // Map collection algorithm relies on a special map transition tree traversal
476 // order which is not implemented for incremental marking. 474 // order which is not implemented for incremental marking.
477 collect_maps_ = FLAG_collect_maps && !was_marked_incrementally_; 475 collect_maps_ = FLAG_collect_maps && !was_marked_incrementally_;
478 476
479 // Rather than passing the tracer around we stash it in a static member 477 // Rather than passing the tracer around we stash it in a static member
480 // variable. 478 // variable.
481 tracer_ = tracer; 479 tracer_ = tracer;
482 480
483 #ifdef DEBUG 481 #ifdef DEBUG
484 ASSERT(state_ == IDLE); 482 ASSERT(state_ == IDLE);
485 state_ = PREPARE_GC; 483 state_ = PREPARE_GC;
486 #endif 484 #endif
487 485
488 // TODO(1726) Revert this into an assertion when compaction is enabled.
489 ASSERT(!FLAG_never_compact || !FLAG_always_compact); 486 ASSERT(!FLAG_never_compact || !FLAG_always_compact);
490 487
491 if (collect_maps_) CreateBackPointers(); 488 if (collect_maps_) CreateBackPointers();
492 #ifdef ENABLE_GDB_JIT_INTERFACE 489 #ifdef ENABLE_GDB_JIT_INTERFACE
493 if (FLAG_gdbjit) { 490 if (FLAG_gdbjit) {
494 // If GDBJIT interface is active disable compaction. 491 // If GDBJIT interface is active disable compaction.
495 compacting_collection_ = false; 492 compacting_collection_ = false;
496 } 493 }
497 #endif 494 #endif
498 495
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 } 1412 }
1416 1413
1417 private: 1414 private:
1418 MarkCompactCollector* collector_; 1415 MarkCompactCollector* collector_;
1419 }; 1416 };
1420 1417
1421 1418
1422 void MarkCompactCollector::PrepareForCodeFlushing() { 1419 void MarkCompactCollector::PrepareForCodeFlushing() {
1423 ASSERT(heap() == Isolate::Current()->heap()); 1420 ASSERT(heap() == Isolate::Current()->heap());
1424 1421
1425 if (!FLAG_flush_code) { 1422 // TODO(1609) Currently incremental marker does not support code flushing.
1423 if (!FLAG_flush_code || was_marked_incrementally_) {
1426 EnableCodeFlushing(false); 1424 EnableCodeFlushing(false);
1427 return; 1425 return;
1428 } 1426 }
1429 1427
1430 #ifdef ENABLE_DEBUGGER_SUPPORT 1428 #ifdef ENABLE_DEBUGGER_SUPPORT
1431 if (heap()->isolate()->debug()->IsLoaded() || 1429 if (heap()->isolate()->debug()->IsLoaded() ||
1432 heap()->isolate()->debug()->has_break_points()) { 1430 heap()->isolate()->debug()->has_break_points()) {
1433 EnableCodeFlushing(false); 1431 EnableCodeFlushing(false);
1434 return; 1432 return;
1435 } 1433 }
1436 #endif 1434 #endif
1435
1437 EnableCodeFlushing(true); 1436 EnableCodeFlushing(true);
1438 1437
1439 // Ensure that empty descriptor array is marked. Method MarkDescriptorArray 1438 // Ensure that empty descriptor array is marked. Method MarkDescriptorArray
1440 // relies on it being marked before any other descriptor array. 1439 // relies on it being marked before any other descriptor array.
1441 HeapObject* descriptor_array = heap()->empty_descriptor_array(); 1440 HeapObject* descriptor_array = heap()->empty_descriptor_array();
1442 MarkBit descriptor_array_mark = Marking::MarkBitFrom(descriptor_array); 1441 MarkBit descriptor_array_mark = Marking::MarkBitFrom(descriptor_array);
1443 MarkObject(descriptor_array, descriptor_array_mark); 1442 MarkObject(descriptor_array, descriptor_array_mark);
1444 1443
1445 // Make sure we are not referencing the code from the stack. 1444 // Make sure we are not referencing the code from the stack.
1446 ASSERT(this == heap()->mark_compact_collector()); 1445 ASSERT(this == heap()->mark_compact_collector());
(...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3680 // of the previous ones. 3679 // of the previous ones.
3681 SweepSpace(heap()->map_space(), PRECISE); 3680 SweepSpace(heap()->map_space(), PRECISE);
3682 3681
3683 ASSERT(live_map_objects_size_ <= heap()->map_space()->Size()); 3682 ASSERT(live_map_objects_size_ <= heap()->map_space()->Size());
3684 3683
3685 // Deallocate unmarked objects and clear marked bits for marked objects. 3684 // Deallocate unmarked objects and clear marked bits for marked objects.
3686 heap_->lo_space()->FreeUnmarkedObjects(); 3685 heap_->lo_space()->FreeUnmarkedObjects();
3687 } 3686 }
3688 3687
3689 3688
3690 // TODO(1466) ReportDeleteIfNeeded is not called currently.
3691 // Our profiling tools do not expect intersections between
3692 // code objects. We should either reenable it or change our tools.
3693 void MarkCompactCollector::EnableCodeFlushing(bool enable) { 3689 void MarkCompactCollector::EnableCodeFlushing(bool enable) {
3694 if (enable) { 3690 if (enable) {
3695 if (code_flusher_ != NULL) return; 3691 if (code_flusher_ != NULL) return;
3696 code_flusher_ = new CodeFlusher(heap()->isolate()); 3692 code_flusher_ = new CodeFlusher(heap()->isolate());
3697 } else { 3693 } else {
3698 if (code_flusher_ == NULL) return; 3694 if (code_flusher_ == NULL) return;
3699 delete code_flusher_; 3695 delete code_flusher_;
3700 code_flusher_ = NULL; 3696 code_flusher_ = NULL;
3701 } 3697 }
3702 } 3698 }
3703 3699
3704 3700
3701 // TODO(1466) ReportDeleteIfNeeded is not called currently.
3702 // Our profiling tools do not expect intersections between
3703 // code objects. We should either reenable it or change our tools.
3705 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, 3704 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj,
3706 Isolate* isolate) { 3705 Isolate* isolate) {
3707 #ifdef ENABLE_GDB_JIT_INTERFACE 3706 #ifdef ENABLE_GDB_JIT_INTERFACE
3708 if (obj->IsCode()) { 3707 if (obj->IsCode()) {
3709 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); 3708 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj));
3710 } 3709 }
3711 #endif 3710 #endif
3712 if (obj->IsCode()) { 3711 if (obj->IsCode()) {
3713 PROFILE(isolate, CodeDeleteEvent(obj->address())); 3712 PROFILE(isolate, CodeDeleteEvent(obj->address()));
3714 } 3713 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 while (buffer != NULL) { 3853 while (buffer != NULL) {
3855 SlotsBuffer* next_buffer = buffer->next(); 3854 SlotsBuffer* next_buffer = buffer->next();
3856 DeallocateBuffer(buffer); 3855 DeallocateBuffer(buffer);
3857 buffer = next_buffer; 3856 buffer = next_buffer;
3858 } 3857 }
3859 *buffer_address = NULL; 3858 *buffer_address = NULL;
3860 } 3859 }
3861 3860
3862 3861
3863 } } // namespace v8::internal 3862 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698