OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "src/regexp-macro-assembler.h" | 38 #include "src/regexp-macro-assembler.h" |
39 #include "src/mips/regexp-macro-assembler-mips.h" | 39 #include "src/mips/regexp-macro-assembler-mips.h" |
40 #endif | 40 #endif |
41 | 41 |
42 namespace v8 { | 42 namespace v8 { |
43 namespace internal { | 43 namespace internal { |
44 | 44 |
45 | 45 |
46 Heap::Heap() | 46 Heap::Heap() |
47 : isolate_(NULL), | 47 : isolate_(NULL), |
| 48 amount_of_external_allocated_memory_(0), |
| 49 amount_of_external_allocated_memory_at_last_global_gc_(0), |
48 code_range_size_(0), | 50 code_range_size_(0), |
49 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 51 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
50 // a multiple of Page::kPageSize. | 52 // a multiple of Page::kPageSize. |
51 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 53 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), |
52 max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 54 max_semi_space_size_(8 * (kPointerSize / 4) * MB), |
53 initial_semispace_size_(Page::kPageSize), | 55 initial_semispace_size_(Page::kPageSize), |
54 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 56 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
55 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 57 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
56 // Variables set based on semispace_size_ and old_generation_size_ in | 58 // Variables set based on semispace_size_ and old_generation_size_ in |
57 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) | 59 // ConfigureHeap. |
58 // Will be 4 * reserved_semispace_size_ to ensure that young | 60 // Will be 4 * reserved_semispace_size_ to ensure that young |
59 // generation can be aligned to its size. | 61 // generation can be aligned to its size. |
60 maximum_committed_(0), | 62 maximum_committed_(0), |
61 old_space_growing_factor_(4), | 63 old_space_growing_factor_(4), |
62 survived_since_last_expansion_(0), | 64 survived_since_last_expansion_(0), |
63 sweep_generation_(0), | 65 sweep_generation_(0), |
64 always_allocate_scope_depth_(0), | 66 always_allocate_scope_depth_(0), |
65 linear_allocation_scope_depth_(0), | 67 linear_allocation_scope_depth_(0), |
66 contexts_disposed_(0), | 68 contexts_disposed_(0), |
67 global_ic_age_(0), | 69 global_ic_age_(0), |
(...skipping 11 matching lines...) Expand all Loading... |
79 gc_post_processing_depth_(0), | 81 gc_post_processing_depth_(0), |
80 ms_count_(0), | 82 ms_count_(0), |
81 gc_count_(0), | 83 gc_count_(0), |
82 remembered_unmapped_pages_index_(0), | 84 remembered_unmapped_pages_index_(0), |
83 unflattened_strings_length_(0), | 85 unflattened_strings_length_(0), |
84 #ifdef DEBUG | 86 #ifdef DEBUG |
85 allocation_timeout_(0), | 87 allocation_timeout_(0), |
86 #endif // DEBUG | 88 #endif // DEBUG |
87 old_generation_allocation_limit_(kMinimumOldGenerationAllocationLimit), | 89 old_generation_allocation_limit_(kMinimumOldGenerationAllocationLimit), |
88 size_of_old_gen_at_last_old_space_gc_(0), | 90 size_of_old_gen_at_last_old_space_gc_(0), |
89 external_allocation_limit_(0), | |
90 amount_of_external_allocated_memory_(0), | |
91 amount_of_external_allocated_memory_at_last_global_gc_(0), | |
92 old_gen_exhausted_(false), | 91 old_gen_exhausted_(false), |
93 inline_allocation_disabled_(false), | 92 inline_allocation_disabled_(false), |
94 store_buffer_rebuilder_(store_buffer()), | 93 store_buffer_rebuilder_(store_buffer()), |
95 hidden_string_(NULL), | 94 hidden_string_(NULL), |
96 gc_safe_size_of_old_object_(NULL), | 95 gc_safe_size_of_old_object_(NULL), |
97 total_regexp_code_generated_(0), | 96 total_regexp_code_generated_(0), |
98 tracer_(NULL), | 97 tracer_(NULL), |
99 high_survival_rate_period_length_(0), | 98 high_survival_rate_period_length_(0), |
100 promoted_objects_size_(0), | 99 promoted_objects_size_(0), |
101 promotion_rate_(0), | 100 promotion_rate_(0), |
(...skipping 4901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5003 PrintPID("Min semi-space size cannot be more than the maximum" | 5002 PrintPID("Min semi-space size cannot be more than the maximum" |
5004 "semi-space size of %d MB\n", max_semi_space_size_); | 5003 "semi-space size of %d MB\n", max_semi_space_size_); |
5005 } | 5004 } |
5006 } else { | 5005 } else { |
5007 initial_semispace_size_ = initial_semispace_size; | 5006 initial_semispace_size_ = initial_semispace_size; |
5008 } | 5007 } |
5009 } | 5008 } |
5010 | 5009 |
5011 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_); | 5010 initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_); |
5012 | 5011 |
5013 // The external allocation limit should be below 256 MB on all architectures | |
5014 // to avoid that resource-constrained embedders run low on memory. | |
5015 external_allocation_limit_ = 192 * MB; | |
5016 ASSERT(external_allocation_limit_ <= 256 * MB); | |
5017 | |
5018 // The old generation is paged and needs at least one page for each space. | 5012 // The old generation is paged and needs at least one page for each space. |
5019 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; | 5013 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; |
5020 max_old_generation_size_ = | 5014 max_old_generation_size_ = |
5021 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), | 5015 Max(static_cast<intptr_t>(paged_space_count * Page::kPageSize), |
5022 max_old_generation_size_); | 5016 max_old_generation_size_); |
5023 | 5017 |
5024 // We rely on being able to allocate new arrays in paged spaces. | 5018 // We rely on being able to allocate new arrays in paged spaces. |
5025 ASSERT(Page::kMaxRegularHeapObjectSize >= | 5019 ASSERT(Page::kMaxRegularHeapObjectSize >= |
5026 (JSArray::kSize + | 5020 (JSArray::kSize + |
5027 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + | 5021 FixedArray::SizeFor(JSObject::kInitialMaxFastElementArray) + |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6436 static_cast<int>(object_sizes_last_time_[index])); | 6430 static_cast<int>(object_sizes_last_time_[index])); |
6437 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6431 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6438 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6432 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6439 | 6433 |
6440 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6434 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6441 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6435 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6442 ClearObjectStats(); | 6436 ClearObjectStats(); |
6443 } | 6437 } |
6444 | 6438 |
6445 } } // namespace v8::internal | 6439 } } // namespace v8::internal |
OLD | NEW |