Modified: trunk/JSTests/ChangeLog (249529 => 249530)
--- trunk/JSTests/ChangeLog 2019-09-05 14:48:38 UTC (rev 249529)
+++ trunk/JSTests/ChangeLog 2019-09-05 15:51:47 UTC (rev 249530)
@@ -1,3 +1,13 @@
+2019-09-05 Yusuke Suzuki <[email protected]>
+
+ [JSC] Do not use FTLOutput::weakPointer directly
+ https://bugs.webkit.org/show_bug.cgi?id=201495
+
+ Reviewed by Filip Pizlo.
+
+ * stress/create-promise-weak-pointer.js: Added.
+ (foo):
+
2019-09-04 Yusuke Suzuki <[email protected]>
[JSC] Make Promise implementation faster
Added: trunk/JSTests/stress/create-promise-weak-pointer.js (0 => 249530)
--- trunk/JSTests/stress/create-promise-weak-pointer.js (rev 0)
+++ trunk/JSTests/stress/create-promise-weak-pointer.js 2019-09-05 15:51:47 UTC (rev 249530)
@@ -0,0 +1,7 @@
+const x = new Proxy(Promise, {});
+function foo() {
+ new x(()=>{});
+}
+for (let i=0; i<100000; i++) {
+ foo();
+}
Modified: trunk/Source/_javascript_Core/ChangeLog (249529 => 249530)
--- trunk/Source/_javascript_Core/ChangeLog 2019-09-05 14:48:38 UTC (rev 249529)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-09-05 15:51:47 UTC (rev 249530)
@@ -1,3 +1,20 @@
+2019-09-05 Yusuke Suzuki <[email protected]>
+
+ [JSC] Do not use FTLOutput::weakPointer directly
+ https://bugs.webkit.org/show_bug.cgi?id=201495
+
+ Reviewed by Filip Pizlo.
+
+ FTLOutput::weakPointer does not register the cell as a weak pointer.
+ CreatePromise's implementation is accidentally using m_out.weakPointer and hits the debug assertion.
+ While the current implementation is not posing correctness issue since these cells are live so long as JSGlobalObject is live,
+ and we register JSGlobalObject as a weakPointer, we should always use FTLLowerDFGToB3's helper function.
+ For FrozenValue, we should use frozenPointer helper function.
+
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileCreatePromise):
+ (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayBuffer):
+
2019-09-04 Yusuke Suzuki <[email protected]>
Unreviewed, partial roll out r249372 due to JetStream2/Basic ~10% regression
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (249529 => 249530)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2019-09-05 14:48:38 UTC (rev 249529)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2019-09-05 15:51:47 UTC (rev 249530)
@@ -6300,7 +6300,7 @@
LBasicBlock continuation = m_out.newBlock();
ValueFromBlock promiseStructure = m_out.anchor(weakStructure(m_graph.registerStructure(m_node->isInternalPromise() ? globalObject->internalPromiseStructure() : globalObject->promiseStructure())));
- m_out.branch(m_out.equal(callee, m_out.weakPointer(m_graph, m_node->isInternalPromise() ? globalObject->internalPromiseConstructor() : globalObject->promiseConstructor())), unsure(fastAllocationCase), unsure(derivedCase));
+ m_out.branch(m_out.equal(callee, weakPointer(m_node->isInternalPromise() ? globalObject->internalPromiseConstructor() : globalObject->promiseConstructor())), unsure(fastAllocationCase), unsure(derivedCase));
LBasicBlock lastNext = m_out.appendTo(derivedCase, isFunctionBlock);
m_out.branch(isFunction(callee, provenType(m_node->child1())), usually(isFunctionBlock), rarely(slowCase));
@@ -6530,7 +6530,7 @@
m_out.jump(continuation);
m_out.appendTo(slowPath, continuation);
- LValue slowArray = vmCall(Int64, m_out.operation(operationNewArrayBuffer), m_callFrame, weakStructure(structure), m_out.weakPointer(m_node->cellOperand()));
+ LValue slowArray = vmCall(Int64, m_out.operation(operationNewArrayBuffer), m_callFrame, weakStructure(structure), frozenPointer(m_node->cellOperand()));
ValueFromBlock slowResult = m_out.anchor(slowArray);
m_out.jump(continuation);
@@ -6543,7 +6543,7 @@
setJSValue(vmCall(
Int64, m_out.operation(operationNewArrayBuffer), m_callFrame,
- weakStructure(structure), m_out.weakPointer(m_node->cellOperand())));
+ weakStructure(structure), frozenPointer(m_node->cellOperand())));
}
void compileNewArrayWithSize()