| 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 "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 4115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4126 objects_->Add(&handle); | 4126 objects_->Add(&handle); |
| 4127 } | 4127 } |
| 4128 private: | 4128 private: |
| 4129 GrowableArray<Object*>* objects_; | 4129 GrowableArray<Object*>* objects_; |
| 4130 }; | 4130 }; |
| 4131 | 4131 |
| 4132 | 4132 |
| 4133 TEST_CASE(PrintJSON) { | 4133 TEST_CASE(PrintJSON) { |
| 4134 Heap* heap = Isolate::Current()->heap(); | 4134 Heap* heap = Isolate::Current()->heap(); |
| 4135 heap->CollectAllGarbage(); | 4135 heap->CollectAllGarbage(); |
| 4136 // We don't want to print garbage objects, so wait for concurrent sweeper. |
| 4137 // TODO(21620): Add heap iteration interface that excludes garbage (or |
| 4138 // use ObjectGraph). |
| 4139 PageSpace* old_space = heap->old_space(); |
| 4140 { |
| 4141 MonitorLocker ml(old_space->tasks_lock()); |
| 4142 while (old_space->tasks() > 0) { |
| 4143 ml.Wait(); |
| 4144 } |
| 4145 } |
| 4136 GrowableArray<Object*> objects; | 4146 GrowableArray<Object*> objects; |
| 4137 ObjectAccumulator acc(&objects); | 4147 ObjectAccumulator acc(&objects); |
| 4138 heap->IterateObjects(&acc); | 4148 heap->IterateObjects(&acc); |
| 4139 for (intptr_t i = 0; i < objects.length(); ++i) { | 4149 for (intptr_t i = 0; i < objects.length(); ++i) { |
| 4140 JSONStream js; | 4150 JSONStream js; |
| 4141 objects[i]->PrintJSON(&js, false); | 4151 objects[i]->PrintJSON(&js, false); |
| 4142 EXPECT_SUBSTRING("\"type\":", js.ToCString()); | 4152 EXPECT_SUBSTRING("\"type\":", js.ToCString()); |
| 4143 } | 4153 } |
| 4144 } | 4154 } |
| 4145 | 4155 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 EXPECT_VALID(h_result); | 4478 EXPECT_VALID(h_result); |
| 4469 Integer& result = Integer::Handle(); | 4479 Integer& result = Integer::Handle(); |
| 4470 result ^= Api::UnwrapHandle(h_result); | 4480 result ^= Api::UnwrapHandle(h_result); |
| 4471 String& foo = String::Handle(String::New("foo")); | 4481 String& foo = String::Handle(String::New("foo")); |
| 4472 Integer& expected = Integer::Handle(); | 4482 Integer& expected = Integer::Handle(); |
| 4473 expected ^= foo.HashCode(); | 4483 expected ^= foo.HashCode(); |
| 4474 EXPECT(result.IsIdenticalTo(expected)); | 4484 EXPECT(result.IsIdenticalTo(expected)); |
| 4475 } | 4485 } |
| 4476 | 4486 |
| 4477 } // namespace dart | 4487 } // namespace dart |
| OLD | NEW |