| OLD | NEW |
| 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_HEAP_INL_H_ | 28 #ifndef V8_HEAP_INL_H_ |
| 29 #define V8_HEAP_INL_H_ | 29 #define V8_HEAP_INL_H_ |
| 30 | 30 |
| 31 #include "heap.h" | 31 #include "heap.h" |
| 32 #include "objects.h" | 32 #include "objects.h" |
| 33 #include "v8-counters.h" | 33 #include "v8-counters.h" |
| 34 #include "write-buffer.h" | 34 #include "store-buffer.h" |
| 35 #include "write-buffer-inl.h" | 35 #include "store-buffer-inl.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 int Heap::MaxObjectSizeInPagedSpace() { | 40 int Heap::MaxObjectSizeInPagedSpace() { |
| 41 return Page::kMaxHeapObjectSize; | 41 return Page::kMaxHeapObjectSize; |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 MaybeObject* Heap::AllocateStringFromUtf8(Vector<const char> str, | 45 MaybeObject* Heap::AllocateStringFromUtf8(Vector<const char> str, |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 265 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
| 266 // An object should be promoted if: | 266 // An object should be promoted if: |
| 267 // - the object has survived a scavenge operation or | 267 // - the object has survived a scavenge operation or |
| 268 // - to space is already 25% full. | 268 // - to space is already 25% full. |
| 269 return old_address < new_space_.age_mark() | 269 return old_address < new_space_.age_mark() |
| 270 || (new_space_.Size() + object_size) >= (new_space_.Capacity() >> 2); | 270 || (new_space_.Size() + object_size) >= (new_space_.Capacity() >> 2); |
| 271 } | 271 } |
| 272 | 272 |
| 273 | 273 |
| 274 void Heap::RecordWrite(Address address, int offset) { | 274 void Heap::RecordWrite(Address address, int offset) { |
| 275 WriteBuffer::Mark(address + offset); | 275 StoreBuffer::Mark(address + offset); |
| 276 } | 276 } |
| 277 | 277 |
| 278 | 278 |
| 279 void Heap::RecordWrites(Address address, int start, int len) { | 279 void Heap::RecordWrites(Address address, int start, int len) { |
| 280 for (int i = 0; i < len; i++) { | 280 for (int i = 0; i < len; i++) { |
| 281 WriteBuffer::Mark(address + start + i); | 281 StoreBuffer::Mark(address + start + i); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 | 285 |
| 286 OldSpace* Heap::TargetSpace(HeapObject* object) { | 286 OldSpace* Heap::TargetSpace(HeapObject* object) { |
| 287 InstanceType type = object->map()->instance_type(); | 287 InstanceType type = object->map()->instance_type(); |
| 288 AllocationSpace space = TargetSpaceId(type); | 288 AllocationSpace space = TargetSpaceId(type); |
| 289 return (space == OLD_POINTER_SPACE) | 289 return (space == OLD_POINTER_SPACE) |
| 290 ? old_pointer_space_ | 290 ? old_pointer_space_ |
| 291 : old_data_space_; | 291 : old_data_space_; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 587 |
| 588 | 588 |
| 589 void ExternalStringTable::ShrinkNewStrings(int position) { | 589 void ExternalStringTable::ShrinkNewStrings(int position) { |
| 590 new_space_strings_.Rewind(position); | 590 new_space_strings_.Rewind(position); |
| 591 Verify(); | 591 Verify(); |
| 592 } | 592 } |
| 593 | 593 |
| 594 } } // namespace v8::internal | 594 } } // namespace v8::internal |
| 595 | 595 |
| 596 #endif // V8_HEAP_INL_H_ | 596 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |