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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 { \ | 232 { \ |
233 return ensureMarked(objectPointer); \ | 233 return ensureMarked(objectPointer); \ |
234 } | 234 } |
235 | 235 |
236 class CountingVisitor : public Visitor { | 236 class CountingVisitor : public Visitor { |
237 public: | 237 public: |
238 CountingVisitor() | 238 CountingVisitor() |
239 : Visitor(Visitor::GenericVisitorType) | 239 : Visitor(Visitor::GenericVisitorType) |
240 , m_count(0) | 240 , m_count(0) |
241 { | 241 { |
| 242 configureEagerTraceLimit(); |
242 } | 243 } |
243 | 244 |
244 virtual void mark(const void* object, TraceCallback) override | 245 virtual void mark(const void* object, TraceCallback) override |
245 { | 246 { |
246 if (object) | 247 if (object) |
247 m_count++; | 248 m_count++; |
248 } | 249 } |
249 | 250 |
250 virtual void markHeader(HeapObjectHeader* header, TraceCallback callback) ov
erride | 251 virtual void markHeader(HeapObjectHeader* header, TraceCallback callback) ov
erride |
251 { | 252 { |
(...skipping 5213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5465 static int sTraceLazy; | 5466 static int sTraceLazy; |
5466 }; | 5467 }; |
5467 | 5468 |
5468 int DeepEagerly::sTraceCalls = 0; | 5469 int DeepEagerly::sTraceCalls = 0; |
5469 int DeepEagerly::sTraceLazy = 0; | 5470 int DeepEagerly::sTraceLazy = 0; |
5470 | 5471 |
5471 TEST(HeapTest, TraceDeepEagerly) | 5472 TEST(HeapTest, TraceDeepEagerly) |
5472 { | 5473 { |
5473 #if !ENABLE(ASSERT) | 5474 #if !ENABLE(ASSERT) |
5474 DeepEagerly* obj = nullptr; | 5475 DeepEagerly* obj = nullptr; |
5475 for (int i = 0; i < 2000; i++) | 5476 for (int i = 0; i < 10000; i++) |
5476 obj = new DeepEagerly(obj); | 5477 obj = new DeepEagerly(obj); |
5477 | 5478 |
5478 Persistent<DeepEagerly> persistent(obj); | 5479 Persistent<DeepEagerly> persistent(obj); |
5479 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 5480 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
5480 | 5481 |
5481 // Verify that the DeepEagerly chain isn't completely unravelled | 5482 // Verify that the DeepEagerly chain isn't completely unravelled |
5482 // by performing eager trace() calls, but the explicit mark | 5483 // by performing eager trace() calls, but the explicit mark |
5483 // stack is switched once some nesting limit is exceeded. | 5484 // stack is switched once some nesting limit is exceeded. |
5484 EXPECT_GT(DeepEagerly::sTraceLazy, 2); | 5485 EXPECT_GT(DeepEagerly::sTraceLazy, 2); |
5485 #endif | 5486 #endif |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5528 // re-adjusting both start&end indices in terms of that expanded buffer. | 5529 // re-adjusting both start&end indices in terms of that expanded buffer. |
5529 EXPECT_EQ(80u, deque->size()); | 5530 EXPECT_EQ(80u, deque->size()); |
5530 i = 0; | 5531 i = 0; |
5531 for (const auto& intWrapper : *deque) { | 5532 for (const auto& intWrapper : *deque) { |
5532 EXPECT_EQ(i + 50, intWrapper->value()); | 5533 EXPECT_EQ(i + 50, intWrapper->value()); |
5533 i++; | 5534 i++; |
5534 } | 5535 } |
5535 } | 5536 } |
5536 | 5537 |
5537 } // namespace blink | 5538 } // namespace blink |
OLD | NEW |