| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 { | 238 { |
| 239 v8::HeapStatistics heapStatistics; | 239 v8::HeapStatistics heapStatistics; |
| 240 isolate->GetHeapStatistics(&heapStatistics); | 240 isolate->GetHeapStatistics(&heapStatistics); |
| 241 return heapStatistics.used_heap_size(); | 241 return heapStatistics.used_heap_size(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 namespace { | 244 namespace { |
| 245 | 245 |
| 246 void visitWeakHandlesForMinorGC(v8::Isolate* isolate) | 246 void visitWeakHandlesForMinorGC(v8::Isolate* isolate) |
| 247 { | 247 { |
| 248 ASSERT(isMainThread()); | |
| 249 MinorGCUnmodifiedWrapperVisitor visitor(isolate); | 248 MinorGCUnmodifiedWrapperVisitor visitor(isolate); |
| 250 isolate->VisitWeakHandles(&visitor); | 249 isolate->VisitWeakHandles(&visitor); |
| 251 } | 250 } |
| 252 | 251 |
| 253 void objectGroupingForMajorGC(v8::Isolate* isolate, bool constructRetainedObject
Infos) | 252 void objectGroupingForMajorGC(v8::Isolate* isolate, bool constructRetainedObject
Infos) |
| 254 { | 253 { |
| 255 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); | 254 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); |
| 256 v8::V8::VisitHandlesWithClassIds(isolate, &visitor); | 255 v8::V8::VisitHandlesWithClassIds(isolate, &visitor); |
| 257 visitor.notifyFinished(); | 256 visitor.notifyFinished(); |
| 258 } | 257 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 283 } | 282 } |
| 284 | 283 |
| 285 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate | 284 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate |
| 286 // directly. | 285 // directly. |
| 287 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 286 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 288 v8::HandleScope scope(isolate); | 287 v8::HandleScope scope(isolate); |
| 289 switch (type) { | 288 switch (type) { |
| 290 case v8::kGCTypeScavenge: | 289 case v8::kGCTypeScavenge: |
| 291 TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate)); | 290 TRACE_EVENT_BEGIN1("devtools.timeline,v8", "MinorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate)); |
| 292 if (isMainThread()) { | 291 if (isMainThread()) { |
| 293 { | 292 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); |
| 294 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMMinorGC"); | 293 } |
| 295 visitWeakHandlesForMinorGC(isolate); | 294 visitWeakHandlesForMinorGC(isolate); |
| 296 } | 295 if (isMainThread()) { |
| 297 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVEN
T_GET_SAMPLING_STATE()); | 296 V8PerIsolateData::from(isolate)->setPreviousSamplingState(TRACE_EVEN
T_GET_SAMPLING_STATE()); |
| 298 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC"); | 297 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8MinorGC"); |
| 299 } | 298 } |
| 300 break; | 299 break; |
| 301 case v8::kGCTypeMarkSweepCompact: | 300 case v8::kGCTypeMarkSweepCompact: |
| 302 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate), "type", "atomic pause"); | 301 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate), "type", "atomic pause"); |
| 303 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain
edObjectInfos); | 302 gcPrologueForMajorGC(isolate, flags & v8::kGCCallbackFlagConstructRetain
edObjectInfos); |
| 304 break; | 303 break; |
| 305 case v8::kGCTypeIncrementalMarking: | 304 case v8::kGCTypeIncrementalMarking: |
| 306 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate), "type", "incremental marking"); | 305 TRACE_EVENT_BEGIN2("devtools.timeline,v8", "MajorGC", "usedHeapSizeBefor
e", usedHeapSize(isolate), "type", "incremental marking"); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 Visitor* m_visitor; | 439 Visitor* m_visitor; |
| 441 }; | 440 }; |
| 442 | 441 |
| 443 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 442 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 444 { | 443 { |
| 445 DOMWrapperTracer tracer(visitor); | 444 DOMWrapperTracer tracer(visitor); |
| 446 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 445 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 447 } | 446 } |
| 448 | 447 |
| 449 } // namespace blink | 448 } // namespace blink |
| OLD | NEW |