| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 minorGCPrologue(isolate); | 325 minorGCPrologue(isolate); |
| 326 else if (type == v8::kGCTypeMarkSweepCompact) | 326 else if (type == v8::kGCTypeMarkSweepCompact) |
| 327 majorGCPrologue(flags & v8::kGCCallbackFlagConstructRetainedObjectInfos,
isolate); | 327 majorGCPrologue(flags & v8::kGCCallbackFlagConstructRetainedObjectInfos,
isolate); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void V8GCController::minorGCPrologue(v8::Isolate* isolate) | 330 void V8GCController::minorGCPrologue(v8::Isolate* isolate) |
| 331 { | 331 { |
| 332 TRACE_EVENT_BEGIN0("v8", "minorGC"); | 332 TRACE_EVENT_BEGIN0("v8", "minorGC"); |
| 333 if (isMainThread()) { | 333 if (isMainThread()) { |
| 334 { | 334 { |
| 335 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "MinorGC"); | 335 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMMinorGC"); |
| 336 v8::HandleScope scope(isolate); | 336 v8::HandleScope scope(isolate); |
| 337 MinorGCWrapperVisitor visitor(isolate); | 337 MinorGCWrapperVisitor visitor(isolate); |
| 338 v8::V8::VisitHandlesForPartialDependence(isolate, &visitor); | 338 v8::V8::VisitHandlesForPartialDependence(isolate, &visitor); |
| 339 visitor.notifyFinished(); | 339 visitor.notifyFinished(); |
| 340 } | 340 } |
| 341 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GE
T_SAMPLING_STATE()); | 341 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GE
T_SAMPLING_STATE()); |
| 342 TRACE_EVENT_SET_SAMPLING_STATE("V8", "MinorGC"); | 342 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8MinorGC"); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Create object groups for DOM tree nodes. | 346 // Create object groups for DOM tree nodes. |
| 347 void V8GCController::majorGCPrologue(bool constructRetainedObjectInfos, v8::Isol
ate* isolate) | 347 void V8GCController::majorGCPrologue(bool constructRetainedObjectInfos, v8::Isol
ate* isolate) |
| 348 { | 348 { |
| 349 v8::HandleScope scope(isolate); | 349 v8::HandleScope scope(isolate); |
| 350 TRACE_EVENT_BEGIN0("v8", "majorGC"); | 350 TRACE_EVENT_BEGIN0("v8", "majorGC"); |
| 351 if (isMainThread()) { | 351 if (isMainThread()) { |
| 352 { | 352 { |
| 353 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "MajorGC"); | 353 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMMajorGC"); |
| 354 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos)
; | 354 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos)
; |
| 355 v8::V8::VisitHandlesWithClassIds(&visitor); | 355 v8::V8::VisitHandlesWithClassIds(&visitor); |
| 356 visitor.notifyFinished(); | 356 visitor.notifyFinished(); |
| 357 } | 357 } |
| 358 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GE
T_SAMPLING_STATE()); | 358 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVENT_GE
T_SAMPLING_STATE()); |
| 359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "MajorGC"); | 359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8MajorGC"); |
| 360 } else { | 360 } else { |
| 361 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); | 361 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); |
| 362 v8::V8::VisitHandlesWithClassIds(&visitor); | 362 v8::V8::VisitHandlesWithClassIds(&visitor); |
| 363 visitor.notifyFinished(); | 363 visitor.notifyFinished(); |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) | 367 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) |
| 368 { | 368 { |
| 369 // FIXME: It would be nice if the GC callbacks passed the Isolate directly..
.. | 369 // FIXME: It would be nice if the GC callbacks passed the Isolate directly..
.. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 { | 405 { |
| 406 v8::HandleScope handleScope(isolate); | 406 v8::HandleScope handleScope(isolate); |
| 407 v8::Local<v8::Context> context = v8::Context::New(isolate); | 407 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 408 if (context.IsEmpty()) | 408 if (context.IsEmpty()) |
| 409 return; | 409 return; |
| 410 v8::Context::Scope contextScope(context); | 410 v8::Context::Scope contextScope(context); |
| 411 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc();
"), isolate); | 411 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc();
"), isolate); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace WebCore | 414 } // namespace WebCore |
| OLD | NEW |