<!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>[202363] 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/202363">202363</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-06-22 18:39:01 -0700 (Wed, 22 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>We should have a DFG intrinsic that checks if a value is a TypedArrayView
https://bugs.webkit.org/show_bug.cgi?id=159048

Reviewed by Saam Barati.

This patch adds a new DFG Intrinsic that checks if a value is a TypedArrayView.
The intrinsic, IsTypedArrayView, works in the same way that the other Is&lt;insert-type&gt;
DFG nodes work. Additionally, a new builtin function isTypedArrayView has been added.
These changes are needed to fix regressions in %TypedArray%.prototype.subarray.

* builtins/BuiltinNames.h:
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter&lt;AbstractStateType&gt;::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* 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::compileIsTypedArrayView):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileIsTypedArrayView):
(JSC::FTL::DFG::LowerDFGToB3::isTypedArrayView):
* runtime/Intrinsic.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSTypedArrayViewPrototype.cpp:
(JSC::typedArrayViewPrivateFuncIsTypedArrayView):
* runtime/JSTypedArrayViewPrototype.h:
* tests/stress/istypedarrayview-intrinsic.js: Added.
(makeFn):
(typedArrays.forEach):
(let.test):
(test):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsBuiltinNamesh">trunk/Source/JavaScriptCore/builtins/BuiltinNames.h</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="#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="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeIntrinsich">trunk/Source/JavaScriptCore/runtime/Intrinsic.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypecpp">trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypeh">trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressistypedarrayviewintrinsicjs">trunk/Source/JavaScriptCore/tests/stress/istypedarrayview-intrinsic.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2016-06-22  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        We should have a DFG intrinsic that checks if a value is a TypedArrayView
+        https://bugs.webkit.org/show_bug.cgi?id=159048
+
+        Reviewed by Saam Barati.
+
+        This patch adds a new DFG Intrinsic that checks if a value is a TypedArrayView.
+        The intrinsic, IsTypedArrayView, works in the same way that the other Is&lt;insert-type&gt;
+        DFG nodes work. Additionally, a new builtin function isTypedArrayView has been added.
+        These changes are needed to fix regressions in %TypedArray%.prototype.subarray.
+
+        * builtins/BuiltinNames.h:
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter&lt;AbstractStateType&gt;::executeEffects):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
+        * 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::compileIsTypedArrayView):
+        * dfg/DFGSpeculativeJIT.h:
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileNode):
+        (JSC::FTL::DFG::LowerDFGToB3::compileIsTypedArrayView):
+        (JSC::FTL::DFG::LowerDFGToB3::isTypedArrayView):
+        * runtime/Intrinsic.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * runtime/JSTypedArrayViewPrototype.cpp:
+        (JSC::typedArrayViewPrivateFuncIsTypedArrayView):
+        * runtime/JSTypedArrayViewPrototype.h:
+        * tests/stress/istypedarrayview-intrinsic.js: Added.
+        (makeFn):
+        (typedArrays.forEach):
+        (let.test):
+        (test):
+
</ins><span class="cx"> 2016-06-21  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix build.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsBuiltinNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/BuiltinNames.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/BuiltinNames.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/builtins/BuiltinNames.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -121,6 +121,7 @@
</span><span class="cx">     macro(thisNumberValue) \
</span><span class="cx">     macro(newTargetLocal) \
</span><span class="cx">     macro(derivedConstructor) \
</span><ins>+    macro(isTypedArrayView) \
</ins><span class="cx">     macro(isBoundFunction) \
</span><span class="cx">     macro(hasInstanceBoundFunction) \
</span><span class="cx">     macro(instanceOf) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -1035,7 +1035,8 @@
</span><span class="cx">     case IsObject:
</span><span class="cx">     case IsObjectOrNull:
</span><span class="cx">     case IsFunction:
</span><del>-    case IsRegExpObject: {
</del><ins>+    case IsRegExpObject:
+    case IsTypedArrayView: {
</ins><span class="cx">         AbstractValue child = forNode(node-&gt;child1());
</span><span class="cx">         if (child.value()) {
</span><span class="cx">             bool constantWasSet = true;
</span><span class="lines">@@ -1097,6 +1098,9 @@
</span><span class="cx">             case IsEmpty:
</span><span class="cx">                 setConstant(node, jsBoolean(child.value().isEmpty()));
</span><span class="cx">                 break;
</span><ins>+            case IsTypedArrayView:
+                setConstant(node, jsBoolean(child.value().isObject() &amp;&amp; isTypedView(child.value().getObject()-&gt;classInfo()-&gt;typedArrayStorageType)));
+                break;
</ins><span class="cx">             default:
</span><span class="cx">                 constantWasSet = false;
</span><span class="cx">                 break;
</span><span class="lines">@@ -1268,6 +1272,19 @@
</span><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx"> 
</span><ins>+        case IsTypedArrayView:
+            if (!(child.m_type &amp; ~SpecTypedArrayView)) {
+                setConstant(node, jsBoolean(true));
+                constantWasSet = true;
+                break;
+            }
+            if (!(child.m_type &amp; SpecTypedArrayView)) {
+                setConstant(node, jsBoolean(false));
+                constantWasSet = true;
+                break;
+            }
+            break;
+
</ins><span class="cx">         default:
</span><span class="cx">             break;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -2314,6 +2314,14 @@
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    case IsTypedArrayViewIntrinsic: {
+        ASSERT(argumentCountIncludingThis == 2);
+
+        insertChecks();
+        set(VirtualRegister(resultOperand), addToGraph(IsTypedArrayView, OpInfo(prediction), get(virtualRegisterForArgument(1, registerOffset))));
+        return true;
+    }
+
</ins><span class="cx">     case StringPrototypeReplaceIntrinsic: {
</span><span class="cx">         if (argumentCountIncludingThis != 3)
</span><span class="cx">             return false;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGClobberizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGClobberize.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -172,6 +172,7 @@
</span><span class="cx">     case IsString:
</span><span class="cx">     case IsObject:
</span><span class="cx">     case IsRegExpObject:
</span><ins>+    case IsTypedArrayView:
</ins><span class="cx">     case LogicalNot:
</span><span class="cx">     case CheckInBounds:
</span><span class="cx">     case DoubleRep:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGDoesGCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -165,6 +165,7 @@
</span><span class="cx">     case IsObjectOrNull:
</span><span class="cx">     case IsFunction:
</span><span class="cx">     case IsRegExpObject:
</span><ins>+    case IsTypedArrayView:
</ins><span class="cx">     case TypeOf:
</span><span class="cx">     case LogicalNot:
</span><span class="cx">     case ToPrimitive:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGFixupPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -1547,6 +1547,7 @@
</span><span class="cx">         case DeleteById:
</span><span class="cx">         case DeleteByVal:
</span><span class="cx">         case IsJSArray:
</span><ins>+        case IsTypedArrayView:
</ins><span class="cx">         case IsEmpty:
</span><span class="cx">         case IsUndefined:
</span><span class="cx">         case IsBoolean:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGNodeTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGNodeType.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGNodeType.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGNodeType.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -317,6 +317,7 @@
</span><span class="cx">     macro(IsObjectOrNull, NodeResultBoolean) \
</span><span class="cx">     macro(IsFunction, NodeResultBoolean) \
</span><span class="cx">     macro(IsRegExpObject, NodeResultBoolean) \
</span><ins>+    macro(IsTypedArrayView, NodeResultBoolean) \
</ins><span class="cx">     macro(TypeOf, NodeResultJS) \
</span><span class="cx">     macro(LogicalNot, NodeResultBoolean) \
</span><span class="cx">     macro(ToPrimitive, NodeResultJS | NodeMustGenerate) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -792,7 +792,8 @@
</span><span class="cx">         case IsObject:
</span><span class="cx">         case IsObjectOrNull:
</span><span class="cx">         case IsFunction:
</span><del>-        case IsRegExpObject: {
</del><ins>+        case IsRegExpObject:
+        case IsTypedArrayView: {
</ins><span class="cx">             setPrediction(SpecBoolean);
</span><span class="cx">             break;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSafeToExecuteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -266,6 +266,7 @@
</span><span class="cx">     case IsObjectOrNull:
</span><span class="cx">     case IsFunction:
</span><span class="cx">     case IsRegExpObject:
</span><ins>+    case IsTypedArrayView:
</ins><span class="cx">     case TypeOf:
</span><span class="cx">     case LogicalNot:
</span><span class="cx">     case CallObjectConstructor:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -3455,6 +3455,36 @@
</span><span class="cx">     blessedBooleanResult(resultGPR, node);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SpeculativeJIT::compileIsTypedArrayView(Node* node)
+{
+    JSValueOperand value(this, node-&gt;child1());
+#if USE(JSVALUE64)
+    GPRTemporary result(this, Reuse, value);
+#else
+    GPRTemporary result(this, Reuse, value, PayloadWord);
+#endif
+
+    JSValueRegs valueRegs = value.jsValueRegs();
+    GPRReg resultGPR = result.gpr();
+
+    JITCompiler::Jump isNotCell = m_jit.branchIfNotCell(valueRegs);
+
+    m_jit.load8(JITCompiler::Address(valueRegs.payloadGPR(), JSCell::typeInfoTypeOffset()), resultGPR);
+    m_jit.sub32(TrustedImm32(Int8ArrayType), resultGPR);
+    m_jit.compare32(JITCompiler::BelowOrEqual,
+        resultGPR,
+        TrustedImm32(Float64ArrayType - Int8ArrayType),
+        resultGPR);
+    blessBoolean(resultGPR);
+    JITCompiler::Jump done = m_jit.jump();
+
+    isNotCell.link(&amp;m_jit);
+    moveFalseTo(resultGPR);
+
+    done.link(&amp;m_jit);
+    blessedBooleanResult(resultGPR, node);
+}
+
</ins><span class="cx"> void SpeculativeJIT::compileCallObjectConstructor(Node* node)
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(node-&gt;child1().useKind() == UntypedUse);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -754,6 +754,7 @@
</span><span class="cx"> 
</span><span class="cx">     void compileIsJSArray(Node*);
</span><span class="cx">     void compileIsRegExpObject(Node*);
</span><ins>+    void compileIsTypedArrayView(Node*);
</ins><span class="cx"> 
</span><span class="cx">     void emitCall(Node*);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -4733,6 +4733,11 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    case IsTypedArrayView: {
+        compileIsTypedArrayView(node);
+        break;
+    }
+
</ins><span class="cx">     case TypeOf: {
</span><span class="cx">         compileTypeOf(node);
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -4658,6 +4658,11 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    case IsTypedArrayView: {
+        compileIsTypedArrayView(node);
+        break;
+    }
+
</ins><span class="cx">     case TypeOf: {
</span><span class="cx">         compileTypeOf(node);
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -187,6 +187,7 @@
</span><span class="cx">     case IsObjectOrNull:
</span><span class="cx">     case IsFunction:
</span><span class="cx">     case IsRegExpObject:
</span><ins>+    case IsTypedArrayView:
</ins><span class="cx">     case CheckTypeInfoFlags:
</span><span class="cx">     case OverridesHasInstance:
</span><span class="cx">     case InstanceOf:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -900,6 +900,9 @@
</span><span class="cx">         case IsRegExpObject:
</span><span class="cx">             compileIsRegExpObject();
</span><span class="cx">             break;
</span><ins>+        case IsTypedArrayView:
+            compileIsTypedArrayView();
+            break;
</ins><span class="cx">         case TypeOf:
</span><span class="cx">             compileTypeOf();
</span><span class="cx">             break;
</span><span class="lines">@@ -6107,6 +6110,24 @@
</span><span class="cx">         setBoolean(m_out.phi(m_out.boolean, notCellResult, cellResult));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    void compileIsTypedArrayView()
+    {
+        LValue value = lowJSValue(m_node-&gt;child1());
+
+        LBasicBlock isCellCase = m_out.newBlock();
+        LBasicBlock continuation = m_out.newBlock();
+
+        ValueFromBlock notCellResult = m_out.anchor(m_out.booleanFalse);
+        m_out.branch(isCell(value, provenType(m_node-&gt;child1())), unsure(isCellCase), unsure(continuation));
+
+        LBasicBlock lastNext = m_out.appendTo(isCellCase, continuation);
+        ValueFromBlock cellResult = m_out.anchor(isTypedArrayView(value, provenType(m_node-&gt;child1())));
+        m_out.jump(continuation);
+
+        m_out.appendTo(continuation, lastNext);
+        setBoolean(m_out.phi(m_out.boolean, notCellResult, cellResult));
+    }
+
</ins><span class="cx">     void compileTypeOf()
</span><span class="cx">     {
</span><span class="cx">         Edge child = m_node-&gt;child1();
</span><span class="lines">@@ -10076,6 +10097,18 @@
</span><span class="cx">             m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
</span><span class="cx">             m_out.constInt32(ArrayType));
</span><span class="cx">     }
</span><ins>+
+    LValue isTypedArrayView(LValue cell, SpeculatedType type = SpecFullTop)
+    {
+        if (LValue proven = isProvenValue(type &amp; SpecCell, SpecTypedArrayView))
+            return proven;
+        LValue jsType = m_out.sub(
+            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
+            m_out.constInt32(Int8ArrayType));
+        return m_out.belowOrEqual(
+            jsType,
+            m_out.constInt32(Float64ArrayType - Int8ArrayType));
+    }
</ins><span class="cx">     
</span><span class="cx">     LValue isObject(LValue cell, SpeculatedType type = SpecFullTop)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIntrinsich"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Intrinsic.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Intrinsic.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/runtime/Intrinsic.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">     FRoundIntrinsic,
</span><span class="cx">     TruncIntrinsic,
</span><span class="cx">     IsRegExpObjectIntrinsic,
</span><ins>+    IsTypedArrayViewIntrinsic,
</ins><span class="cx">     BoundThisNoArgsFunctionCallIntrinsic,
</span><span class="cx"> 
</span><span class="cx">     // Getter intrinsics.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -655,6 +655,7 @@
</span><span class="cx">     JSFunction* privateFuncTypedArrayLength = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncLength);
</span><span class="cx">     JSFunction* privateFuncTypedArrayGetOriginalConstructor = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncGetOriginalConstructor);
</span><span class="cx">     JSFunction* privateFuncTypedArraySort = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncSort);
</span><ins>+    JSFunction* privateFuncIsTypedArrayView = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncIsTypedArrayView, IsTypedArrayViewIntrinsic);
</ins><span class="cx">     JSFunction* privateFuncIsBoundFunction = JSFunction::create(vm, this, 0, String(), isBoundFunction);
</span><span class="cx">     JSFunction* privateFuncHasInstanceBoundFunction = JSFunction::create(vm, this, 0, String(), hasInstanceBoundFunction);
</span><span class="cx">     JSFunction* privateFuncInstanceOf = JSFunction::create(vm, this, 0, String(), objectPrivateFuncInstanceOf);
</span><span class="lines">@@ -703,6 +704,7 @@
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().typedArrayLengthPrivateName(), privateFuncTypedArrayLength, DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().typedArrayGetOriginalConstructorPrivateName(), privateFuncTypedArrayGetOriginalConstructor, DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().typedArraySortPrivateName(), privateFuncTypedArraySort, DontEnum | DontDelete | ReadOnly),
</span><ins>+        GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().isTypedArrayViewPrivateName(), privateFuncIsTypedArrayView, DontEnum | DontDelete | ReadOnly),
</ins><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().isBoundFunctionPrivateName(), privateFuncIsBoundFunction, DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().hasInstanceBoundFunctionPrivateName(), privateFuncHasInstanceBoundFunction, DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;builtinNames().instanceOfPrivateName(), privateFuncInstanceOf, DontEnum | DontDelete | ReadOnly),
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -64,6 +64,12 @@
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();                                                               \
</span><span class="cx"> } while (false)
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL typedArrayViewPrivateFuncIsTypedArrayView(ExecState* exec)
+{
+    JSValue value = exec-&gt;uncheckedArgument(0);
+    return JSValue::encode(jsBoolean(value.isCell() &amp;&amp; isTypedView(value.asCell()-&gt;classInfo()-&gt;typedArrayStorageType)));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL typedArrayViewPrivateFuncLength(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSArrayBufferView* thisObject = jsDynamicCast&lt;JSArrayBufferView*&gt;(exec-&gt;argument(0));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSTypedArrayViewPrototypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.h (202362 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.h        2016-06-23 01:13:45 UTC (rev 202362)
+++ trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.h        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">     static Structure* createStructure(VM&amp;, JSGlobalObject*, JSValue prototype);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL typedArrayViewPrivateFuncIsTypedArrayView(ExecState*);
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL typedArrayViewPrivateFuncSort(ExecState*);
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL typedArrayViewPrivateFuncLength(ExecState*);
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL typedArrayViewPrivateFuncGetOriginalConstructor(ExecState*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressistypedarrayviewintrinsicjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/istypedarrayview-intrinsic.js (0 => 202363)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/istypedarrayview-intrinsic.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/istypedarrayview-intrinsic.js        2016-06-23 01:39:01 UTC (rev 202363)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+let typedArrays = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
+
+function makeFn(dontInline) {
+    let foo = createBuiltin(`(function (a) { &quot;use strict&quot;; return @isTypedArrayView(a); })`);
+    if (dontInline)
+        noInline(foo)
+    return foo;
+}
+
+typedArrays.forEach(function() {
+    let test = Function(
+        `
+        let foo = makeFn();
+        let bar = makeFn(true);
+        let view = new Int8Array(10);
+
+        for (i = 0; i &lt; 100000; i++) {
+            if (!foo(view))
+                throw new Error(i);
+            if (!bar(view))
+                throw new Error(i);
+        }
+        `
+    );
+    test();
+});
+
+typedArrays.forEach(constructor1 =&gt; {
+    typedArrays.forEach(constructor2 =&gt; {
+        let test = Function(
+            `
+            let foo = makeFn();
+            let bar = makeFn(true);
+            let view1 = new ${constructor1.name}(10);
+            let view2 = new ${constructor2.name}(10);
+
+            for (i = 0; i &lt; 100000; i++) {
+                let view = i % 2 === 0 ? view1 : view2;
+                if (!foo(view))
+                    throw new Error(i);
+                if (!bar(view))
+                    throw new Error(i);
+            }
+            `
+        );
+        test();
+    });
+});
+
+let test = function() {
+    let foo = makeFn();
+    let bar = makeFn(true);
+    for (i = 0; i &lt; 100000; i++) {
+        if (foo(true))
+            throw new Error(i);
+        if (bar(true))
+            throw new Error(i);
+    }
+}
+test();
+
+test = function() {
+    let bar = makeFn(true);
+    let view = new Int8Array(10);
+    let obj = new DataView(new ArrayBuffer(10));
+    for (i = 0; i &lt; 100000; i++) {
+        if (i % 2 === 0) {
+            if (!foo(view))
+                throw new Error(i);
+        } else {
+            if (foo(obj))
+                throw new Error(i);
+        }
+    }
+}
</ins></span></pre>
</div>
</div>

</body>
</html>