OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 #include "regexp-macro-assembler.h" | 60 #include "regexp-macro-assembler.h" |
61 #include "mips/regexp-macro-assembler-mips.h" | 61 #include "mips/regexp-macro-assembler-mips.h" |
62 #endif | 62 #endif |
63 | 63 |
64 namespace v8 { | 64 namespace v8 { |
65 namespace internal { | 65 namespace internal { |
66 | 66 |
67 | 67 |
68 Heap::Heap() | 68 Heap::Heap() |
69 : isolate_(NULL), | 69 : isolate_(NULL), |
70 code_range_size_(kIs64BitArch ? 512 * MB : 0), | |
70 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 71 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
71 // a multiple of Page::kPageSize. | 72 // a multiple of Page::kPageSize. |
72 #if V8_TARGET_ARCH_X64 | 73 reserved_semispace_size_((kIs64BitArch ? 16 : 8) * MB), |
danno
2013/09/24 11:52:24
I am not a big fan of the ? here and elsewhere.
H
rmcilroy
2013/09/24 13:00:07
Personally I find this more confusing / error pron
| |
73 #define LUMP_OF_MEMORY (2 * MB) | 74 max_semispace_size_((kIs64BitArch ? 16 : 8) * MB), |
74 code_range_size_(512*MB), | |
75 #else | |
76 #define LUMP_OF_MEMORY MB | |
77 code_range_size_(0), | |
78 #endif | |
79 #if defined(ANDROID) || V8_TARGET_ARCH_MIPS | |
80 reserved_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | |
81 max_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | |
82 initial_semispace_size_(Page::kPageSize), | 75 initial_semispace_size_(Page::kPageSize), |
83 max_old_generation_size_(192*MB), | 76 max_old_generation_size_((kIs64BitArch ? 1400ul : 700ul) * MB), |
84 max_executable_size_(max_old_generation_size_), | 77 max_executable_size_((kIs64BitArch ? 512ul : 256ul) * MB), |
85 #else | |
86 reserved_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | |
87 max_semispace_size_(8 * Max(LUMP_OF_MEMORY, Page::kPageSize)), | |
88 initial_semispace_size_(Page::kPageSize), | |
89 max_old_generation_size_(700ul * LUMP_OF_MEMORY), | |
90 max_executable_size_(256l * LUMP_OF_MEMORY), | |
91 #endif | |
92 | |
93 // Variables set based on semispace_size_ and old_generation_size_ in | 78 // Variables set based on semispace_size_ and old_generation_size_ in |
94 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) | 79 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) |
95 // Will be 4 * reserved_semispace_size_ to ensure that young | 80 // Will be 4 * reserved_semispace_size_ to ensure that young |
96 // generation can be aligned to its size. | 81 // generation can be aligned to its size. |
97 survived_since_last_expansion_(0), | 82 survived_since_last_expansion_(0), |
98 sweep_generation_(0), | 83 sweep_generation_(0), |
99 always_allocate_scope_depth_(0), | 84 always_allocate_scope_depth_(0), |
100 linear_allocation_scope_depth_(0), | 85 linear_allocation_scope_depth_(0), |
101 contexts_disposed_(0), | 86 contexts_disposed_(0), |
102 global_ic_age_(0), | 87 global_ic_age_(0), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 configured_(false), | 148 configured_(false), |
164 chunks_queued_for_free_(NULL), | 149 chunks_queued_for_free_(NULL), |
165 relocation_mutex_(NULL) { | 150 relocation_mutex_(NULL) { |
166 // Allow build-time customization of the max semispace size. Building | 151 // Allow build-time customization of the max semispace size. Building |
167 // V8 with snapshots and a non-default max semispace size is much | 152 // V8 with snapshots and a non-default max semispace size is much |
168 // easier if you can define it as part of the build environment. | 153 // easier if you can define it as part of the build environment. |
169 #if defined(V8_MAX_SEMISPACE_SIZE) | 154 #if defined(V8_MAX_SEMISPACE_SIZE) |
170 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; | 155 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; |
171 #endif | 156 #endif |
172 | 157 |
158 // Ensure old_generation_size_ is a multiple of kPageSize. | |
159 ASSERT(MB >= Page::kPageSize); | |
160 | |
173 intptr_t max_virtual = OS::MaxVirtualMemory(); | 161 intptr_t max_virtual = OS::MaxVirtualMemory(); |
174 | 162 |
175 if (max_virtual > 0) { | 163 if (max_virtual > 0) { |
176 if (code_range_size_ > 0) { | 164 if (code_range_size_ > 0) { |
177 // Reserve no more than 1/8 of the memory for the code range. | 165 // Reserve no more than 1/8 of the memory for the code range. |
178 code_range_size_ = Min(code_range_size_, max_virtual >> 3); | 166 code_range_size_ = Min(code_range_size_, max_virtual >> 3); |
179 } | 167 } |
180 } | 168 } |
181 | 169 |
182 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); | 170 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
(...skipping 7902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8085 if (FLAG_concurrent_recompilation) { | 8073 if (FLAG_concurrent_recompilation) { |
8086 heap_->relocation_mutex_->Lock(); | 8074 heap_->relocation_mutex_->Lock(); |
8087 #ifdef DEBUG | 8075 #ifdef DEBUG |
8088 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8076 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
8089 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8077 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
8090 #endif // DEBUG | 8078 #endif // DEBUG |
8091 } | 8079 } |
8092 } | 8080 } |
8093 | 8081 |
8094 } } // namespace v8::internal | 8082 } } // namespace v8::internal |
OLD | NEW |