| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); | 377 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); |
| 378 v8::V8::VisitHandlesWithClassIds(isolate, &visitor); | 378 v8::V8::VisitHandlesWithClassIds(isolate, &visitor); |
| 379 visitor.notifyFinished(); | 379 visitor.notifyFinished(); |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) | 383 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) |
| 384 { | 384 { |
| 385 // FIXME: It would be nice if the GC callbacks passed the Isolate directly..
.. | 385 // FIXME: It would be nice if the GC callbacks passed the Isolate directly..
.. |
| 386 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 386 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 387 if (type == v8::kGCTypeScavenge) | 387 if (type == v8::kGCTypeScavenge) { |
| 388 minorGCEpilogue(isolate); | 388 minorGCEpilogue(isolate); |
| 389 else if (type == v8::kGCTypeMarkSweepCompact) | 389 } else if (type == v8::kGCTypeMarkSweepCompact) { |
| 390 majorGCEpilogue(isolate); | 390 majorGCEpilogue(isolate); |
| 391 ThreadState::current()->didV8GC(); | 391 ThreadState::current()->didV8GC(); |
| 392 } |
| 392 | 393 |
| 393 // Forces a Blink heap garbage collection when a garbage collection | 394 // Forces a Blink heap garbage collection when a garbage collection |
| 394 // was forced from V8. This is used for tests that force GCs from | 395 // was forced from V8. This is used for tests that force GCs from |
| 395 // JavaScript to verify that objects die when expected. | 396 // JavaScript to verify that objects die when expected. |
| 396 if (flags & v8::kGCCallbackFlagForced) { | 397 if (flags & v8::kGCCallbackFlagForced) { |
| 397 // This single GC is not enough for two reasons: | 398 // This single GC is not enough for two reasons: |
| 398 // (1) The GC is not precise because the GC scans on-stack pointers co
nservatively. | 399 // (1) The GC is not precise because the GC scans on-stack pointers co
nservatively. |
| 399 // (2) One GC is not enough to break a chain of persistent handles. It
's possible that | 400 // (2) One GC is not enough to break a chain of persistent handles. It
's possible that |
| 400 // some heap allocated objects own objects that contain persistent
handles | 401 // some heap allocated objects own objects that contain persistent
handles |
| 401 // pointing to other heap allocated objects. To break the chain, w
e need multiple GCs. | 402 // pointing to other heap allocated objects. To break the chain, w
e need multiple GCs. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 Visitor* m_visitor; | 497 Visitor* m_visitor; |
| 497 }; | 498 }; |
| 498 | 499 |
| 499 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 500 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 500 { | 501 { |
| 501 DOMWrapperTracer tracer(visitor); | 502 DOMWrapperTracer tracer(visitor); |
| 502 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 503 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 503 } | 504 } |
| 504 | 505 |
| 505 } // namespace blink | 506 } // namespace blink |
| OLD | NEW |