Title: [266447] trunk
Revision
266447
Author
[email protected]
Date
2020-09-01 19:18:03 -0700 (Tue, 01 Sep 2020)

Log Message

Skip fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html if Gigacage is not enabled
https://bugs.webkit.org/show_bug.cgi?id=216043
<rdar://problem/66394369>

Reviewed by Mark Lam.

Source/_javascript_Core:

* tools/JSDollarVM.cpp:
(JSC::functionIsGigacageEnabled):
(JSC::JSDollarVM::finishCreation):

LayoutTests:

The test is stressing Gigacage Exhaustion. So without Gigacage, this test is meaningless.
GuardMalloc behaves differently from usual Malloc / bmalloc: which crashes when exhausting memory.
As a result, we observe test crash when GuardMalloc is enabled. Since our test harness does not support
GuardMalloc annotation in TestExpectations, we needed a workaround to avoid this crash.

* TestExpectations:
* fast/css-custom-paint/out-of-memory-while-adding-worklet-module-expected.txt:
* fast/css-custom-paint/script-tests/out-of-memory-while-adding-worklet-module.js:
(vm.isGigacageEnabled.useAllMemory.try.get Object):
(vm.isGigacageEnabled.useAllMemory.try.foo):
(vm.isGigacageEnabled):
(useAllMemory.try.get Object): Deleted.
(useAllMemory.try.foo): Deleted.
(): Deleted.
(catch): Deleted.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (266446 => 266447)


--- trunk/LayoutTests/ChangeLog	2020-09-02 01:56:22 UTC (rev 266446)
+++ trunk/LayoutTests/ChangeLog	2020-09-02 02:18:03 UTC (rev 266447)
@@ -1,3 +1,27 @@
+2020-09-01  Yusuke Suzuki  <[email protected]>
+
+        Skip fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html if Gigacage is not enabled
+        https://bugs.webkit.org/show_bug.cgi?id=216043
+        <rdar://problem/66394369>
+
+        Reviewed by Mark Lam.
+
+        The test is stressing Gigacage Exhaustion. So without Gigacage, this test is meaningless.
+        GuardMalloc behaves differently from usual Malloc / bmalloc: which crashes when exhausting memory.
+        As a result, we observe test crash when GuardMalloc is enabled. Since our test harness does not support
+        GuardMalloc annotation in TestExpectations, we needed a workaround to avoid this crash.
+
+        * TestExpectations:
+        * fast/css-custom-paint/out-of-memory-while-adding-worklet-module-expected.txt:
+        * fast/css-custom-paint/script-tests/out-of-memory-while-adding-worklet-module.js:
+        (vm.isGigacageEnabled.useAllMemory.try.get Object):
+        (vm.isGigacageEnabled.useAllMemory.try.foo):
+        (vm.isGigacageEnabled):
+        (useAllMemory.try.get Object): Deleted.
+        (useAllMemory.try.foo): Deleted.
+        (): Deleted.
+        (catch): Deleted.
+
 2020-09-01  Hector Lopez  <[email protected]>
 
         Unreviewed, reverting r266408.

Modified: trunk/LayoutTests/TestExpectations (266446 => 266447)


--- trunk/LayoutTests/TestExpectations	2020-09-02 01:56:22 UTC (rev 266446)
+++ trunk/LayoutTests/TestExpectations	2020-09-02 02:18:03 UTC (rev 266447)
@@ -1170,8 +1170,7 @@
 webkit.org/b/136078 fast/borders/border-painting-dotted.html [ ImageOnlyFailure ]
 webkit.org/b/136078 fast/borders/border-painting-double.html [ ImageOnlyFailure ]
 
-# Skip this because it is too slow on debug builds.
-[ Debug ] fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html [ Skip ]
+fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html [ DumpJSConsoleLogInStdErr ]
 
 # official flexbox tests
 webkit.org/b/143294 imported/w3c/web-platform-tests/css/css-flexbox/css-flexbox-height-animation-stretch.html [ Pass ImageOnlyFailure ]

Modified: trunk/LayoutTests/fast/css-custom-paint/out-of-memory-while-adding-worklet-module-expected.txt (266446 => 266447)


--- trunk/LayoutTests/fast/css-custom-paint/out-of-memory-while-adding-worklet-module-expected.txt	2020-09-02 01:56:22 UTC (rev 266446)
+++ trunk/LayoutTests/fast/css-custom-paint/out-of-memory-while-adding-worklet-module-expected.txt	2020-09-02 02:18:03 UTC (rev 266447)
@@ -1,2 +1 @@
-CONSOLE MESSAGE: RangeError: Out of memory
 

Modified: trunk/LayoutTests/fast/css-custom-paint/script-tests/out-of-memory-while-adding-worklet-module.js (266446 => 266447)


