Chromium Code Reviews| 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 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // { | |
| 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 // } | |
|
haraken
2016/11/02 01:12:47
Can we remove this comment? It's not worth adding
chcunningham
2016/11/02 01:19:06
Sorry, I mean to uncomment it actually, but it doe
haraken
2016/11/02 01:22:30
Ah, actually this test doesn't make sense in the f
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |