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

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

Issue 1179973005: Make ObjectGraph wait for concurrent sweeper before using mark bits (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « runtime/vm/object_graph.cc ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/object_graph.h" 6 #include "vm/object_graph.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 intptr_t empty_length = graph.RetainingPath(&c, Object::empty_array()); 105 intptr_t empty_length = graph.RetainingPath(&c, Object::empty_array());
106 Array& path = Array::Handle(Array::New(1, Heap::kNew)); 106 Array& path = Array::Handle(Array::New(1, Heap::kNew));
107 intptr_t one_length = graph.RetainingPath(&c, path); 107 intptr_t one_length = graph.RetainingPath(&c, path);
108 EXPECT_EQ(null_length, empty_length); 108 EXPECT_EQ(null_length, empty_length);
109 EXPECT_EQ(null_length, one_length); 109 EXPECT_EQ(null_length, one_length);
110 EXPECT_LE(3, null_length); 110 EXPECT_LE(3, null_length);
111 } 111 }
112 { 112 {
113 HANDLESCOPE(isolate); 113 HANDLESCOPE(isolate);
114 Array& path = Array::Handle(Array::New(6, Heap::kNew)); 114 Array& path = Array::Handle(Array::New(6, Heap::kNew));
115 // Trigger a full GC to increase probability of concurrent tasks.
116 isolate->heap()->CollectAllGarbage();
115 intptr_t length = graph.RetainingPath(&c, path); 117 intptr_t length = graph.RetainingPath(&c, path);
116 EXPECT_LE(3, length); 118 EXPECT_LE(3, length);
117 Array& expected_c = Array::Handle(); 119 Array& expected_c = Array::Handle();
118 expected_c ^= path.At(0); 120 expected_c ^= path.At(0);
119 // c is the first element in b. 121 // c is the first element in b.
120 Smi& offset_from_parent = Smi::Handle(); 122 Smi& offset_from_parent = Smi::Handle();
121 offset_from_parent ^= path.At(1); 123 offset_from_parent ^= path.At(1);
122 EXPECT_EQ(Array::element_offset(0), 124 EXPECT_EQ(Array::element_offset(0),
123 offset_from_parent.Value() * kWordSize); 125 offset_from_parent.Value() * kWordSize);
124 Array& expected_b = Array::Handle(); 126 Array& expected_b = Array::Handle();
125 expected_b ^= path.At(2); 127 expected_b ^= path.At(2);
126 // b is the element with index 10 in a. 128 // b is the element with index 10 in a.
127 offset_from_parent ^= path.At(3); 129 offset_from_parent ^= path.At(3);
128 EXPECT_EQ(Array::element_offset(10), 130 EXPECT_EQ(Array::element_offset(10),
129 offset_from_parent.Value() * kWordSize); 131 offset_from_parent.Value() * kWordSize);
130 Array& expected_a = Array::Handle(); 132 Array& expected_a = Array::Handle();
131 expected_a ^= path.At(4); 133 expected_a ^= path.At(4);
132 EXPECT(expected_c.raw() == c.raw()); 134 EXPECT(expected_c.raw() == c.raw());
133 EXPECT(expected_b.raw() == a.At(10)); 135 EXPECT(expected_b.raw() == a.At(10));
134 EXPECT(expected_a.raw() == a.raw()); 136 EXPECT(expected_a.raw() == a.raw());
135 } 137 }
136 } 138 }
137 } 139 }
138 140
139 } // namespace dart 141 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698