| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 if (!MemoryAllocator::Setup(MaxCapacity())) return false; | 2454 if (!MemoryAllocator::Setup(MaxCapacity())) return false; |
| 2455 void* chunk | 2455 void* chunk |
| 2456 = MemoryAllocator::ReserveInitialChunk(2 * young_generation_size_); | 2456 = MemoryAllocator::ReserveInitialChunk(2 * young_generation_size_); |
| 2457 if (chunk == NULL) return false; | 2457 if (chunk == NULL) return false; |
| 2458 | 2458 |
| 2459 // Put the initial chunk of the old space at the start of the initial | 2459 // Put the initial chunk of the old space at the start of the initial |
| 2460 // chunk, then the two new space semispaces, then the initial chunk of | 2460 // chunk, then the two new space semispaces, then the initial chunk of |
| 2461 // code space. Align the pair of semispaces to their size, which must be | 2461 // code space. Align the pair of semispaces to their size, which must be |
| 2462 // a power of 2. | 2462 // a power of 2. |
| 2463 ASSERT(IsPowerOf2(young_generation_size_)); | 2463 ASSERT(IsPowerOf2(young_generation_size_)); |
| 2464 Address old_space_start = reinterpret_cast<Address>(chunk); | 2464 Address code_space_start = reinterpret_cast<Address>(chunk); |
| 2465 Address new_space_start = RoundUp(old_space_start, young_generation_size_); | 2465 Address new_space_start = RoundUp(code_space_start, young_generation_size_); |
| 2466 Address code_space_start = new_space_start + young_generation_size_; | 2466 Address old_space_start = new_space_start + young_generation_size_; |
| 2467 int old_space_size = new_space_start - old_space_start; | 2467 int code_space_size = new_space_start - code_space_start; |
| 2468 int code_space_size = young_generation_size_ - old_space_size; | 2468 int old_space_size = young_generation_size_ - code_space_size; |
| 2469 | 2469 |
| 2470 // Initialize new space. | 2470 // Initialize new space. |
| 2471 new_space_ = new NewSpace(initial_semispace_size_, | 2471 new_space_ = new NewSpace(initial_semispace_size_, |
| 2472 semispace_size_, | 2472 semispace_size_, |
| 2473 NEW_SPACE); | 2473 NEW_SPACE); |
| 2474 if (new_space_ == NULL) return false; | 2474 if (new_space_ == NULL) return false; |
| 2475 if (!new_space_->Setup(new_space_start, young_generation_size_)) return false; | 2475 if (!new_space_->Setup(new_space_start, young_generation_size_)) return false; |
| 2476 | 2476 |
| 2477 // Initialize old space, set the maximum capacity to the old generation | 2477 // Initialize old space, set the maximum capacity to the old generation |
| 2478 // size. It will not contain code. | 2478 // size. It will not contain code. |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3035 return "Scavenge"; | 3035 return "Scavenge"; |
| 3036 case MARK_COMPACTOR: | 3036 case MARK_COMPACTOR: |
| 3037 return MarkCompactCollector::HasCompacted() ? "Mark-compact" | 3037 return MarkCompactCollector::HasCompacted() ? "Mark-compact" |
| 3038 : "Mark-sweep"; | 3038 : "Mark-sweep"; |
| 3039 } | 3039 } |
| 3040 return "Unknown GC"; | 3040 return "Unknown GC"; |
| 3041 } | 3041 } |
| 3042 | 3042 |
| 3043 | 3043 |
| 3044 } } // namespace v8::internal | 3044 } } // namespace v8::internal |
| OLD | NEW |