Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: src/heap.cc

Issue 2827008: [Isolates] Make instance variables of Heap non-static. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Since we're converting Heap over in stages, this file is in a strange state 49 // Since we're converting Heap over in stages, this file is in a strange state
50 // with regard to static/nonstatic methods. THIS refers to this in a 50 // with regard to static/nonstatic methods. THIS refers to this in a
51 // method that will eventually become non-static. HEAP should be used in 51 // method that will eventually become non-static. HEAP should be used in
52 // methods that will remain static. 52 // methods that will remain static.
53 #define THIS HEAP 53 #define THIS HEAP
54 54
55 namespace v8 { 55 namespace v8 {
56 namespace internal { 56 namespace internal {
57 57
58 58
59 String* Heap::hidden_symbol_;
60 Object* Heap::roots_[Heap::kRootListLength];
61
62
63 NewSpace Heap::new_space_;
64 OldSpace* Heap::old_pointer_space_ = NULL;
65 OldSpace* Heap::old_data_space_ = NULL;
66 OldSpace* Heap::code_space_ = NULL;
67 MapSpace* Heap::map_space_ = NULL;
68 CellSpace* Heap::cell_space_ = NULL;
69 LargeObjectSpace* Heap::lo_space_ = NULL;
70
71 static const int kMinimumPromotionLimit = 2*MB; 59 static const int kMinimumPromotionLimit = 2*MB;
72 static const int kMinimumAllocationLimit = 8*MB; 60 static const int kMinimumAllocationLimit = 8*MB;
73 61
74 int Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit;
75 int Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit;
76
77 int Heap::old_gen_exhausted_ = false;
78
79 int Heap::amount_of_external_allocated_memory_ = 0;
80 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0;
81
82 // semispace_size_ should be a power of 2 and old_generation_size_ should be
83 // a multiple of Page::kPageSize.
84 #if defined(ANDROID)
85 int Heap::max_semispace_size_ = 2*MB;
86 int Heap::max_old_generation_size_ = 192*MB;
87 int Heap::initial_semispace_size_ = 128*KB;
88 size_t Heap::code_range_size_ = 0;
89 #elif defined(V8_TARGET_ARCH_X64)
90 int Heap::max_semispace_size_ = 16*MB;
91 int Heap::max_old_generation_size_ = 1*GB;
92 int Heap::initial_semispace_size_ = 1*MB;
93 size_t Heap::code_range_size_ = 512*MB;
94 #else
95 int Heap::max_semispace_size_ = 8*MB;
96 int Heap::max_old_generation_size_ = 512*MB;
97 int Heap::initial_semispace_size_ = 512*KB;
98 size_t Heap::code_range_size_ = 0;
99 #endif
100
101 // The snapshot semispace size will be the default semispace size if
102 // snapshotting is used and will be the requested semispace size as
103 // set up by ConfigureHeap otherwise.
104 int Heap::reserved_semispace_size_ = Heap::max_semispace_size_;
105
106 List<Heap::GCPrologueCallbackPair> Heap::gc_prologue_callbacks_;
107 List<Heap::GCEpilogueCallbackPair> Heap::gc_epilogue_callbacks_;
108
109 GCCallback Heap::global_gc_prologue_callback_ = NULL;
110 GCCallback Heap::global_gc_epilogue_callback_ = NULL;
111
112 // Variables set based on semispace_size_ and old_generation_size_ in
113 // ConfigureHeap.
114
115 // Will be 4 * reserved_semispace_size_ to ensure that young
116 // generation can be aligned to its size.
117 int Heap::survived_since_last_expansion_ = 0;
118 int Heap::external_allocation_limit_ = 0;
119
120 Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
121
122 int Heap::mc_count_ = 0;
123 int Heap::ms_count_ = 0;
124 int Heap::gc_count_ = 0;
125
126 GCTracer* Heap::tracer_ = NULL;
127
128 int Heap::unflattened_strings_length_ = 0;
129
130 int Heap::always_allocate_scope_depth_ = 0;
131 int Heap::linear_allocation_scope_depth_ = 0;
132 int Heap::contexts_disposed_ = 0;
133
134 #ifdef DEBUG
135 bool Heap::allocation_allowed_ = true;
136
137 int Heap::allocation_timeout_ = 0;
138 bool Heap::disallow_allocation_failure_ = false;
139 #endif // DEBUG
140 62
141 int GCTracer::alive_after_last_gc_ = 0; 63 int GCTracer::alive_after_last_gc_ = 0;
142 double GCTracer::last_gc_end_timestamp_ = 0.0; 64 double GCTracer::last_gc_end_timestamp_ = 0.0;
143 int GCTracer::max_gc_pause_ = 0; 65 int GCTracer::max_gc_pause_ = 0;
144 int GCTracer::max_alive_after_gc_ = 0; 66 int GCTracer::max_alive_after_gc_ = 0;
145 int GCTracer::min_in_mutator_ = kMaxInt; 67 int GCTracer::min_in_mutator_ = kMaxInt;
146 68
147 Heap::Heap() : isolate_(NULL) { 69 Heap::Heap()
148 // TODO(zarko): members that previously relied on static initialization 70 : isolate_(NULL),
149 // should be initialized here. 71 // semispace_size_ should be a power of 2 and old_generation_size_ should be
72 // a multiple of Page::kPageSize.
73 #if defined(ANDROID)
74 reserved_semispace_size_(2*MB),
75 max_semispace_size_(2*MB),
76 initial_semispace_size_(128*KB),
77 max_old_generation_size_(192*MB),
78 code_range_size_(0),
79 #elif defined(V8_TARGET_ARCH_X64)
80 reserved_semispace_size_(16*MB),
81 max_semispace_size_(16*MB),
82 initial_semispace_size_(1*MB),
83 max_old_generation_size_(1*GB),
84 code_range_size_(512*MB),
85 #else
86 reserved_semispace_size_(8*MB),
87 max_semispace_size_(8*MB),
88 initial_semispace_size_(512*KB),
89 max_old_generation_size_(512*MB),
90 code_range_size_(0),
91 #endif
92 // Variables set based on semispace_size_ and old_generation_size_ in
93 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_)
94 // Will be 4 * reserved_semispace_size_ to ensure that young
95 // generation can be aligned to its size.
96 survived_since_last_expansion_(0),
97 always_allocate_scope_depth_(0),
98 linear_allocation_scope_depth_(0),
99 contexts_disposed_(0),
100 old_pointer_space_(NULL),
101 old_data_space_(NULL),
102 code_space_(NULL),
103 map_space_(NULL),
104 cell_space_(NULL),
105 lo_space_(NULL),
106 gc_state_(NOT_IN_GC),
107 mc_count_(0),
108 ms_count_(0),
109 gc_count_(0),
110 unflattened_strings_length_(0),
111 #ifdef DEBUG
112 allocation_allowed_(true),
113 allocation_timeout_(0),
114 disallow_allocation_failure_(false),
115 #endif // DEBUG
116 old_gen_promotion_limit_(kMinimumPromotionLimit),
117 old_gen_allocation_limit_(kMinimumAllocationLimit),
118 external_allocation_limit_(0),
119 amount_of_external_allocated_memory_(0),
120 amount_of_external_allocated_memory_at_last_global_gc_(0),
121 old_gen_exhausted_(false),
122 hidden_symbol_(NULL),
123 global_gc_prologue_callback_(NULL),
124 global_gc_epilogue_callback_(NULL),
125 tracer_(NULL) {
126 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
150 } 127 }
151 128
152 129
153 int Heap::Capacity() { 130 int Heap::Capacity() {
154 if (!HasBeenSetup()) return 0; 131 if (!HasBeenSetup()) return 0;
155 132
156 return new_space_.Capacity() + 133 return new_space_.Capacity() +
157 old_pointer_space_->Capacity() + 134 old_pointer_space_->Capacity() +
158 old_data_space_->Capacity() + 135 old_data_space_->Capacity() +
159 code_space_->Capacity() + 136 code_space_->Capacity() +
(...skipping 4596 matching lines...) Expand 10 before | Expand all | Expand 10 after
4756 void ExternalStringTable::TearDown() { 4733 void ExternalStringTable::TearDown() {
4757 new_space_strings_.Free(); 4734 new_space_strings_.Free();
4758 old_space_strings_.Free(); 4735 old_space_strings_.Free();
4759 } 4736 }
4760 4737
4761 4738
4762 List<Object*> ExternalStringTable::new_space_strings_; 4739 List<Object*> ExternalStringTable::new_space_strings_;
4763 List<Object*> ExternalStringTable::old_space_strings_; 4740 List<Object*> ExternalStringTable::old_space_strings_;
4764 4741
4765 } } // namespace v8::internal 4742 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698