OLD | NEW |
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 Loading... |
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 Loading... |
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. |
OLD | NEW |