OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by), | 465 ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by), |
466 live_byte_count_ + by); | 466 live_byte_count_ + by); |
467 } | 467 } |
468 live_byte_count_ += by; | 468 live_byte_count_ += by; |
469 ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_); | 469 ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_); |
470 } | 470 } |
471 int LiveBytes() { | 471 int LiveBytes() { |
472 ASSERT(static_cast<unsigned>(live_byte_count_) <= size_); | 472 ASSERT(static_cast<unsigned>(live_byte_count_) <= size_); |
473 return live_byte_count_; | 473 return live_byte_count_; |
474 } | 474 } |
475 static void IncrementLiveBytes(Address address, int by) { | 475 |
| 476 static void IncrementLiveBytesFromGC(Address address, int by) { |
476 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); | 477 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); |
477 } | 478 } |
478 | 479 |
| 480 static void IncrementLiveBytesFromMutator(Address address, int by); |
| 481 |
479 static const intptr_t kAlignment = | 482 static const intptr_t kAlignment = |
480 (static_cast<uintptr_t>(1) << kPageSizeBits); | 483 (static_cast<uintptr_t>(1) << kPageSizeBits); |
481 | 484 |
482 static const intptr_t kAlignmentMask = kAlignment - 1; | 485 static const intptr_t kAlignmentMask = kAlignment - 1; |
483 | 486 |
484 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; | 487 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; |
485 | 488 |
486 static const intptr_t kLiveBytesOffset = | 489 static const intptr_t kLiveBytesOffset = |
487 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + | 490 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + |
488 kPointerSize + kPointerSize + kPointerSize + kIntSize; | 491 kPointerSize + kPointerSize + kPointerSize + kIntSize; |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && | 1559 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && |
1557 !p->WasSweptPrecisely(); | 1560 !p->WasSweptPrecisely(); |
1558 } | 1561 } |
1559 | 1562 |
1560 void SetPagesToSweep(Page* first) { | 1563 void SetPagesToSweep(Page* first) { |
1561 ASSERT(unswept_free_bytes_ == 0); | 1564 ASSERT(unswept_free_bytes_ == 0); |
1562 if (first == &anchor_) first = NULL; | 1565 if (first == &anchor_) first = NULL; |
1563 first_unswept_page_ = first; | 1566 first_unswept_page_ = first; |
1564 } | 1567 } |
1565 | 1568 |
| 1569 void IncrementUnsweptFreeBytes(int by) { |
| 1570 unswept_free_bytes_ += by; |
| 1571 } |
| 1572 |
1566 void IncreaseUnsweptFreeBytes(Page* p) { | 1573 void IncreaseUnsweptFreeBytes(Page* p) { |
1567 ASSERT(ShouldBeSweptLazily(p)); | 1574 ASSERT(ShouldBeSweptLazily(p)); |
1568 unswept_free_bytes_ += (Page::kObjectAreaSize - p->LiveBytes()); | 1575 unswept_free_bytes_ += (Page::kObjectAreaSize - p->LiveBytes()); |
1569 } | 1576 } |
1570 | 1577 |
1571 void DecreaseUnsweptFreeBytes(Page* p) { | 1578 void DecreaseUnsweptFreeBytes(Page* p) { |
1572 ASSERT(ShouldBeSweptLazily(p)); | 1579 ASSERT(ShouldBeSweptLazily(p)); |
1573 unswept_free_bytes_ -= (Page::kObjectAreaSize - p->LiveBytes()); | 1580 unswept_free_bytes_ -= (Page::kObjectAreaSize - p->LiveBytes()); |
1574 } | 1581 } |
1575 | 1582 |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 } | 2656 } |
2650 // Must be small, since an iteration is used for lookup. | 2657 // Must be small, since an iteration is used for lookup. |
2651 static const int kMaxComments = 64; | 2658 static const int kMaxComments = 64; |
2652 }; | 2659 }; |
2653 #endif | 2660 #endif |
2654 | 2661 |
2655 | 2662 |
2656 } } // namespace v8::internal | 2663 } } // namespace v8::internal |
2657 | 2664 |
2658 #endif // V8_SPACES_H_ | 2665 #endif // V8_SPACES_H_ |
OLD | NEW |