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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 bool isLastInArray() const { return m_isLast; } | 1101 bool isLastInArray() const { return m_isLast; } |
1102 void setLastInArray(bool value) { m_isLast = value; } | 1102 void setLastInArray(bool value) { m_isLast = value; } |
1103 | 1103 |
1104 IntWrapper* payload() const { return m_payload; } | 1104 IntWrapper* payload() const { return m_payload; } |
1105 | 1105 |
1106 private: | 1106 private: |
1107 Member<IntWrapper> m_payload; | 1107 Member<IntWrapper> m_payload; |
1108 bool m_isLast; | 1108 bool m_isLast; |
1109 }; | 1109 }; |
1110 | 1110 |
| 1111 } // WebCore namespace |
| 1112 |
| 1113 namespace WTF { |
| 1114 |
| 1115 // We need the below vector trait specialization for the above HeapVectors to be
have correctly wrt. memset, memcmp etc. |
| 1116 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector
Traits<WebCore::VectorObject> { }; |
| 1117 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim
pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { }; |
| 1118 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas
sVectorTraits<WebCore::VectorObjectNoTrace> { }; |
| 1119 |
| 1120 } // WTF namespace |
| 1121 |
| 1122 namespace WebCore { |
| 1123 |
1111 TEST(HeapTest, Transition) | 1124 TEST(HeapTest, Transition) |
1112 { | 1125 { |
1113 { | 1126 { |
1114 RefPtr<TransitionRefCounted> refCounted = TransitionRefCounted::create()
; | 1127 RefPtr<TransitionRefCounted> refCounted = TransitionRefCounted::create()
; |
1115 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); | 1128 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); |
1116 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 1129 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
1117 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); | 1130 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); |
1118 } | 1131 } |
1119 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 1132 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
1120 EXPECT_EQ(0, TransitionRefCounted::s_aliveCount); | 1133 EXPECT_EQ(0, TransitionRefCounted::s_aliveCount); |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 for (size_t i = 0; i < prefixSize + suffixSize; i++) | 2817 for (size_t i = 0; i < prefixSize + suffixSize; i++) |
2805 EXPECT_EQ(i, static_cast<size_t>(arr->at(i).payload()->value())); | 2818 EXPECT_EQ(i, static_cast<size_t>(arr->at(i).payload()->value())); |
2806 } | 2819 } |
2807 | 2820 |
2808 arr = 0; | 2821 arr = 0; |
2809 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 2822 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
2810 EXPECT_EQ(8, IntWrapper::s_destructorCalls); | 2823 EXPECT_EQ(8, IntWrapper::s_destructorCalls); |
2811 } | 2824 } |
2812 | 2825 |
2813 } // WebCore namespace | 2826 } // WebCore namespace |
2814 | |
2815 namespace WTF { | |
2816 | |
2817 // We need the below vector trait specialization for the above HeapVectors to be
have correctly wrt. memset, memcmp etc. | |
2818 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector
Traits<WebCore::VectorObject> { }; | |
2819 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim
pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { }; | |
2820 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas
sVectorTraits<WebCore::VectorObjectNoTrace> { }; | |
2821 | |
2822 } // WTF namespace | |
2823 | |
OLD | NEW |