| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MajorGC"); | 267 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MajorGC"); |
| 268 } else { | 268 } else { |
| 269 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); | 269 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 } | 273 } |
| 274 | 274 |
| 275 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) | 275 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) |
| 276 { | 276 { |
| 277 if (ThreadState::current()) | |
| 278 ThreadState::current()->willStartV8GC(); | |
| 279 | |
| 280 if (isMainThread()) { | 277 if (isMainThread()) { |
| 281 ScriptForbiddenScope::enter(); | 278 ScriptForbiddenScope::enter(); |
| 282 } | 279 } |
| 283 | 280 |
| 281 // TODO(haraken): It is not safe to run finalizers in a prologue callback |
| 282 // because V8AbstractEventListener's destructor cann call into V8. We |
| 283 // should post a task to schedule willStartV8GC() and avoid running it |
| 284 // inside the prologue callback. |
| 285 // if (ThreadState::current()) |
| 286 // ThreadState::current()->willStartV8GC(); |
| 287 |
| 284 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate | 288 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate |
| 285 // directly. | 289 // directly. |
| 286 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 290 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 287 v8::HandleScope scope(isolate); | 291 v8::HandleScope scope(isolate); |
| 288 switch (type) { | 292 switch (type) { |
| 289 case v8::kGCTypeScavenge: | 293 case v8::kGCTypeScavenge: |
| 290 TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate)); | 294 TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate)); |
| 291 if (isMainThread()) { | 295 if (isMainThread()) { |
| 292 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); | 296 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); |
| 293 } | 297 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 Visitor* m_visitor; | 443 Visitor* m_visitor; |
| 440 }; | 444 }; |
| 441 | 445 |
| 442 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 446 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 443 { | 447 { |
| 444 DOMWrapperTracer tracer(visitor); | 448 DOMWrapperTracer tracer(visitor); |
| 445 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 449 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 446 } | 450 } |
| 447 | 451 |
| 448 } // namespace blink | 452 } // namespace blink |
| OLD | NEW |