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

Side by Side Diff: vm/heap.cc

Issue 11722026: Do not emit pointer information for embedded singleton VM Isolate objects while generating code. Th… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 11 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/heap_profiler.h" 10 #include "vm/heap_profiler.h"
(...skipping 17 matching lines...) Expand all
28 "Enables heap verification before GC."); 28 "Enables heap verification before GC.");
29 DEFINE_FLAG(bool, verify_after_gc, false, 29 DEFINE_FLAG(bool, verify_after_gc, false,
30 "Enables heap verification after GC."); 30 "Enables heap verification after GC.");
31 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); 31 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation.");
32 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," 32 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB,"
33 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); 33 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap");
34 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, 34 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB,
35 "old gen heap size in MB," 35 "old gen heap size in MB,"
36 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); 36 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap");
37 37
38 Heap::Heap() : read_only_(false) { 38 Heap::Heap() : read_only_(false), gc_in_progress_(false) {
39 new_space_ = new Scavenger(this, 39 new_space_ = new Scavenger(this,
40 (FLAG_new_gen_heap_size * MB), 40 (FLAG_new_gen_heap_size * MB),
41 kNewObjectAlignmentOffset); 41 kNewObjectAlignmentOffset);
42 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); 42 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB));
43 stats_.num_ = 0; 43 stats_.num_ = 0;
44 heap_trace_ = new HeapTrace; 44 heap_trace_ = new HeapTrace;
45 } 45 }
46 46
47 47
48 Heap::~Heap() { 48 Heap::~Heap() {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return old_space_->GetPeer(raw_obj); 360 return old_space_->GetPeer(raw_obj);
361 } 361 }
362 362
363 363
364 int64_t Heap::PeerCount() const { 364 int64_t Heap::PeerCount() const {
365 return new_space_->PeerCount() + old_space_->PeerCount(); 365 return new_space_->PeerCount() + old_space_->PeerCount();
366 } 366 }
367 367
368 368
369 void Heap::RecordBeforeGC(Space space, GCReason reason) { 369 void Heap::RecordBeforeGC(Space space, GCReason reason) {
370 ASSERT(!gc_in_progress_);
371 gc_in_progress_ = true;
370 stats_.num_++; 372 stats_.num_++;
371 stats_.space_ = space; 373 stats_.space_ = space;
372 stats_.reason_ = reason; 374 stats_.reason_ = reason;
373 stats_.before_.micros_ = OS::GetCurrentTimeMicros(); 375 stats_.before_.micros_ = OS::GetCurrentTimeMicros();
374 stats_.before_.new_used_ = new_space_->in_use(); 376 stats_.before_.new_used_ = new_space_->in_use();
375 stats_.before_.new_capacity_ = new_space_->capacity(); 377 stats_.before_.new_capacity_ = new_space_->capacity();
376 stats_.before_.old_used_ = old_space_->in_use(); 378 stats_.before_.old_used_ = old_space_->in_use();
377 stats_.before_.old_capacity_ = old_space_->capacity(); 379 stats_.before_.old_capacity_ = old_space_->capacity();
378 stats_.times_[0] = 0; 380 stats_.times_[0] = 0;
379 stats_.times_[1] = 0; 381 stats_.times_[1] = 0;
380 stats_.times_[2] = 0; 382 stats_.times_[2] = 0;
381 stats_.times_[3] = 0; 383 stats_.times_[3] = 0;
382 stats_.data_[0] = 0; 384 stats_.data_[0] = 0;
383 stats_.data_[1] = 0; 385 stats_.data_[1] = 0;
384 stats_.data_[2] = 0; 386 stats_.data_[2] = 0;
385 stats_.data_[3] = 0; 387 stats_.data_[3] = 0;
386 } 388 }
387 389
388 390
389 void Heap::RecordAfterGC() { 391 void Heap::RecordAfterGC() {
390 stats_.after_.micros_ = OS::GetCurrentTimeMicros(); 392 stats_.after_.micros_ = OS::GetCurrentTimeMicros();
391 stats_.after_.new_used_ = new_space_->in_use(); 393 stats_.after_.new_used_ = new_space_->in_use();
392 stats_.after_.new_capacity_ = new_space_->capacity(); 394 stats_.after_.new_capacity_ = new_space_->capacity();
393 stats_.after_.old_used_ = old_space_->in_use(); 395 stats_.after_.old_used_ = old_space_->in_use();
394 stats_.after_.old_capacity_ = old_space_->capacity(); 396 stats_.after_.old_capacity_ = old_space_->capacity();
397 ASSERT(gc_in_progress_);
398 gc_in_progress_ = false;
395 } 399 }
396 400
397 401
398 static intptr_t RoundToKB(intptr_t memory_size) { 402 static intptr_t RoundToKB(intptr_t memory_size) {
399 return (memory_size + (KB >> 1)) >> KBLog2; 403 return (memory_size + (KB >> 1)) >> KBLog2;
400 } 404 }
401 405
402 406
403 static double RoundToSecs(int64_t micros) { 407 static double RoundToSecs(int64_t micros) {
404 const int k1M = 1000000; // Converting us to secs. 408 const int k1M = 1000000; // Converting us to secs.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 isolate()->IncrementNoGCScopeDepth(); 465 isolate()->IncrementNoGCScopeDepth();
462 } 466 }
463 467
464 468
465 NoGCScope::~NoGCScope() { 469 NoGCScope::~NoGCScope() {
466 isolate()->DecrementNoGCScopeDepth(); 470 isolate()->DecrementNoGCScopeDepth();
467 } 471 }
468 #endif // defined(DEBUG) 472 #endif // defined(DEBUG)
469 473
470 } // namespace dart 474 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698