Title: [165269] trunk/Source/WebCore
Revision
165269
Author
[email protected]
Date
2014-03-07 09:51:08 -0800 (Fri, 07 Mar 2014)

Log Message

Remove non-working optimization that was attempted on iOS only
https://bugs.webkit.org/show_bug.cgi?id=129595
<rdar://problem/15798825>

Reviewed by Sam Weinig.

Code in GCController tried to optimize cases where the controller
was used, but no _javascript_ had been run in the current process.
The code was never effective, and was iOS-only. Another way to fix
the problem would be to change the code so it works, and if we do
that we should do it for all platforms, not just iOS.

* bindings/js/GCController.cpp:
(WebCore::GCController::garbageCollectNow): Remove check of
JSDOMWindow::commonVMExists, since it's called just after a call
to JSDOMWindow::commonVM, which will create it as a side effect.
(WebCore::GCController::releaseExecutableMemory): Ditto.

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::commonVM): Removed iOS-specific code
that pulled the commonVM global out into another function so we
can check for its existence without creating it as a side effect.

* bindings/js/JSDOMWindowBase.h: Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165268 => 165269)


--- trunk/Source/WebCore/ChangeLog	2014-03-07 17:33:26 UTC (rev 165268)
+++ trunk/Source/WebCore/ChangeLog	2014-03-07 17:51:08 UTC (rev 165269)
@@ -1,3 +1,30 @@
+2014-03-07  Darin Adler  <[email protected]>
+
+        Remove non-working optimization that was attempted on iOS only
+        https://bugs.webkit.org/show_bug.cgi?id=129595
+        <rdar://problem/15798825>
+
+        Reviewed by Sam Weinig.
+
+        Code in GCController tried to optimize cases where the controller
+        was used, but no _javascript_ had been run in the current process.
+        The code was never effective, and was iOS-only. Another way to fix
+        the problem would be to change the code so it works, and if we do
+        that we should do it for all platforms, not just iOS.
+
+        * bindings/js/GCController.cpp:
+        (WebCore::GCController::garbageCollectNow): Remove check of
+        JSDOMWindow::commonVMExists, since it's called just after a call
+        to JSDOMWindow::commonVM, which will create it as a side effect.
+        (WebCore::GCController::releaseExecutableMemory): Ditto.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::commonVM): Removed iOS-specific code
+        that pulled the commonVM global out into another function so we
+        can check for its existence without creating it as a side effect.
+
+        * bindings/js/JSDOMWindowBase.h: Ditto.
+
 2014-03-07  Bem Jones-Bey  <[email protected]>
 
         [CSS Shapes] inset does not properly clamp large corner radii

Modified: trunk/Source/WebCore/bindings/js/GCController.cpp (165268 => 165269)


