| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 { | 414 { |
| 415 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate | 415 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate |
| 416 // directly. | 416 // directly. |
| 417 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 417 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 418 switch (type) { | 418 switch (type) { |
| 419 case v8::kGCTypeScavenge: | 419 case v8::kGCTypeScavenge: |
| 420 TRACE_EVENT_END1("devtools.timeline,v8", "MinorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); | 420 TRACE_EVENT_END1("devtools.timeline,v8", "MinorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); |
| 421 if (isMainThread()) { | 421 if (isMainThread()) { |
| 422 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); | 422 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); |
| 423 } | 423 } |
| 424 ThreadState::current()->scheduleV8FollowupGCIfNeeded(); | 424 ThreadState::current()->scheduleV8FollowupGCIfNeeded(false); |
| 425 break; | 425 break; |
| 426 case v8::kGCTypeMarkSweepCompact: | 426 case v8::kGCTypeMarkSweepCompact: |
| 427 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); | 427 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); |
| 428 if (isMainThread()) { | 428 if (isMainThread()) { |
| 429 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); | 429 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); |
| 430 } | 430 } |
| 431 break; | 431 break; |
| 432 case v8::kGCTypeIncrementalMarking: | 432 case v8::kGCTypeIncrementalMarking: |
| 433 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); | 433 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); |
| 434 if (isMainThread()) { | 434 if (isMainThread()) { |
| 435 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); | 435 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); |
| 436 } | 436 } |
| 437 break; | 437 break; |
| 438 case v8::kGCTypeProcessWeakCallbacks: | 438 case v8::kGCTypeProcessWeakCallbacks: |
| 439 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); | 439 TRACE_EVENT_END1("devtools.timeline,v8", "MajorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); |
| 440 if (isMainThread()) { | 440 if (isMainThread()) { |
| 441 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); | 441 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); |
| 442 } | 442 } |
| 443 ThreadState::current()->scheduleV8FollowupGCIfNeeded(); | 443 ThreadState::current()->scheduleV8FollowupGCIfNeeded(true); |
| 444 break; | 444 break; |
| 445 default: | 445 default: |
| 446 ASSERT_NOT_REACHED(); | 446 ASSERT_NOT_REACHED(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 if (isMainThread()) | 449 if (isMainThread()) |
| 450 ScriptForbiddenScope::exit(); | 450 ScriptForbiddenScope::exit(); |
| 451 | 451 |
| 452 // v8::kGCCallbackFlagForced forces a Blink heap garbage collection | 452 // v8::kGCCallbackFlagForced forces a Blink heap garbage collection |
| 453 // when a garbage collection was forced from V8. This is either used | 453 // when a garbage collection was forced from V8. This is either used |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 Visitor* m_visitor; | 524 Visitor* m_visitor; |
| 525 }; | 525 }; |
| 526 | 526 |
| 527 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 527 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 528 { | 528 { |
| 529 DOMWrapperTracer tracer(visitor); | 529 DOMWrapperTracer tracer(visitor); |
| 530 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 530 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace blink | 533 } // namespace blink |
| OLD | NEW |