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

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

Issue 1250463004: Migrate NoSafepointScope; add constrained concurrent allocation to unit test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Assert current thread is mutator; add shared assertion macro. Created 5 years, 5 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/heap.cc ('k') | runtime/vm/object.h » ('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/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"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 EXPECT_LE(expected_size, after - before); 206 EXPECT_LE(expected_size, after - before);
207 EXPECT_GT(expected_size + kTolerance, after - before); 207 EXPECT_GT(expected_size + kTolerance, after - before);
208 Dart_ExitScope(); 208 Dart_ExitScope();
209 } 209 }
210 210
211 211
212 class FindOnly : public FindObjectVisitor { 212 class FindOnly : public FindObjectVisitor {
213 public: 213 public:
214 FindOnly(Isolate* isolate, RawObject* target) 214 FindOnly(Isolate* isolate, RawObject* target)
215 : FindObjectVisitor(isolate), target_(target) { 215 : FindObjectVisitor(isolate), target_(target) {
216 ASSERT(isolate->no_safepoint_scope_depth() != 0); 216 #if defined(DEBUG)
217 EXPECT_GT(Thread::Current()->no_safepoint_scope_depth(), 0);
218 #endif
217 } 219 }
218 virtual ~FindOnly() { } 220 virtual ~FindOnly() { }
219 221
220 virtual bool FindObject(RawObject* obj) const { 222 virtual bool FindObject(RawObject* obj) const {
221 return obj == target_; 223 return obj == target_;
222 } 224 }
223 private: 225 private:
224 RawObject* target_; 226 RawObject* target_;
225 }; 227 };
226 228
(...skipping 30 matching lines...) Expand all
257 const String& obj = String::Handle(String::New("x", Heap::kOld)); 259 const String& obj = String::Handle(String::New("x", Heap::kOld));
258 Heap* heap = Thread::Current()->isolate()->heap(); 260 Heap* heap = Thread::Current()->isolate()->heap();
259 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); 261 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
260 heap->WriteProtect(true); 262 heap->WriteProtect(true);
261 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); 263 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
262 heap->WriteProtect(false); 264 heap->WriteProtect(false);
263 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw()))); 265 EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
264 } 266 }
265 267
266 } // namespace dart. 268 } // namespace dart.
OLDNEW
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698