Title: [273717] trunk
Revision
273717
Author
[email protected]
Date
2021-03-01 18:04:55 -0800 (Mon, 01 Mar 2021)

Log Message

REGRESSION: Object.defineProperties triggering a setter
https://bugs.webkit.org/show_bug.cgi?id=222538

Reviewed by Keith Miller.

JSTests:

* stress/dfg-put-by-val-string-or-symbol-should-check-direct.js: Added.
(test1):
(test2):

Source/_javascript_Core:

DFG's compilePutByValForCellWithString and compilePutByValForCellWithSymbol do not care about "Direct" flag.
This patch fixes that to call appropriate function if node is PutByValDirect.
FTL does not have this issue.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePutByValForCellWithString):
(JSC::DFG::SpeculativeJIT::compilePutByValForCellWithSymbol):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (273716 => 273717)


--- trunk/JSTests/ChangeLog	2021-03-02 01:57:16 UTC (rev 273716)
+++ trunk/JSTests/ChangeLog	2021-03-02 02:04:55 UTC (rev 273717)
@@ -1,5 +1,16 @@
 2021-03-01  Yusuke Suzuki  <[email protected]>
 
+        REGRESSION: Object.defineProperties triggering a setter
+        https://bugs.webkit.org/show_bug.cgi?id=222538
+
+        Reviewed by Keith Miller.
+
+        * stress/dfg-put-by-val-string-or-symbol-should-check-direct.js: Added.
+        (test1):
+        (test2):
+
+2021-03-01  Yusuke Suzuki  <[email protected]>
+
         [JSC] Throw TypeError when getFunctionRealm hits revoked Proxy
         https://bugs.webkit.org/show_bug.cgi?id=222523
 

Added: trunk/JSTests/stress/dfg-put-by-val-string-or-symbol-should-check-direct.js (0 => 273717)


--- trunk/JSTests/stress/dfg-put-by-val-string-or-symbol-should-check-direct.js	                        (rev 0)
+++ trunk/JSTests/stress/dfg-put-by-val-string-or-symbol-should-check-direct.js	2021-03-02 02:04:55 UTC (rev 273717)
@@ -0,0 +1,33 @@
+let testSymbol = Symbol("test");
+Object.defineProperty(Object.prototype, "test", {
+    set() {
+        throw new Error('bad');
+    },
+    get() { return 42; }
+});
+Object.defineProperty(Object.prototype, testSymbol, {
+    set() {
+        throw new Error('bad');
+    },
+    get() { return 42; }
+});
+
+function test1(prop) {
+    return { [prop]: prop };
+}
+noInline(test1);
+
+for (var i = 0; i < 1e4; ++i) {
+    test1("test" + i);
+    test1("test");
+}
+
+function test2(prop) {
+    return { [prop]: prop };
+}
+noInline(test2);
+
+for (var i = 0; i < 1e4; ++i) {
+    test2(Symbol("test"));
+    test2(testSymbol);
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (273716 => 273717)


--- trunk/Source/_javascript_Core/ChangeLog	2021-03-02 01:57:16 UTC (rev 273716)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-03-02 02:04:55 UTC (rev 273717)
@@ -1,3 +1,18 @@
+2021-03-01  Yusuke Suzuki  <[email protected]>
+
+        REGRESSION: Object.defineProperties triggering a setter
+        https://bugs.webkit.org/show_bug.cgi?id=222538
+
+        Reviewed by Keith Miller.
+
+        DFG's compilePutByValForCellWithString and compilePutByValForCellWithSymbol do not care about "Direct" flag.
+        This patch fixes that to call appropriate function if node is PutByValDirect.
+        FTL does not have this issue.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compilePutByValForCellWithString):
+        (JSC::DFG::SpeculativeJIT::compilePutByValForCellWithSymbol):
+
 2021-03-01  Xan Lopez  <[email protected]>
 
         [JSC] WebAssembly: make Wasm::Signature 32bit friendly

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (273716 => 273717)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-03-02 01:57:16 UTC (rev 273716)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-03-02 02:04:55 UTC (rev 273717)
@@ -3605,7 +3605,11 @@
     speculateString(child2, arg2GPR);
 
     flushRegisters();
-    callOperation(node->ecmaMode().isStrict() ? operationPutByValCellStringStrict : operationPutByValCellStringNonStrict, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), arg1GPR, arg2GPR, arg3Regs);
+    callOperation(
+        node->ecmaMode().isStrict()
+            ? (node->op() == PutByValDirect ? operationPutByValDirectCellStringStrict : operationPutByValCellStringStrict)
+            : (node->op() == PutByValDirect ? operationPutByValDirectCellStringNonStrict : operationPutByValCellStringNonStrict),
+        TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), arg1GPR, arg2GPR, arg3Regs);
     m_jit.exceptionCheck();
 
     noResult(node);
@@ -3624,7 +3628,11 @@
     speculateSymbol(child2, arg2GPR);
 
     flushRegisters();
-    callOperation(node->ecmaMode().isStrict() ? operationPutByValCellSymbolStrict : operationPutByValCellSymbolNonStrict, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), arg1GPR, arg2GPR, arg3Regs);
+    callOperation(
+        node->ecmaMode().isStrict()
+            ? (node->op() == PutByValDirect ? operationPutByValDirectCellSymbolStrict : operationPutByValCellSymbolStrict)
+            : (node->op() == PutByValDirect ? operationPutByValDirectCellSymbolNonStrict : operationPutByValCellSymbolNonStrict),
+        TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), arg1GPR, arg2GPR, arg3Regs);
     m_jit.exceptionCheck();
 
     noResult(node);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to