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

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, 8 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 4836 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 // During deserialization of the startup snapshot this creates the partial 4992 // During deserialization of the startup snapshot this creates the partial
4992 // snapshot cache and deserializes the objects it refers to. During 4993 // snapshot cache and deserializes the objects it refers to. During
4993 // serialization this does nothing, since the partial snapshot cache is 4994 // serialization this does nothing, since the partial snapshot cache is
4994 // empty. However the next thing we do is create the partial snapshot, 4995 // empty. However the next thing we do is create the partial snapshot,
4995 // filling up the partial snapshot cache with objects it needs as we go. 4996 // filling up the partial snapshot cache with objects it needs as we go.
4996 SerializerDeserializer::Iterate(isolate_, v); 4997 SerializerDeserializer::Iterate(isolate_, v);
4997 // We don't do a v->Synchronize call here, because in debug mode that will 4998 // We don't do a v->Synchronize call here, because in debug mode that will
4998 // output a flag to the snapshot. However at this point the serializer and 4999 // output a flag to the snapshot. However at this point the serializer and
4999 // deserializer are deliberately a little unsynchronized (see above) so the 5000 // deserializer are deliberately a little unsynchronized (see above) so the
5000 // checking of the sync flag in the snapshot would fail. 5001 // checking of the sync flag in the snapshot would fail.
5002 for (StrongRootsList* list = strong_roots_list_; list; list = list->next_) {
5003 v->VisitPointers(list->start_, list->end_);
5004 }
5001 } 5005 }
5002 5006
5003 5007
5004 // TODO(1236194): Since the heap size is configurable on the command line 5008 // TODO(1236194): Since the heap size is configurable on the command line
5005 // and through the API, we should gracefully handle the case that the heap 5009 // and through the API, we should gracefully handle the case that the heap
5006 // size is not big enough to fit all the initial objects. 5010 // size is not big enough to fit all the initial objects.
5007 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, 5011 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
5008 int max_executable_size, size_t code_range_size) { 5012 int max_executable_size, size_t code_range_size) {
5009 if (HasBeenSetUp()) return false; 5013 if (HasBeenSetUp()) return false;
5010 5014
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
5481 5485
5482 if (lo_space_ != NULL) { 5486 if (lo_space_ != NULL) {
5483 lo_space_->TearDown(); 5487 lo_space_->TearDown();
5484 delete lo_space_; 5488 delete lo_space_;
5485 lo_space_ = NULL; 5489 lo_space_ = NULL;
5486 } 5490 }
5487 5491
5488 store_buffer()->TearDown(); 5492 store_buffer()->TearDown();
5489 5493
5490 isolate_->memory_allocator()->TearDown(); 5494 isolate_->memory_allocator()->TearDown();
5495
5496 StrongRootsList* next = NULL;
5497 for (StrongRootsList* list = strong_roots_list_; list; list = next) {
5498 next = list->next_;
5499 delete list;
5500 }
5501 strong_roots_list_ = NULL;
5491 } 5502 }
5492 5503
5493 5504
5494 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, 5505 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback,
5495 GCType gc_type, bool pass_isolate) { 5506 GCType gc_type, bool pass_isolate) {
5496 DCHECK(callback != NULL); 5507 DCHECK(callback != NULL);
5497 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate); 5508 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate);
5498 DCHECK(!gc_prologue_callbacks_.Contains(pair)); 5509 DCHECK(!gc_prologue_callbacks_.Contains(pair));
5499 return gc_prologue_callbacks_.Add(pair); 5510 return gc_prologue_callbacks_.Add(pair);
5500 } 5511 }
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6380 static_cast<int>(object_sizes_last_time_[index])); 6391 static_cast<int>(object_sizes_last_time_[index]));
6381 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6392 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6382 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6393 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6383 6394
6384 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6395 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6385 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6396 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6386 ClearObjectStats(); 6397 ClearObjectStats();
6387 } 6398 }
6388 } 6399 }
6389 } // namespace v8::internal 6400 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/identity-map.h » ('j') | src/heap/identity-map.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698