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 5047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5058 // size is not big enough to fit all the initial objects. | 5058 // size is not big enough to fit all the initial objects. |
5059 bool Heap::ConfigureHeap(int max_semispace_size, | 5059 bool Heap::ConfigureHeap(int max_semispace_size, |
5060 intptr_t max_old_gen_size, | 5060 intptr_t max_old_gen_size, |
5061 intptr_t max_executable_size) { | 5061 intptr_t max_executable_size) { |
5062 if (HasBeenSetup()) return false; | 5062 if (HasBeenSetup()) return false; |
5063 | 5063 |
5064 if (max_semispace_size > 0) { | 5064 if (max_semispace_size > 0) { |
5065 if (max_semispace_size < Page::kPageSize) { | 5065 if (max_semispace_size < Page::kPageSize) { |
5066 max_semispace_size = Page::kPageSize; | 5066 max_semispace_size = Page::kPageSize; |
5067 if (FLAG_trace_gc) { | 5067 if (FLAG_trace_gc) { |
5068 PrintF("Max semispace size cannot be less than %dkbytes", | 5068 PrintF("Max semispace size cannot be less than %dkbytes\n", |
5069 Page::kPageSize >> 10); | 5069 Page::kPageSize >> 10); |
5070 } | 5070 } |
5071 } | 5071 } |
5072 max_semispace_size_ = max_semispace_size; | 5072 max_semispace_size_ = max_semispace_size; |
5073 } | 5073 } |
5074 | 5074 |
5075 if (Snapshot::IsEnabled()) { | 5075 if (Snapshot::IsEnabled()) { |
5076 // If we are using a snapshot we always reserve the default amount | 5076 // If we are using a snapshot we always reserve the default amount |
5077 // of memory for each semispace because code in the snapshot has | 5077 // of memory for each semispace because code in the snapshot has |
5078 // write-barrier code that relies on the size and alignment of new | 5078 // write-barrier code that relies on the size and alignment of new |
5079 // space. We therefore cannot use a larger max semispace size | 5079 // space. We therefore cannot use a larger max semispace size |
5080 // than the default reserved semispace size. | 5080 // than the default reserved semispace size. |
5081 if (max_semispace_size_ > reserved_semispace_size_) { | 5081 if (max_semispace_size_ > reserved_semispace_size_) { |
5082 max_semispace_size_ = reserved_semispace_size_; | 5082 max_semispace_size_ = reserved_semispace_size_; |
5083 if (FLAG_trace_gc) { | 5083 if (FLAG_trace_gc) { |
5084 PrintF("Max semispace size cannot be more than %dkbytes", | 5084 PrintF("Max semispace size cannot be more than %dkbytes\n", |
5085 reserved_semispace_size_ >> 10); | 5085 reserved_semispace_size_ >> 10); |
5086 } | 5086 } |
5087 } | 5087 } |
5088 } else { | 5088 } else { |
5089 // If we are not using snapshots we reserve space for the actual | 5089 // If we are not using snapshots we reserve space for the actual |
5090 // max semispace size. | 5090 // max semispace size. |
5091 reserved_semispace_size_ = max_semispace_size_; | 5091 reserved_semispace_size_ = max_semispace_size_; |
5092 } | 5092 } |
5093 | 5093 |
5094 if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size; | 5094 if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size; |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6391 isolate_->heap()->store_buffer()->Compact(); | 6391 isolate_->heap()->store_buffer()->Compact(); |
6392 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6392 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6393 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6393 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6394 next = chunk->next_chunk(); | 6394 next = chunk->next_chunk(); |
6395 isolate_->memory_allocator()->Free(chunk); | 6395 isolate_->memory_allocator()->Free(chunk); |
6396 } | 6396 } |
6397 chunks_queued_for_free_ = NULL; | 6397 chunks_queued_for_free_ = NULL; |
6398 } | 6398 } |
6399 | 6399 |
6400 } } // namespace v8::internal | 6400 } } // namespace v8::internal |
OLD | NEW |