| 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 intptr_t Heap::TopOffset(Heap::Space space) { | 492 intptr_t Heap::TopOffset(Heap::Space space) { |
| 493 if (space == kNew) { | 493 if (space == kNew) { |
| 494 return OFFSET_OF(Heap, new_space_) + Scavenger::top_offset(); | 494 return OFFSET_OF(Heap, new_space_) + Scavenger::top_offset(); |
| 495 } else { | 495 } else { |
| 496 ASSERT(space == kOld); | 496 ASSERT(space == kOld); |
| 497 return OFFSET_OF(Heap, old_space_) + PageSpace::top_offset(); | 497 return OFFSET_OF(Heap, old_space_) + PageSpace::top_offset(); |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 | 501 |
| 502 intptr_t Heap::EndOffset(Heap::Space space) { | |
| 503 if (space == kNew) { | |
| 504 return OFFSET_OF(Heap, new_space_) + Scavenger::end_offset(); | |
| 505 } else { | |
| 506 ASSERT(space == kOld); | |
| 507 return OFFSET_OF(Heap, old_space_) + PageSpace::end_offset(); | |
| 508 } | |
| 509 } | |
| 510 | |
| 511 | |
| 512 void Heap::Init(Isolate* isolate, | 502 void Heap::Init(Isolate* isolate, |
| 513 intptr_t max_new_gen_words, | 503 intptr_t max_new_gen_words, |
| 514 intptr_t max_old_gen_words, | 504 intptr_t max_old_gen_words, |
| 515 intptr_t max_external_words) { | 505 intptr_t max_external_words) { |
| 516 ASSERT(isolate->heap() == NULL); | 506 ASSERT(isolate->heap() == NULL); |
| 517 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words, | 507 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words, |
| 518 max_external_words); | 508 max_external_words); |
| 519 isolate->set_heap(heap); | 509 isolate->set_heap(heap); |
| 520 } | 510 } |
| 521 | 511 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 Dart::vm_isolate()->heap()->WriteProtect(false); | 844 Dart::vm_isolate()->heap()->WriteProtect(false); |
| 855 } | 845 } |
| 856 | 846 |
| 857 | 847 |
| 858 WritableVMIsolateScope::~WritableVMIsolateScope() { | 848 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 859 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 849 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 860 Dart::vm_isolate()->heap()->WriteProtect(true); | 850 Dart::vm_isolate()->heap()->WriteProtect(true); |
| 861 } | 851 } |
| 862 | 852 |
| 863 } // namespace dart | 853 } // namespace dart |
| OLD | NEW |