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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 void runThread() | 277 void runThread() |
278 { | 278 { |
279 ThreadState::attach(); | 279 ThreadState::attach(); |
280 | 280 |
281 int gcCount = 0; | 281 int gcCount = 0; |
282 while (!done()) { | 282 while (!done()) { |
283 ThreadState::current()->safePoint(ThreadState::NoHeapPointersOnStack
); | 283 ThreadState::current()->safePoint(ThreadState::NoHeapPointersOnStack
); |
284 { | 284 { |
285 IntWrapper* wrapper; | 285 IntWrapper* wrapper; |
286 | 286 |
| 287 typedef Persistent<IntWrapper, GlobalPersistents> GlobalIntWrapp
erPersistent; |
| 288 OwnPtr<GlobalIntWrapperPersistent> globalPersistent = adoptPtr(n
ew GlobalIntWrapperPersistent(IntWrapper::create(0x0ed0cabb))); |
| 289 |
287 for (int i = 0; i < numberOfAllocations; i++) { | 290 for (int i = 0; i < numberOfAllocations; i++) { |
288 wrapper = IntWrapper::create(0x0bbac0de); | 291 wrapper = IntWrapper::create(0x0bbac0de); |
289 if (!(i % 10)) | 292 if (!(i % 10)) { |
| 293 globalPersistent = adoptPtr(new GlobalIntWrapperPersiste
nt(IntWrapper::create(0x0ed0cabb))); |
290 ThreadState::current()->safePoint(ThreadState::HeapPoint
ersOnStack); | 294 ThreadState::current()->safePoint(ThreadState::HeapPoint
ersOnStack); |
| 295 } |
291 yield(); | 296 yield(); |
292 } | 297 } |
293 | 298 |
294 if (gcCount < gcPerThread) { | 299 if (gcCount < gcPerThread) { |
295 Heap::collectGarbage(ThreadState::HeapPointersOnStack); | 300 Heap::collectGarbage(ThreadState::HeapPointersOnStack); |
296 gcCount++; | 301 gcCount++; |
297 atomicIncrement(&m_gcCount); | 302 atomicIncrement(&m_gcCount); |
298 } | 303 } |
299 | 304 |
300 EXPECT_EQ(wrapper->value(), 0x0bbac0de); | 305 EXPECT_EQ(wrapper->value(), 0x0bbac0de); |
| 306 EXPECT_EQ((*globalPersistent)->value(), 0x0ed0cabb); |
301 } | 307 } |
302 yield(); | 308 yield(); |
303 } | 309 } |
304 ThreadState::current()->cleanup(); | 310 ThreadState::current()->cleanup(); |
305 ThreadState::detach(); | 311 ThreadState::detach(); |
306 atomicDecrement(&m_threadsToFinish); | 312 atomicDecrement(&m_threadsToFinish); |
307 } | 313 } |
308 | 314 |
309 volatile int m_gcCount; | 315 volatile int m_gcCount; |
310 volatile int m_threadsToFinish; | 316 volatile int m_threadsToFinish; |
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 DEFINE_GC_INFO(RefCountedAndGarbageCollected2); | 2317 DEFINE_GC_INFO(RefCountedAndGarbageCollected2); |
2312 DEFINE_GC_INFO(SimpleFinalizedObject); | 2318 DEFINE_GC_INFO(SimpleFinalizedObject); |
2313 DEFINE_GC_INFO(SimpleObject); | 2319 DEFINE_GC_INFO(SimpleObject); |
2314 DEFINE_GC_INFO(SuperClass); | 2320 DEFINE_GC_INFO(SuperClass); |
2315 DEFINE_GC_INFO(SubData); | 2321 DEFINE_GC_INFO(SubData); |
2316 DEFINE_GC_INFO(TestTypedHeapClass); | 2322 DEFINE_GC_INFO(TestTypedHeapClass); |
2317 DEFINE_GC_INFO(TraceCounter); | 2323 DEFINE_GC_INFO(TraceCounter); |
2318 DEFINE_GC_INFO(TransitionRefCounted); | 2324 DEFINE_GC_INFO(TransitionRefCounted); |
2319 | 2325 |
2320 } // namespace | 2326 } // namespace |
OLD | NEW |