| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 4226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4237 HeapVector<InlinedVectorObject, 2> vector; | 4237 HeapVector<InlinedVectorObject, 2> vector; |
| 4238 InlinedVectorObject i1, i2; | 4238 InlinedVectorObject i1, i2; |
| 4239 vector.append(i1); | 4239 vector.append(i1); |
| 4240 vector.append(i2); | 4240 vector.append(i2); |
| 4241 } | 4241 } |
| 4242 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 4242 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
| 4243 EXPECT_LE(4, InlinedVectorObject::s_destructorCalls); | 4243 EXPECT_LE(4, InlinedVectorObject::s_destructorCalls); |
| 4244 | 4244 |
| 4245 InlinedVectorObject::s_destructorCalls = 0; | 4245 InlinedVectorObject::s_destructorCalls = 0; |
| 4246 { | 4246 { |
| 4247 auto const heapObject = new InlinedVectorObjectWrapper(); | 4247 Persistent<InlinedVectorObjectWrapper> vectorWrapper = new InlinedVector
ObjectWrapper(); |
| 4248 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); | 4248 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); |
| 4249 EXPECT_EQ(2, InlinedVectorObject::s_destructorCalls); | 4249 EXPECT_EQ(2, InlinedVectorObject::s_destructorCalls); |
| 4250 // Force compiler to keep |heapObject| variable on the stack | |
| 4251 // while collectGarbage() is working. | |
| 4252 // Otherwise GC would think that it's safe to collect the object. | |
| 4253 EXPECT_TRUE(heapObject); | |
| 4254 } | 4250 } |
| 4255 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 4251 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
| 4256 EXPECT_LE(8, InlinedVectorObject::s_destructorCalls); | 4252 EXPECT_LE(8, InlinedVectorObject::s_destructorCalls); |
| 4257 } | 4253 } |
| 4258 | 4254 |
| 4259 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables | 4255 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
| 4260 // Vector<>s with inline capacity, enable this test. | 4256 // Vector<>s with inline capacity, enable this test. |
| 4261 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) | 4257 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
| 4262 TEST(HeapTest, VectorDestructorsWithVtable) | 4258 TEST(HeapTest, VectorDestructorsWithVtable) |
| 4263 { | 4259 { |
| (...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6279 { | 6275 { |
| 6280 Persistent<ClassWithMember> object = ClassWithMember::create(); | 6276 Persistent<ClassWithMember> object = ClassWithMember::create(); |
| 6281 EXPECT_EQ(0, object->traceCount()); | 6277 EXPECT_EQ(0, object->traceCount()); |
| 6282 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 6278 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
| 6283 EXPECT_TRUE(mixin); | 6279 EXPECT_TRUE(mixin); |
| 6284 EXPECT_GT(object->traceCount(), 0); | 6280 EXPECT_GT(object->traceCount(), 0); |
| 6285 EXPECT_GT(mixin->traceCount(), 0); | 6281 EXPECT_GT(mixin->traceCount(), 0); |
| 6286 } | 6282 } |
| 6287 | 6283 |
| 6288 } // namespace blink | 6284 } // namespace blink |
| OLD | NEW |