| 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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 1690 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 1691 EXPECT_EQ(2, HeapTestSubClass::s_destructorCalls); | 1691 EXPECT_EQ(2, HeapTestSubClass::s_destructorCalls); |
| 1692 EXPECT_EQ(3, HeapTestSuperClass::s_destructorCalls); | 1692 EXPECT_EQ(3, HeapTestSuperClass::s_destructorCalls); |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 TEST(HeapTest, TypedHeapSanity) | 1695 TEST(HeapTest, TypedHeapSanity) |
| 1696 { | 1696 { |
| 1697 // We use TraceCounter for allocating an object on the general heap. | 1697 // We use TraceCounter for allocating an object on the general heap. |
| 1698 Persistent<TraceCounter> generalHeapObject = TraceCounter::create(); | 1698 Persistent<TraceCounter> generalHeapObject = TraceCounter::create(); |
| 1699 Persistent<TestTypedHeapClass> typedHeapObject = TestTypedHeapClass::create(
); | 1699 Persistent<TestTypedHeapClass> typedHeapObject = TestTypedHeapClass::create(
); |
| 1700 EXPECT_NE(pageHeaderAddress(reinterpret_cast<Address>(generalHeapObject.get(
))), | 1700 EXPECT_NE(pageHeaderFromObject(generalHeapObject.get()), |
| 1701 pageHeaderAddress(reinterpret_cast<Address>(typedHeapObject.get()))); | 1701 pageHeaderFromObject(typedHeapObject.get())); |
| 1702 } | 1702 } |
| 1703 | 1703 |
| 1704 TEST(HeapTest, NoAllocation) | 1704 TEST(HeapTest, NoAllocation) |
| 1705 { | 1705 { |
| 1706 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); | 1706 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); |
| 1707 { | 1707 { |
| 1708 // Disallow allocation | 1708 // Disallow allocation |
| 1709 NoAllocationScope<AnyThread> noAllocationScope; | 1709 NoAllocationScope<AnyThread> noAllocationScope; |
| 1710 EXPECT_FALSE(ThreadState::current()->isAllocationAllowed()); | 1710 EXPECT_FALSE(ThreadState::current()->isAllocationAllowed()); |
| 1711 } | 1711 } |
| (...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4578 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 4578 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 4579 EXPECT_EQ(1u, map->size()); | 4579 EXPECT_EQ(1u, map->size()); |
| 4580 EXPECT_EQ(lifeObject, map->get(lifeObject)->link()); | 4580 EXPECT_EQ(lifeObject, map->get(lifeObject)->link()); |
| 4581 lifeObject.clear(); // Despite its name. | 4581 lifeObject.clear(); // Despite its name. |
| 4582 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 4582 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 4583 EXPECT_EQ(0u, map->size()); | 4583 EXPECT_EQ(0u, map->size()); |
| 4584 } | 4584 } |
| 4585 | 4585 |
| 4586 | 4586 |
| 4587 } // WebCore namespace | 4587 } // WebCore namespace |
| OLD | NEW |