| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 // has been invoked, we rerun major GC to release objects which become | 795 // has been invoked, we rerun major GC to release objects which become |
| 796 // garbage. | 796 // garbage. |
| 797 // Note: as weak callbacks can execute arbitrary code, we cannot | 797 // Note: as weak callbacks can execute arbitrary code, we cannot |
| 798 // hope that eventually there will be no weak callbacks invocations. | 798 // hope that eventually there will be no weak callbacks invocations. |
| 799 // Therefore stop recollecting after several attempts. | 799 // Therefore stop recollecting after several attempts. |
| 800 if (isolate()->concurrent_recompilation_enabled()) { | 800 if (isolate()->concurrent_recompilation_enabled()) { |
| 801 // The optimizing compiler may be unnecessarily holding on to memory. | 801 // The optimizing compiler may be unnecessarily holding on to memory. |
| 802 DisallowHeapAllocation no_recursive_gc; | 802 DisallowHeapAllocation no_recursive_gc; |
| 803 isolate()->optimizing_compiler_thread()->Flush(); | 803 isolate()->optimizing_compiler_thread()->Flush(); |
| 804 } | 804 } |
| 805 isolate()->ClearSerializerData(); |
| 805 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | | 806 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | |
| 806 kReduceMemoryFootprintMask); | 807 kReduceMemoryFootprintMask); |
| 807 isolate_->compilation_cache()->Clear(); | 808 isolate_->compilation_cache()->Clear(); |
| 808 const int kMaxNumberOfAttempts = 7; | 809 const int kMaxNumberOfAttempts = 7; |
| 809 const int kMinNumberOfAttempts = 2; | 810 const int kMinNumberOfAttempts = 2; |
| 810 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { | 811 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { |
| 811 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && | 812 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && |
| 812 attempt + 1 >= kMinNumberOfAttempts) { | 813 attempt + 1 >= kMinNumberOfAttempts) { |
| 813 break; | 814 break; |
| 814 } | 815 } |
| (...skipping 5568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6383 static_cast<int>(object_sizes_last_time_[index])); | 6384 static_cast<int>(object_sizes_last_time_[index])); |
| 6384 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6385 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6385 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6386 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6386 | 6387 |
| 6387 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6388 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6388 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6389 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6389 ClearObjectStats(); | 6390 ClearObjectStats(); |
| 6390 } | 6391 } |
| 6391 } | 6392 } |
| 6392 } // namespace v8::internal | 6393 } // namespace v8::internal |
| OLD | NEW |