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_(8 * (kPointerSize / 4) * MB), |
73 #define LUMP_OF_MEMORY (2 * MB) | 74 max_semispace_size_(8 * (kPointerSize / 4) * 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_(700ul * (kPointerSize / 4) * MB), |
84 max_executable_size_(max_old_generation_size_), | 77 max_executable_size_(256ul * (kPointerSize / 4) * 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 7694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7877 if (FLAG_concurrent_recompilation) { | 7865 if (FLAG_concurrent_recompilation) { |
7878 heap_->relocation_mutex_->Lock(); | 7866 heap_->relocation_mutex_->Lock(); |
7879 #ifdef DEBUG | 7867 #ifdef DEBUG |
7880 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7868 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
7881 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7869 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
7882 #endif // DEBUG | 7870 #endif // DEBUG |
7883 } | 7871 } |
7884 } | 7872 } |
7885 | 7873 |
7886 } } // namespace v8::internal | 7874 } } // namespace v8::internal |
OLD | NEW |