| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 void Heap::PerformScavenge() { | 670 void Heap::PerformScavenge() { |
| 671 GCTracer tracer(this, NULL, NULL); | 671 GCTracer tracer(this, NULL, NULL); |
| 672 if (incremental_marking()->IsStopped()) { | 672 if (incremental_marking()->IsStopped()) { |
| 673 PerformGarbageCollection(SCAVENGER, &tracer); | 673 PerformGarbageCollection(SCAVENGER, &tracer); |
| 674 } else { | 674 } else { |
| 675 PerformGarbageCollection(MARK_COMPACTOR, &tracer); | 675 PerformGarbageCollection(MARK_COMPACTOR, &tracer); |
| 676 } | 676 } |
| 677 } | 677 } |
| 678 | 678 |
| 679 | 679 |
| 680 void Heap::MoveElements(FixedArray* array, |
| 681 int dst_index, |
| 682 int src_index, |
| 683 int len) { |
| 684 if (len == 0) return; |
| 685 |
| 686 ASSERT(array->map() != HEAP->fixed_cow_array_map()); |
| 687 Object** dst_objects = array->data_start() + dst_index; |
| 688 memmove(dst_objects, |
| 689 array->data_start() + src_index, |
| 690 len * kPointerSize); |
| 691 if (!InNewSpace(array)) { |
| 692 for (int i = 0; i < len; i++) { |
| 693 // TODO(hpayer): check store buffer for entries |
| 694 if (InNewSpace(dst_objects[i])) { |
| 695 RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i)); |
| 696 } |
| 697 } |
| 698 } |
| 699 incremental_marking()->RecordWrites(array); |
| 700 } |
| 701 |
| 702 |
| 680 #ifdef VERIFY_HEAP | 703 #ifdef VERIFY_HEAP |
| 681 // Helper class for verifying the symbol table. | 704 // Helper class for verifying the symbol table. |
| 682 class SymbolTableVerifier : public ObjectVisitor { | 705 class SymbolTableVerifier : public ObjectVisitor { |
| 683 public: | 706 public: |
| 684 void VisitPointers(Object** start, Object** end) { | 707 void VisitPointers(Object** start, Object** end) { |
| 685 // Visit all HeapObject pointers in [start, end). | 708 // Visit all HeapObject pointers in [start, end). |
| 686 for (Object** p = start; p < end; p++) { | 709 for (Object** p = start; p < end; p++) { |
| 687 if ((*p)->IsHeapObject()) { | 710 if ((*p)->IsHeapObject()) { |
| 688 // Check that the symbol is actually a symbol. | 711 // Check that the symbol is actually a symbol. |
| 689 CHECK((*p)->IsTheHole() || (*p)->IsUndefined() || (*p)->IsSymbol()); | 712 CHECK((*p)->IsTheHole() || (*p)->IsUndefined() || (*p)->IsSymbol()); |
| (...skipping 6666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7356 static_cast<int>(object_sizes_last_time_[index])); | 7379 static_cast<int>(object_sizes_last_time_[index])); |
| 7357 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7380 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7358 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7381 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7359 | 7382 |
| 7360 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7383 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7361 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7384 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7362 ClearObjectStats(); | 7385 ClearObjectStats(); |
| 7363 } | 7386 } |
| 7364 | 7387 |
| 7365 } } // namespace v8::internal | 7388 } } // namespace v8::internal |
| OLD | NEW |