| 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/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 heap()->IncrementPromotedObjectsSize(object_size); | 3052 heap()->IncrementPromotedObjectsSize(object_size); |
| 3053 return true; | 3053 return true; |
| 3054 } | 3054 } |
| 3055 | 3055 |
| 3056 return false; | 3056 return false; |
| 3057 } | 3057 } |
| 3058 | 3058 |
| 3059 | 3059 |
| 3060 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot) { | 3060 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot) { |
| 3061 // This function does not support large objects right now. | 3061 // This function does not support large objects right now. |
| 3062 if (p->owner() == NULL) return true; | 3062 Space* owner = p->owner(); |
| 3063 if (owner == heap_->lo_space() || owner == NULL) return true; |
| 3063 | 3064 |
| 3064 uint32_t mark_bit_index = p->AddressToMarkbitIndex(slot); | 3065 uint32_t mark_bit_index = p->AddressToMarkbitIndex(slot); |
| 3065 unsigned int start_index = mark_bit_index >> Bitmap::kBitsPerCellLog2; | 3066 unsigned int start_index = mark_bit_index >> Bitmap::kBitsPerCellLog2; |
| 3066 MarkBit::CellType index_in_cell = 1U | 3067 MarkBit::CellType index_in_cell = 1U |
| 3067 << (mark_bit_index & Bitmap::kBitIndexMask); | 3068 << (mark_bit_index & Bitmap::kBitIndexMask); |
| 3068 MarkBit::CellType* cells = p->markbits()->cells(); | 3069 MarkBit::CellType* cells = p->markbits()->cells(); |
| 3069 Address cell_base = p->area_start(); | 3070 Address cell_base = p->area_start(); |
| 3070 unsigned int cell_base_start_index = Bitmap::IndexToCell( | 3071 unsigned int cell_base_start_index = Bitmap::IndexToCell( |
| 3071 Bitmap::CellAlignIndex(p->AddressToMarkbitIndex(cell_base))); | 3072 Bitmap::CellAlignIndex(p->AddressToMarkbitIndex(cell_base))); |
| 3072 | 3073 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3114 // If the slot is within the last found object in the cell, the slot is | 3115 // If the slot is within the last found object in the cell, the slot is |
| 3115 // in a live object. | 3116 // in a live object. |
| 3116 return true; | 3117 return true; |
| 3117 } | 3118 } |
| 3118 return false; | 3119 return false; |
| 3119 } | 3120 } |
| 3120 | 3121 |
| 3121 | 3122 |
| 3122 bool MarkCompactCollector::IsSlotInBlackObjectSlow(Page* p, Address slot) { | 3123 bool MarkCompactCollector::IsSlotInBlackObjectSlow(Page* p, Address slot) { |
| 3123 // This function does not support large objects right now. | 3124 // This function does not support large objects right now. |
| 3124 if (p->owner() == NULL) return true; | 3125 Space* owner = p->owner(); |
| 3126 if (owner == heap_->lo_space() || owner == NULL) return true; |
| 3125 | 3127 |
| 3126 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 3128 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
| 3127 Address cell_base = it.CurrentCellBase(); | 3129 Address cell_base = it.CurrentCellBase(); |
| 3128 MarkBit::CellType* cell = it.CurrentCell(); | 3130 MarkBit::CellType* cell = it.CurrentCell(); |
| 3129 | 3131 |
| 3130 MarkBit::CellType current_cell = *cell; | 3132 MarkBit::CellType current_cell = *cell; |
| 3131 if (current_cell == 0) continue; | 3133 if (current_cell == 0) continue; |
| 3132 | 3134 |
| 3133 int offset = 0; | 3135 int offset = 0; |
| 3134 while (current_cell != 0) { | 3136 while (current_cell != 0) { |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4636 SlotsBuffer* buffer = *buffer_address; | 4638 SlotsBuffer* buffer = *buffer_address; |
| 4637 while (buffer != NULL) { | 4639 while (buffer != NULL) { |
| 4638 SlotsBuffer* next_buffer = buffer->next(); | 4640 SlotsBuffer* next_buffer = buffer->next(); |
| 4639 DeallocateBuffer(buffer); | 4641 DeallocateBuffer(buffer); |
| 4640 buffer = next_buffer; | 4642 buffer = next_buffer; |
| 4641 } | 4643 } |
| 4642 *buffer_address = NULL; | 4644 *buffer_address = NULL; |
| 4643 } | 4645 } |
| 4644 } | 4646 } |
| 4645 } // namespace v8::internal | 4647 } // namespace v8::internal |
| OLD | NEW |