--- trunk/LayoutTests/fast/css-custom-paint/script-tests/out-of-memory-while-adding-worklet-module.js	2020-09-02 01:56:22 UTC (rev 266446)
+++ trunk/LayoutTests/fast/css-custom-paint/script-tests/out-of-memory-while-adding-worklet-module.js	2020-09-02 02:18:03 UTC (rev 266447)
@@ -1,29 +1,31 @@
-window.allocated = [];
-function useAllMemory() {
+if ($vm.isGigacageEnabled()) {
+    window.allocated = [];
+    function useAllMemory() {
+        try {
+            const a = [];
+            a.__proto__ = {};
+            Object.defineProperty(a, 0, { get: foo });
+            Object.defineProperty(a, 80000000, {});
+            function foo() {
+                new Uint8Array(a);
+            }
+            new Promise(foo).catch(() => {});
+            while(1) {
+                window.allocated.push(new ArrayBuffer(1000));
+            }
+        } catch { }
+    }
+
+    var exception;
+    useAllMemory();
     try {
-        const a = [];
-        a.__proto__ = {};
-        Object.defineProperty(a, 0, { get: foo });
-        Object.defineProperty(a, 80000000, {});
-        function foo() {
-            new Uint8Array(a);
+        for (let i = 0; i < 5000; i++) {
+            CSS.paintWorklet.addModule('');
         }
-        new Promise(foo).catch(() => {});
-        while(1) {
-            window.allocated.push(new ArrayBuffer(1000));
-        }
-    } catch { }
-}
+    } catch (e) {
+        exception = e;
+    }
 
-var exception;
-useAllMemory();
-try {
-    for (let i = 0; i < 5000; i++) {
-        CSS.paintWorklet.addModule('');
-    }
-} catch (e) {
-    exception = e;
+    if (exception != "RangeError: Out of memory")
+        throw "FAIL: expect: 'RangeError: Out of memory', actual: '" + exception + "'";
 }
-
-if (exception != "RangeError: Out of memory")
-    throw "FAIL: expect: 'RangeError: Out of memory', actual: '" + exception + "'";

Modified: trunk/Source/_javascript_Core/ChangeLog (266446 => 266447)


--- trunk/Source/_javascript_Core/ChangeLog	2020-09-02 01:56:22 UTC (rev 266446)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-09-02 02:18:03 UTC (rev 266447)
@@ -1,3 +1,15 @@
+2020-09-01  Yusuke Suzuki  <[email protected]>
+
+        Skip fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html if Gigacage is not enabled
+        https://bugs.webkit.org/show_bug.cgi?id=216043
+        <rdar://problem/66394369>
+
+        Reviewed by Mark Lam.
+
+        * tools/JSDollarVM.cpp:
+        (JSC::functionIsGigacageEnabled):
+        (JSC::JSDollarVM::finishCreation):
+
 2020-08-31  Mark Lam  <[email protected]>
 
         Remove some PtrTag debugging code from release builds.

Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (266446 => 266447)


--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2020-09-02 01:56:22 UTC (rev 266446)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2020-09-02 02:18:03 UTC (rev 266447)
@@ -3054,6 +3054,7 @@
 
 static EncodedJSValue JSC_HOST_CALL functionHasOwnLengthProperty(JSGlobalObject* globalObject, CallFrame* callFrame)
 {
+    DollarVMAssertScope assertScope;
     VM& vm = globalObject->vm();
 
     JSObject* target = asObject(callFrame->uncheckedArgument(0));
@@ -3063,6 +3064,7 @@
 
 static EncodedJSValue JSC_HOST_CALL functionRejectPromiseAsHandled(JSGlobalObject* globalObject, CallFrame* callFrame)
 {
+    DollarVMAssertScope assertScope;
     JSPromise* promise = jsCast<JSPromise*>(callFrame->uncheckedArgument(0));
     JSValue reason = callFrame->uncheckedArgument(1);
     promise->rejectAsHandled(globalObject, reason);
@@ -3071,6 +3073,7 @@
 
 static EncodedJSValue JSC_HOST_CALL functionSetUserPreferredLanguages(JSGlobalObject* globalObject, CallFrame* callFrame)
 {
+    DollarVMAssertScope assertScope;
     VM& vm = globalObject->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
@@ -3092,21 +3095,25 @@
 
 static EncodedJSValue JSC_HOST_CALL functionICUVersion(JSGlobalObject*, CallFrame*)
 {
+    DollarVMAssertScope assertScope;
     return JSValue::encode(jsNumber(WTF::ICU::majorVersion()));
 }
 
 static EncodedJSValue JSC_HOST_CALL functionICUHeaderVersion(JSGlobalObject*, CallFrame*)
 {
+    DollarVMAssertScope assertScope;
     return JSValue::encode(jsNumber(U_ICU_VERSION_MAJOR_NUM));
 }
 
 static EncodedJSValue JSC_HOST_CALL functionAssertEnabled(JSGlobalObject*, CallFrame*)
 {
+    DollarVMAssertScope assertScope;
     return JSValue::encode(jsBoolean(ASSERT_ENABLED));
 }
 
 static EncodedJSValue JSC_HOST_CALL functionIsMemoryLimited(JSGlobalObject*, CallFrame*)
 {
+    DollarVMAssertScope assertScope;
 #if PLATFORM(IOS) || PLATFORM(APPLETV) || PLATFORM(WATCHOS)
     return JSValue::encode(jsBoolean(true));
 #else
@@ -3116,9 +3123,16 @@
 
 static EncodedJSValue JSC_HOST_CALL functionUseJIT(JSGlobalObject*, CallFrame*)
 {
+    DollarVMAssertScope assertScope;
     return JSValue::encode(jsBoolean(Options::useJIT()));
 }
 
+static EncodedJSValue JSC_HOST_CALL functionIsGigacageEnabled(JSGlobalObject*, CallFrame*)
+{
+    DollarVMAssertScope assertScope;
+    return JSValue::encode(jsBoolean(Gigacage::isEnabled()));
+}
+
 constexpr unsigned jsDollarVMPropertyAttributes = PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete;
 
 void JSDollarVM::finishCreation(VM& vm)
@@ -3264,6 +3278,7 @@
 
     addFunction(vm, "isMemoryLimited", functionIsMemoryLimited, 0);
     addFunction(vm, "useJIT", functionUseJIT, 0);
+    addFunction(vm, "isGigacageEnabled", functionIsGigacageEnabled, 0);
 
     m_objectDoingSideEffectPutWithoutCorrectSlotStatusStructure.set(vm, this, ObjectDoingSideEffectPutWithoutCorrectSlotStatus::createStructure(vm, globalObject, jsNull()));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to