Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: runtime/vm/heap.cc

Issue 578443003: Support old-space allocation in generated code (bump block only for now). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 19 matching lines...) Expand all
30 "Enables heap verification before GC."); 30 "Enables heap verification before GC.");
31 DEFINE_FLAG(bool, verify_after_gc, false, 31 DEFINE_FLAG(bool, verify_after_gc, false,
32 "Enables heap verification after GC."); 32 "Enables heap verification after GC.");
33 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); 33 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation.");
34 DEFINE_FLAG(int, new_gen_ext_limit, 64, 34 DEFINE_FLAG(int, new_gen_ext_limit, 64,
35 "maximum total external size (MB) in new gen before triggering GC"); 35 "maximum total external size (MB) in new gen before triggering GC");
36 DEFINE_FLAG(int, pretenure_threshold, 98, 36 DEFINE_FLAG(int, pretenure_threshold, 98,
37 "Trigger pretenuring when this many percent are promoted."); 37 "Trigger pretenuring when this many percent are promoted.");
38 DEFINE_FLAG(int, pretenure_interval, 10, 38 DEFINE_FLAG(int, pretenure_interval, 10,
39 "Back off pretenuring after this many cycles."); 39 "Back off pretenuring after this many cycles.");
40 DEFINE_FLAG(bool, pretenure_all, false, "Global pretenuring (for testing).");
40 41
41 Heap::Heap(Isolate* isolate, 42 Heap::Heap(Isolate* isolate,
42 intptr_t max_new_gen_semi_words, 43 intptr_t max_new_gen_semi_words,
43 intptr_t max_old_gen_words) 44 intptr_t max_old_gen_words)
44 : isolate_(isolate), 45 : isolate_(isolate),
45 read_only_(false), 46 read_only_(false),
46 gc_in_progress_(false), 47 gc_in_progress_(false),
47 pretenure_policy_(0) { 48 pretenure_policy_(0) {
48 for (int sel = 0; 49 for (int sel = 0;
49 sel < kNumWeakSelectors; 50 sel < kNumWeakSelectors;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 387 }
387 388
388 389
389 void Heap::WriteProtect(bool read_only) { 390 void Heap::WriteProtect(bool read_only) {
390 read_only_ = read_only; 391 read_only_ = read_only;
391 new_space_->WriteProtect(read_only); 392 new_space_->WriteProtect(read_only);
392 old_space_->WriteProtect(read_only); 393 old_space_->WriteProtect(read_only);
393 } 394 }
394 395
395 396
396 uword Heap::TopAddress() { 397 uword Heap::TopAddress(Heap::Space space) {
397 return reinterpret_cast<uword>(new_space_->TopAddress()); 398 if (space == kNew) {
399 return reinterpret_cast<uword>(new_space_->TopAddress());
400 } else {
401 ASSERT(space == kPretenured);
Ivan Posva 2014/09/19 18:45:55 Please add a TODO to the definition of kPretenured
koda 2014/09/19 20:48:29 Done.
402 return reinterpret_cast<uword>(old_space_->TopAddress());
403 }
398 } 404 }
399 405
400 406
401 uword Heap::EndAddress() { 407 uword Heap::EndAddress(Heap::Space space) {
402 return reinterpret_cast<uword>(new_space_->EndAddress()); 408 if (space == kNew) {
409 return reinterpret_cast<uword>(new_space_->EndAddress());
410 } else {
411 ASSERT(space == kPretenured);
412 return reinterpret_cast<uword>(old_space_->EndAddress());
413 }
414 }
415
416
417 Heap::Space Heap::SpaceForAllocation(intptr_t cid) const {
418 return FLAG_pretenure_all ? kPretenured : kNew;
403 } 419 }
404 420
405 421
406 void Heap::Init(Isolate* isolate, 422 void Heap::Init(Isolate* isolate,
407 intptr_t max_new_gen_words, 423 intptr_t max_new_gen_words,
408 intptr_t max_old_gen_words) { 424 intptr_t max_old_gen_words) {
409 ASSERT(isolate->heap() == NULL); 425 ASSERT(isolate->heap() == NULL);
410 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words); 426 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words);
411 isolate->set_heap(heap); 427 isolate->set_heap(heap);
412 } 428 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 heap->DisableGrowthControl(); 704 heap->DisableGrowthControl();
689 } 705 }
690 706
691 707
692 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 708 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
693 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 709 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
694 heap->SetGrowthControlState(current_growth_controller_state_); 710 heap->SetGrowthControlState(current_growth_controller_state_);
695 } 711 }
696 712
697 } // namespace dart 713 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698