Changeset 123556 in webkit
- Timestamp:
- Jul 24, 2012 5:37:11 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r123555 r123556 1 2012-07-24 Kenneth Russell <kbr@google.com> 2 3 [chromium] Hint garbage collector to run if page uses Canvas contexts 4 https://bugs.webkit.org/show_bug.cgi?id=76225 5 6 Reviewed by Kentaro Hara. 7 8 This test doesn't directly exercise this code path yet, but it 9 needs to work regardless and also needs to be expanded. 10 11 * fast/canvas/webgl/context-creation-and-destruction-expected.txt: Added. 12 * fast/canvas/webgl/context-creation-and-destruction.html: Added. 13 1 14 2012-07-24 Alexis Menard <alexis.menard@openbossa.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r123553 r123556 1 2012-07-24 Kenneth Russell <kbr@google.com> 2 3 [chromium] Hint garbage collector to run if page uses Canvas contexts 4 https://bugs.webkit.org/show_bug.cgi?id=76225 5 6 Reviewed by Kentaro Hara. 7 8 Upon creating a canvas context, set a hint in the current isolate 9 indicating that a full GC should be done upon the next page 10 navigation. 11 12 This improves Chrome's robustness on some WebGL stress tests which 13 simulate real-world behavior by repeatedly navigating among 14 several samples. More general measures are being investigated, but 15 this change makes V8 behave the same as JSC on these stress tests. 16 JSC doesn't currently use generational garbage collection, so it 17 has more opportunities to discover unreferenced canvas contexts. 18 19 Test: fast/canvas/webgl/context-creation-and-destruction.html 20 21 * bindings/v8/V8Binding.cpp: 22 (WebCore::V8BindingPerIsolateData::V8BindingPerIsolateData): 23 Initialize per-isolate low memory hint. 24 * bindings/v8/V8Binding.h: 25 (V8BindingPerIsolateData): 26 (WebCore::V8BindingPerIsolateData::setLowMemoryNotificationHint): 27 Set a per-isolate hint to signal a low memory condition upon the next page navigation. 28 (WebCore::V8BindingPerIsolateData::clearLowMemoryNotificationHint): 29 Clear the previously set hint. 30 (WebCore::V8BindingPerIsolateData::isLowMemoryNotificationHint): 31 Get the previously set hint. 32 * bindings/v8/V8Proxy.cpp: 33 (WebCore::V8Proxy::hintForGCIfNecessary): 34 If necessary, send V8 a hint that it should GC. 35 (WebCore): 36 (WebCore::V8Proxy::clearForClose): 37 (WebCore::V8Proxy::clearForNavigation): 38 Call hintForGCIfNecessary. 39 * bindings/v8/V8Proxy.h: 40 (V8Proxy): 41 * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: 42 (WebCore::V8HTMLCanvasElement::getContextCallback): 43 Set a hint that we should GC upon the next page navigation. 44 1 45 2012-07-24 Dave Tu <dtu@chromium.org> 2 46 -
trunk/Source/WebCore/bindings/v8/V8Binding.cpp
r123500 r123556 61 61 , m_internalScriptRecursionLevel(0) 62 62 #endif 63 , m_lowMemoryNotificationHint(false) 63 64 { 64 65 } -
trunk/Source/WebCore/bindings/v8/V8Binding.h
r122555 r123556 221 221 void reportMemoryUsage(MemoryObjectInfo*) const; 222 222 223 // Gives the system a hint that we should send a low memory 224 // notification upon the next close or navigation event, 225 // because some expensive objects have been allocated that we 226 // want to take every opportunity to collect. 227 void setLowMemoryNotificationHint() { m_lowMemoryNotificationHint = true; } 228 void clearLowMemoryNotificationHint() { m_lowMemoryNotificationHint = false; } 229 bool isLowMemoryNotificationHint() const { return m_lowMemoryNotificationHint; } 230 223 231 private: 224 232 explicit V8BindingPerIsolateData(v8::Isolate*); … … 249 257 #endif 250 258 GCEventData m_gcEventData; 259 260 bool m_lowMemoryNotificationHint; 251 261 }; 252 262 -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r123112 r123556 560 560 } 561 561 562 void V8Proxy::hintForGCIfNecessary() 563 { 564 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); 565 if (data->isLowMemoryNotificationHint()) { 566 data->clearLowMemoryNotificationHint(); 567 v8::V8::LowMemoryNotification(); 568 } 569 } 570 562 571 void V8Proxy::clearForClose() 563 572 { 564 573 resetIsolatedWorlds(); 574 hintForGCIfNecessary(); 565 575 windowShell()->clearForClose(); 566 576 } … … 569 579 { 570 580 resetIsolatedWorlds(); 581 hintForGCIfNecessary(); 571 582 windowShell()->clearForNavigation(); 572 583 } -
trunk/Source/WebCore/bindings/v8/V8Proxy.h
r120229 r123556 272 272 void resetIsolatedWorlds(); 273 273 274 void hintForGCIfNecessary(); 275 274 276 PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*); 275 277 -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
r119572 r123556 87 87 if (!result) 88 88 return v8::Null(args.GetIsolate()); 89 90 // Both 2D and 3D canvas contexts can hold on to lots of GPU resources, and we 91 // want to take an opportunity to get rid of them as soon as possible when we 92 // navigate away from pages using them. 93 V8BindingPerIsolateData* perIsolateData = V8BindingPerIsolateData::current(args.GetIsolate()); 94 perIsolateData->setLowMemoryNotificationHint(); 95 89 96 if (result->is2d()) 90 97 return toV8(static_cast<CanvasRenderingContext2D*>(result), args.GetIsolate());
Note: See TracChangeset
for help on using the changeset viewer.