--- trunk/Source/WebCore/bindings/js/GCController.cpp	2014-03-07 17:33:26 UTC (rev 165268)
+++ trunk/Source/WebCore/bindings/js/GCController.cpp	2014-03-07 17:51:08 UTC (rev 165269)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -58,7 +58,7 @@
 void GCController::garbageCollectSoon()
 {
     // We only use reportAbandonedObjectGraph on systems with CoreFoundation 
-    // since it uses a runloop-based timer that is currently only available on 
+    // since it uses a run-loop-based timer that is currently only available on
     // systems with CoreFoundation. If and when the notion of a run loop is pushed 
     // down into WTF so that more platforms can take advantage of it, we will be 
     // able to use reportAbandonedObjectGraph on more platforms.
@@ -74,19 +74,13 @@
 #if !USE(CF)
 void GCController::gcTimerFired(Timer<GCController>*)
 {
-    collect(0);
+    collect(nullptr);
 }
 #endif
 
 void GCController::garbageCollectNow()
 {
     JSLockHolder lock(JSDOMWindow::commonVM());
-#if PLATFORM(IOS)
-    // If _javascript_ was never run in this process, there's no need to call GC which will
-    // end up creating a VM unnecessarily.
-    if (!JSDOMWindow::commonVMExists())
-        return;
-#endif
     if (!JSDOMWindow::commonVM().heap.isBusy())
         JSDOMWindow::commonVM().heap.collectAllGarbage();
 }
@@ -107,18 +101,9 @@
 {
     JSLockHolder lock(JSDOMWindow::commonVM());
 
-#if PLATFORM(IOS)
-    // If _javascript_ was never run in this process, there's no need to call GC which will
-    // end up creating a VM unnecessarily.
-    if (!JSDOMWindow::commonVMExists())
-        return;
-#endif
-
-    // We shouldn't have any _javascript_ running on our stack when this function is called. The
-    // following line asserts that.
+    // We shouldn't have any _javascript_ running on our stack when this function is called.
+    // The following line asserts that, but to be safe we check this in release builds anyway.
     ASSERT(!JSDOMWindow::commonVM().entryScope);
-
-    // But be safe in release builds just in case...
     if (JSDOMWindow::commonVM().entryScope)
         return;
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (165268 => 165269)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2014-03-07 17:33:26 UTC (rev 165268)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2014-03-07 17:51:08 UTC (rev 165269)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 2000 Harri Porten ([email protected])
  *  Copyright (C) 2006 Jon Shier ([email protected])
- *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reseved.
+ *  Copyright (C) 2003-2009, 2014 Apple Inc. All rights reseved.
  *  Copyright (C) 2006 Alexey Proskuryakov ([email protected])
  *
  *  This library is free software; you can redistribute it and/or
@@ -207,44 +207,24 @@
 {
     ASSERT(isMainThread());
 
-#if !PLATFORM(IOS)
-    static VM* vm = 0;
-#else
-    VM*& vm = commonVMInternal();
-#endif
+    static VM* vm = nullptr;
     if (!vm) {
         ScriptController::initializeThreading();
         vm = VM::createLeaked(LargeHeap).leakRef();
-#if PLATFORM(IOS)
-        PassOwnPtr<WebSafeGCActivityCallback> activityCallback = WebSafeGCActivityCallback::create(&vm->heap);
-        vm->heap.setActivityCallback(activityCallback);
-        PassOwnPtr<WebSafeIncrementalSweeper> incrementalSweeper = WebSafeIncrementalSweeper::create(&vm->heap);
-        vm->heap.setIncrementalSweeper(incrementalSweeper);
+#if !PLATFORM(IOS)
+        vm->setExclusiveThread(std::this_thread::get_id());
+#else
+        vm->heap.setActivityCallback(WebSafeGCActivityCallback::create(&vm->heap));
+        vm->heap.setIncrementalSweeper(WebSafeIncrementalSweeper::create(&vm->heap));
         vm->makeUsableFromMultipleThreads();
         vm->heap.machineThreads().addCurrentThread();
-#else
-        vm->setExclusiveThread(std::this_thread::get_id());
-#endif // !PLATFORM(IOS)
+#endif
         initNormalWorldClientData(vm);
     }
 
     return *vm;
 }
 
-#if PLATFORM(IOS)
-bool JSDOMWindowBase::commonVMExists()
-{
-    return commonVMInternal();
-}
-
-VM*& JSDOMWindowBase::commonVMInternal()
-{
-    ASSERT(isMainThread());
-    static VM* commonVM;
-    return commonVM;
-}
-#endif
-
 // JSDOMGlobalObject* is ignored, accessing a window in any context will
 // use that DOMWindow's prototype chain.
 JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow)

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h (165268 => 165269)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h	2014-03-07 17:33:26 UTC (rev 165268)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h	2014-03-07 17:51:08 UTC (rev 165269)
@@ -72,10 +72,6 @@
         JSDOMWindowShell* shell() const;
 
         static JSC::VM& commonVM();
-#if PLATFORM(IOS)
-        static bool commonVMExists();
-        static JSC::VM*& commonVMInternal();
-#endif
 
     private:
         RefPtr<DOMWindow> m_impl;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to