| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (ThreadState::current()) | 379 if (ThreadState::current()) |
| 380 ThreadState::current()->willStartV8GC(); | 380 ThreadState::current()->willStartV8GC(); |
| 381 | 381 |
| 382 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSw
eep, Heap::PageNavigationGC); |
| 383 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSw
eep, Heap::PageNavigationGC); |
| 384 |
| 382 if (isMainThread()) { | 385 if (isMainThread()) { |
| 383 ScriptForbiddenScope::enter(); | 386 ScriptForbiddenScope::enter(); |
| 384 } | 387 } |
| 385 | 388 |
| 386 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate | 389 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate |
| 387 // directly. | 390 // directly. |
| 388 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 391 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 389 v8::HandleScope scope(isolate); | 392 v8::HandleScope scope(isolate); |
| 390 switch (type) { | 393 switch (type) { |
| 391 case v8::kGCTypeScavenge: | 394 case v8::kGCTypeScavenge: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 414 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMajorGC"); | 417 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMajorGC"); |
| 415 } | 418 } |
| 416 break; | 419 break; |
| 417 default: | 420 default: |
| 418 ASSERT_NOT_REACHED(); | 421 ASSERT_NOT_REACHED(); |
| 419 } | 422 } |
| 420 } | 423 } |
| 421 | 424 |
| 422 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) | 425 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) |
| 423 { | 426 { |
| 427 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSw
eep, Heap::PageNavigationGC); |
| 428 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSw
eep, Heap::PageNavigationGC); |
| 429 |
| 424 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate | 430 // TODO(haraken): It would be nice if the GC callbacks passed the Isolate |
| 425 // directly. | 431 // directly. |
| 426 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 432 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 427 switch (type) { | 433 switch (type) { |
| 428 case v8::kGCTypeScavenge: | 434 case v8::kGCTypeScavenge: |
| 429 TRACE_EVENT_END1("devtools.timeline,v8", "MinorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); | 435 TRACE_EVENT_END1("devtools.timeline,v8", "MinorGC", "usedHeapSizeAfter",
usedHeapSize(isolate)); |
| 430 if (isMainThread()) { | 436 if (isMainThread()) { |
| 431 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); | 437 TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(V8PerIsolateData::from(isola
te)->previousSamplingState()); |
| 432 } | 438 } |
| 433 if (ThreadState::current()) | 439 if (ThreadState::current()) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 Visitor* m_visitor; | 547 Visitor* m_visitor; |
| 542 }; | 548 }; |
| 543 | 549 |
| 544 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 550 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 545 { | 551 { |
| 546 DOMWrapperTracer tracer(visitor); | 552 DOMWrapperTracer tracer(visitor); |
| 547 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 553 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 548 } | 554 } |
| 549 | 555 |
| 550 } // namespace blink | 556 } // namespace blink |
| OLD | NEW |