| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
| 9 #include "src/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 const int kThreshold = IncrementalMarking::kAllocatedThreshold; | 2464 const int kThreshold = IncrementalMarking::kAllocatedThreshold; |
| 2465 | 2465 |
| 2466 // Memory in the linear allocation area is counted as allocated. We may free | 2466 // Memory in the linear allocation area is counted as allocated. We may free |
| 2467 // a little of this again immediately - see below. | 2467 // a little of this again immediately - see below. |
| 2468 owner_->Allocate(new_node_size); | 2468 owner_->Allocate(new_node_size); |
| 2469 | 2469 |
| 2470 if (owner_->heap()->inline_allocation_disabled()) { | 2470 if (owner_->heap()->inline_allocation_disabled()) { |
| 2471 // Keep the linear allocation area empty if requested to do so, just | 2471 // Keep the linear allocation area empty if requested to do so, just |
| 2472 // return area back to the free list instead. | 2472 // return area back to the free list instead. |
| 2473 owner_->Free(new_node->address() + size_in_bytes, bytes_left); | 2473 owner_->Free(new_node->address() + size_in_bytes, bytes_left); |
| 2474 DCHECK(owner_->top() == NULL && owner_->limit() == NULL); | 2474 owner_->SetTopAndLimit(new_node->address() + size_in_bytes, |
| 2475 new_node->address() + size_in_bytes); |
| 2475 } else if (bytes_left > kThreshold && | 2476 } else if (bytes_left > kThreshold && |
| 2476 owner_->heap()->incremental_marking()->IsMarkingIncomplete() && | 2477 owner_->heap()->incremental_marking()->IsMarkingIncomplete() && |
| 2477 FLAG_incremental_marking) { | 2478 FLAG_incremental_marking) { |
| 2478 int linear_size = owner_->RoundSizeDownToObjectAlignment(kThreshold); | 2479 int linear_size = owner_->RoundSizeDownToObjectAlignment(kThreshold); |
| 2479 // We don't want to give too large linear areas to the allocator while | 2480 // We don't want to give too large linear areas to the allocator while |
| 2480 // incremental marking is going on, because we won't check again whether | 2481 // incremental marking is going on, because we won't check again whether |
| 2481 // we want to do another increment until the linear area is used up. | 2482 // we want to do another increment until the linear area is used up. |
| 2482 owner_->Free(new_node->address() + size_in_bytes + linear_size, | 2483 owner_->Free(new_node->address() + size_in_bytes + linear_size, |
| 2483 new_node_size - size_in_bytes - linear_size); | 2484 new_node_size - size_in_bytes - linear_size); |
| 2484 owner_->SetTopAndLimit(new_node->address() + size_in_bytes, | 2485 owner_->SetTopAndLimit(new_node->address() + size_in_bytes, |
| 2485 new_node->address() + size_in_bytes + linear_size); | 2486 new_node->address() + size_in_bytes + linear_size); |
| 2486 } else if (bytes_left > 0) { | 2487 } else if (bytes_left >= 0) { |
| 2487 // Normally we give the rest of the node to the allocator as its new | 2488 // Normally we give the rest of the node to the allocator as its new |
| 2488 // linear allocation area. | 2489 // linear allocation area. |
| 2489 owner_->SetTopAndLimit(new_node->address() + size_in_bytes, | 2490 owner_->SetTopAndLimit(new_node->address() + size_in_bytes, |
| 2490 new_node->address() + new_node_size); | 2491 new_node->address() + new_node_size); |
| 2491 } | 2492 } |
| 2492 | 2493 |
| 2493 owner_->AllocationStep(new_node->address(), size_in_bytes); | 2494 owner_->AllocationStep(new_node->address(), size_in_bytes); |
| 2494 | 2495 |
| 2495 return new_node; | 2496 return new_node; |
| 2496 } | 2497 } |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3222 object->ShortPrint(); | 3223 object->ShortPrint(); |
| 3223 PrintF("\n"); | 3224 PrintF("\n"); |
| 3224 } | 3225 } |
| 3225 printf(" --------------------------------------\n"); | 3226 printf(" --------------------------------------\n"); |
| 3226 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3227 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3227 } | 3228 } |
| 3228 | 3229 |
| 3229 #endif // DEBUG | 3230 #endif // DEBUG |
| 3230 } // namespace internal | 3231 } // namespace internal |
| 3231 } // namespace v8 | 3232 } // namespace v8 |
| OLD | NEW |