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

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 20 matching lines...) Expand all
31 DEFINE_FLAG(int, pretenure_interval, 10, 31 DEFINE_FLAG(int, pretenure_interval, 10,
32 "Back off pretenuring after this many cycles."); 32 "Back off pretenuring after this many cycles.");
33 DEFINE_FLAG(int, pretenure_threshold, 98, 33 DEFINE_FLAG(int, pretenure_threshold, 98,
34 "Trigger pretenuring when this many percent are promoted."); 34 "Trigger pretenuring when this many percent are promoted.");
35 DEFINE_FLAG(bool, verbose_gc, false, "Enables verbose GC."); 35 DEFINE_FLAG(bool, verbose_gc, false, "Enables verbose GC.");
36 DEFINE_FLAG(int, verbose_gc_hdr, 40, "Print verbose GC header interval."); 36 DEFINE_FLAG(int, verbose_gc_hdr, 40, "Print verbose GC header interval.");
37 DEFINE_FLAG(bool, verify_after_gc, false, 37 DEFINE_FLAG(bool, verify_after_gc, false,
38 "Enables heap verification after GC."); 38 "Enables heap verification after GC.");
39 DEFINE_FLAG(bool, verify_before_gc, false, 39 DEFINE_FLAG(bool, verify_before_gc, false,
40 "Enables heap verification before GC."); 40 "Enables heap verification before GC.");
41 DEFINE_FLAG(bool, pretenure_all, false, "Global pretenuring (for testing).");
41 42
42 43
43 Heap::Heap(Isolate* isolate, 44 Heap::Heap(Isolate* isolate,
44 intptr_t max_new_gen_semi_words, 45 intptr_t max_new_gen_semi_words,
45 intptr_t max_old_gen_words) 46 intptr_t max_old_gen_words)
46 : isolate_(isolate), 47 : isolate_(isolate),
47 read_only_(false), 48 read_only_(false),
48 gc_in_progress_(false), 49 gc_in_progress_(false),
49 pretenure_policy_(0) { 50 pretenure_policy_(0) {
50 for (int sel = 0; 51 for (int sel = 0;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 398 }
398 399
399 400
400 void Heap::WriteProtect(bool read_only) { 401 void Heap::WriteProtect(bool read_only) {
401 read_only_ = read_only; 402 read_only_ = read_only;
402 new_space_->WriteProtect(read_only); 403 new_space_->WriteProtect(read_only);
403 old_space_->WriteProtect(read_only); 404 old_space_->WriteProtect(read_only);
404 } 405 }
405 406
406 407
407 uword Heap::TopAddress() { 408 uword Heap::TopAddress(Heap::Space space) {
408 return reinterpret_cast<uword>(new_space_->TopAddress()); 409 if (space == kNew) {
410 return reinterpret_cast<uword>(new_space_->TopAddress());
411 } else {
412 ASSERT(space == kPretenured);
413 return reinterpret_cast<uword>(old_space_->TopAddress());
414 }
409 } 415 }
410 416
411 417
412 uword Heap::EndAddress() { 418 uword Heap::EndAddress(Heap::Space space) {
413 return reinterpret_cast<uword>(new_space_->EndAddress()); 419 if (space == kNew) {
420 return reinterpret_cast<uword>(new_space_->EndAddress());
421 } else {
422 ASSERT(space == kPretenured);
423 return reinterpret_cast<uword>(old_space_->EndAddress());
424 }
425 }
426
427
428 Heap::Space Heap::SpaceForAllocation(intptr_t cid) const {
429 return FLAG_pretenure_all ? kPretenured : kNew;
414 } 430 }
415 431
416 432
417 void Heap::Init(Isolate* isolate, 433 void Heap::Init(Isolate* isolate,
418 intptr_t max_new_gen_words, 434 intptr_t max_new_gen_words,
419 intptr_t max_old_gen_words) { 435 intptr_t max_old_gen_words) {
420 ASSERT(isolate->heap() == NULL); 436 ASSERT(isolate->heap() == NULL);
421 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words); 437 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words);
422 isolate->set_heap(heap); 438 isolate->set_heap(heap);
423 } 439 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 heap->DisableGrowthControl(); 715 heap->DisableGrowthControl();
700 } 716 }
701 717
702 718
703 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 719 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
704 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 720 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
705 heap->SetGrowthControlState(current_growth_controller_state_); 721 heap->SetGrowthControlState(current_growth_controller_state_);
706 } 722 }
707 723
708 } // namespace dart 724 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/intrinsifier_arm.cc » ('j') | runtime/vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698