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

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

Issue 864843002: Remove default heap size limit and add separate limit for externals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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
« no previous file with comments | « runtime/vm/pages.cc ('k') | tests/standalone/oom_error_stacktrace_test.dart » ('j') | 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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/pages.h" 6 #include "vm/pages.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
11 TEST_CASE(Pages) { 11 TEST_CASE(Pages) {
12 PageSpace* space = new PageSpace(NULL, 4 * MBInWords); 12 PageSpace* space = new PageSpace(NULL, 4 * MBInWords, 8 * MBInWords);
13 EXPECT(!space->Contains(reinterpret_cast<uword>(&space))); 13 EXPECT(!space->Contains(reinterpret_cast<uword>(&space)));
14 uword block = space->TryAllocate(8 * kWordSize); 14 uword block = space->TryAllocate(8 * kWordSize);
15 EXPECT(block != 0); 15 EXPECT(block != 0);
16 uword total = 0; 16 uword total = 0;
17 while (total < 2 * MB) { 17 while (total < 2 * MB) {
18 const intptr_t kBlockSize = 16 * kWordSize; 18 const intptr_t kBlockSize = 16 * kWordSize;
19 uword new_block = space->TryAllocate(kBlockSize); 19 uword new_block = space->TryAllocate(kBlockSize);
20 EXPECT(block != 0); 20 EXPECT(block != 0);
21 EXPECT(block != new_block); 21 EXPECT(block != new_block);
22 EXPECT(space->IsValidAddress(new_block)); 22 EXPECT(space->IsValidAddress(new_block));
23 block = new_block; 23 block = new_block;
24 total += kBlockSize; 24 total += kBlockSize;
25 } 25 }
26 // Allocate a large block. 26 // Allocate a large block.
27 uword large_block = space->TryAllocate(1 * MB); 27 uword large_block = space->TryAllocate(1 * MB);
28 EXPECT(large_block != 0); 28 EXPECT(large_block != 0);
29 EXPECT(block != large_block); 29 EXPECT(block != large_block);
30 EXPECT(space->IsValidAddress(large_block)); 30 EXPECT(space->IsValidAddress(large_block));
31 delete space; 31 delete space;
32 } 32 }
33 33
34 } // namespace dart 34 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | tests/standalone/oom_error_stacktrace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698