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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MajorGC"); | 369 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MajorGC"); |
370 } else { | 370 } else { |
371 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); | 371 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 } | 375 } |
376 | 376 |
377 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) | 377 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) |
378 { | 378 { |
379 // Finish Oilpan's complete sweeping before running a V8 GC. | |
380 // This will let the GC collect more V8 objects. | |
381 // | |
382 // TODO(haraken): It's a bit too late for a major GC to schedule | |
383 // completeSweep() here, because gcPrologue for a major GC is called | |
384 // not at the point where the major GC started but at the point where | |
385 // the major GC requests object grouping. | |
386 if (ThreadState::current()) | 379 if (ThreadState::current()) |
387 ThreadState::current()->completeSweep(); | 380 ThreadState::current()->willStartV8GC(); |
388 | 381 |
389 if (isMainThread()) { | 382 if (isMainThread()) { |
390 ScriptForbiddenScope::enter(); | 383 ScriptForbiddenScope::enter(); |
391 } | 384 } |
392 | 385 |
393 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate | 386 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate |
394 // directly. | 387 // directly. |
395 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 388 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
396 v8::HandleScope scope(isolate); | 389 v8::HandleScope scope(isolate); |
397 switch (type) { | 390 switch (type) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 Visitor* m_visitor; | 541 Visitor* m_visitor; |
549 }; | 542 }; |
550 | 543 |
551 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 544 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
552 { | 545 { |
553 DOMWrapperTracer tracer(visitor); | 546 DOMWrapperTracer tracer(visitor); |
554 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 547 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
555 } | 548 } |
556 | 549 |
557 } // namespace blink | 550 } // namespace blink |
OLD | NEW |