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 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 | 2020 |
2021 int bytes_left = new_node_size - size_in_bytes; | 2021 int bytes_left = new_node_size - size_in_bytes; |
2022 ASSERT(bytes_left >= 0); | 2022 ASSERT(bytes_left >= 0); |
2023 | 2023 |
2024 int old_linear_size = static_cast<int>(owner_->limit() - owner_->top()); | 2024 int old_linear_size = static_cast<int>(owner_->limit() - owner_->top()); |
2025 // Mark the old linear allocation area with a free space map so it can be | 2025 // Mark the old linear allocation area with a free space map so it can be |
2026 // skipped when scanning the heap. This also puts it back in the free list | 2026 // skipped when scanning the heap. This also puts it back in the free list |
2027 // if it is big enough. | 2027 // if it is big enough. |
2028 owner_->Free(owner_->top(), old_linear_size); | 2028 owner_->Free(owner_->top(), old_linear_size); |
2029 | 2029 |
| 2030 #ifdef DEBUG |
| 2031 for (int i = 0; i < size_in_bytes / kPointerSize; i++) { |
| 2032 reinterpret_cast<Object**>(new_node->address())[i] = Smi::FromInt(0); |
| 2033 } |
| 2034 #endif |
| 2035 |
2030 owner_->heap()->incremental_marking()->OldSpaceStep( | 2036 owner_->heap()->incremental_marking()->OldSpaceStep( |
2031 size_in_bytes - old_linear_size); | 2037 size_in_bytes - old_linear_size); |
2032 | 2038 |
2033 #ifdef DEBUG | |
2034 for (int i = 0; i < size_in_bytes / kPointerSize; i++) { | |
2035 reinterpret_cast<Object**>(new_node->address())[i] = | |
2036 Smi::FromInt(kCodeZapValue); | |
2037 } | |
2038 #endif | |
2039 | |
2040 // The old-space-step might have finished sweeping and restarted marking. | 2039 // The old-space-step might have finished sweeping and restarted marking. |
2041 // Verify that it did not turn the page of the new node into an evacuation | 2040 // Verify that it did not turn the page of the new node into an evacuation |
2042 // candidate. | 2041 // candidate. |
2043 ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(new_node)); | 2042 ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(new_node)); |
2044 | 2043 |
2045 const int kThreshold = IncrementalMarking::kAllocatedThreshold; | 2044 const int kThreshold = IncrementalMarking::kAllocatedThreshold; |
2046 | 2045 |
2047 // Memory in the linear allocation area is counted as allocated. We may free | 2046 // Memory in the linear allocation area is counted as allocated. We may free |
2048 // a little of this again immediately - see below. | 2047 // a little of this again immediately - see below. |
2049 owner_->Allocate(new_node_size); | 2048 owner_->Allocate(new_node_size); |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2858 object->ShortPrint(); | 2857 object->ShortPrint(); |
2859 PrintF("\n"); | 2858 PrintF("\n"); |
2860 } | 2859 } |
2861 printf(" --------------------------------------\n"); | 2860 printf(" --------------------------------------\n"); |
2862 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2861 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
2863 } | 2862 } |
2864 | 2863 |
2865 #endif // DEBUG | 2864 #endif // DEBUG |
2866 | 2865 |
2867 } } // namespace v8::internal | 2866 } } // namespace v8::internal |
OLD | NEW |