| 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 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 | 1272 |
| 1273 bool becomes_to_space = (id_ == kFromSpace); | 1273 bool becomes_to_space = (id_ == kFromSpace); |
| 1274 id_ = becomes_to_space ? kToSpace : kFromSpace; | 1274 id_ = becomes_to_space ? kToSpace : kFromSpace; |
| 1275 NewSpacePage* page = anchor_.next_page(); | 1275 NewSpacePage* page = anchor_.next_page(); |
| 1276 while (page != &anchor_) { | 1276 while (page != &anchor_) { |
| 1277 page->set_owner(this); | 1277 page->set_owner(this); |
| 1278 page->SetFlags(flags, mask); | 1278 page->SetFlags(flags, mask); |
| 1279 if (becomes_to_space) { | 1279 if (becomes_to_space) { |
| 1280 page->ClearFlag(MemoryChunk::IN_FROM_SPACE); | 1280 page->ClearFlag(MemoryChunk::IN_FROM_SPACE); |
| 1281 page->SetFlag(MemoryChunk::IN_TO_SPACE); | 1281 page->SetFlag(MemoryChunk::IN_TO_SPACE); |
| 1282 page->ClearFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK); |
| 1282 } else { | 1283 } else { |
| 1283 page->SetFlag(MemoryChunk::IN_FROM_SPACE); | 1284 page->SetFlag(MemoryChunk::IN_FROM_SPACE); |
| 1284 page->ClearFlag(MemoryChunk::IN_TO_SPACE); | 1285 page->ClearFlag(MemoryChunk::IN_TO_SPACE); |
| 1285 } | 1286 } |
| 1286 ASSERT(page->IsFlagSet(MemoryChunk::SCAN_ON_SCAVENGE)); | 1287 ASSERT(page->IsFlagSet(MemoryChunk::SCAN_ON_SCAVENGE)); |
| 1287 ASSERT(page->IsFlagSet(MemoryChunk::IN_TO_SPACE) || | 1288 ASSERT(page->IsFlagSet(MemoryChunk::IN_TO_SPACE) || |
| 1288 page->IsFlagSet(MemoryChunk::IN_FROM_SPACE)); | 1289 page->IsFlagSet(MemoryChunk::IN_FROM_SPACE)); |
| 1289 page = page->next_page(); | 1290 page = page->next_page(); |
| 1290 } | 1291 } |
| 1291 } | 1292 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 | 1584 |
| 1584 void NewSpace::RecordPromotion(HeapObject* obj) { | 1585 void NewSpace::RecordPromotion(HeapObject* obj) { |
| 1585 InstanceType type = obj->map()->instance_type(); | 1586 InstanceType type = obj->map()->instance_type(); |
| 1586 ASSERT(0 <= type && type <= LAST_TYPE); | 1587 ASSERT(0 <= type && type <= LAST_TYPE); |
| 1587 promoted_histogram_[type].increment_number(1); | 1588 promoted_histogram_[type].increment_number(1); |
| 1588 promoted_histogram_[type].increment_bytes(obj->Size()); | 1589 promoted_histogram_[type].increment_bytes(obj->Size()); |
| 1589 } | 1590 } |
| 1590 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 1591 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 1591 | 1592 |
| 1592 | 1593 |
| 1594 void SemiSpace::set_age_mark(Address mark) { |
| 1595 age_mark_ = mark; |
| 1596 ASSERT(to_space_.Contains(mark)); |
| 1597 // Mark all pages up to the one containing mark. |
| 1598 NewSpacePageIterator it(space_low(), mark); |
| 1599 while (it.has_next()) { |
| 1600 it.next()->SetFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK); |
| 1601 } |
| 1602 } |
| 1603 |
| 1593 // ----------------------------------------------------------------------------- | 1604 // ----------------------------------------------------------------------------- |
| 1594 // Free lists for old object spaces implementation | 1605 // Free lists for old object spaces implementation |
| 1595 | 1606 |
| 1596 void FreeListNode::set_size(Heap* heap, int size_in_bytes) { | 1607 void FreeListNode::set_size(Heap* heap, int size_in_bytes) { |
| 1597 ASSERT(size_in_bytes > 0); | 1608 ASSERT(size_in_bytes > 0); |
| 1598 ASSERT(IsAligned(size_in_bytes, kPointerSize)); | 1609 ASSERT(IsAligned(size_in_bytes, kPointerSize)); |
| 1599 | 1610 |
| 1600 // We write a map and possibly size information to the block. If the block | 1611 // We write a map and possibly size information to the block. If the block |
| 1601 // is big enough to be a FreeSpace with at least one extra word (the next | 1612 // is big enough to be a FreeSpace with at least one extra word (the next |
| 1602 // pointer), we set its map to be the free space map and its size to an | 1613 // pointer), we set its map to be the free space map and its size to an |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 2475 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
| 2465 if (obj->IsCode()) { | 2476 if (obj->IsCode()) { |
| 2466 Code* code = Code::cast(obj); | 2477 Code* code = Code::cast(obj); |
| 2467 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 2478 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
| 2468 } | 2479 } |
| 2469 } | 2480 } |
| 2470 } | 2481 } |
| 2471 #endif // DEBUG | 2482 #endif // DEBUG |
| 2472 | 2483 |
| 2473 } } // namespace v8::internal | 2484 } } // namespace v8::internal |
| OLD | NEW |