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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 | 1761 |
1762 CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack
); | 1762 CheckWithSlack(baseLevel + total, Heap::objectPayloadSizeForTesting(), slack
); |
1763 if (testPagesAllocated) | 1763 if (testPagesAllocated) |
1764 EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1)); | 1764 EXPECT_EQ(0ul, Heap::allocatedSpace() & (blinkPageSize - 1)); |
1765 | 1765 |
1766 for (size_t i = 0; i < persistentCount; i++) { | 1766 for (size_t i = 0; i < persistentCount; i++) { |
1767 delete persistents[i]; | 1767 delete persistents[i]; |
1768 persistents[i] = 0; | 1768 persistents[i] = 0; |
1769 } | 1769 } |
1770 | 1770 |
1771 uint8_t* address = reinterpret_cast<uint8_t*>(Heap::reallocate<DynamicallySi
zedObject>(0, 100)); | 1771 uint8_t* address = reinterpret_cast<uint8_t*>(Heap::allocate<DynamicallySize
dObject>(100)); |
1772 for (int i = 0; i < 100; i++) | 1772 for (int i = 0; i < 100; i++) |
1773 address[i] = i; | 1773 address[i] = i; |
1774 address = reinterpret_cast<uint8_t*>(Heap::reallocate<DynamicallySizedObject
>(address, 100000)); | 1774 address = reinterpret_cast<uint8_t*>(Heap::reallocate<DynamicallySizedObject
>(address, 100000)); |
1775 for (int i = 0; i < 100; i++) | 1775 for (int i = 0; i < 100; i++) |
1776 EXPECT_EQ(address[i], i); | 1776 EXPECT_EQ(address[i], i); |
1777 address = reinterpret_cast<uint8_t*>(Heap::reallocate<DynamicallySizedObject
>(address, 50)); | 1777 address = reinterpret_cast<uint8_t*>(Heap::reallocate<DynamicallySizedObject
>(address, 50)); |
1778 for (int i = 0; i < 50; i++) | 1778 for (int i = 0; i < 50; i++) |
1779 EXPECT_EQ(address[i], i); | 1779 EXPECT_EQ(address[i], i); |
1780 // This should be equivalent to free(address). | 1780 // This should be equivalent to free(address). |
1781 EXPECT_EQ(reinterpret_cast<uintptr_t>(Heap::reallocate<DynamicallySizedObjec
t>(address, 0)), 0ul); | 1781 EXPECT_EQ(reinterpret_cast<uintptr_t>(Heap::reallocate<DynamicallySizedObjec
t>(address, 0)), 0ul); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); | 1865 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); |
1866 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); | 1866 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); |
1867 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 1867 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
1868 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); | 1868 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); |
1869 } | 1869 } |
1870 | 1870 |
1871 class SimpleFinalizedEagerObjectBase : public GarbageCollectedFinalized<SimpleFi
nalizedEagerObjectBase> { | 1871 class SimpleFinalizedEagerObjectBase : public GarbageCollectedFinalized<SimpleFi
nalizedEagerObjectBase> { |
1872 public: | 1872 public: |
1873 virtual ~SimpleFinalizedEagerObjectBase() { } | 1873 virtual ~SimpleFinalizedEagerObjectBase() { } |
1874 DEFINE_INLINE_TRACE() { } | 1874 DEFINE_INLINE_TRACE() { } |
| 1875 |
1875 EAGERLY_FINALIZE(); | 1876 EAGERLY_FINALIZE(); |
1876 protected: | 1877 protected: |
1877 SimpleFinalizedEagerObjectBase() { } | 1878 SimpleFinalizedEagerObjectBase() { } |
1878 }; | 1879 }; |
1879 | 1880 |
1880 class SimpleFinalizedEagerObject : public SimpleFinalizedEagerObjectBase { | 1881 class SimpleFinalizedEagerObject : public SimpleFinalizedEagerObjectBase { |
1881 public: | 1882 public: |
1882 static SimpleFinalizedEagerObject* create() | 1883 static SimpleFinalizedEagerObject* create() |
1883 { | 1884 { |
1884 return new SimpleFinalizedEagerObject(); | 1885 return new SimpleFinalizedEagerObject(); |
(...skipping 4225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6110 { | 6111 { |
6111 Persistent<ClassWithMember> object = ClassWithMember::create(); | 6112 Persistent<ClassWithMember> object = ClassWithMember::create(); |
6112 EXPECT_EQ(0, object->traceCount()); | 6113 EXPECT_EQ(0, object->traceCount()); |
6113 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 6114 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
6114 EXPECT_TRUE(mixin); | 6115 EXPECT_TRUE(mixin); |
6115 EXPECT_GT(object->traceCount(), 0); | 6116 EXPECT_GT(object->traceCount(), 0); |
6116 EXPECT_GT(mixin->traceCount(), 0); | 6117 EXPECT_GT(mixin->traceCount(), 0); |
6117 } | 6118 } |
6118 | 6119 |
6119 } // namespace blink | 6120 } // namespace blink |
OLD | NEW |