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

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

Issue 1351453008: Parallel marking. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add TODO to remove busy wait Created 5 years, 2 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
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/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
11 #include "vm/unit_test.h" 11 #include "vm/unit_test.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 DECLARE_FLAG(int, marker_tasks);
16
15 TEST_CASE(OldGC) { 17 TEST_CASE(OldGC) {
16 const char* kScriptChars = 18 const char* kScriptChars =
17 "main() {\n" 19 "main() {\n"
18 " return [1, 2, 3];\n" 20 " return [1, 2, 3];\n"
19 "}\n"; 21 "}\n";
20 FLAG_verbose_gc = true; 22 FLAG_verbose_gc = true;
21 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 23 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
22 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); 24 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
23 25
24 EXPECT_VALID(result); 26 EXPECT_VALID(result);
25 EXPECT(!Dart_IsNull(result)); 27 EXPECT(!Dart_IsNull(result));
26 EXPECT(Dart_IsList(result)); 28 EXPECT(Dart_IsList(result));
27 Isolate* isolate = Isolate::Current(); 29 Isolate* isolate = Isolate::Current();
28 Heap* heap = isolate->heap(); 30 Heap* heap = isolate->heap();
29 heap->CollectGarbage(Heap::kOld); 31 heap->CollectGarbage(Heap::kOld);
30 } 32 }
31 33
32 34
35 TEST_CASE(OldGC_Unsync) {
36 FLAG_marker_tasks = 0;
37 const char* kScriptChars =
38 "main() {\n"
39 " return [1, 2, 3];\n"
40 "}\n";
41 FLAG_verbose_gc = true;
42 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
43 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
44
45 EXPECT_VALID(result);
46 EXPECT(!Dart_IsNull(result));
47 EXPECT(Dart_IsList(result));
48 Isolate* isolate = Isolate::Current();
49 Heap* heap = isolate->heap();
50 heap->CollectGarbage(Heap::kOld);
51 }
52
53
33 TEST_CASE(LargeSweep) { 54 TEST_CASE(LargeSweep) {
34 const char* kScriptChars = 55 const char* kScriptChars =
35 "main() {\n" 56 "main() {\n"
36 " return new List(8 * 1024 * 1024);\n" 57 " return new List(8 * 1024 * 1024);\n"
37 "}\n"; 58 "}\n";
38 FLAG_verbose_gc = true; 59 FLAG_verbose_gc = true;
39 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 60 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
40 Dart_EnterScope(); 61 Dart_EnterScope();
41 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); 62 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
42 63
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 const String& obj = String::Handle(String::New("x", Heap::kOld)); 280 const String& obj = String::Handle(String::New("x", Heap::kOld));
260 Heap* heap = Thread::Current()->isolate()->heap(); 281 Heap* heap = Thread::Current()->isolate()->heap();
261 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); 282 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
262 heap->WriteProtect(true); 283 heap->WriteProtect(true);
263 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); 284 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
264 heap->WriteProtect(false); 285 heap->WriteProtect(false);
265 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); 286 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
266 } 287 }
267 288
268 } // namespace dart. 289 } // namespace dart.
OLDNEW
« runtime/vm/gc_marker.cc ('K') | « runtime/vm/gc_marker.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698