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

Side by Side Diff: vm/heap_test.cc

Issue 10021072: Remove the deprecated method invocation and field access apis from the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | « vm/exceptions_test.cc ('k') | vm/isolate_test.cc » ('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/globals.h" 6 #include "vm/globals.h"
7 #include "vm/heap.h" 7 #include "vm/heap.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 // Only ia32 and x64 can run execution tests. 12 // Only ia32 and x64 can run execution tests.
13 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 13 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
14 TEST_CASE(OldGC) { 14 TEST_CASE(OldGC) {
15 const char* kScriptChars = 15 const char* kScriptChars =
16 "class HeapTester {\n" 16 "void main() {\n"
17 " static void main() {\n" 17 " return [1, 2, 3];\n"
18 " return [1, 2, 3];\n"
19 " }\n"
20 "}\n"; 18 "}\n";
21 FLAG_verbose_gc = true; 19 FLAG_verbose_gc = true;
22 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 20 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
23 Dart_Handle result = Dart_InvokeStatic(lib, 21 Dart_Handle result = Dart_Invoke(lib,
24 Dart_NewString("HeapTester"), 22 Dart_NewString("main"),
25 Dart_NewString("main"), 23 0, NULL);
26 0, NULL);
27 24
28 EXPECT_VALID(result); 25 EXPECT_VALID(result);
29 EXPECT(!Dart_IsNull(result)); 26 EXPECT(!Dart_IsNull(result));
30 EXPECT(Dart_IsList(result)); 27 EXPECT(Dart_IsList(result));
31 Isolate* isolate = Isolate::Current(); 28 Isolate* isolate = Isolate::Current();
32 Heap* heap = isolate->heap(); 29 Heap* heap = isolate->heap();
33 heap->CollectGarbage(Heap::kOld); 30 heap->CollectGarbage(Heap::kOld);
34 } 31 }
35 32
36 33
37 TEST_CASE(LargeSweep) { 34 TEST_CASE(LargeSweep) {
38 const char* kScriptChars = 35 const char* kScriptChars =
39 "class HeapTester {\n" 36 "void main() {\n"
40 " static void main() {\n" 37 " return new List(8 * 1024 * 1024);\n"
41 " return new List(8 * 1024 * 1024);\n"
42 " }\n"
43 "}\n"; 38 "}\n";
44 FLAG_verbose_gc = true; 39 FLAG_verbose_gc = true;
45 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 40 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
46 Dart_EnterScope(); 41 Dart_EnterScope();
47 Dart_Handle result = Dart_InvokeStatic(lib, 42 Dart_Handle result = Dart_Invoke(lib,
48 Dart_NewString("HeapTester"), 43 Dart_NewString("main"),
49 Dart_NewString("main"), 44 0, NULL);
50 0, NULL);
51 45
52 EXPECT_VALID(result); 46 EXPECT_VALID(result);
53 EXPECT(!Dart_IsNull(result)); 47 EXPECT(!Dart_IsNull(result));
54 EXPECT(Dart_IsList(result)); 48 EXPECT(Dart_IsList(result));
55 Isolate* isolate = Isolate::Current(); 49 Isolate* isolate = Isolate::Current();
56 Heap* heap = isolate->heap(); 50 Heap* heap = isolate->heap();
57 heap->CollectGarbage(Heap::kOld); 51 heap->CollectGarbage(Heap::kOld);
58 Dart_ExitScope(); 52 Dart_ExitScope();
59 heap->CollectGarbage(Heap::kOld); 53 heap->CollectGarbage(Heap::kOld);
60 } 54 }
61 55
62 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 56 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
63 } 57 }
OLDNEW
« no previous file with comments | « vm/exceptions_test.cc ('k') | vm/isolate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698