Changeset 50562 in webkit
- Timestamp:
- Nov 5, 2009 7:36:14 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r50561 r50562 1 2009-11-05 Anton Muhin <antonm@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 If high memory usage is detected, hint to V8 that it might be due 6 to external objects retained by V8 objects. 7 https://bugs.webkit.org/show_bug.cgi?id=31051 8 9 * bindings/v8/V8GCController.cpp: 10 (WebCore::GetMemoryUsageInMB): 11 (WebCore::V8GCController::gcEpilogue): 12 (WebCore::V8GCController::checkMemoryUsage): 13 * bindings/v8/V8GCController.h: 14 * bindings/v8/V8Proxy.cpp: 15 (WebCore::V8Proxy::evaluate): 16 (WebCore::V8Proxy::runScript): 17 (WebCore::V8Proxy::callFunction): 18 1 19 2009-11-05 Jeff Schiller <codedread@gmail.com> 2 20 -
trunk/WebCore/bindings/v8/V8GCController.cpp
r50293 r50562 417 417 }; 418 418 419 int V8GCController::workingSetEstimateMB = 0; 420 421 namespace { 422 423 int getMemoryUsageInMB() 424 { 425 return ChromiumBridge::memoryUsageMB(); 426 } 427 428 } // anonymous namespace 429 419 430 void V8GCController::gcEpilogue() 420 431 { … … 426 437 visitActiveDOMObjectsInCurrentThread(&epilogueVisitor); 427 438 439 workingSetEstimateMB = getMemoryUsageInMB(); 440 428 441 #ifndef NDEBUG 429 442 // Check all survivals are weak. … … 439 452 } 440 453 454 void V8GCController::checkMemoryUsage() 455 { 456 const int lowUsageMB = 256; // If memory usage is below this threshold, do not bother forcing GC. 457 const int highUsageMB = 1024; // If memory usage is above this threshold, force GC more aggresively. 458 const int highUsageDeltaMB = 128; // Delta of memory usage growth (vs. last workingSetEstimateMB) to force GC when memory usage is high. 459 460 int memoryUsageMB = getMemoryUsageInMB(); 461 if ((memoryUsageMB > lowUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB)) 462 v8::V8::LowMemoryNotification(); 463 } 464 465 441 466 } // namespace WebCore -
trunk/WebCore/bindings/v8/V8GCController.h
r46239 r50562 79 79 static void gcPrologue(); 80 80 static void gcEpilogue(); 81 82 static void checkMemoryUsage(); 83 84 private: 85 // Estimate of current working set. 86 static int workingSetEstimateMB; 81 87 }; 82 88 -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r50523 r50562 375 375 ASSERT(v8::Context::InContext()); 376 376 377 V8GCController::checkMemoryUsage(); 378 377 379 #if ENABLE(INSPECTOR) 378 380 if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) … … 419 421 return notHandledByInterceptor(); 420 422 423 V8GCController::checkMemoryUsage(); 421 424 // Compute the source string and prevent against infinite recursion. 422 425 if (m_recursion >= kMaxRecursionDepth) { … … 473 476 v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) 474 477 { 478 V8GCController::checkMemoryUsage(); 475 479 v8::Local<v8::Value> result; 476 480 {
Note: See TracChangeset
for help on using the changeset viewer.