https://bugs.webkit.org/show_bug.cgi?id=180022
Reviewed by Saam Barati.
JSTests:
* stress/delete-by-id.js: Added.
(shouldBe):
(test1):
(test2):
* stress/delete-by-val-ftl.js: Added.
(shouldBe):
(test1):
(test2):
Source/JavaScriptCore:
We should increase the coverage of FTL. Even if the code includes DeleteById,
it does not mean that remaining part of the code should not be optimized in FTL.
Right now, even CallEval and `with` scope are handled in FTL.
This patch just adds DeleteById and DeleteByVal handling to FTL to allow optimizing
code including them.
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileDeleteById):
(JSC::FTL::DFG::LowerDFGToB3::compileDeleteByVal):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225153
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-11-26 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [FTL] Support DeleteById and DeleteByVal
+ https://bugs.webkit.org/show_bug.cgi?id=180022
+
+ Reviewed by Saam Barati.
+
+ * stress/delete-by-id.js: Added.
+ (shouldBe):
+ (test1):
+ (test2):
+ * stress/delete-by-val-ftl.js: Added.
+ (shouldBe):
+ (test1):
+ (test2):
+
2017-11-26 Yusuke Suzuki <utatane.tea@gmail.com>
[DFG] Introduce {Set,Map,WeakMap}Fields
--- /dev/null
+function shouldBe(actual, expected)
+{
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+function test1(object)
+{
+ return delete object.cocoa;
+}
+noInline(test1);
+
+function test2(object)
+{
+ return delete object.cappuccino;
+}
+noInline(test2);
+
+for (var i = 0; i < 1e5; ++i) {
+ var object = {
+ cocoa: 42
+ };
+ Object.defineProperty(object, "cappuccino", {
+ value: 42
+ });
+ shouldBe(test1(object), true);
+ shouldBe(test2(object), false);
+}
--- /dev/null
+function shouldBe(actual, expected)
+{
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+function test1(object, key)
+{
+ return delete object[key];
+}
+noInline(test1);
+
+function test2(object, key)
+{
+ return delete object[key];
+}
+noInline(test2);
+
+for (var i = 0; i < 1e5; ++i) {
+ var object = {
+ cocoa: 42
+ };
+ Object.defineProperty(object, "cappuccino", {
+ value: 42
+ });
+ shouldBe(test1(object, "cocoa"), true);
+ shouldBe(test2(object, "cappuccino"), false);
+}
+2017-11-26 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [FTL] Support DeleteById and DeleteByVal
+ https://bugs.webkit.org/show_bug.cgi?id=180022
+
+ Reviewed by Saam Barati.
+
+ We should increase the coverage of FTL. Even if the code includes DeleteById,
+ it does not mean that remaining part of the code should not be optimized in FTL.
+ Right now, even CallEval and `with` scope are handled in FTL.
+
+ This patch just adds DeleteById and DeleteByVal handling to FTL to allow optimizing
+ code including them.
+
+ * ftl/FTLCapabilities.cpp:
+ (JSC::FTL::canCompile):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileNode):
+ (JSC::FTL::DFG::LowerDFGToB3::compileDeleteById):
+ (JSC::FTL::DFG::LowerDFGToB3::compileDeleteByVal):
+
2017-11-26 Yusuke Suzuki <utatane.tea@gmail.com>
[DFG] Introduce {Set,Map,WeakMap}Fields
case PutGetterSetterById:
case PutGetterByVal:
case PutSetterByVal:
+ case DeleteById:
+ case DeleteByVal:
case CreateRest:
case GetRestLength:
case RegExpExec:
case PutSetterByVal:
compilePutAccessorByVal();
break;
+ case DeleteById:
+ compileDeleteById();
+ break;
+ case DeleteByVal:
+ compileDeleteByVal();
+ break;
case GetButterfly:
case GetButterflyWithoutCaging:
compileGetButterfly();
m_out.operation(m_node->op() == PutGetterByVal ? operationPutGetterByVal : operationPutSetterByVal),
m_callFrame, base, subscript, m_out.constInt32(m_node->accessorAttributes()), accessor);
}
+
+ void compileDeleteById()
+ {
+ LValue base = lowJSValue(m_node->child1());
+ auto uid = m_graph.identifiers()[m_node->identifierNumber()];
+ setBoolean(m_out.notZero64(vmCall(Int64, m_out.operation(operationDeleteById), m_callFrame, base, m_out.constIntPtr(uid))));
+ }
+
+ void compileDeleteByVal()
+ {
+ LValue base = lowJSValue(m_node->child1());
+ LValue subscript = lowJSValue(m_node->child2());
+ setBoolean(m_out.notZero64(vmCall(Int64, m_out.operation(operationDeleteByVal), m_callFrame, base, subscript)));
+ }
void compileArrayPush()
{