<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200459] trunk/Source/JavaScriptCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200459">200459</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-05-05 10:30:02 -0700 (Thu, 05 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add support for delete by value to the DFG
https://bugs.webkit.org/show_bug.cgi?id=157372
Reviewed by Filip Pizlo.
This patch adds basic support for delete by value to the DFG. delete by value
just calls out to a C++ operation on each execution. Additionally, this patch
fixes an issue with delete by id where we would crash if the base was null
or undefined.
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileDeleteById):
(JSC::DFG::SpeculativeJIT::compileDeleteByVal):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_del_by_val):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_del_by_val):
* tests/stress/delete-by-val.js: Added.
(assert):
(test):
* tests/stress/delete-to-object-exception.js: Added.
(assert):
(test):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh">trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp">trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCapabilitiescpp">trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGClobberizeh">trunk/Source/JavaScriptCore/dfg/DFGClobberize.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGDoesGCcpp">trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGFixupPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGNodeTypeh">trunk/Source/JavaScriptCore/dfg/DFGNodeType.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSafeToExecuteh">trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITh">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITcpp">trunk/Source/JavaScriptCore/jit/JIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationscpp">trunk/Source/JavaScriptCore/jit/JITOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationsh">trunk/Source/JavaScriptCore/jit/JITOperations.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccesscpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccess32_64cpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressdeletebyvaljs">trunk/Source/JavaScriptCore/tests/stress/delete-by-val.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressdeletetoobjectexceptionjs">trunk/Source/JavaScriptCore/tests/stress/delete-to-object-exception.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2016-05-05 Keith Miller <keith_miller@apple.com>
+
+ Add support for delete by value to the DFG
+ https://bugs.webkit.org/show_bug.cgi?id=157372
+
+ Reviewed by Filip Pizlo.
+
+ This patch adds basic support for delete by value to the DFG. delete by value
+ just calls out to a C++ operation on each execution. Additionally, this patch
+ fixes an issue with delete by id where we would crash if the base was null
+ or undefined.
+
+ * dfg/DFGAbstractInterpreterInlines.h:
+ (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGCapabilities.cpp:
+ (JSC::DFG::capabilityLevel):
+ * dfg/DFGClobberize.h:
+ (JSC::DFG::clobberize):
+ * dfg/DFGDoesGC.cpp:
+ (JSC::DFG::doesGC):
+ * dfg/DFGFixupPhase.cpp:
+ (JSC::DFG::FixupPhase::fixupNode):
+ * dfg/DFGNodeType.h:
+ * dfg/DFGPredictionPropagationPhase.cpp:
+ * dfg/DFGSafeToExecute.h:
+ (JSC::DFG::safeToExecute):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compileDeleteById):
+ (JSC::DFG::SpeculativeJIT::compileDeleteByVal):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::callOperation):
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOperations.cpp:
+ * jit/JITOperations.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_del_by_val):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_del_by_val):
+ * tests/stress/delete-by-val.js: Added.
+ (assert):
+ (test):
+ * tests/stress/delete-to-object-exception.js: Added.
+ (assert):
+ (test):
+
</ins><span class="cx"> 2016-05-05 Michael Saboff <msaboff@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix after change set r200447.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -2191,7 +2191,8 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- case DeleteById: {
</del><ins>+ case DeleteById:
+ case DeleteByVal: {
</ins><span class="cx"> // FIXME: This could decide if the delete will be successful based on the set of structures that
</span><span class="cx"> // we get from our base value. https://bugs.webkit.org/show_bug.cgi?id=156611
</span><span class="cx"> clobberWorld(node->origin.semantic, clobberLimit);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -4160,6 +4160,14 @@
</span><span class="cx"> NEXT_OPCODE(op_del_by_id);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ case op_del_by_val: {
+ int dst = currentInstruction[1].u.operand;
+ Node* base = get(VirtualRegister(currentInstruction[2].u.operand));
+ Node* key = get(VirtualRegister(currentInstruction[3].u.operand));
+ set(VirtualRegister(dst), addToGraph(DeleteByVal, base, key));
+ NEXT_OPCODE(op_del_by_val);
+ }
+
</ins><span class="cx"> case op_profile_type: {
</span><span class="cx"> Node* valueToProfile = get(VirtualRegister(currentInstruction[1].u.operand));
</span><span class="cx"> addToGraph(ProfileType, OpInfo(currentInstruction[2].u.location), valueToProfile);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -164,6 +164,7 @@
</span><span class="cx"> case op_put_getter_by_val:
</span><span class="cx"> case op_put_setter_by_val:
</span><span class="cx"> case op_del_by_id:
</span><ins>+ case op_del_by_val:
</ins><span class="cx"> case op_jmp:
</span><span class="cx"> case op_jtrue:
</span><span class="cx"> case op_jfalse:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGClobberizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGClobberize.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -448,6 +448,7 @@
</span><span class="cx"> case PutGetterByVal:
</span><span class="cx"> case PutSetterByVal:
</span><span class="cx"> case DeleteById:
</span><ins>+ case DeleteByVal:
</ins><span class="cx"> case ArrayPush:
</span><span class="cx"> case ArrayPop:
</span><span class="cx"> case Call:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGDoesGCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx"> case PutGetterByVal:
</span><span class="cx"> case PutSetterByVal:
</span><span class="cx"> case DeleteById:
</span><ins>+ case DeleteByVal:
</ins><span class="cx"> case CheckStructure:
</span><span class="cx"> case GetExecutable:
</span><span class="cx"> case GetButterfly:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGFixupPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -1541,6 +1541,7 @@
</span><span class="cx"> case ProfileWillCall:
</span><span class="cx"> case ProfileDidCall:
</span><span class="cx"> case DeleteById:
</span><ins>+ case DeleteByVal:
</ins><span class="cx"> case IsArrayObject:
</span><span class="cx"> case IsJSArray:
</span><span class="cx"> case IsArrayConstructor:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGNodeTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGNodeType.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGNodeType.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGNodeType.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -195,6 +195,7 @@
</span><span class="cx"> macro(PutGetterByVal, NodeMustGenerate) \
</span><span class="cx"> macro(PutSetterByVal, NodeMustGenerate) \
</span><span class="cx"> macro(DeleteById, NodeResultBoolean | NodeMustGenerate) \
</span><ins>+ macro(DeleteByVal, NodeResultBoolean | NodeMustGenerate) \
</ins><span class="cx"> macro(CheckStructure, NodeMustGenerate) \
</span><span class="cx"> macro(GetExecutable, NodeResultJS) \
</span><span class="cx"> macro(PutStructure, NodeMustGenerate) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -751,6 +751,7 @@
</span><span class="cx"> setPrediction(SpecDoubleReal);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case DeleteByVal:
</ins><span class="cx"> case DeleteById:
</span><span class="cx"> case LogicalNot:
</span><span class="cx"> case CompareLess:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSafeToExecuteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -193,6 +193,7 @@
</span><span class="cx"> case ValueAdd:
</span><span class="cx"> case TryGetById:
</span><span class="cx"> case DeleteById:
</span><ins>+ case DeleteByVal:
</ins><span class="cx"> case GetById:
</span><span class="cx"> case GetByIdFlush:
</span><span class="cx"> case PutById:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -1072,6 +1072,26 @@
</span><span class="cx"> unblessedBooleanResult(resultGPR, node, UseChildrenCalledExplicitly);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SpeculativeJIT::compileDeleteByVal(Node* node)
+{
+ JSValueOperand base(this, node->child1());
+ JSValueOperand key(this, node->child2());
+ GPRFlushedCallResult result(this);
+
+ JSValueRegs baseRegs = base.jsValueRegs();
+ JSValueRegs keyRegs = key.jsValueRegs();
+ GPRReg resultGPR = result.gpr();
+
+ base.use();
+ key.use();
+
+ flushRegisters();
+ callOperation(operationDeleteByVal, resultGPR, baseRegs, keyRegs);
+ m_jit.exceptionCheck();
+
+ unblessedBooleanResult(resultGPR, node, UseChildrenCalledExplicitly);
+}
+
</ins><span class="cx"> bool SpeculativeJIT::nonSpeculativeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
</span><span class="cx"> {
</span><span class="cx"> unsigned branchIndexInBlock = detectPeepHoleBranch();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -715,6 +715,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void compileDeleteById(Node*);
</span><ins>+ void compileDeleteByVal(Node*);
</ins><span class="cx"> void compileTryGetById(Node*);
</span><span class="cx"> void compileIn(Node*);
</span><span class="cx">
</span><span class="lines">@@ -1511,6 +1512,10 @@
</span><span class="cx"> m_jit.setupArgumentsWithExecState(arg1, arg2);
</span><span class="cx"> return appendCallSetResult(operation, result);
</span><span class="cx"> }
</span><ins>+ JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
+ {
+ return callOperation(operation, result, arg1.gpr(), arg2.gpr());
+ }
</ins><span class="cx"> JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2, GPRReg arg3)
</span><span class="cx"> {
</span><span class="cx"> m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
</span><span class="lines">@@ -1946,6 +1951,12 @@
</span><span class="cx"> m_jit.setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
</span><span class="cx"> return appendCallSetResult(operation, result);
</span><span class="cx"> }
</span><ins>+
+ JITCompiler::Call callOperation(S_JITOperation_EJJ operation, GPRReg result, JSValueRegs arg1, JSValueRegs arg2)
+ {
+ return callOperation(operation, result, arg1.tagGPR(), arg1.payloadGPR(), arg2.tagGPR(), arg2.payloadGPR());
+ }
+
</ins><span class="cx"> JITCompiler::Call callOperation(S_JITOperation_EGJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
</span><span class="cx"> {
</span><span class="cx"> m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, SH4_32BIT_DUMMY_ARG arg3Payload, arg3Tag);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -4102,6 +4102,11 @@
</span><span class="cx"> compileDeleteById(node);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+
+ case DeleteByVal: {
+ compileDeleteByVal(node);
+ break;
+ }
</ins><span class="cx">
</span><span class="cx"> case CheckCell: {
</span><span class="cx"> SpeculateCellOperand cell(this, node->child1());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -4143,6 +4143,11 @@
</span><span class="cx"> compileDeleteById(node);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+
+ case DeleteByVal: {
+ compileDeleteByVal(node);
+ break;
+ }
</ins><span class="cx">
</span><span class="cx"> case CheckCell: {
</span><span class="cx"> SpeculateCellOperand cell(this, node->child1());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/jit/JIT.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -187,7 +187,6 @@
</span><span class="cx"> unsigned bytecodeOffset = m_bytecodeOffset;
</span><span class="cx">
</span><span class="cx"> switch (opcodeID) {
</span><del>- DEFINE_SLOW_OP(del_by_val)
</del><span class="cx"> DEFINE_SLOW_OP(in)
</span><span class="cx"> DEFINE_SLOW_OP(less)
</span><span class="cx"> DEFINE_SLOW_OP(lesseq)
</span><span class="lines">@@ -222,6 +221,7 @@
</span><span class="cx"> DEFINE_OP(op_resume)
</span><span class="cx"> DEFINE_OP(op_debug)
</span><span class="cx"> DEFINE_OP(op_del_by_id)
</span><ins>+ DEFINE_OP(op_del_by_val)
</ins><span class="cx"> DEFINE_OP(op_div)
</span><span class="cx"> DEFINE_OP(op_end)
</span><span class="cx"> DEFINE_OP(op_enter)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/jit/JIT.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -496,6 +496,7 @@
</span><span class="cx"> void emit_op_resume(Instruction*);
</span><span class="cx"> void emit_op_debug(Instruction*);
</span><span class="cx"> void emit_op_del_by_id(Instruction*);
</span><ins>+ void emit_op_del_by_val(Instruction*);
</ins><span class="cx"> void emit_op_div(Instruction*);
</span><span class="cx"> void emit_op_end(Instruction*);
</span><span class="cx"> void emit_op_enter(Instruction*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -1871,7 +1871,6 @@
</span><span class="cx"> return JSValue::encode(jsBoolean(operationDeleteById(exec, base, uid)));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> size_t JIT_OPERATION operationDeleteById(ExecState* exec, EncodedJSValue encodedBase, UniquedStringImpl* uid)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = exec->vm();
</span><span class="lines">@@ -1879,13 +1878,45 @@
</span><span class="cx">
</span><span class="cx"> JSObject* baseObj = JSValue::decode(encodedBase).toObject(exec);
</span><span class="cx"> if (!baseObj)
</span><del>- JSValue::encode(JSValue());
</del><ins>+ return false;
</ins><span class="cx"> bool couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, Identifier::fromUid(&vm, uid));
</span><span class="cx"> if (!couldDelete && exec->codeBlock()->isStrictMode())
</span><span class="cx"> vm.throwException(exec, createTypeError(exec, ASCIILiteral("Unable to delete property.")));
</span><span class="cx"> return couldDelete;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JIT_OPERATION operationDeleteByValJSResult(ExecState* exec, EncodedJSValue base, EncodedJSValue key)
+{
+ return JSValue::encode(jsBoolean(operationDeleteByVal(exec, base, key)));
+}
+
+size_t JIT_OPERATION operationDeleteByVal(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedKey)
+{
+ VM& vm = exec->vm();
+ NativeCallFrameTracer tracer(&vm, exec);
+
+ JSObject* baseObj = JSValue::decode(encodedBase).toObject(exec);
+ JSValue key = JSValue::decode(encodedKey);
+ if (!baseObj)
+ return false;
+
+ bool couldDelete;
+ uint32_t index;
+ if (key.getUInt32(index))
+ couldDelete = baseObj->methodTable(vm)->deletePropertyByIndex(baseObj, exec, index);
+ else {
+ if (vm.exception())
+ return false;
+ Identifier property = key.toPropertyKey(exec);
+ if (vm.exception())
+ return false;
+ couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, property);
+ }
+ if (!couldDelete && exec->codeBlock()->isStrictMode())
+ vm.throwException(exec, createTypeError(exec, ASCIILiteral("Unable to delete property.")));
+ return couldDelete;
+}
+
</ins><span class="cx"> EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedProto)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = exec->vm();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.h (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.h        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.h        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -373,6 +373,8 @@
</span><span class="cx"> EncodedJSValue JIT_OPERATION operationHasIndexedPropertyGeneric(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo*) WTF_INTERNAL;
</span><span class="cx"> EncodedJSValue JIT_OPERATION operationDeleteByIdJSResult(ExecState*, EncodedJSValue base, UniquedStringImpl*) WTF_INTERNAL;
</span><span class="cx"> size_t JIT_OPERATION operationDeleteById(ExecState*, EncodedJSValue base, UniquedStringImpl*) WTF_INTERNAL;
</span><ins>+EncodedJSValue JIT_OPERATION operationDeleteByValJSResult(ExecState*, EncodedJSValue base, EncodedJSValue target) WTF_INTERNAL;
+size_t JIT_OPERATION operationDeleteByVal(ExecState*, EncodedJSValue base, EncodedJSValue target) WTF_INTERNAL;
</ins><span class="cx"> JSCell* JIT_OPERATION operationGetPNames(ExecState*, JSObject*) WTF_INTERNAL;
</span><span class="cx"> EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState*, EncodedJSValue, EncodedJSValue proto) WTF_INTERNAL;
</span><span class="cx"> int32_t JIT_OPERATION operationSizeFrameForVarargs(ExecState*, EncodedJSValue arguments, int32_t numUsedStackSlots, int32_t firstVarArgOffset) WTF_INTERNAL;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -532,6 +532,16 @@
</span><span class="cx"> callOperation(operationDeleteByIdJSResult, dst, regT0, m_codeBlock->identifier(property).impl());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void JIT::emit_op_del_by_val(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int property = currentInstruction[3].u.operand;
+ emitGetVirtualRegister(base, regT0);
+ emitGetVirtualRegister(property, regT1);
+ callOperation(operationDeleteByValJSResult, dst, regT0, regT1);
+}
+
</ins><span class="cx"> void JIT::emit_op_try_get_by_id(Instruction* currentInstruction)
</span><span class="cx"> {
</span><span class="cx"> int resultVReg = currentInstruction[1].u.operand;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccess32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp (200458 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp        2016-05-05 17:14:49 UTC (rev 200458)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -130,6 +130,15 @@
</span><span class="cx"> callOperation(operationDeleteByIdJSResult, dst, regT1, regT0, m_codeBlock->identifier(property).impl());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void JIT::emit_op_del_by_val(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int property = currentInstruction[3].u.operand;
+ emitLoad2(base, regT1, regT0, property, regT3, regT2);
+ callOperation(operationDeleteByValJSResult, dst, regT1, regT0, regT3, regT2);
+}
+
</ins><span class="cx"> JIT::CodeRef JIT::stringGetByValStubGenerator(VM* vm)
</span><span class="cx"> {
</span><span class="cx"> JSInterfaceJIT jit(vm);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressdeletebyvaljs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/delete-by-val.js (0 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/delete-by-val.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/delete-by-val.js        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+function assert(condition) {
+ if (!condition)
+ throw new Error("assertion failed");
+}
+
+function test(i) {
+ let foo = {};
+ foo["bar" + i] = 1;
+ assert(foo["bar" + i] === 1)
+ assert(delete foo["bar" + i]);
+ assert(!("bar" + i in foo));
+}
+
+for (let i = 0; i < 100000; ++i)
+ test(i);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressdeletetoobjectexceptionjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/delete-to-object-exception.js (0 => 200459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/delete-to-object-exception.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/delete-to-object-exception.js        2016-05-05 17:30:02 UTC (rev 200459)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+function assert(condition) {
+ if (!condition)
+ throw new Error("assertion failed");
+}
+
+function test(i) {
+ let value = null;
+ let passed = true;
+
+ try {
+ delete value.bar;
+ passed = false;
+ } catch(e) {}
+ try {
+ delete value["bar" + i];
+ passed = false;
+ } catch(e) {}
+ if (!passed)
+ throw new Error("didn't throw");
+}
+noInline(test);
+
+for (let i = 0; i < 10000; ++i)
+ test();
</ins></span></pre>
</div>
</div>
</body>
</html>