| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "code-stubs.h" | 7 #include "code-stubs.h" |
| 8 #include "compilation-cache.h" | 8 #include "compilation-cache.h" |
| 9 #include "cpu-profiler.h" | 9 #include "cpu-profiler.h" |
| 10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 ClearWeakCollections(); | 410 ClearWeakCollections(); |
| 411 | 411 |
| 412 #ifdef VERIFY_HEAP | 412 #ifdef VERIFY_HEAP |
| 413 if (FLAG_verify_heap) { | 413 if (FLAG_verify_heap) { |
| 414 VerifyMarking(heap_); | 414 VerifyMarking(heap_); |
| 415 } | 415 } |
| 416 #endif | 416 #endif |
| 417 | 417 |
| 418 SweepSpaces(); | 418 SweepSpaces(); |
| 419 | 419 |
| 420 if (!FLAG_collect_maps) ReattachInitialMaps(); | |
| 421 | |
| 422 #ifdef DEBUG | 420 #ifdef DEBUG |
| 423 if (FLAG_verify_native_context_separation) { | 421 if (FLAG_verify_native_context_separation) { |
| 424 VerifyNativeContextSeparation(heap_); | 422 VerifyNativeContextSeparation(heap_); |
| 425 } | 423 } |
| 426 #endif | 424 #endif |
| 427 | 425 |
| 428 #ifdef VERIFY_HEAP | 426 #ifdef VERIFY_HEAP |
| 429 if (heap()->weak_embedded_objects_verification_enabled()) { | 427 if (heap()->weak_embedded_objects_verification_enabled()) { |
| 430 VerifyWeakEmbeddedObjectsInCode(); | 428 VerifyWeakEmbeddedObjectsInCode(); |
| 431 } | 429 } |
| (...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2526 } | 2524 } |
| 2527 } | 2525 } |
| 2528 } | 2526 } |
| 2529 // Move to next element in the list. | 2527 // Move to next element in the list. |
| 2530 raw_context = context->get(Context::NEXT_CONTEXT_LINK); | 2528 raw_context = context->get(Context::NEXT_CONTEXT_LINK); |
| 2531 } | 2529 } |
| 2532 ProcessMarkingDeque(); | 2530 ProcessMarkingDeque(); |
| 2533 } | 2531 } |
| 2534 | 2532 |
| 2535 | 2533 |
| 2536 void MarkCompactCollector::ReattachInitialMaps() { | |
| 2537 HeapObjectIterator map_iterator(heap()->map_space()); | |
| 2538 for (HeapObject* obj = map_iterator.Next(); | |
| 2539 obj != NULL; | |
| 2540 obj = map_iterator.Next()) { | |
| 2541 Map* map = Map::cast(obj); | |
| 2542 | |
| 2543 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); | |
| 2544 if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue; | |
| 2545 | |
| 2546 if (map->attached_to_shared_function_info()) { | |
| 2547 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map); | |
| 2548 } | |
| 2549 } | |
| 2550 } | |
| 2551 | |
| 2552 | |
| 2553 void MarkCompactCollector::ClearNonLiveReferences() { | 2534 void MarkCompactCollector::ClearNonLiveReferences() { |
| 2554 // Iterate over the map space, setting map transitions that go from | 2535 // Iterate over the map space, setting map transitions that go from |
| 2555 // a marked map to an unmarked map to null transitions. This action | 2536 // a marked map to an unmarked map to null transitions. This action |
| 2556 // is carried out only on maps of JSObjects and related subtypes. | 2537 // is carried out only on maps of JSObjects and related subtypes. |
| 2557 HeapObjectIterator map_iterator(heap()->map_space()); | 2538 HeapObjectIterator map_iterator(heap()->map_space()); |
| 2558 for (HeapObject* obj = map_iterator.Next(); | 2539 for (HeapObject* obj = map_iterator.Next(); |
| 2559 obj != NULL; | 2540 obj != NULL; |
| 2560 obj = map_iterator.Next()) { | 2541 obj = map_iterator.Next()) { |
| 2561 Map* map = Map::cast(obj); | 2542 Map* map = Map::cast(obj); |
| 2562 | 2543 |
| 2563 if (!map->CanTransition()) continue; | 2544 if (!map->CanTransition()) continue; |
| 2564 | 2545 |
| 2565 MarkBit map_mark = Marking::MarkBitFrom(map); | 2546 MarkBit map_mark = Marking::MarkBitFrom(map); |
| 2566 if (map_mark.Get() && map->attached_to_shared_function_info()) { | |
| 2567 // This map is used for inobject slack tracking and has been detached | |
| 2568 // from SharedFunctionInfo during the mark phase. | |
| 2569 // Since it survived the GC, reattach it now. | |
| 2570 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map); | |
| 2571 } | |
| 2572 | |
| 2573 ClearNonLivePrototypeTransitions(map); | 2547 ClearNonLivePrototypeTransitions(map); |
| 2574 ClearNonLiveMapTransitions(map, map_mark); | 2548 ClearNonLiveMapTransitions(map, map_mark); |
| 2575 | 2549 |
| 2576 if (map_mark.Get()) { | 2550 if (map_mark.Get()) { |
| 2577 ClearNonLiveDependentCode(map->dependent_code()); | 2551 ClearNonLiveDependentCode(map->dependent_code()); |
| 2578 } else { | 2552 } else { |
| 2579 ClearDependentCode(map->dependent_code()); | 2553 ClearDependentCode(map->dependent_code()); |
| 2580 map->set_dependent_code(DependentCode::cast(heap()->empty_fixed_array())); | 2554 map->set_dependent_code(DependentCode::cast(heap()->empty_fixed_array())); |
| 2581 } | 2555 } |
| 2582 } | 2556 } |
| (...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 while (buffer != NULL) { | 4505 while (buffer != NULL) { |
| 4532 SlotsBuffer* next_buffer = buffer->next(); | 4506 SlotsBuffer* next_buffer = buffer->next(); |
| 4533 DeallocateBuffer(buffer); | 4507 DeallocateBuffer(buffer); |
| 4534 buffer = next_buffer; | 4508 buffer = next_buffer; |
| 4535 } | 4509 } |
| 4536 *buffer_address = NULL; | 4510 *buffer_address = NULL; |
| 4537 } | 4511 } |
| 4538 | 4512 |
| 4539 | 4513 |
| 4540 } } // namespace v8::internal | 4514 } } // namespace v8::internal |
| OLD | NEW |