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), | |
71 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 70 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
72 // a multiple of Page::kPageSize. | 71 // a multiple of Page::kPageSize. |
73 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 72 #if V8_TARGET_ARCH_X64 |
74 max_semispace_size_(8 * (kPointerSize / 4) * MB), | 73 #define LUMP_OF_MEMORY (2 * 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)), |
75 initial_semispace_size_(Page::kPageSize), | 82 initial_semispace_size_(Page::kPageSize), |
76 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 83 max_old_generation_size_(192*MB), |
77 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 84 max_executable_size_(max_old_generation_size_), |
| 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 |
78 // Variables set based on semispace_size_ and old_generation_size_ in | 93 // Variables set based on semispace_size_ and old_generation_size_ in |
79 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) | 94 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) |
80 // Will be 4 * reserved_semispace_size_ to ensure that young | 95 // Will be 4 * reserved_semispace_size_ to ensure that young |
81 // generation can be aligned to its size. | 96 // generation can be aligned to its size. |
82 survived_since_last_expansion_(0), | 97 survived_since_last_expansion_(0), |
83 sweep_generation_(0), | 98 sweep_generation_(0), |
84 always_allocate_scope_depth_(0), | 99 always_allocate_scope_depth_(0), |
85 linear_allocation_scope_depth_(0), | 100 linear_allocation_scope_depth_(0), |
86 contexts_disposed_(0), | 101 contexts_disposed_(0), |
87 global_ic_age_(0), | 102 global_ic_age_(0), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 configured_(false), | 163 configured_(false), |
149 chunks_queued_for_free_(NULL), | 164 chunks_queued_for_free_(NULL), |
150 relocation_mutex_(NULL) { | 165 relocation_mutex_(NULL) { |
151 // Allow build-time customization of the max semispace size. Building | 166 // Allow build-time customization of the max semispace size. Building |
152 // V8 with snapshots and a non-default max semispace size is much | 167 // V8 with snapshots and a non-default max semispace size is much |
153 // easier if you can define it as part of the build environment. | 168 // easier if you can define it as part of the build environment. |
154 #if defined(V8_MAX_SEMISPACE_SIZE) | 169 #if defined(V8_MAX_SEMISPACE_SIZE) |
155 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; | 170 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; |
156 #endif | 171 #endif |
157 | 172 |
158 // Ensure old_generation_size_ is a multiple of kPageSize. | |
159 ASSERT(MB >= Page::kPageSize); | |
160 | |
161 intptr_t max_virtual = OS::MaxVirtualMemory(); | 173 intptr_t max_virtual = OS::MaxVirtualMemory(); |
162 | 174 |
163 if (max_virtual > 0) { | 175 if (max_virtual > 0) { |
164 if (code_range_size_ > 0) { | 176 if (code_range_size_ > 0) { |
165 // Reserve no more than 1/8 of the memory for the code range. | 177 // Reserve no more than 1/8 of the memory for the code range. |
166 code_range_size_ = Min(code_range_size_, max_virtual >> 3); | 178 code_range_size_ = Min(code_range_size_, max_virtual >> 3); |
167 } | 179 } |
168 } | 180 } |
169 | 181 |
170 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); | 182 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
(...skipping 7694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7865 if (FLAG_concurrent_recompilation) { | 7877 if (FLAG_concurrent_recompilation) { |
7866 heap_->relocation_mutex_->Lock(); | 7878 heap_->relocation_mutex_->Lock(); |
7867 #ifdef DEBUG | 7879 #ifdef DEBUG |
7868 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7880 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
7869 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7881 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
7870 #endif // DEBUG | 7882 #endif // DEBUG |
7871 } | 7883 } |
7872 } | 7884 } |
7873 | 7885 |
7874 } } // namespace v8::internal | 7886 } } // namespace v8::internal |
OLD | NEW |