Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 1652103003: Oilpan: Remove synchronous completeSweep() from V8's minor GC prologue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal lbackFlags flags) 284 void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal lbackFlags flags)
285 { 285 {
286 if (isMainThread()) 286 if (isMainThread())
287 ScriptForbiddenScope::enter(); 287 ScriptForbiddenScope::enter();
288 288
289 // TODO(haraken): A GC callback is not allowed to re-enter V8. This means 289 // TODO(haraken): A GC callback is not allowed to re-enter V8. This means
290 // that it's unsafe to run Oilpan's GC in the GC callback because it may 290 // that it's unsafe to run Oilpan's GC in the GC callback because it may
291 // run finalizers that call into V8. To avoid the risk, we should post 291 // run finalizers that call into V8. To avoid the risk, we should post
292 // a task to schedule the Oilpan's GC. 292 // a task to schedule the Oilpan's GC.
293 // (In practice, there is no finalizer that calls into V8 and thus is safe.) 293 // (In practice, there is no finalizer that calls into V8 and thus is safe.)
294 if (ThreadState::current())
295 ThreadState::current()->willStartV8GC();
296 294
297 v8::HandleScope scope(isolate); 295 v8::HandleScope scope(isolate);
298 switch (type) { 296 switch (type) {
299 case v8::kGCTypeScavenge: 297 case v8::kGCTypeScavenge:
298 if (ThreadState::current())
299 ThreadState::current()->willStartV8GC(BlinkGC::V8MinorGC);
300
300 TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefor e", usedHeapSize(isolate)); 301 TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefor e", usedHeapSize(isolate));
301 if (isMainThread()) { 302 if (isMainThread()) {
302 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); 303 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC");
303 } 304 }
304 visitWeakHandlesForMinorGC(isolate); 305 visitWeakHandlesForMinorGC(isolate);
305 if (isMainThread()) { 306 if (isMainThread()) {
306 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVEN T_GET_SAMPLING_STATE()); 307 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVEN T_GET_SAMPLING_STATE());
307 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC"); 308 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC");
308 } 309 }
309 break; 310 break;
310 case v8::kGCTypeMarkSweepCompact: 311 case v8::kGCTypeMarkSweepCompact:
312 if (ThreadState::current())
313 ThreadState::current()->willStartV8GC(BlinkGC::V8MajorGC);
314
311 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "atomic pause"); 315 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "atomic pause");
312 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain edObjectInfos); 316 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain edObjectInfos);
313 break; 317 break;
314 case v8::kGCTypeIncrementalMarking: 318 case v8::kGCTypeIncrementalMarking:
319 if (ThreadState::current())
320 ThreadState::current()->willStartV8GC(BlinkGC::V8MajorGC);
321
315 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "incremental marking"); 322 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "incremental marking");
316 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain edObjectInfos); 323 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain edObjectInfos);
317 break; 324 break;
318 case v8::kGCTypeProcessWeakCallbacks: 325 case v8::kGCTypeProcessWeakCallbacks:
319 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "weak processing"); 326 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor e", usedHeapSize(isolate), "type", "weak processing");
320 if (isMainThread()) { 327 if (isMainThread()) {
321 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVEN T_GET_SAMPLING_STATE()); 328 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVEN T_GET_SAMPLING_STATE());
322 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMajorGC"); 329 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMajorGC");
323 } 330 }
324 break; 331 break;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 Visitor* m_visitor; 460 Visitor* m_visitor;
454 }; 461 };
455 462
456 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) 463 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor)
457 { 464 {
458 DOMWrapperTracer tracer(visitor); 465 DOMWrapperTracer tracer(visitor);
459 isolate->VisitHandlesWithClassIds(&tracer); 466 isolate->VisitHandlesWithClassIds(&tracer);
460 } 467 }
461 468
462 } // namespace blink 469 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698