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

Side by Side Diff: src/heap/heap.cc

Issue 1105693002: Implement IdentityMap<V>, a robust, GC-safe object-identity HashMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 full_codegen_bytes_generated_(0), 134 full_codegen_bytes_generated_(0),
135 crankshaft_codegen_bytes_generated_(0), 135 crankshaft_codegen_bytes_generated_(0),
136 gcs_since_last_deopt_(0), 136 gcs_since_last_deopt_(0),
137 allocation_sites_scratchpad_length_(0), 137 allocation_sites_scratchpad_length_(0),
138 promotion_queue_(this), 138 promotion_queue_(this),
139 configured_(false), 139 configured_(false),
140 external_string_table_(this), 140 external_string_table_(this),
141 chunks_queued_for_free_(NULL), 141 chunks_queued_for_free_(NULL),
142 gc_callbacks_depth_(0), 142 gc_callbacks_depth_(0),
143 deserialization_complete_(false), 143 deserialization_complete_(false),
144 concurrent_sweeping_enabled_(false) { 144 concurrent_sweeping_enabled_(false),
145 strong_roots_list_(NULL) {
145 // Allow build-time customization of the max semispace size. Building 146 // Allow build-time customization of the max semispace size. Building
146 // V8 with snapshots and a non-default max semispace size is much 147 // V8 with snapshots and a non-default max semispace size is much
147 // easier if you can define it as part of the build environment. 148 // easier if you can define it as part of the build environment.
148 #if defined(V8_MAX_SEMISPACE_SIZE) 149 #if defined(V8_MAX_SEMISPACE_SIZE)
149 max_semi_space_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; 150 max_semi_space_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
150 #endif 151 #endif
151 152
152 // Ensure old_generation_size_ is a multiple of kPageSize. 153 // Ensure old_generation_size_ is a multiple of kPageSize.
153 DCHECK(MB >= Page::kPageSize); 154 DCHECK(MB >= Page::kPageSize);
154 155
(...skipping 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after
5023 // During deserialization of the startup snapshot this creates the partial 5024 // During deserialization of the startup snapshot this creates the partial
5024 // snapshot cache and deserializes the objects it refers to. During 5025 // snapshot cache and deserializes the objects it refers to. During
5025 // serialization this does nothing, since the partial snapshot cache is 5026 // serialization this does nothing, since the partial snapshot cache is
5026 // empty. However the next thing we do is create the partial snapshot, 5027 // empty. However the next thing we do is create the partial snapshot,
5027 // filling up the partial snapshot cache with objects it needs as we go. 5028 // filling up the partial snapshot cache with objects it needs as we go.
5028 SerializerDeserializer::Iterate(isolate_, v); 5029 SerializerDeserializer::Iterate(isolate_, v);
5029 // We don't do a v->Synchronize call here, because in debug mode that will 5030 // We don't do a v->Synchronize call here, because in debug mode that will
5030 // output a flag to the snapshot. However at this point the serializer and 5031 // output a flag to the snapshot. However at this point the serializer and
5031 // deserializer are deliberately a little unsynchronized (see above) so the 5032 // deserializer are deliberately a little unsynchronized (see above) so the
5032 // checking of the sync flag in the snapshot would fail. 5033 // checking of the sync flag in the snapshot would fail.
5034 for (StrongRootsList* list = strong_roots_list_; list; list = list->next_) {
Erik Corry 2015/04/28 15:27:31 We don't need a lock here?
5035 v->VisitPointers(list->start_, list->end_);
5036 }
5033 } 5037 }
5034 5038
5035 5039
5036 // TODO(1236194): Since the heap size is configurable on the command line 5040 // TODO(1236194): Since the heap size is configurable on the command line
5037 // and through the API, we should gracefully handle the case that the heap 5041 // and through the API, we should gracefully handle the case that the heap
5038 // size is not big enough to fit all the initial objects. 5042 // size is not big enough to fit all the initial objects.
5039 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, 5043 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
5040 int max_executable_size, size_t code_range_size) { 5044 int max_executable_size, size_t code_range_size) {
5041 if (HasBeenSetUp()) return false; 5045 if (HasBeenSetUp()) return false;
5042 5046
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
5513 5517
5514 if (lo_space_ != NULL) { 5518 if (lo_space_ != NULL) {
5515 lo_space_->TearDown(); 5519 lo_space_->TearDown();
5516 delete lo_space_; 5520 delete lo_space_;
5517 lo_space_ = NULL; 5521 lo_space_ = NULL;
5518 } 5522 }
5519 5523
5520 store_buffer()->TearDown(); 5524 store_buffer()->TearDown();
5521 5525
5522 isolate_->memory_allocator()->TearDown(); 5526 isolate_->memory_allocator()->TearDown();
5527
5528 StrongRootsList* next = NULL;
5529 for (StrongRootsList* list = strong_roots_list_; list; list = next) {
5530 next = list->next_;
5531 delete list;
5532 }
5533 strong_roots_list_ = NULL;
5523 } 5534 }
5524 5535
5525 5536
5526 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, 5537 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback,
5527 GCType gc_type, bool pass_isolate) { 5538 GCType gc_type, bool pass_isolate) {
5528 DCHECK(callback != NULL); 5539 DCHECK(callback != NULL);
5529 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate); 5540 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate);
5530 DCHECK(!gc_prologue_callbacks_.Contains(pair)); 5541 DCHECK(!gc_prologue_callbacks_.Contains(pair));
5531 return gc_prologue_callbacks_.Add(pair); 5542 return gc_prologue_callbacks_.Add(pair);
5532 } 5543 }
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6412 static_cast<int>(object_sizes_last_time_[index])); 6423 static_cast<int>(object_sizes_last_time_[index]));
6413 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6424 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6414 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6425 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6415 6426
6416 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6427 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6417 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6428 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6418 ClearObjectStats(); 6429 ClearObjectStats();
6419 } 6430 }
6420 } 6431 }
6421 } // namespace v8::internal 6432 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698