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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 | 332 |
333 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) | 333 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) |
334 { | 334 { |
335 // FIXME: It would be nice if the GC callbacks passed the Isolate directly..
.. | 335 // FIXME: It would be nice if the GC callbacks passed the Isolate directly..
.. |
336 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 336 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
337 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent"
, "usedHeapSizeBefore", usedHeapSize(isolate)); | 337 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent"
, "usedHeapSizeBefore", usedHeapSize(isolate)); |
338 if (type == v8::kGCTypeScavenge) | 338 if (type == v8::kGCTypeScavenge) |
339 minorGCPrologue(isolate); | 339 minorGCPrologue(isolate); |
340 else if (type == v8::kGCTypeMarkSweepCompact) | 340 else if (type == v8::kGCTypeMarkSweepCompact) |
341 majorGCPrologue(flags & v8::kGCCallbackFlagConstructRetainedObjectInfos,
isolate); | 341 majorGCPrologue(isolate, flags & v8::kGCCallbackFlagConstructRetainedObj
ectInfos); |
342 } | 342 } |
343 | 343 |
344 void V8GCController::minorGCPrologue(v8::Isolate* isolate) | 344 void V8GCController::minorGCPrologue(v8::Isolate* isolate) |
345 { | 345 { |
346 TRACE_EVENT_BEGIN0("v8", "minorGC"); | 346 TRACE_EVENT_BEGIN0("v8", "minorGC"); |
347 if (isMainThread()) { | 347 if (isMainThread()) { |
348 ScriptForbiddenScope::enter(); | 348 ScriptForbiddenScope::enter(); |
349 { | 349 { |
350 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); | 350 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); |
351 v8::HandleScope scope(isolate); | 351 v8::HandleScope scope(isolate); |
352 MinorGCWrapperVisitor visitor(isolate); | 352 MinorGCWrapperVisitor visitor(isolate); |
353 v8::V8::VisitHandlesForPartialDependence(isolate, &visitor); | 353 v8::V8::VisitHandlesForPartialDependence(isolate, &visitor); |
354 visitor.notifyFinished(); | 354 visitor.notifyFinished(); |
355 } | 355 } |
356 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GE
T_SAMPLING_STATE()); | 356 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GE
T_SAMPLING_STATE()); |
357 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC"); | 357 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC"); |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 // Create object groups for DOM tree nodes. | 361 // Create object groups for DOM tree nodes. |
362 void V8GCController::majorGCPrologue(bool constructRetainedObjectInfos, v8::Isol
ate* isolate) | 362 void V8GCController::majorGCPrologue(v8::Isolate* isolate, bool constructRetaine
dObjectInfos) |
363 { | 363 { |
364 v8::HandleScope scope(isolate); | 364 v8::HandleScope scope(isolate); |
365 TRACE_EVENT_BEGIN0("v8", "majorGC"); | 365 TRACE_EVENT_BEGIN0("v8", "majorGC"); |
366 if (isMainThread()) { | 366 if (isMainThread()) { |
367 ScriptForbiddenScope::enter(); | 367 ScriptForbiddenScope::enter(); |
368 { | 368 { |
369 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMajorGC"); | 369 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMajorGC"); |
370 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos)
; | 370 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos)
; |
371 v8::V8::VisitHandlesWithClassIds(isolate, &visitor); | 371 v8::V8::VisitHandlesWithClassIds(isolate, &visitor); |
372 visitor.notifyFinished(); | 372 visitor.notifyFinished(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 Visitor* m_visitor; | 495 Visitor* m_visitor; |
496 }; | 496 }; |
497 | 497 |
498 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 498 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
499 { | 499 { |
500 DOMWrapperTracer tracer(visitor); | 500 DOMWrapperTracer tracer(visitor); |
501 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 501 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
502 } | 502 } |
503 | 503 |
504 } // namespace blink | 504 } // namespace blink |
OLD | NEW |