OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/heap.h" | 5 #include "vm/heap.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 | 367 |
368 void Heap::UpdatePretenurePolicy() { | 368 void Heap::UpdatePretenurePolicy() { |
369 if (FLAG_disable_alloc_stubs_after_gc) { | 369 if (FLAG_disable_alloc_stubs_after_gc) { |
370 ClassTable* table = isolate_->class_table(); | 370 ClassTable* table = isolate_->class_table(); |
371 for (intptr_t cid = 1; cid < table->NumCids(); ++cid) { | 371 for (intptr_t cid = 1; cid < table->NumCids(); ++cid) { |
372 if (((cid >= kNumPredefinedCids) || (cid == kArrayCid)) && | 372 if (((cid >= kNumPredefinedCids) || (cid == kArrayCid)) && |
373 table->IsValidIndex(cid) && | 373 table->IsValidIndex(cid) && |
374 table->HasValidClassAt(cid)) { | 374 table->HasValidClassAt(cid)) { |
375 const Class& cls = Class::Handle(isolate_, table->At(cid)); | 375 const Class& cls = Class::Handle(isolate_, table->At(cid)); |
376 cls.SwitchAllocationStub(); | 376 cls.DisableAllocationStub(); |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
380 ClassHeapStats* stats = | 380 ClassHeapStats* stats = |
381 isolate_->class_table()->StatsWithUpdatedSize(kOneByteStringCid); | 381 isolate_->class_table()->StatsWithUpdatedSize(kOneByteStringCid); |
382 int allocated = stats->pre_gc.new_count; | 382 int allocated = stats->pre_gc.new_count; |
383 int promo_percent = (allocated == 0) ? 0 : | 383 int promo_percent = (allocated == 0) ? 0 : |
384 (100 * stats->promoted_count) / allocated; | 384 (100 * stats->promoted_count) / allocated; |
385 if (promo_percent >= FLAG_pretenure_threshold) { | 385 if (promo_percent >= FLAG_pretenure_threshold) { |
386 pretenure_policy_ += FLAG_pretenure_interval; | 386 pretenure_policy_ += FLAG_pretenure_interval; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 heap->DisableGrowthControl(); | 717 heap->DisableGrowthControl(); |
718 } | 718 } |
719 | 719 |
720 | 720 |
721 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 721 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
722 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 722 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
723 heap->SetGrowthControlState(current_growth_controller_state_); | 723 heap->SetGrowthControlState(current_growth_controller_state_); |
724 } | 724 } |
725 | 725 |
726 } // namespace dart | 726 } // namespace dart |
OLD | NEW |