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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 #if defined(DEBUG) | 388 #if defined(DEBUG) |
389 if (FLAG_heap_stats) { | 389 if (FLAG_heap_stats) { |
390 new_space_.CollectStatistics(); | 390 new_space_.CollectStatistics(); |
391 ReportHeapStatistics("After GC"); | 391 ReportHeapStatistics("After GC"); |
392 } else if (FLAG_log_gc) { | 392 } else if (FLAG_log_gc) { |
393 new_space_.ReportStatistics(); | 393 new_space_.ReportStatistics(); |
394 } | 394 } |
395 #else | 395 #else |
396 if (FLAG_log_gc) new_space_.ReportStatistics(); | 396 if (FLAG_log_gc) new_space_.ReportStatistics(); |
397 #endif // DEBUG | 397 #endif // DEBUG |
398 for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount); | |
399 ++i) { | |
400 int count = deferred_counters_[i]; | |
401 deferred_counters_[i] = 0; | |
402 while (count != 0) { | |
Jakob Kummerow
2015/05/11 08:27:37
nit: I'd suggest s/!=/>/ here, as it's slightly mo
Erik Corry
2015/05/11 09:56:12
Done.
| |
403 count--; | |
404 isolate()->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(i)); | |
405 } | |
406 } | |
398 } | 407 } |
399 | 408 |
400 | 409 |
410 void Heap::IncrementDeferredCount(v8::Isolate::UseCounterFeature feature) { | |
411 deferred_counters_[feature]++; | |
412 } | |
413 | |
414 | |
401 void Heap::GarbageCollectionPrologue() { | 415 void Heap::GarbageCollectionPrologue() { |
402 { | 416 { |
403 AllowHeapAllocation for_the_first_part_of_prologue; | 417 AllowHeapAllocation for_the_first_part_of_prologue; |
404 ClearJSFunctionResultCaches(); | 418 ClearJSFunctionResultCaches(); |
405 gc_count_++; | 419 gc_count_++; |
406 unflattened_strings_length_ = 0; | 420 unflattened_strings_length_ = 0; |
407 | 421 |
408 if (FLAG_flush_code && FLAG_flush_code_incrementally) { | 422 if (FLAG_flush_code && FLAG_flush_code_incrementally) { |
409 mark_compact_collector()->EnableCodeFlushing(true); | 423 mark_compact_collector()->EnableCodeFlushing(true); |
410 } | 424 } |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 | 932 |
919 if (collector == MARK_COMPACTOR) { | 933 if (collector == MARK_COMPACTOR) { |
920 gc_idle_time_handler_.NotifyMarkCompact(); | 934 gc_idle_time_handler_.NotifyMarkCompact(); |
921 } else { | 935 } else { |
922 gc_idle_time_handler_.NotifyScavenge(); | 936 gc_idle_time_handler_.NotifyScavenge(); |
923 } | 937 } |
924 | 938 |
925 tracer()->Stop(collector); | 939 tracer()->Stop(collector); |
926 } | 940 } |
927 | 941 |
942 if (collector == MARK_COMPACTOR && | |
943 (gc_callback_flags & kGCCallbackFlagForced) != 0) { | |
944 isolate()->CountUsage(v8::Isolate::kForcedGC); | |
945 } | |
946 | |
928 // Start incremental marking for the next cycle. The heap snapshot | 947 // Start incremental marking for the next cycle. The heap snapshot |
929 // generator needs incremental marking to stay off after it aborted. | 948 // generator needs incremental marking to stay off after it aborted. |
930 if (!mark_compact_collector()->abort_incremental_marking() && | 949 if (!mark_compact_collector()->abort_incremental_marking() && |
931 incremental_marking()->IsStopped() && | 950 incremental_marking()->IsStopped() && |
932 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { | 951 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { |
933 incremental_marking()->Start(); | 952 incremental_marking()->Start(); |
934 } | 953 } |
935 | 954 |
936 return next_gc_likely_to_collect_more; | 955 return next_gc_likely_to_collect_more; |
937 } | 956 } |
(...skipping 4477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5415 DCHECK(hash_seed() == 0); | 5434 DCHECK(hash_seed() == 0); |
5416 if (FLAG_randomize_hashes) { | 5435 if (FLAG_randomize_hashes) { |
5417 if (FLAG_hash_seed == 0) { | 5436 if (FLAG_hash_seed == 0) { |
5418 int rnd = isolate()->random_number_generator()->NextInt(); | 5437 int rnd = isolate()->random_number_generator()->NextInt(); |
5419 set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask)); | 5438 set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask)); |
5420 } else { | 5439 } else { |
5421 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); | 5440 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); |
5422 } | 5441 } |
5423 } | 5442 } |
5424 | 5443 |
5444 for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount); | |
5445 i++) { | |
5446 deferred_counters_[i] = 0; | |
5447 } | |
5448 | |
5449 | |
5425 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 5450 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
5426 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 5451 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
5427 | 5452 |
5428 store_buffer()->SetUp(); | 5453 store_buffer()->SetUp(); |
5429 | 5454 |
5430 mark_compact_collector()->SetUp(); | 5455 mark_compact_collector()->SetUp(); |
5431 | 5456 |
5432 return true; | 5457 return true; |
5433 } | 5458 } |
5434 | 5459 |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6485 } | 6510 } |
6486 delete list; | 6511 delete list; |
6487 } else { | 6512 } else { |
6488 prev = list; | 6513 prev = list; |
6489 } | 6514 } |
6490 list = next; | 6515 list = next; |
6491 } | 6516 } |
6492 } | 6517 } |
6493 } | 6518 } |
6494 } // namespace v8::internal | 6519 } // namespace v8::internal |
OLD | NEW |