Title: [261549] trunk/Source
Revision
261549
Author
[email protected]
Date
2020-05-12 01:49:10 -0700 (Tue, 12 May 2020)

Log Message

Wasm::enableFastMemory() was called too late.
https://bugs.webkit.org/show_bug.cgi?id=211773

Reviewed by Yusuke Suzuki.

Source/_javascript_Core:

If Wasm fast memory is to be enabled, we should just do it in initializeThreading()
just like for all the other signal handlers that need to be initialized for JSC.
This simplifies its initialization and ensures that it is done in a timely manner
before Configs are frozen.

* jsc.cpp:
(jscmain):
* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):

Source/WebKit:

Previously, we were calling Wasm::enableFastMemory() in WebProcess::initializeWebProcess().
By then, it is too late because the JSC::Config and WTF::Config have already been
frozen.  There is nothing special about Wasm::enableFastMemory() that it needs to
be called this late.  This patch moves it into JSC::initializeThreading() where
it belongs.

This change also make the initialization of Wasm fast memory consistent with how
we have always done it for the jsc shell i.e. it is initialized at the end of
JSC::initializeThreading().

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (261548 => 261549)


--- trunk/Source/_javascript_Core/ChangeLog	2020-05-12 07:20:57 UTC (rev 261548)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-05-12 08:49:10 UTC (rev 261549)
@@ -1,3 +1,20 @@
+2020-05-12  Mark Lam  <[email protected]>
+
+        Wasm::enableFastMemory() was called too late.
+        https://bugs.webkit.org/show_bug.cgi?id=211773
+
+        Reviewed by Yusuke Suzuki.
+
+        If Wasm fast memory is to be enabled, we should just do it in initializeThreading()
+        just like for all the other signal handlers that need to be initialized for JSC.
+        This simplifies its initialization and ensures that it is done in a timely manner
+        before Configs are frozen.
+
+        * jsc.cpp:
+        (jscmain):
+        * runtime/InitializeThreading.cpp:
+        (JSC::initializeThreading):
+
 2020-05-11  Darin Adler  <[email protected]>
 
         Fix problems caught by replacing WTF::Optional with std::optional

Modified: trunk/Source/_javascript_Core/jsc.cpp (261548 => 261549)


--- trunk/Source/_javascript_Core/jsc.cpp	2020-05-12 07:20:57 UTC (rev 261548)
+++ trunk/Source/_javascript_Core/jsc.cpp	2020-05-12 08:49:10 UTC (rev 261549)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2000 Harri Porten ([email protected])
- *  Copyright (C) 2004-2019 Apple Inc. All rights reserved.
+ *  Copyright (C) 2004-2020 Apple Inc. All rights reserved.
  *  Copyright (C) 2006 Bjoern Graf ([email protected])
  *
  *  This library is free software; you can redistribute it and/or
@@ -76,7 +76,6 @@
 #include "VMInspector.h"
 #include "WasmCapabilities.h"
 #include "WasmContext.h"
-#include "WasmFaultSignalHandler.h"
 #include "WasmMemory.h"
 #include <locale.h>
 #include <math.h>
@@ -3231,9 +3230,6 @@
     // Initialize JSC before getting VM.
     JSC::initializeThreading();
     initializeTimeoutIfNeeded();
-#if ENABLE(WEBASSEMBLY)
-    JSC::Wasm::enableFastMemory();
-#endif
 
     bool gigacageDisableRequested = false;
 #if GIGACAGE_ENABLED && !COMPILER(MSVC)

Modified: trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp (261548 => 261549)


--- trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp	2020-05-12 07:20:57 UTC (rev 261548)
+++ trunk/Source/_javascript_Core/runtime/InitializeThreading.cpp	2020-05-12 08:49:10 UTC (rev 261549)
@@ -47,6 +47,7 @@
 #include "VMTraps.h"
 #include "WasmCalleeRegistry.h"
 #include "WasmCapabilities.h"
+#include "WasmFaultSignalHandler.h"
 #include "WasmThunks.h"
 #include "WriteBarrier.h"
 #include <mutex>
@@ -104,6 +105,9 @@
         WTF::startMachExceptionHandlerThread();
 #endif
         VMTraps::initializeSignals();
+#if ENABLE(WEBASSEMBLY)
+        Wasm::enableFastMemory();
+#endif
 
         WTF::compilerFence();
         RELEASE_ASSERT(!g_jscConfig.initializeThreadingHasBeenCalled);

Modified: trunk/Source/WebKit/ChangeLog (261548 => 261549)


--- trunk/Source/WebKit/ChangeLog	2020-05-12 07:20:57 UTC (rev 261548)
+++ trunk/Source/WebKit/ChangeLog	2020-05-12 08:49:10 UTC (rev 261549)
@@ -1,3 +1,23 @@
+2020-05-12  Mark Lam  <[email protected]>
+
+        Wasm::enableFastMemory() was called too late.
+        https://bugs.webkit.org/show_bug.cgi?id=211773
+
+        Reviewed by Yusuke Suzuki.
+
+        Previously, we were calling Wasm::enableFastMemory() in WebProcess::initializeWebProcess().
+        By then, it is too late because the JSC::Config and WTF::Config have already been
+        frozen.  There is nothing special about Wasm::enableFastMemory() that it needs to
+        be called this late.  This patch moves it into JSC::initializeThreading() where
+        it belongs.
+
+        This change also make the initialization of Wasm fast memory consistent with how
+        we have always done it for the jsc shell i.e. it is initialized at the end of
+        JSC::initializeThreading().
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+
 2020-05-11  Darin Adler  <[email protected]>
 
         Fix problems caught by replacing WTF::Optional with std::optional

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (261548 => 261549)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2020-05-12 07:20:57 UTC (rev 261548)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2020-05-12 08:49:10 UTC (rev 261549)
@@ -83,7 +83,6 @@
 #include "WebsiteDataType.h"
 #include <_javascript_Core/JSLock.h>
 #include <_javascript_Core/MemoryStatistics.h>
-#include <_javascript_Core/WasmFaultSignalHandler.h>
 #include <WebCore/AXObjectCache.h>
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/AuthenticationChallenge.h>
@@ -466,10 +465,6 @@
     ServiceWorkerProvider::setSharedProvider(WebServiceWorkerProvider::singleton());
 #endif
 
-#if ENABLE(WEBASSEMBLY)
-    JSC::Wasm::enableFastMemory();
-#endif
-
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
     WebResourceLoadObserver::setShouldLogUserInteraction(parameters.shouldLogUserInteraction);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to