| 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // major GC. Therefore if we collect aggressively and weak handle callback | 606 // major GC. Therefore if we collect aggressively and weak handle callback |
| 607 // has been invoked, we rerun major GC to release objects which become | 607 // has been invoked, we rerun major GC to release objects which become |
| 608 // garbage. | 608 // garbage. |
| 609 // Note: as weak callbacks can execute arbitrary code, we cannot | 609 // Note: as weak callbacks can execute arbitrary code, we cannot |
| 610 // hope that eventually there will be no weak callbacks invocations. | 610 // hope that eventually there will be no weak callbacks invocations. |
| 611 // Therefore stop recollecting after several attempts. | 611 // Therefore stop recollecting after several attempts. |
| 612 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | | 612 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | |
| 613 kReduceMemoryFootprintMask); | 613 kReduceMemoryFootprintMask); |
| 614 isolate_->compilation_cache()->Clear(); | 614 isolate_->compilation_cache()->Clear(); |
| 615 const int kMaxNumberOfAttempts = 7; | 615 const int kMaxNumberOfAttempts = 7; |
| 616 const int kMinNumberOfAttempts = 2; |
| 616 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { | 617 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { |
| 617 if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR, gc_reason, NULL)) { | 618 if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR, gc_reason, NULL) && |
| 619 attempt + 1 >= kMinNumberOfAttempts) { |
| 618 break; | 620 break; |
| 619 } | 621 } |
| 620 } | 622 } |
| 621 mark_compact_collector()->SetFlags(kNoGCFlags); | 623 mark_compact_collector()->SetFlags(kNoGCFlags); |
| 622 new_space_.Shrink(); | 624 new_space_.Shrink(); |
| 623 UncommitFromSpace(); | 625 UncommitFromSpace(); |
| 624 incremental_marking()->UncommitMarkingDeque(); | 626 incremental_marking()->UncommitMarkingDeque(); |
| 625 } | 627 } |
| 626 | 628 |
| 627 | 629 |
| (...skipping 7506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8134 if (FLAG_parallel_recompilation) { | 8136 if (FLAG_parallel_recompilation) { |
| 8135 heap_->relocation_mutex_->Lock(); | 8137 heap_->relocation_mutex_->Lock(); |
| 8136 #ifdef DEBUG | 8138 #ifdef DEBUG |
| 8137 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8139 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 8138 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8140 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 8139 #endif // DEBUG | 8141 #endif // DEBUG |
| 8140 } | 8142 } |
| 8141 } | 8143 } |
| 8142 | 8144 |
| 8143 } } // namespace v8::internal | 8145 } } // namespace v8::internal |
| OLD | NEW |