| 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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 return NULL; | 1508 return NULL; |
| 1509 } | 1509 } |
| 1510 | 1510 |
| 1511 private: | 1511 private: |
| 1512 Heap* heap_; | 1512 Heap* heap_; |
| 1513 }; | 1513 }; |
| 1514 | 1514 |
| 1515 | 1515 |
| 1516 void Heap::Scavenge() { | 1516 void Heap::Scavenge() { |
| 1517 RelocationLock relocation_lock(this); | 1517 RelocationLock relocation_lock(this); |
| 1518 // There are soft limits in the allocation code, designed to trigger a mark |
| 1519 // sweep collection by failing allocations. There is no sense in trying to |
| 1520 // trigger one during scavenge: scavenges allocation should always succeed. |
| 1521 AlwaysAllocateScope scope(isolate()); |
| 1518 | 1522 |
| 1519 #ifdef VERIFY_HEAP | 1523 #ifdef VERIFY_HEAP |
| 1520 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); | 1524 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); |
| 1521 #endif | 1525 #endif |
| 1522 | 1526 |
| 1523 gc_state_ = SCAVENGE; | 1527 gc_state_ = SCAVENGE; |
| 1524 | 1528 |
| 1525 // Implements Cheney's copying algorithm | 1529 // Implements Cheney's copying algorithm |
| 1526 LOG(isolate_, ResourceEvent("scavenge", "begin")); | 1530 LOG(isolate_, ResourceEvent("scavenge", "begin")); |
| 1527 | 1531 |
| (...skipping 4856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6384 static_cast<int>(object_sizes_last_time_[index])); | 6388 static_cast<int>(object_sizes_last_time_[index])); |
| 6385 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6389 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6386 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6390 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6387 | 6391 |
| 6388 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6392 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6389 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6393 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6390 ClearObjectStats(); | 6394 ClearObjectStats(); |
| 6391 } | 6395 } |
| 6392 } | 6396 } |
| 6393 } // namespace v8::internal | 6397 } // namespace v8::internal |
| OLD | NEW |