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

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

Issue 11276022: Avoid integer overflow when computing the size of new space in bytes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years, 1 month 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
« no previous file with comments | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler_stats.h" 9 #include "vm/compiler_stats.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 18 matching lines...) Expand all
29 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); 29 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation.");
30 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," 30 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB,"
31 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); 31 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap");
32 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, 32 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB,
33 "old gen heap size in MB," 33 "old gen heap size in MB,"
34 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); 34 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap");
35 DEFINE_FLAG(int, code_heap_size, Heap::kCodeHeapSizeInMB, 35 DEFINE_FLAG(int, code_heap_size, Heap::kCodeHeapSizeInMB,
36 "code heap size in MB," 36 "code heap size in MB,"
37 "e.g: --code_heap_size=8 allocates a 8MB code heap"); 37 "e.g: --code_heap_size=8 allocates a 8MB code heap");
38 38
39 Heap::Heap() : read_only_(false) { 39 Heap::Heap() : read_only_(false) {
40 new_space_ = new Scavenger(this, 40 new_space_ = new Scavenger(this,
41 (FLAG_new_gen_heap_size * MB), 41 (FLAG_new_gen_heap_size * MB),
42 kNewObjectAlignmentOffset); 42 kNewObjectAlignmentOffset);
43 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); 43 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB));
44 code_space_ = new PageSpace(this, (FLAG_code_heap_size * MB), true); 44 code_space_ = new PageSpace(this, (FLAG_code_heap_size * MB), true);
45 } 45 }
46 46
47 47
48 Heap::~Heap() { 48 Heap::~Heap() {
49 delete new_space_; 49 delete new_space_;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 isolate()->IncrementNoGCScopeDepth(); 391 isolate()->IncrementNoGCScopeDepth();
392 } 392 }
393 393
394 394
395 NoGCScope::~NoGCScope() { 395 NoGCScope::~NoGCScope() {
396 isolate()->DecrementNoGCScopeDepth(); 396 isolate()->DecrementNoGCScopeDepth();
397 } 397 }
398 #endif // defined(DEBUG) 398 #endif // defined(DEBUG)
399 399
400 } // namespace dart 400 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698