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 4024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4035 InlinedVectorObject::s_destructorCalls = 0; | 4035 InlinedVectorObject::s_destructorCalls = 0; |
4036 { | 4036 { |
4037 new InlinedVectorObjectWrapper(); | 4037 new InlinedVectorObjectWrapper(); |
4038 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); | 4038 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); |
4039 EXPECT_EQ(2, InlinedVectorObject::s_destructorCalls); | 4039 EXPECT_EQ(2, InlinedVectorObject::s_destructorCalls); |
4040 } | 4040 } |
4041 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 4041 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
4042 EXPECT_LE(8, InlinedVectorObject::s_destructorCalls); | 4042 EXPECT_LE(8, InlinedVectorObject::s_destructorCalls); |
4043 } | 4043 } |
4044 | 4044 |
| 4045 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
| 4046 // Vector<>s with inline capacity, enable this test. |
| 4047 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
4045 TEST(HeapTest, VectorDestructorsWithVtable) | 4048 TEST(HeapTest, VectorDestructorsWithVtable) |
4046 { | 4049 { |
4047 clearOutOldGarbage(); | 4050 clearOutOldGarbage(); |
4048 InlinedVectorObjectWithVtable::s_destructorCalls = 0; | 4051 InlinedVectorObjectWithVtable::s_destructorCalls = 0; |
4049 { | 4052 { |
4050 HeapVector<InlinedVectorObjectWithVtable> vector; | 4053 HeapVector<InlinedVectorObjectWithVtable> vector; |
4051 InlinedVectorObjectWithVtable i1, i2; | 4054 InlinedVectorObjectWithVtable i1, i2; |
4052 vector.append(i1); | 4055 vector.append(i1); |
4053 vector.append(i2); | 4056 vector.append(i2); |
4054 } | 4057 } |
(...skipping 22 matching lines...) Expand all Loading... |
4077 | 4080 |
4078 InlinedVectorObjectWithVtable::s_destructorCalls = 0; | 4081 InlinedVectorObjectWithVtable::s_destructorCalls = 0; |
4079 { | 4082 { |
4080 new InlinedVectorObjectWithVtableWrapper(); | 4083 new InlinedVectorObjectWithVtableWrapper(); |
4081 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); | 4084 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); |
4082 EXPECT_EQ(3, InlinedVectorObjectWithVtable::s_destructorCalls); | 4085 EXPECT_EQ(3, InlinedVectorObjectWithVtable::s_destructorCalls); |
4083 } | 4086 } |
4084 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 4087 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
4085 EXPECT_EQ(9, InlinedVectorObjectWithVtable::s_destructorCalls); | 4088 EXPECT_EQ(9, InlinedVectorObjectWithVtable::s_destructorCalls); |
4086 } | 4089 } |
| 4090 #endif |
4087 | 4091 |
4088 template<typename Set> | 4092 template<typename Set> |
4089 void rawPtrInHashHelper() | 4093 void rawPtrInHashHelper() |
4090 { | 4094 { |
4091 Set set; | 4095 Set set; |
4092 set.add(new int(42)); | 4096 set.add(new int(42)); |
4093 set.add(new int(42)); | 4097 set.add(new int(42)); |
4094 EXPECT_EQ(2u, set.size()); | 4098 EXPECT_EQ(2u, set.size()); |
4095 for (typename Set::iterator it = set.begin(); it != set.end(); ++it) { | 4099 for (typename Set::iterator it = set.begin(); it != set.end(); ++it) { |
4096 EXPECT_EQ(42, **it); | 4100 EXPECT_EQ(42, **it); |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6032 { | 6036 { |
6033 Persistent<ClassWithMember> object = ClassWithMember::create(); | 6037 Persistent<ClassWithMember> object = ClassWithMember::create(); |
6034 EXPECT_EQ(0, object->traceCount()); | 6038 EXPECT_EQ(0, object->traceCount()); |
6035 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 6039 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
6036 EXPECT_TRUE(mixin); | 6040 EXPECT_TRUE(mixin); |
6037 EXPECT_GT(object->traceCount(), 0); | 6041 EXPECT_GT(object->traceCount(), 0); |
6038 EXPECT_GT(mixin->traceCount(), 0); | 6042 EXPECT_GT(mixin->traceCount(), 0); |
6039 } | 6043 } |
6040 | 6044 |
6041 } // namespace blink | 6045 } // namespace blink |
OLD | NEW |