| 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/v8.h" | 5 #include "src/v8.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/full-codegen.h" | 9 #include "src/full-codegen.h" |
| 10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 Address new_top = old_top + aligned_size; | 1471 Address new_top = old_top + aligned_size; |
| 1472 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); | 1472 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); |
| 1473 heap()->incremental_marking()->Step(bytes_allocated, | 1473 heap()->incremental_marking()->Step(bytes_allocated, |
| 1474 IncrementalMarking::GC_VIA_STACK_GUARD); | 1474 IncrementalMarking::GC_VIA_STACK_GUARD); |
| 1475 UpdateInlineAllocationLimit(aligned_size); | 1475 UpdateInlineAllocationLimit(aligned_size); |
| 1476 top_on_previous_step_ = new_top; | 1476 top_on_previous_step_ = new_top; |
| 1477 if (alignment == kDoubleAligned) | 1477 if (alignment == kDoubleAligned) |
| 1478 return AllocateRawAligned(size_in_bytes, kDoubleAligned); | 1478 return AllocateRawAligned(size_in_bytes, kDoubleAligned); |
| 1479 else if (alignment == kDoubleUnaligned) | 1479 else if (alignment == kDoubleUnaligned) |
| 1480 return AllocateRawAligned(size_in_bytes, kDoubleUnaligned); | 1480 return AllocateRawAligned(size_in_bytes, kDoubleUnaligned); |
| 1481 return AllocateRaw(size_in_bytes); | 1481 return AllocateRawUnaligned(size_in_bytes); |
| 1482 } else if (AddFreshPage()) { | 1482 } else if (AddFreshPage()) { |
| 1483 // Switched to new page. Try allocating again. | 1483 // Switched to new page. Try allocating again. |
| 1484 int bytes_allocated = static_cast<int>(old_top - top_on_previous_step_); | 1484 int bytes_allocated = static_cast<int>(old_top - top_on_previous_step_); |
| 1485 heap()->incremental_marking()->Step(bytes_allocated, | 1485 heap()->incremental_marking()->Step(bytes_allocated, |
| 1486 IncrementalMarking::GC_VIA_STACK_GUARD); | 1486 IncrementalMarking::GC_VIA_STACK_GUARD); |
| 1487 top_on_previous_step_ = to_space_.page_low(); | 1487 top_on_previous_step_ = to_space_.page_low(); |
| 1488 if (alignment == kDoubleAligned) | 1488 if (alignment == kDoubleAligned) |
| 1489 return AllocateRawAligned(size_in_bytes, kDoubleAligned); | 1489 return AllocateRawAligned(size_in_bytes, kDoubleAligned); |
| 1490 else if (alignment == kDoubleUnaligned) | 1490 else if (alignment == kDoubleUnaligned) |
| 1491 return AllocateRawAligned(size_in_bytes, kDoubleUnaligned); | 1491 return AllocateRawAligned(size_in_bytes, kDoubleUnaligned); |
| 1492 return AllocateRaw(size_in_bytes); | 1492 return AllocateRawUnaligned(size_in_bytes); |
| 1493 } else { | 1493 } else { |
| 1494 return AllocationResult::Retry(); | 1494 return AllocationResult::Retry(); |
| 1495 } | 1495 } |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 | 1498 |
| 1499 #ifdef VERIFY_HEAP | 1499 #ifdef VERIFY_HEAP |
| 1500 // We do not use the SemiSpaceIterator because verification doesn't assume | 1500 // We do not use the SemiSpaceIterator because verification doesn't assume |
| 1501 // that it works (it depends on the invariants we are checking). | 1501 // that it works (it depends on the invariants we are checking). |
| 1502 void NewSpace::Verify() { | 1502 void NewSpace::Verify() { |
| (...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3133 object->ShortPrint(); | 3133 object->ShortPrint(); |
| 3134 PrintF("\n"); | 3134 PrintF("\n"); |
| 3135 } | 3135 } |
| 3136 printf(" --------------------------------------\n"); | 3136 printf(" --------------------------------------\n"); |
| 3137 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3137 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3138 } | 3138 } |
| 3139 | 3139 |
| 3140 #endif // DEBUG | 3140 #endif // DEBUG |
| 3141 } | 3141 } |
| 3142 } // namespace v8::internal | 3142 } // namespace v8::internal |
| OLD | NEW |