Chromium Code Reviews| Index: vm/dart_api_impl_test.cc |
| =================================================================== |
| --- vm/dart_api_impl_test.cc (revision 9471) |
| +++ vm/dart_api_impl_test.cc (working copy) |
| @@ -1307,11 +1307,11 @@ |
| { |
| Dart_EnterScope(); |
| - // create an object in new space |
| + // create an object in new space. |
|
cshapiro
2012/07/10 21:15:39
Presumably the periods are being added to make the
siva
2012/07/10 21:27:16
Done.
|
| Dart_Handle new_ref = Dart_NewString("new string"); |
| EXPECT_VALID(new_ref); |
| - // create an object in old space |
| + // create an object in old space. |
| Dart_Handle old_ref; |
| { |
| Isolate* isolate = Isolate::Current(); |
| @@ -1320,20 +1320,20 @@ |
| EXPECT_VALID(old_ref); |
| } |
| - // create a weak ref to the new space object |
| + // create a weak ref to the new space object. |
| weak_new_ref = Dart_NewWeakPersistentHandle(new_ref, NULL, NULL); |
| EXPECT_VALID(weak_new_ref); |
| EXPECT(!Dart_IsNull(weak_new_ref)); |
| - // create a weak ref to the old space object |
| + // create a weak ref to the old space object. |
| weak_old_ref = Dart_NewWeakPersistentHandle(old_ref, NULL, NULL); |
| EXPECT_VALID(weak_old_ref); |
| EXPECT(!Dart_IsNull(weak_old_ref)); |
| - // garbage collect new space |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + // garbage collect new space. |
| + Isolate::Current()->heap()->Scavenge(); |
|
cshapiro
2012/07/10 21:15:39
I think it would be helpful to expand the comment
siva
2012/07/10 21:27:16
As discussed I have added a class called GCTestHel
|
| - // nothing should be invalidated or cleared |
| + // nothing should be invalidated or cleared. |
| EXPECT_VALID(new_ref); |
| EXPECT(!Dart_IsNull(new_ref)); |
| EXPECT_VALID(old_ref); |
| @@ -1347,10 +1347,10 @@ |
| EXPECT(!Dart_IsNull(weak_old_ref)); |
| EXPECT(Dart_IdentityEquals(old_ref, weak_old_ref)); |
| - // garbage collect old space |
| + // garbage collect old space. |
| Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| - // nothing should be invalidated or cleared |
| + // nothing should be invalidated or cleared. |
| EXPECT_VALID(new_ref); |
| EXPECT(!Dart_IsNull(new_ref)); |
| EXPECT_VALID(old_ref); |
| @@ -1368,19 +1368,19 @@ |
| Dart_ExitScope(); |
| } |
| - // garbage collect new space again |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + // garbage collect new space again. |
| + Isolate::Current()->heap()->Scavenge(); |
|
cshapiro
2012/07/10 21:15:39
Ditto.
siva
2012/07/10 21:27:16
Ditto.
On 2012/07/10 21:15:39, cshapiro wrote:
|
| - // weak ref to new space object should now be cleared |
| + // weak ref to new space object should now be cleared. |
| EXPECT_VALID(weak_new_ref); |
| EXPECT(Dart_IsNull(weak_new_ref)); |
| EXPECT_VALID(weak_old_ref); |
| EXPECT(!Dart_IsNull(weak_old_ref)); |
| - // garbage collect old space again |
| + // garbage collect old space again. |
| Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| - // weak ref to old space object should now be cleared |
| + // weak ref to old space object should now be cleared. |
| EXPECT_VALID(weak_new_ref); |
| EXPECT(Dart_IsNull(weak_new_ref)); |
| EXPECT_VALID(weak_old_ref); |
| @@ -1389,7 +1389,7 @@ |
| Dart_DeletePersistentHandle(weak_new_ref); |
| Dart_DeletePersistentHandle(weak_old_ref); |
| - // garbage collect one last time to revisit deleted handles |
| + // garbage collect one last time to revisit deleted handles. |
| Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| } |
| @@ -1416,7 +1416,7 @@ |
| EXPECT(*peer == 0); |
| Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| EXPECT(*peer == 0); |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + Isolate::Current()->heap()->Scavenge(); |
| EXPECT(*peer == 42); |
| delete peer; |
| Dart_DeletePersistentHandle(weak_ref); |
| @@ -1482,7 +1482,7 @@ |
| EXPECT_VALID(weak3); |
| EXPECT_VALID(weak4); |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + Isolate::Current()->heap()->Scavenge(); |
| // New space collection should not affect old space objects |
| EXPECT(!Dart_IsNull(weak1)); |
| @@ -1646,8 +1646,8 @@ |
| EXPECT(!Dart_IsNull(old_pwph)); |
| EXPECT(Dart_IsPrologueWeakPersistentHandle(old_pwph)); |
| // Garbage collect new space without invoking API callbacks. |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew, |
| - Heap::kIgnoreApiCallbacks); |
| + Isolate::Current()->heap()->Scavenge(); |
| + |
| // Both prologue weak handles should be preserved. |
| EXPECT(!Dart_IsNull(new_pwph)); |
| EXPECT(!Dart_IsNull(old_pwph)); |
| @@ -1658,8 +1658,8 @@ |
| EXPECT(!Dart_IsNull(new_pwph)); |
| EXPECT(!Dart_IsNull(old_pwph)); |
| // Garbage collect new space invoking API callbacks. |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew, |
| - Heap::kInvokeApiCallbacks); |
| + Isolate::Current()->heap()->Scavenge(Heap::kInvokeApiCallbacks); |
| + |
| // The prologue weak handle with a new space referent should now be |
| // cleared. The old space referent should be preserved. |
| EXPECT(Dart_IsNull(new_pwph)); |
| @@ -1722,7 +1722,7 @@ |
| EXPECT_VALID(weak2); |
| EXPECT_VALID(weak3); |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + Isolate::Current()->heap()->Scavenge(); |
| // New space collection should not affect old space objects |
| EXPECT(!Dart_IsNull(weak1)); |
| @@ -1824,8 +1824,7 @@ |
| EXPECT_VALID(Dart_NewWeakReferenceSet(keys, ARRAY_SIZE(keys), |
| values, ARRAY_SIZE(values))); |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew, |
| - Heap::kInvokeApiCallbacks); |
| + Isolate::Current()->heap()->Scavenge(Heap::kInvokeApiCallbacks); |
| } |
| // All weak references should be preserved. |
| @@ -1833,8 +1832,7 @@ |
| EXPECT(!Dart_IsNull(weak2)); |
| EXPECT(!Dart_IsNull(weak3)); |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew, |
| - Heap::kIgnoreApiCallbacks); |
| + Isolate::Current()->heap()->Scavenge(); |
| // No weak references should be preserved. |
| EXPECT(Dart_IsNull(weak1)); |
| @@ -1955,7 +1953,7 @@ |
| // invoke the prologue callback. No status values should change. |
| global_prologue_callback_status = 3; |
| global_epilogue_callback_status = 7; |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + Isolate::Current()->heap()->Scavenge(); |
| EXPECT_EQ(3, global_prologue_callback_status); |
| EXPECT_EQ(7, global_epilogue_callback_status); |
| @@ -1963,8 +1961,7 @@ |
| // invoke the prologue callback. No status values should change. |
| global_prologue_callback_status = 3; |
| global_epilogue_callback_status = 7; |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew, |
| - Heap::kInvokeApiCallbacks); |
| + Isolate::Current()->heap()->Scavenge(Heap::kInvokeApiCallbacks); |
| EXPECT_EQ(6, global_prologue_callback_status); |
| EXPECT_EQ(7, global_epilogue_callback_status); |
| @@ -1998,15 +1995,14 @@ |
| // or the epilogue callback. No status values should change. |
| global_prologue_callback_status = 3; |
| global_epilogue_callback_status = 7; |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + Isolate::Current()->heap()->Scavenge(); |
| EXPECT_EQ(3, global_prologue_callback_status); |
| EXPECT_EQ(7, global_epilogue_callback_status); |
| // Garbage collect new space. This should invoke the prologue and |
| // the epilogue callback. The prologue and epilogue status values |
| // should change. |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew, |
| - Heap::kInvokeApiCallbacks); |
| + Isolate::Current()->heap()->Scavenge(Heap::kInvokeApiCallbacks); |
| EXPECT_EQ(6, global_prologue_callback_status); |
| EXPECT_EQ(28, global_epilogue_callback_status); |
| @@ -2057,7 +2053,7 @@ |
| // or epilogue callbacks. No status values should change. |
| global_prologue_callback_status = 3; |
| global_epilogue_callback_status = 7; |
| - Isolate::Current()->heap()->CollectGarbage(Heap::kNew); |
| + Isolate::Current()->heap()->Scavenge(); |
| EXPECT_EQ(3, global_prologue_callback_status); |
| EXPECT_EQ(7, global_epilogue_callback_status); |