Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: Source/platform/heap/HeapTest.cpp

Issue 406523002: Oilpan: Make sure that vtables for garbage collected mixin objects have (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix non-oilpan compilation Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4823 matching lines...) Expand 10 before | Expand all | Expand 10 after
4834 static volatile uintptr_t s_workerObjectPointer; 4834 static volatile uintptr_t s_workerObjectPointer;
4835 }; 4835 };
4836 4836
4837 volatile uintptr_t DeadBitTester::s_workerObjectPointer = 0; 4837 volatile uintptr_t DeadBitTester::s_workerObjectPointer = 0;
4838 4838
4839 TEST(HeapTest, ObjectDeadBit) 4839 TEST(HeapTest, ObjectDeadBit)
4840 { 4840 {
4841 DeadBitTester::test(); 4841 DeadBitTester::test();
4842 } 4842 }
4843 4843
4844 class MixinWithGarbageCollectionInConstructor : public GarbageCollectedMixin {
4845 public:
4846 MixinWithGarbageCollectionInConstructor()
4847 {
4848 Heap::collectGarbage(ThreadState::HeapPointersOnStack);
4849 }
4850 };
4851
4852 class ClassWithGarbageCollectingMixinConstructor
4853 : public GarbageCollected<ClassWithGarbageCollectingMixinConstructor>
4854 , public MixinWithGarbageCollectionInConstructor {
4855 USING_GARBAGE_COLLECTED_MIXIN(ClassWithGarbageCollectingMixinConstructor);
4856 public:
4857 ClassWithGarbageCollectingMixinConstructor() : m_wrapper(IntWrapper::create( 32))
4858 {
4859 }
4860
4861 virtual void trace(Visitor* visitor)
4862 {
4863 visitor->trace(m_wrapper);
4864 }
4865
4866 void verify()
4867 {
4868 EXPECT_EQ(32, m_wrapper->value());
4869 }
4870
4871 private:
4872 Member<IntWrapper> m_wrapper;
4873 };
4874
4875 // Regression test for out of bounds call through vtable.
4876 // Passes if it doesn't crash.
4877 TEST(HeapTest, GarbageCollectionDuringMixinConstruction)
4878 {
4879 ClassWithGarbageCollectingMixinConstructor* a =
4880 new ClassWithGarbageCollectingMixinConstructor();
4881 a->verify();
4882 }
4883
4844 } // WebCore namespace 4884 } // WebCore namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698