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