| 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 25 matching lines...) Expand all Loading... |
| 36 #include "platform/heap/Heap.h" | 36 #include "platform/heap/Heap.h" |
| 37 #include "platform/heap/HeapLinkedStack.h" | 37 #include "platform/heap/HeapLinkedStack.h" |
| 38 #include "platform/heap/HeapTerminatedArrayBuilder.h" | 38 #include "platform/heap/HeapTerminatedArrayBuilder.h" |
| 39 #include "platform/heap/SafePoint.h" | 39 #include "platform/heap/SafePoint.h" |
| 40 #include "platform/heap/ThreadState.h" | 40 #include "platform/heap/ThreadState.h" |
| 41 #include "platform/heap/Visitor.h" | 41 #include "platform/heap/Visitor.h" |
| 42 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
| 43 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
| 44 #include "wtf/HashTraits.h" | 44 #include "wtf/HashTraits.h" |
| 45 #include "wtf/LinkedHashSet.h" | 45 #include "wtf/LinkedHashSet.h" |
| 46 #include "wtf/SizeAssertions.h" |
| 46 | 47 |
| 47 #include <gtest/gtest.h> | 48 #include <gtest/gtest.h> |
| 48 | 49 |
| 49 namespace blink { | 50 namespace blink { |
| 50 | 51 |
| 51 static void preciselyCollectGarbage() | 52 static void preciselyCollectGarbage() |
| 52 { | 53 { |
| 53 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 54 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
| 54 } | 55 } |
| 55 | 56 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 81 | 82 |
| 82 IntWrapper(int x) : m_x(x) { } | 83 IntWrapper(int x) : m_x(x) { } |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 IntWrapper(); | 86 IntWrapper(); |
| 86 int m_x; | 87 int m_x; |
| 87 }; | 88 }; |
| 88 static_assert(WTF::NeedsTracing<IntWrapper>::value, "NeedsTracing macro failed t
o recognize trace method."); | 89 static_assert(WTF::NeedsTracing<IntWrapper>::value, "NeedsTracing macro failed t
o recognize trace method."); |
| 89 | 90 |
| 90 #if !ENABLE(GC_PROFILING) | 91 #if !ENABLE(GC_PROFILING) |
| 91 struct SameSizeAsPersistent { | 92 ASSERT_SIZE(Persistent<IntWrapper>, 16, 16); |
| 92 void* m_pointer[4]; | |
| 93 }; | |
| 94 | |
| 95 static_assert(sizeof(Persistent<IntWrapper>) <= sizeof(SameSizeAsPersistent), "P
ersistent handle should stay small"); | |
| 96 #endif | 93 #endif |
| 97 | 94 |
| 98 class ThreadMarker { | 95 class ThreadMarker { |
| 99 public: | 96 public: |
| 100 ThreadMarker() : m_creatingThread(reinterpret_cast<ThreadState*>(0)), m_num(
0) { } | 97 ThreadMarker() : m_creatingThread(reinterpret_cast<ThreadState*>(0)), m_num(
0) { } |
| 101 ThreadMarker(unsigned i) : m_creatingThread(ThreadState::current()), m_num(i
) { } | 98 ThreadMarker(unsigned i) : m_creatingThread(ThreadState::current()), m_num(i
) { } |
| 102 ThreadMarker(WTF::HashTableDeletedValueType deleted) : m_creatingThread(rein
terpret_cast<ThreadState*>(-1)), m_num(0) { } | 99 ThreadMarker(WTF::HashTableDeletedValueType deleted) : m_creatingThread(rein
terpret_cast<ThreadState*>(-1)), m_num(0) { } |
| 103 ~ThreadMarker() | 100 ~ThreadMarker() |
| 104 { | 101 { |
| 105 EXPECT_TRUE((m_creatingThread == ThreadState::current()) | 102 EXPECT_TRUE((m_creatingThread == ThreadState::current()) |
| (...skipping 6324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6430 { | 6427 { |
| 6431 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); | 6428 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); |
| 6432 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); | 6429 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); |
| 6433 } | 6430 } |
| 6434 | 6431 |
| 6435 wakeWorkerThread(); | 6432 wakeWorkerThread(); |
| 6436 parkMainThread(); | 6433 parkMainThread(); |
| 6437 } | 6434 } |
| 6438 | 6435 |
| 6439 } // namespace blink | 6436 } // namespace blink |
| OLD | NEW |