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

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

Issue 2464273002: Fix ThreadHeap::isHeapObjectAlive(const T*& ptr) stack overflow. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 } 3915 }
3916 3916
3917 TEST(HeapTest, Comparisons) { 3917 TEST(HeapTest, Comparisons) {
3918 Persistent<Bar> barPersistent = Bar::create(); 3918 Persistent<Bar> barPersistent = Bar::create();
3919 Persistent<Foo> fooPersistent = Foo::create(barPersistent); 3919 Persistent<Foo> fooPersistent = Foo::create(barPersistent);
3920 EXPECT_TRUE(barPersistent != fooPersistent); 3920 EXPECT_TRUE(barPersistent != fooPersistent);
3921 barPersistent = fooPersistent; 3921 barPersistent = fooPersistent;
3922 EXPECT_TRUE(barPersistent == fooPersistent); 3922 EXPECT_TRUE(barPersistent == fooPersistent);
3923 } 3923 }
3924 3924
3925 TEST(HeapTest, CheckConstObjectAlive) {
3926 SimpleObject* object = SimpleObject::create();
3927 const SimpleObject* constObject = object;
3928
3929 EXPECT_FALSE(ThreadHeap::isHeapObjectAlive(object));
3930 EXPECT_FALSE(ThreadHeap::isHeapObjectAlive(constObject));
3931
3932 // {
chcunningham 2016/11/01 23:26:05 I'd like to test the isHeapObjectAlive = TRUE case
3933 // TestGCScope scope(BlinkGC::HeapPointersOnStack);
3934 // ThreadHeap& heap = ThreadState::current()->heap();
3935 // CountingVisitor visitor(ThreadState::current());
3936
3937 // Address objectAddress = reinterpret_cast<Address>(object);
3938 // EXPECT_TRUE(heap.checkAndMarkPointer(&visitor, objectAddress));
3939
3940 // EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(object));
3941 // EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(constObject));
3942 // }
3943 }
3944
3925 TEST(HeapTest, CheckAndMarkPointer) { 3945 TEST(HeapTest, CheckAndMarkPointer) {
3926 ThreadHeap& heap = ThreadState::current()->heap(); 3946 ThreadHeap& heap = ThreadState::current()->heap();
3927 clearOutOldGarbage(); 3947 clearOutOldGarbage();
3928 3948
3929 Vector<Address> objectAddresses; 3949 Vector<Address> objectAddresses;
3930 Vector<Address> endAddresses; 3950 Vector<Address> endAddresses;
3931 Address largeObjectAddress; 3951 Address largeObjectAddress;
3932 Address largeObjectEndAddress; 3952 Address largeObjectEndAddress;
3933 for (int i = 0; i < 10; i++) { 3953 for (int i = 0; i < 10; i++) {
3934 SimpleObject* object = SimpleObject::create(); 3954 SimpleObject* object = SimpleObject::create();
(...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after
6801 "HeapVector"); 6821 "HeapVector");
6802 static_assert( 6822 static_assert(
6803 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, 6823 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value,
6804 "HeapDeque"); 6824 "HeapDeque");
6805 static_assert(WTF::IsGarbageCollectedType< 6825 static_assert(WTF::IsGarbageCollectedType<
6806 HeapTerminatedArray<Member<IntWrapper>>>::value, 6826 HeapTerminatedArray<Member<IntWrapper>>>::value,
6807 "HeapTerminatedArray"); 6827 "HeapTerminatedArray");
6808 } 6828 }
6809 6829
6810 } // namespace blink 6830 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698