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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 } | 445 } |
446 | 446 |
447 | 447 |
448 void Heap::WriteProtect(bool read_only) { | 448 void Heap::WriteProtect(bool read_only) { |
449 read_only_ = read_only; | 449 read_only_ = read_only; |
450 new_space_.WriteProtect(read_only); | 450 new_space_.WriteProtect(read_only); |
451 old_space_.WriteProtect(read_only); | 451 old_space_.WriteProtect(read_only); |
452 } | 452 } |
453 | 453 |
454 | 454 |
455 uword Heap::TopAddress(Heap::Space space) { | |
456 if (space == kNew) { | |
457 return reinterpret_cast<uword>(new_space_.TopAddress()); | |
458 } else { | |
459 ASSERT(space == kPretenured); | |
460 return reinterpret_cast<uword>(old_space_.TopAddress()); | |
461 } | |
462 } | |
463 | |
464 | |
465 uword Heap::EndAddress(Heap::Space space) { | |
466 if (space == kNew) { | |
467 return reinterpret_cast<uword>(new_space_.EndAddress()); | |
468 } else { | |
469 ASSERT(space == kPretenured); | |
470 return reinterpret_cast<uword>(old_space_.EndAddress()); | |
471 } | |
472 } | |
473 | |
474 | |
475 Heap::Space Heap::SpaceForAllocation(intptr_t cid) { | 455 Heap::Space Heap::SpaceForAllocation(intptr_t cid) { |
476 return FLAG_pretenure_all ? kPretenured : kNew; | 456 return FLAG_pretenure_all ? kPretenured : kNew; |
477 } | 457 } |
478 | 458 |
479 | 459 |
480 intptr_t Heap::TopOffset(Heap::Space space) { | 460 intptr_t Heap::TopOffset(Heap::Space space) { |
481 if (space == kNew) { | 461 if (space == kNew) { |
482 return OFFSET_OF(Heap, new_space_) + Scavenger::top_offset(); | 462 return OFFSET_OF(Heap, new_space_) + Scavenger::top_offset(); |
483 } else { | 463 } else { |
484 ASSERT(space == kPretenured); | 464 ASSERT(space == kPretenured); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 heap->DisableGrowthControl(); | 765 heap->DisableGrowthControl(); |
786 } | 766 } |
787 | 767 |
788 | 768 |
789 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 769 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
790 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 770 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
791 heap->SetGrowthControlState(current_growth_controller_state_); | 771 heap->SetGrowthControlState(current_growth_controller_state_); |
792 } | 772 } |
793 | 773 |
794 } // namespace dart | 774 } // namespace dart |
OLD | NEW |