| 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/heap_profiler.h" | 10 #include "vm/heap_profiler.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 new_space_->Scavenge(kInvokeApiCallbacks); | 194 new_space_->Scavenge(kInvokeApiCallbacks); |
| 195 RecordAfterGC(); | 195 RecordAfterGC(); |
| 196 PrintStats(); | 196 PrintStats(); |
| 197 RecordBeforeGC(kOld, kFull); | 197 RecordBeforeGC(kOld, kFull); |
| 198 old_space_->MarkSweep(kInvokeApiCallbacks); | 198 old_space_->MarkSweep(kInvokeApiCallbacks); |
| 199 RecordAfterGC(); | 199 RecordAfterGC(); |
| 200 PrintStats(); | 200 PrintStats(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 | 203 |
| 204 void Heap::EnableGrowthControl() { | 204 void Heap::SetGrowthControlState(bool state) { |
| 205 old_space_->EnableGrowthControl(); | 205 old_space_->SetGrowthControlState(state); |
| 206 } |
| 207 |
| 208 |
| 209 bool Heap::GrowthControlState() { |
| 210 return old_space_->GrowthControlState(); |
| 206 } | 211 } |
| 207 | 212 |
| 208 | 213 |
| 209 void Heap::WriteProtect(bool read_only) { | 214 void Heap::WriteProtect(bool read_only) { |
| 210 read_only_ = read_only; | 215 read_only_ = read_only; |
| 211 new_space_->WriteProtect(read_only); | 216 new_space_->WriteProtect(read_only); |
| 212 old_space_->WriteProtect(read_only); | 217 old_space_->WriteProtect(read_only); |
| 213 } | 218 } |
| 214 | 219 |
| 215 | 220 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 NoGCScope::NoGCScope() : StackResource(Isolate::Current()) { | 480 NoGCScope::NoGCScope() : StackResource(Isolate::Current()) { |
| 476 isolate()->IncrementNoGCScopeDepth(); | 481 isolate()->IncrementNoGCScopeDepth(); |
| 477 } | 482 } |
| 478 | 483 |
| 479 | 484 |
| 480 NoGCScope::~NoGCScope() { | 485 NoGCScope::~NoGCScope() { |
| 481 isolate()->DecrementNoGCScopeDepth(); | 486 isolate()->DecrementNoGCScopeDepth(); |
| 482 } | 487 } |
| 483 #endif // defined(DEBUG) | 488 #endif // defined(DEBUG) |
| 484 | 489 |
| 490 |
| 491 NoHeapGrowthControlScope::NoHeapGrowthControlScope() |
| 492 : StackResource(Isolate::Current()) { |
| 493 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 494 current_growth_controller_state_ = heap->GrowthControlState(); |
| 495 heap->DisableGrowthControl(); |
| 496 } |
| 497 |
| 498 |
| 499 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 500 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 501 heap->SetGrowthControlState(current_growth_controller_state_); |
| 502 } |
| 503 |
| 485 } // namespace dart | 504 } // namespace dart |
| OLD | NEW |