| 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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 | 1308 |
| 1309 void NewSpace::Flip() { SemiSpace::Swap(&from_space_, &to_space_); } | 1309 void NewSpace::Flip() { SemiSpace::Swap(&from_space_, &to_space_); } |
| 1310 | 1310 |
| 1311 | 1311 |
| 1312 void NewSpace::Grow() { | 1312 void NewSpace::Grow() { |
| 1313 // Double the semispace size but only up to maximum capacity. | 1313 // Double the semispace size but only up to maximum capacity. |
| 1314 DCHECK(TotalCapacity() < MaximumCapacity()); | 1314 DCHECK(TotalCapacity() < MaximumCapacity()); |
| 1315 int new_capacity = | 1315 int new_capacity = |
| 1316 Min(MaximumCapacity(), 2 * static_cast<int>(TotalCapacity())); | 1316 Min(MaximumCapacity(), |
| 1317 FLAG_semi_space_growth_factor * static_cast<int>(TotalCapacity())); |
| 1317 if (to_space_.GrowTo(new_capacity)) { | 1318 if (to_space_.GrowTo(new_capacity)) { |
| 1318 // Only grow from space if we managed to grow to-space. | 1319 // Only grow from space if we managed to grow to-space. |
| 1319 if (!from_space_.GrowTo(new_capacity)) { | 1320 if (!from_space_.GrowTo(new_capacity)) { |
| 1320 // If we managed to grow to-space but couldn't grow from-space, | 1321 // If we managed to grow to-space but couldn't grow from-space, |
| 1321 // attempt to shrink to-space. | 1322 // attempt to shrink to-space. |
| 1322 if (!to_space_.ShrinkTo(from_space_.TotalCapacity())) { | 1323 if (!to_space_.ShrinkTo(from_space_.TotalCapacity())) { |
| 1323 // We are in an inconsistent state because we could not | 1324 // We are in an inconsistent state because we could not |
| 1324 // commit/uncommit memory from new space. | 1325 // commit/uncommit memory from new space. |
| 1325 CHECK(false); | 1326 CHECK(false); |
| 1326 } | 1327 } |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3204 object->ShortPrint(); | 3205 object->ShortPrint(); |
| 3205 PrintF("\n"); | 3206 PrintF("\n"); |
| 3206 } | 3207 } |
| 3207 printf(" --------------------------------------\n"); | 3208 printf(" --------------------------------------\n"); |
| 3208 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3209 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3209 } | 3210 } |
| 3210 | 3211 |
| 3211 #endif // DEBUG | 3212 #endif // DEBUG |
| 3212 } | 3213 } |
| 3213 } // namespace v8::internal | 3214 } // namespace v8::internal |
| OLD | NEW |