OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 #endif // DEBUG | 413 #endif // DEBUG |
414 } | 414 } |
415 | 415 |
416 | 416 |
417 void Heap::GarbageCollectionPrologue() { | 417 void Heap::GarbageCollectionPrologue() { |
418 isolate_->transcendental_cache()->Clear(); | 418 isolate_->transcendental_cache()->Clear(); |
419 ClearJSFunctionResultCaches(); | 419 ClearJSFunctionResultCaches(); |
420 gc_count_++; | 420 gc_count_++; |
421 unflattened_strings_length_ = 0; | 421 unflattened_strings_length_ = 0; |
422 | 422 |
423 bool should_enable_code_flushing = FLAG_flush_code; | |
424 #ifdef ENABLE_DEBUGGER_SUPPORT | |
425 if (isolate_->debug()->IsLoaded() || isolate_->debug()->has_break_points()) { | |
426 should_enable_code_flushing = false; | |
427 } | |
428 #endif | |
429 mark_compact_collector()->EnableCodeFlushing(should_enable_code_flushing); | |
430 | |
431 #ifdef VERIFY_HEAP | 423 #ifdef VERIFY_HEAP |
432 if (FLAG_verify_heap) { | 424 if (FLAG_verify_heap) { |
433 Verify(); | 425 Verify(); |
434 } | 426 } |
435 #endif | 427 #endif |
436 | 428 |
437 #ifdef DEBUG | 429 #ifdef DEBUG |
438 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); | 430 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
439 allow_allocation(false); | 431 allow_allocation(false); |
440 | 432 |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 for (HeapObject* heap_object = cell_iterator.Next(); | 1312 for (HeapObject* heap_object = cell_iterator.Next(); |
1321 heap_object != NULL; | 1313 heap_object != NULL; |
1322 heap_object = cell_iterator.Next()) { | 1314 heap_object = cell_iterator.Next()) { |
1323 if (heap_object->IsJSGlobalPropertyCell()) { | 1315 if (heap_object->IsJSGlobalPropertyCell()) { |
1324 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(heap_object); | 1316 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(heap_object); |
1325 Address value_address = cell->ValueAddress(); | 1317 Address value_address = cell->ValueAddress(); |
1326 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); | 1318 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); |
1327 } | 1319 } |
1328 } | 1320 } |
1329 | 1321 |
1330 // Copy objects reachable from the code flushing candidates list. | |
1331 MarkCompactCollector* collector = mark_compact_collector(); | |
1332 if (collector->is_code_flushing_enabled()) { | |
1333 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); | |
1334 } | |
1335 | |
1336 // Scavenge object reachable from the native contexts list directly. | 1322 // Scavenge object reachable from the native contexts list directly. |
1337 scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_)); | 1323 scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_)); |
1338 | 1324 |
1339 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1325 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
1340 isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles( | 1326 isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles( |
1341 &IsUnscavengedHeapObject); | 1327 &IsUnscavengedHeapObject); |
1342 isolate_->global_handles()->IterateNewSpaceWeakIndependentRoots( | 1328 isolate_->global_handles()->IterateNewSpaceWeakIndependentRoots( |
1343 &scavenge_visitor); | 1329 &scavenge_visitor); |
1344 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1330 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
1345 | 1331 |
(...skipping 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5541 | 5527 |
5542 | 5528 |
5543 bool Heap::LookupSymbolIfExists(String* string, String** symbol) { | 5529 bool Heap::LookupSymbolIfExists(String* string, String** symbol) { |
5544 if (string->IsSymbol()) { | 5530 if (string->IsSymbol()) { |
5545 *symbol = string; | 5531 *symbol = string; |
5546 return true; | 5532 return true; |
5547 } | 5533 } |
5548 return symbol_table()->LookupSymbolIfExists(string, symbol); | 5534 return symbol_table()->LookupSymbolIfExists(string, symbol); |
5549 } | 5535 } |
5550 | 5536 |
5551 | |
5552 void Heap::ZapFromSpace() { | 5537 void Heap::ZapFromSpace() { |
5553 NewSpacePageIterator it(new_space_.FromSpaceStart(), | 5538 NewSpacePageIterator it(new_space_.FromSpaceStart(), |
5554 new_space_.FromSpaceEnd()); | 5539 new_space_.FromSpaceEnd()); |
5555 while (it.has_next()) { | 5540 while (it.has_next()) { |
5556 NewSpacePage* page = it.next(); | 5541 NewSpacePage* page = it.next(); |
5557 for (Address cursor = page->area_start(), limit = page->area_end(); | 5542 for (Address cursor = page->area_start(), limit = page->area_end(); |
5558 cursor < limit; | 5543 cursor < limit; |
5559 cursor += kPointerSize) { | 5544 cursor += kPointerSize) { |
5560 Memory::Address_at(cursor) = kFromSpaceZapValue; | 5545 Memory::Address_at(cursor) = kFromSpaceZapValue; |
5561 } | 5546 } |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7367 static_cast<int>(object_sizes_last_time_[index])); | 7352 static_cast<int>(object_sizes_last_time_[index])); |
7368 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7353 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7369 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7354 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7370 | 7355 |
7371 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7356 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7372 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7357 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7373 ClearObjectStats(); | 7358 ClearObjectStats(); |
7374 } | 7359 } |
7375 | 7360 |
7376 } } // namespace v8::internal | 7361 } } // namespace v8::internal |
OLD | NEW |