| 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 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3314 // This is a low-level test where we call checkAndMarkPointer. This method | 3314 // This is a low-level test where we call checkAndMarkPointer. This method |
| 3315 // causes the object start bitmap to be computed which requires the heap | 3315 // causes the object start bitmap to be computed which requires the heap |
| 3316 // to be in a consistent state (e.g. the free allocation area must be put | 3316 // to be in a consistent state (e.g. the free allocation area must be put |
| 3317 // into a free list header). However when we call makeConsistentForSweeping
it | 3317 // into a free list header). However when we call makeConsistentForSweeping
it |
| 3318 // also clears out the freelists so we have to rebuild those before trying | 3318 // also clears out the freelists so we have to rebuild those before trying |
| 3319 // to allocate anything again. We do this by forcing a GC after doing the | 3319 // to allocate anything again. We do this by forcing a GC after doing the |
| 3320 // checkAndMarkPointer tests. | 3320 // checkAndMarkPointer tests. |
| 3321 { | 3321 { |
| 3322 TestGCScope scope(ThreadState::HeapPointersOnStack); | 3322 TestGCScope scope(ThreadState::HeapPointersOnStack); |
| 3323 EXPECT_TRUE(scope.allThreadsParked()); // Fail the test if we could not
park all threads. | 3323 EXPECT_TRUE(scope.allThreadsParked()); // Fail the test if we could not
park all threads. |
| 3324 Heap::prepareForGC(); | 3324 Heap::makeConsistentForSweeping(); |
| 3325 for (size_t i = 0; i < objectAddresses.size(); i++) { | 3325 for (size_t i = 0; i < objectAddresses.size(); i++) { |
| 3326 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, objectAddresses[i]))
; | 3326 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, objectAddresses[i]))
; |
| 3327 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, endAddresses[i])); | 3327 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, endAddresses[i])); |
| 3328 } | 3328 } |
| 3329 EXPECT_EQ(objectAddresses.size() * 2, visitor.count()); | 3329 EXPECT_EQ(objectAddresses.size() * 2, visitor.count()); |
| 3330 visitor.reset(); | 3330 visitor.reset(); |
| 3331 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, largeObjectAddress)); | 3331 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, largeObjectAddress)); |
| 3332 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, largeObjectEndAddress)); | 3332 EXPECT_TRUE(Heap::checkAndMarkPointer(&visitor, largeObjectEndAddress)); |
| 3333 EXPECT_EQ(2ul, visitor.count()); | 3333 EXPECT_EQ(2ul, visitor.count()); |
| 3334 visitor.reset(); | 3334 visitor.reset(); |
| (...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5332 TEST(HeapTest, NonNodeAllocatingNodeInDestructor) | 5332 TEST(HeapTest, NonNodeAllocatingNodeInDestructor) |
| 5333 { | 5333 { |
| 5334 new NonNodeAllocatingNodeInDestructor(); | 5334 new NonNodeAllocatingNodeInDestructor(); |
| 5335 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 5335 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 5336 EXPECT_EQ(10, (*NonNodeAllocatingNodeInDestructor::s_node)->value()); | 5336 EXPECT_EQ(10, (*NonNodeAllocatingNodeInDestructor::s_node)->value()); |
| 5337 delete NonNodeAllocatingNodeInDestructor::s_node; | 5337 delete NonNodeAllocatingNodeInDestructor::s_node; |
| 5338 NonNodeAllocatingNodeInDestructor::s_node = 0; | 5338 NonNodeAllocatingNodeInDestructor::s_node = 0; |
| 5339 } | 5339 } |
| 5340 | 5340 |
| 5341 } // namespace blink | 5341 } // namespace blink |
| OLD | NEW |