<!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>[192836] 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/192836">192836</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2015-11-30 15:13:41 -0800 (Mon, 30 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Snippefy op_div for the baseline JIT.
https://bugs.webkit.org/show_bug.cgi?id=151607
Reviewed by Geoffrey Garen.
* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* jit/JIT.h:
* jit/JITArithmetic.cpp:
(JSC::JIT::emit_op_div):
(JSC::JIT::emitSlow_op_div):
(JSC::JIT::compileBinaryArithOpSlowCase): Deleted.
* jit/JITArithmetic32_64.cpp:
(JSC::JIT::emitBinaryDoubleOp):
(JSC::JIT::emit_op_div): Deleted.
(JSC::JIT::emitSlow_op_div): Deleted.
- Removed the 32-bit specific op_div implementation. The 64-bit version with the
op_div snippet can now service both 32-bit and 64-bit.
* jit/JITDivGenerator.cpp: Added.
(JSC::JITDivGenerator::loadOperand):
(JSC::JITDivGenerator::generateFastPath):
* jit/JITDivGenerator.h: Added.
(JSC::JITDivGenerator::JITDivGenerator):
(JSC::JITDivGenerator::didEmitFastPath):
(JSC::JITDivGenerator::endJumpList):
(JSC::JITDivGenerator::slowPathJumpList):
* jit/JITInlines.h:
(JSC::JIT::getOperandConstantDouble): Added.
* jit/SnippetOperand.h: Added.
(JSC::SnippetOperand::SnippetOperand):
(JSC::SnippetOperand::mightBeNumber):
(JSC::SnippetOperand::definitelyIsNumber):
(JSC::SnippetOperand::isConst):
(JSC::SnippetOperand::isConstInt32):
(JSC::SnippetOperand::isConstDouble):
(JSC::SnippetOperand::asRawBits):
(JSC::SnippetOperand::asConstInt32):
(JSC::SnippetOperand::asConstDouble):
(JSC::SnippetOperand::setConstInt32):
(JSC::SnippetOperand::setConstDouble):
- The SnippetOperand encapsulates operand constness, const type, and profiling
information. As a result:
1. The argument list to the JITDivGenerator constructor is now more concise.
2. The logic of the JITDivGenerator is now less verbose and easier to express.
* parser/ResultType.h:
(JSC::ResultType::isInt32):
(JSC::ResultType::definitelyIsNumber):
(JSC::ResultType::definitelyIsString):
(JSC::ResultType::definitelyIsBoolean):
(JSC::ResultType::mightBeNumber):
(JSC::ResultType::isNotNumber):
- Made these functions const because they were always meant to be const.
This also allows me to enforce constness in the SnippetOperand.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITArithmeticcpp">trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITArithmetic32_64cpp">trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITInlinesh">trunk/Source/JavaScriptCore/jit/JITInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserResultTypeh">trunk/Source/JavaScriptCore/parser/ResultType.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorejitJITDivGeneratorcpp">trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITDivGeneratorh">trunk/Source/JavaScriptCore/jit/JITDivGenerator.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitSnippetOperandh">trunk/Source/JavaScriptCore/jit/SnippetOperand.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -455,6 +455,7 @@
</span><span class="cx"> jit/JITCall32_64.cpp
</span><span class="cx"> jit/JITCode.cpp
</span><span class="cx"> jit/JITDisassembler.cpp
</span><ins>+ jit/JITDivGenerator.cpp
</ins><span class="cx"> jit/JITExceptions.cpp
</span><span class="cx"> jit/JITInlineCacheGenerator.cpp
</span><span class="cx"> jit/JITMulGenerator.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -1,3 +1,67 @@
</span><ins>+2015-11-30 Mark Lam <mark.lam@apple.com>
+
+ Snippefy op_div for the baseline JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=151607
+
+ Reviewed by Geoffrey Garen.
+
+ * CMakeLists.txt:
+ * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+ * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emitSlow_op_div):
+ (JSC::JIT::compileBinaryArithOpSlowCase): Deleted.
+
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_div): Deleted.
+ (JSC::JIT::emitSlow_op_div): Deleted.
+ - Removed the 32-bit specific op_div implementation. The 64-bit version with the
+ op_div snippet can now service both 32-bit and 64-bit.
+
+ * jit/JITDivGenerator.cpp: Added.
+ (JSC::JITDivGenerator::loadOperand):
+ (JSC::JITDivGenerator::generateFastPath):
+ * jit/JITDivGenerator.h: Added.
+ (JSC::JITDivGenerator::JITDivGenerator):
+ (JSC::JITDivGenerator::didEmitFastPath):
+ (JSC::JITDivGenerator::endJumpList):
+ (JSC::JITDivGenerator::slowPathJumpList):
+
+ * jit/JITInlines.h:
+ (JSC::JIT::getOperandConstantDouble): Added.
+
+ * jit/SnippetOperand.h: Added.
+ (JSC::SnippetOperand::SnippetOperand):
+ (JSC::SnippetOperand::mightBeNumber):
+ (JSC::SnippetOperand::definitelyIsNumber):
+ (JSC::SnippetOperand::isConst):
+ (JSC::SnippetOperand::isConstInt32):
+ (JSC::SnippetOperand::isConstDouble):
+ (JSC::SnippetOperand::asRawBits):
+ (JSC::SnippetOperand::asConstInt32):
+ (JSC::SnippetOperand::asConstDouble):
+ (JSC::SnippetOperand::setConstInt32):
+ (JSC::SnippetOperand::setConstDouble):
+ - The SnippetOperand encapsulates operand constness, const type, and profiling
+ information. As a result:
+ 1. The argument list to the JITDivGenerator constructor is now more concise.
+ 2. The logic of the JITDivGenerator is now less verbose and easier to express.
+
+ * parser/ResultType.h:
+ (JSC::ResultType::isInt32):
+ (JSC::ResultType::definitelyIsNumber):
+ (JSC::ResultType::definitelyIsString):
+ (JSC::ResultType::definitelyIsBoolean):
+ (JSC::ResultType::mightBeNumber):
+ (JSC::ResultType::isNotNumber):
+ - Made these functions const because they were always meant to be const.
+ This also allows me to enforce constness in the SnippetOperand.
+
</ins><span class="cx"> 2015-11-30 Sukolsak Sakshuwong <sukolsak@gmail.com>
</span><span class="cx">
</span><span class="cx"> Fix coding style of Intl code
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -647,6 +647,7 @@
</span><span class="cx"> <ClCompile Include="..\jit\JITCall32_64.cpp" />
</span><span class="cx"> <ClCompile Include="..\jit\JITCode.cpp" />
</span><span class="cx"> <ClCompile Include="..\jit\JITDisassembler.cpp" />
</span><ins>+ <ClCompile Include="..\jit\JITDivGenerator.cpp" />
</ins><span class="cx"> <ClCompile Include="..\jit\JITExceptions.cpp" />
</span><span class="cx"> <ClCompile Include="..\jit\JITInlineCacheGenerator.cpp" />
</span><span class="cx"> <ClCompile Include="..\jit\JITMulGenerator.cpp" />
</span><span class="lines">@@ -1465,6 +1466,7 @@
</span><span class="cx"> <ClInclude Include="..\jit\JITCode.h" />
</span><span class="cx"> <ClInclude Include="..\jit\JITCompilationEffort.h" />
</span><span class="cx"> <ClInclude Include="..\jit\JITDisassembler.h" />
</span><ins>+ <ClInclude Include="..\jit\JITDivGenerator.h" />
</ins><span class="cx"> <ClInclude Include="..\jit\JITExceptions.h" />
</span><span class="cx"> <ClInclude Include="..\jit\JITInlineCacheGenerator.h" />
</span><span class="cx"> <ClInclude Include="..\jit\JITInlines.h" />
</span><span class="lines">@@ -1485,6 +1487,7 @@
</span><span class="cx"> <ClInclude Include="..\jit\RegisterSet.h" />
</span><span class="cx"> <ClInclude Include="..\jit\Repatch.h" />
</span><span class="cx"> <ClInclude Include="..\jit\ScratchRegisterAllocator.h" />
</span><ins>+ <ClInclude Include="..\jit\SnippetOperand.h" />
</ins><span class="cx"> <ClInclude Include="..\jit\SpecializedThunkJIT.h" />
</span><span class="cx"> <ClInclude Include="..\jit\TempRegisterSet.h" />
</span><span class="cx"> <ClInclude Include="..\jit\ThunkGenerator.h" />
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -441,6 +441,9 @@
</span><span class="cx"> <ClCompile Include="..\jit\JITDisassembler.cpp">
</span><span class="cx"> <Filter>jit</Filter>
</span><span class="cx"> </ClCompile>
</span><ins>+ <ClCompile Include="..\jit\JITDivGenerator.cpp">
+ <Filter>jit</Filter>
+ </ClCompile>
</ins><span class="cx"> <ClCompile Include="..\jit\JITExceptions.cpp">
</span><span class="cx"> <Filter>jit</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -2516,6 +2519,9 @@
</span><span class="cx"> <ClInclude Include="..\jit\JITDisassembler.h">
</span><span class="cx"> <Filter>jit</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\jit\JITDivGenerator.h">
+ <Filter>jit</Filter>
+ </ClInclude>
</ins><span class="cx"> <ClInclude Include="..\jit\JITExceptions.h">
</span><span class="cx"> <Filter>jit</Filter>
</span><span class="cx"> </ClInclude>
</span><span class="lines">@@ -2543,6 +2549,9 @@
</span><span class="cx"> <ClInclude Include="..\jit\SpecializedThunkJIT.h">
</span><span class="cx"> <Filter>jit</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\jit\SnippetOperand.h">
+ <Filter>jit</Filter>
+ </ClInclude>
</ins><span class="cx"> <ClInclude Include="..\jit\ThunkGenerator.h">
</span><span class="cx"> <Filter>jit</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -1972,6 +1972,9 @@
</span><span class="cx">                 FE1220281BE7F5910039E6F2 /* JITAddGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1220251BE7F5640039E6F2 /* JITAddGenerator.cpp */; };
</span><span class="cx">                 FE187A011BFBE55E0038BBCA /* JITMulGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1879FF1BFBC73C0038BBCA /* JITMulGenerator.cpp */; };
</span><span class="cx">                 FE187A021BFBE5610038BBCA /* JITMulGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A001BFBC73C0038BBCA /* JITMulGenerator.h */; };
</span><ins>+                FE187A0D1C030D5C0038BBCA /* JITDivGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0B1C0229230038BBCA /* JITDivGenerator.h */; settings = {ASSET_TAGS = (); }; };
+                FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */; settings = {ASSET_TAGS = (); }; };
+                FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; settings = {ASSET_TAGS = (); }; };
</ins><span class="cx">                 FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1C0FFC1B193E9800B53FCA /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FE1C0FFF1B194FD100B53FCA /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1C0FFE1B194FD100B53FCA /* Exception.cpp */; };
</span><span class="cx">                 FE20CE9D15F04A9500DF3430 /* LLIntCLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */; };
</span><span class="lines">@@ -4112,6 +4115,9 @@
</span><span class="cx">                 FE1220261BE7F5640039E6F2 /* JITAddGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITAddGenerator.h; sourceTree = "<group>"; };
</span><span class="cx">                 FE1879FF1BFBC73C0038BBCA /* JITMulGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITMulGenerator.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 FE187A001BFBC73C0038BBCA /* JITMulGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITMulGenerator.h; sourceTree = "<group>"; };
</span><ins>+                FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITDivGenerator.cpp; sourceTree = "<group>"; };
+                FE187A0B1C0229230038BBCA /* JITDivGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITDivGenerator.h; sourceTree = "<group>"; };
+                FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SnippetOperand.h; sourceTree = "<group>"; };
</ins><span class="cx">                 FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
</span><span class="cx">                 FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntCLoop.cpp; path = llint/LLIntCLoop.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -4791,6 +4797,8 @@
</span><span class="cx">                                 0F0776BD14FF002800102332 /* JITCompilationEffort.h */,
</span><span class="cx">                                 0FAF7EFA165BA919000C8455 /* JITDisassembler.cpp */,
</span><span class="cx">                                 0FAF7EFB165BA919000C8455 /* JITDisassembler.h */,
</span><ins>+                                FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */,
+                                FE187A0B1C0229230038BBCA /* JITDivGenerator.h */,
</ins><span class="cx">                                 0F46807F14BA572700BFE272 /* JITExceptions.cpp */,
</span><span class="cx">                                 0F46808014BA572700BFE272 /* JITExceptions.h */,
</span><span class="cx">                                 0FB14E1C18124ACE009B6B4D /* JITInlineCacheGenerator.cpp */,
</span><span class="lines">@@ -4832,6 +4840,7 @@
</span><span class="cx">                                 0FEE98421A89227500754E93 /* SetupVarargsFrame.cpp */,
</span><span class="cx">                                 0FEE98401A8865B600754E93 /* SetupVarargsFrame.h */,
</span><span class="cx">                                 A709F2EF17A0AC0400512E98 /* SlowPathCall.h */,
</span><ins>+                                FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */,
</ins><span class="cx">                                 A7386551118697B400540279 /* SpecializedThunkJIT.h */,
</span><span class="cx">                                 A7FF647A18C52E8500B55307 /* SpillRegistersMode.h */,
</span><span class="cx">                                 0FC314111814559100033232 /* TempRegisterSet.cpp */,
</span><span class="lines">@@ -7197,6 +7206,7 @@
</span><span class="cx">                                 14BA7A9813AADFF8005B7C2C /* Heap.h in Headers */,
</span><span class="cx">                                 0F32BD111BB34F190093A57F /* HeapHelperPool.h in Headers */,
</span><span class="cx">                                 C2DA778318E259990066FCB6 /* HeapInlines.h in Headers */,
</span><ins>+                                FE187A0D1C030D5C0038BBCA /* JITDivGenerator.h in Headers */,
</ins><span class="cx">                                 2AD8932B17E3868F00668276 /* HeapIterationScope.h in Headers */,
</span><span class="cx">                                 A5339EC91BB4B4600054F005 /* HeapObserver.h in Headers */,
</span><span class="cx">                                 2A6F462617E959CE00C45C98 /* HeapOperation.h in Headers */,
</span><span class="lines">@@ -7260,6 +7270,7 @@
</span><span class="cx">                                 A1B9E23E1B4E0D6700BC7FED /* IntlCollatorPrototype.h in Headers */,
</span><span class="cx">                                 A18193E41B4E0CDB00FC1029 /* IntlCollatorPrototype.lut.h in Headers */,
</span><span class="cx">                                 A1587D6E1B4DC14100D69849 /* IntlDateTimeFormat.h in Headers */,
</span><ins>+                                FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */,
</ins><span class="cx">                                 A1587D701B4DC14100D69849 /* IntlDateTimeFormatConstructor.h in Headers */,
</span><span class="cx">                                 A1587D751B4DC1C600D69849 /* IntlDateTimeFormatConstructor.lut.h in Headers */,
</span><span class="cx">                                 A1587D721B4DC14100D69849 /* IntlDateTimeFormatPrototype.h in Headers */,
</span><span class="lines">@@ -8598,6 +8609,7 @@
</span><span class="cx">                                 0FD1202F1A8AED12000F5280 /* FTLJSCallBase.cpp in Sources */,
</span><span class="cx">                                 0FD120331A8C85BD000F5280 /* FTLJSCallVarargs.cpp in Sources */,
</span><span class="cx">                                 62774DAA1B8D4B190006F05A /* FTLJSTailCall.cpp in Sources */,
</span><ins>+                                FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */,
</ins><span class="cx">                                 0FB4FB731BC843140025CA5A /* FTLLazySlowPath.cpp in Sources */,
</span><span class="cx">                                 0F8F2B95172E04A0007DBDA5 /* FTLLink.cpp in Sources */,
</span><span class="cx">                                 0FCEFADF180738C000472CE4 /* FTLLocation.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/jit/JIT.h        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -404,6 +404,7 @@
</span><span class="cx"> void emitPutVirtualRegister(int dst, JSValueRegs src);
</span><span class="cx">
</span><span class="cx"> int32_t getOperandConstantInt(int src);
</span><ins>+ double getOperandConstantDouble(int src);
</ins><span class="cx">
</span><span class="cx"> #if USE(JSVALUE32_64)
</span><span class="cx"> bool getOperandConstantInt(int op1, int op2, int& op, int32_t& constant);
</span><span class="lines">@@ -462,7 +463,6 @@
</span><span class="cx"> void emitJumpSlowCaseIfNotInt(RegisterID, RegisterID, RegisterID scratch);
</span><span class="cx">
</span><span class="cx"> void emitTagBool(RegisterID);
</span><del>- void compileBinaryArithOpSlowCase(Instruction*, OpcodeID, Vector<SlowCaseEntry>::iterator&, int dst, int src1, int src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase);
</del><span class="cx">
</span><span class="cx"> void compileGetByIdHotPath(int baseVReg, const Identifier*);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITArithmeticcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CodeBlock.h"
</span><span class="cx"> #include "JITAddGenerator.h"
</span><ins>+#include "JITDivGenerator.h"
</ins><span class="cx"> #include "JITInlines.h"
</span><span class="cx"> #include "JITMulGenerator.h"
</span><span class="cx"> #include "JITOperations.h"
</span><span class="lines">@@ -661,181 +662,6 @@
</span><span class="cx">
</span><span class="cx"> /* ------------------------------ END: OP_MOD ------------------------------ */
</span><span class="cx">
</span><del>-/* ------------------------------ BEGIN: USE(JSVALUE64) (OP_ADD, OP_SUB, OP_MUL) ------------------------------ */
-
-void JIT::compileBinaryArithOpSlowCase(Instruction* currentInstruction, OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, int result, int op1, int op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase)
-{
- // We assume that subtracting TagTypeNumber is equivalent to adding DoubleEncodeOffset.
- COMPILE_ASSERT(((TagTypeNumber + DoubleEncodeOffset) == 0), TagTypeNumber_PLUS_DoubleEncodeOffset_EQUALS_0);
-
- Jump notImm1;
- Jump notImm2;
- if (op1HasImmediateIntFastCase) {
- notImm2 = getSlowCase(iter);
- } else if (op2HasImmediateIntFastCase) {
- notImm1 = getSlowCase(iter);
- } else {
- notImm1 = getSlowCase(iter);
- notImm2 = getSlowCase(iter);
- }
-
- linkSlowCase(iter); // Integer overflow case - we could handle this in JIT code, but this is likely rare.
-
- Label stubFunctionCall(this);
-
- JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_mul);
- slowPathCall.call();
- Jump end = jump();
-
- if (op1HasImmediateIntFastCase) {
- notImm2.link(this);
- if (!types.second().definitelyIsNumber())
- emitJumpIfNotNumber(regT0).linkTo(stubFunctionCall, this);
- emitGetVirtualRegister(op1, regT1);
- convertInt32ToDouble(regT1, fpRegT1);
- add64(tagTypeNumberRegister, regT0);
- move64ToDouble(regT0, fpRegT2);
- } else if (op2HasImmediateIntFastCase) {
- notImm1.link(this);
- if (!types.first().definitelyIsNumber())
- emitJumpIfNotNumber(regT0).linkTo(stubFunctionCall, this);
- emitGetVirtualRegister(op2, regT1);
- convertInt32ToDouble(regT1, fpRegT1);
- add64(tagTypeNumberRegister, regT0);
- move64ToDouble(regT0, fpRegT2);
- } else {
- // if we get here, eax is not an int32, edx not yet checked.
- notImm1.link(this);
- if (!types.first().definitelyIsNumber())
- emitJumpIfNotNumber(regT0).linkTo(stubFunctionCall, this);
- if (!types.second().definitelyIsNumber())
- emitJumpIfNotNumber(regT1).linkTo(stubFunctionCall, this);
- add64(tagTypeNumberRegister, regT0);
- move64ToDouble(regT0, fpRegT1);
- Jump op2isDouble = emitJumpIfNotInt(regT1);
- convertInt32ToDouble(regT1, fpRegT2);
- Jump op2wasInteger = jump();
-
- // if we get here, eax IS an int32, edx is not.
- notImm2.link(this);
- if (!types.second().definitelyIsNumber())
- emitJumpIfNotNumber(regT1).linkTo(stubFunctionCall, this);
- convertInt32ToDouble(regT0, fpRegT1);
- op2isDouble.link(this);
- add64(tagTypeNumberRegister, regT1);
- move64ToDouble(regT1, fpRegT2);
- op2wasInteger.link(this);
- }
-
- ASSERT_UNUSED(opcodeID, opcodeID == op_div);
- divDouble(fpRegT2, fpRegT1);
-
- moveDoubleTo64(fpRegT1, regT0);
- sub64(tagTypeNumberRegister, regT0);
- emitPutVirtualRegister(result, regT0);
-
- end.link(this);
-}
-
-void JIT::emit_op_div(Instruction* currentInstruction)
-{
- int dst = currentInstruction[1].u.operand;
- int op1 = currentInstruction[2].u.operand;
- int op2 = currentInstruction[3].u.operand;
- OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
-
- if (isOperandConstantDouble(op1)) {
- emitGetVirtualRegister(op1, regT0);
- add64(tagTypeNumberRegister, regT0);
- move64ToDouble(regT0, fpRegT0);
- } else if (isOperandConstantInt(op1)) {
- emitLoadInt32ToDouble(op1, fpRegT0);
- } else {
- emitGetVirtualRegister(op1, regT0);
- if (!types.first().definitelyIsNumber())
- emitJumpSlowCaseIfNotNumber(regT0);
- Jump notInt = emitJumpIfNotInt(regT0);
- convertInt32ToDouble(regT0, fpRegT0);
- Jump skipDoubleLoad = jump();
- notInt.link(this);
- add64(tagTypeNumberRegister, regT0);
- move64ToDouble(regT0, fpRegT0);
- skipDoubleLoad.link(this);
- }
-
- if (isOperandConstantDouble(op2)) {
- emitGetVirtualRegister(op2, regT1);
- add64(tagTypeNumberRegister, regT1);
- move64ToDouble(regT1, fpRegT1);
- } else if (isOperandConstantInt(op2)) {
- emitLoadInt32ToDouble(op2, fpRegT1);
- } else {
- emitGetVirtualRegister(op2, regT1);
- if (!types.second().definitelyIsNumber())
- emitJumpSlowCaseIfNotNumber(regT1);
- Jump notInt = emitJumpIfNotInt(regT1);
- convertInt32ToDouble(regT1, fpRegT1);
- Jump skipDoubleLoad = jump();
- notInt.link(this);
- add64(tagTypeNumberRegister, regT1);
- move64ToDouble(regT1, fpRegT1);
- skipDoubleLoad.link(this);
- }
- divDouble(fpRegT1, fpRegT0);
-
- // Is the result actually an integer? The DFG JIT would really like to know. If it's
- // not an integer, we increment a count. If this together with the slow case counter
- // are below threshold then the DFG JIT will compile this division with a specualtion
- // that the remainder is zero.
-
- // As well, there are cases where a double result here would cause an important field
- // in the heap to sometimes have doubles in it, resulting in double predictions getting
- // propagated to a use site where it might cause damage (such as the index to an array
- // access). So if we are DFG compiling anything in the program, we want this code to
- // ensure that it produces integers whenever possible.
-
- JumpList notInteger;
- branchConvertDoubleToInt32(fpRegT0, regT0, notInteger, fpRegT1);
- // If we've got an integer, we might as well make that the result of the division.
- emitTagInt(regT0, regT0);
- Jump isInteger = jump();
- notInteger.link(this);
- moveDoubleTo64(fpRegT0, regT0);
- Jump doubleZero = branchTest64(Zero, regT0);
- add32(TrustedImm32(1), AbsoluteAddress(&m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset)->m_counter));
- sub64(tagTypeNumberRegister, regT0);
- Jump trueDouble = jump();
- doubleZero.link(this);
- move(tagTypeNumberRegister, regT0);
- trueDouble.link(this);
- isInteger.link(this);
-
- emitPutVirtualRegister(dst, regT0);
-}
-
-void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- int op1 = currentInstruction[2].u.operand;
- int op2 = currentInstruction[3].u.operand;
- OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
- if (types.first().definitelyIsNumber() && types.second().definitelyIsNumber()) {
- if (!ASSERT_DISABLED)
- abortWithReason(JITDivOperandsAreNotNumbers);
- return;
- }
- if (!isOperandConstantDouble(op1) && !isOperandConstantInt(op1)) {
- if (!types.first().definitelyIsNumber())
- linkSlowCase(iter);
- }
- if (!isOperandConstantDouble(op2) && !isOperandConstantInt(op2)) {
- if (!types.second().definitelyIsNumber())
- linkSlowCase(iter);
- }
- // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0.
- JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_div);
- slowPathCall.call();
-}
-
</del><span class="cx"> #endif // USE(JSVALUE64)
</span><span class="cx">
</span><span class="cx"> void JIT::emit_op_add(Instruction* currentInstruction)
</span><span class="lines">@@ -906,6 +732,79 @@
</span><span class="cx"> slowPathCall.call();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void JIT::emit_op_div(Instruction* currentInstruction)
+{
+ int result = currentInstruction[1].u.operand;
+ int op1 = currentInstruction[2].u.operand;
+ int op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+#if USE(JSVALUE64)
+ JSValueRegs leftRegs = JSValueRegs(regT0);
+ JSValueRegs rightRegs = JSValueRegs(regT1);
+ JSValueRegs resultRegs = leftRegs;
+ GPRReg scratchGPR = regT2;
+ FPRReg scratchFPR = InvalidFPRReg;
+#else
+ JSValueRegs leftRegs = JSValueRegs(regT1, regT0);
+ JSValueRegs rightRegs = JSValueRegs(regT3, regT2);
+ JSValueRegs resultRegs = leftRegs;
+ GPRReg scratchGPR = regT4;
+ FPRReg scratchFPR = fpRegT2;
+#endif
+
+ uint32_t* profilingCounter = &m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset)->m_counter;
+
+ SnippetOperand leftOperand(types.first());
+ SnippetOperand rightOperand(types.second());
+
+ if (isOperandConstantInt(op1))
+ leftOperand.setConstInt32(getOperandConstantInt(op1));
+#if USE(JSVALUE64)
+ else if (isOperandConstantDouble(op1))
+ leftOperand.setConstDouble(getOperandConstantDouble(op1));
+#endif
+
+ if (isOperandConstantInt(op2))
+ rightOperand.setConstInt32(getOperandConstantInt(op2));
+#if USE(JSVALUE64)
+ else if (isOperandConstantDouble(op2))
+ rightOperand.setConstDouble(getOperandConstantDouble(op2));
+#endif
+
+ ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
+
+ if (!leftOperand.isConst())
+ emitGetVirtualRegister(op1, leftRegs);
+ if (!rightOperand.isConst())
+ emitGetVirtualRegister(op2, rightRegs);
+
+ JITDivGenerator gen(leftOperand, rightOperand, resultRegs, leftRegs, rightRegs,
+ fpRegT0, fpRegT1, scratchGPR, scratchFPR, profilingCounter);
+
+ gen.generateFastPath(*this);
+
+ if (gen.didEmitFastPath()) {
+ gen.endJumpList().link(this);
+ emitPutVirtualRegister(result, resultRegs);
+
+ addSlowCase(gen.slowPathJumpList());
+ } else {
+ ASSERT(gen.endJumpList().empty());
+ ASSERT(gen.slowPathJumpList().empty());
+ JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_div);
+ slowPathCall.call();
+ }
+}
+
+void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkAllSlowCasesForBytecodeOffset(m_slowCases, iter, m_bytecodeOffset);
+
+ JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_div);
+ slowPathCall.call();
+}
+
</ins><span class="cx"> void JIT::emit_op_mul(Instruction* currentInstruction)
</span><span class="cx"> {
</span><span class="cx"> int result = currentInstruction[1].u.operand;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITArithmetic32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -478,8 +478,6 @@
</span><span class="cx"> slowPathCall.call();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Addition (+)
-
</del><span class="cx"> void JIT::emitBinaryDoubleOp(OpcodeID opcodeID, int dst, int op1, int op2, OperandTypes types, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters, bool op2IsInRegisters)
</span><span class="cx"> {
</span><span class="cx"> JumpList end;
</span><span class="lines">@@ -512,35 +510,6 @@
</span><span class="cx"> // Do the math.
</span><span class="cx"> doTheMath.link(this);
</span><span class="cx"> switch (opcodeID) {
</span><del>- case op_div: {
- emitLoadDouble(op1, fpRegT1);
- divDouble(fpRegT0, fpRegT1);
-
- // Is the result actually an integer? The DFG JIT would really like to know. If it's
- // not an integer, we increment a count. If this together with the slow case counter
- // are below threshold then the DFG JIT will compile this division with a specualtion
- // that the remainder is zero.
-
- // As well, there are cases where a double result here would cause an important field
- // in the heap to sometimes have doubles in it, resulting in double predictions getting
- // propagated to a use site where it might cause damage (such as the index to an array
- // access). So if we are DFG compiling anything in the program, we want this code to
- // ensure that it produces integers whenever possible.
-
- // FIXME: This will fail to convert to integer if the result is zero. We should
- // distinguish between positive zero and negative zero here.
-
- JumpList notInteger;
- branchConvertDoubleToInt32(fpRegT1, regT2, notInteger, fpRegT0);
- // If we've got an integer, we might as well make that the result of the division.
- emitStoreInt32(dst, regT2);
- Jump isInteger = jump();
- notInteger.link(this);
- add32(TrustedImm32(1), AbsoluteAddress(&m_codeBlock->specialFastCaseProfileForBytecodeOffset(m_bytecodeOffset)->m_counter));
- emitStoreDouble(dst, fpRegT1);
- isInteger.link(this);
- break;
- }
</del><span class="cx"> case op_jless:
</span><span class="cx"> emitLoadDouble(op1, fpRegT2);
</span><span class="cx"> addJump(branchDouble(DoubleLessThan, fpRegT2, fpRegT0), dst);
</span><span class="lines">@@ -598,34 +567,6 @@
</span><span class="cx">
</span><span class="cx"> // Do the math.
</span><span class="cx"> switch (opcodeID) {
</span><del>- case op_div: {
- emitLoadDouble(op2, fpRegT2);
- divDouble(fpRegT2, fpRegT0);
- // Is the result actually an integer? The DFG JIT would really like to know. If it's
- // not an integer, we increment a count. If this together with the slow case counter
- // are below threshold then the DFG JIT will compile this division with a specualtion
- // that the remainder is zero.
-
- // As well, there are cases where a double result here would cause an important field
- // in the heap to sometimes have doubles in it, resulting in double predictions getting
- // propagated to a use site where it might cause damage (such as the index to an array
- // access). So if we are DFG compiling anything in the program, we want this code to
- // ensure that it produces integers whenever possible.
-
- // FIXME: This will fail to convert to integer if the result is zero. We should
- // distinguish between positive zero and negative zero here.
-
- JumpList notInteger;
- branchConvertDoubleToInt32(fpRegT0, regT2, notInteger, fpRegT1);
- // If we've got an integer, we might as well make that the result of the division.
- emitStoreInt32(dst, regT2);
- Jump isInteger = jump();
- notInteger.link(this);
- add32(TrustedImm32(1), AbsoluteAddress(&m_codeBlock->specialFastCaseProfileForBytecodeOffset(m_bytecodeOffset)->m_counter));
- emitStoreDouble(dst, fpRegT0);
- isInteger.link(this);
- break;
- }
</del><span class="cx"> case op_jless:
</span><span class="cx"> emitLoadDouble(op2, fpRegT1);
</span><span class="cx"> addJump(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), dst);
</span><span class="lines">@@ -666,85 +607,6 @@
</span><span class="cx"> end.link(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Division (/)
-
-void JIT::emit_op_div(Instruction* currentInstruction)
-{
- int dst = currentInstruction[1].u.operand;
- int op1 = currentInstruction[2].u.operand;
- int op2 = currentInstruction[3].u.operand;
- OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
-
- m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset);
-
- if (!supportsFloatingPoint()) {
- addSlowCase(jump());
- return;
- }
-
- // Int32 divide.
- JumpList notInt32Op1;
- JumpList notInt32Op2;
-
- JumpList end;
-
- emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
-
- notInt32Op1.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
- notInt32Op2.append(branch32(NotEqual, regT3, TrustedImm32(JSValue::Int32Tag)));
-
- convertInt32ToDouble(regT0, fpRegT0);
- convertInt32ToDouble(regT2, fpRegT1);
- divDouble(fpRegT1, fpRegT0);
- // Is the result actually an integer? The DFG JIT would really like to know. If it's
- // not an integer, we increment a count. If this together with the slow case counter
- // are below threshold then the DFG JIT will compile this division with a specualtion
- // that the remainder is zero.
-
- // As well, there are cases where a double result here would cause an important field
- // in the heap to sometimes have doubles in it, resulting in double predictions getting
- // propagated to a use site where it might cause damage (such as the index to an array
- // access). So if we are DFG compiling anything in the program, we want this code to
- // ensure that it produces integers whenever possible.
-
- // FIXME: This will fail to convert to integer if the result is zero. We should
- // distinguish between positive zero and negative zero here.
-
- JumpList notInteger;
- branchConvertDoubleToInt32(fpRegT0, regT2, notInteger, fpRegT1);
- // If we've got an integer, we might as well make that the result of the division.
- emitStoreInt32(dst, regT2);
- end.append(jump());
- notInteger.link(this);
- add32(TrustedImm32(1), AbsoluteAddress(&m_codeBlock->specialFastCaseProfileForBytecodeOffset(m_bytecodeOffset)->m_counter));
- emitStoreDouble(dst, fpRegT0);
- end.append(jump());
-
- // Double divide.
- emitBinaryDoubleOp(op_div, dst, op1, op2, types, notInt32Op1, notInt32Op2);
- end.link(this);
-}
-
-void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
- OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
-
- if (!supportsFloatingPoint())
- linkSlowCase(iter);
- else {
- if (!types.first().definitelyIsNumber())
- linkSlowCase(iter); // double check
-
- if (!types.second().definitelyIsNumber()) {
- linkSlowCase(iter); // int32 check
- linkSlowCase(iter); // double check
- }
- }
-
- JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_div);
- slowPathCall.call();
-}
-
</del><span class="cx"> // Mod (%)
</span><span class="cx">
</span><span class="cx"> /* ------------------------------ BEGIN: OP_MOD ------------------------------ */
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITDivGeneratorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp (0 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JITDivGenerator.h"
+
+#if ENABLE(JIT)
+
+#include "JSCJSValueInlines.h"
+
+namespace JSC {
+
+void JITDivGenerator::loadOperand(CCallHelpers& jit, SnippetOperand& opr, JSValueRegs oprRegs, FPRReg destFPR)
+{
+ if (opr.isConstInt32()) {
+ jit.move(CCallHelpers::Imm32(opr.asConstInt32()), m_scratchGPR);
+ jit.convertInt32ToDouble(m_scratchGPR, destFPR);
+#if USE(JSVALUE64)
+ } else if (opr.isConstDouble()) {
+ jit.move(CCallHelpers::Imm64(opr.asRawBits()), m_scratchGPR);
+ jit.move64ToDouble(m_scratchGPR, destFPR);
+#endif
+ } else {
+ if (!opr.definitelyIsNumber())
+ m_slowPathJumpList.append(jit.branchIfNotNumber(oprRegs, m_scratchGPR));
+ CCallHelpers::Jump notInt32 = jit.branchIfNotInt32(oprRegs);
+ jit.convertInt32ToDouble(oprRegs.payloadGPR(), destFPR);
+ CCallHelpers::Jump oprIsLoaded = jit.jump();
+ notInt32.link(&jit);
+ jit.unboxDoubleNonDestructive(oprRegs, destFPR, m_scratchGPR, m_scratchFPR);
+ oprIsLoaded.link(&jit);
+ }
+}
+
+void JITDivGenerator::generateFastPath(CCallHelpers& jit)
+{
+ ASSERT(m_scratchGPR != InvalidGPRReg);
+ ASSERT(m_scratchGPR != m_left.payloadGPR());
+ ASSERT(m_scratchGPR != m_right.payloadGPR());
+#if USE(JSVALUE32_64)
+ ASSERT(m_scratchGPR != m_left.tagGPR());
+ ASSERT(m_scratchGPR != m_right.tagGPR());
+ ASSERT(m_scratchFPR != InvalidFPRReg);
+#endif
+
+ ASSERT(!m_didEmitFastPath);
+ if (!jit.supportsFloatingPoint())
+ return;
+ if (!m_leftOperand.mightBeNumber() || !m_rightOperand.mightBeNumber())
+ return;
+
+ ASSERT(!m_leftOperand.isConstInt32() || !m_rightOperand.isConstInt32());
+ m_didEmitFastPath = true;
+ loadOperand(jit, m_leftOperand, m_left, m_leftFPR);
+ loadOperand(jit, m_rightOperand, m_right, m_rightFPR);
+
+ jit.divDouble(m_rightFPR, m_leftFPR);
+
+ // Is the result actually an integer? The DFG JIT would really like to know. If it's
+ // not an integer, we increment a count. If this together with the slow case counter
+ // are below threshold then the DFG JIT will compile this division with a speculation
+ // that the remainder is zero.
+
+ // As well, there are cases where a double result here would cause an important field
+ // in the heap to sometimes have doubles in it, resulting in double predictions getting
+ // propagated to a use site where it might cause damage (such as the index to an array
+ // access). So if we are DFG compiling anything in the program, we want this code to
+ // ensure that it produces integers whenever possible.
+
+ CCallHelpers::JumpList notInt32;
+ jit.branchConvertDoubleToInt32(m_leftFPR, m_scratchGPR, notInt32, m_scratchFPR);
+
+ // If we've got an integer, we might as well make that the result of the division.
+ jit.boxInt32(m_scratchGPR, m_result);
+ m_endJumpList.append(jit.jump());
+
+ notInt32.link(&jit);
+#if USE(JSVALUE64)
+ jit.moveDoubleTo64(m_leftFPR, m_scratchGPR);
+ CCallHelpers::Jump notDoubleZero = jit.branchTest64(CCallHelpers::NonZero, m_scratchGPR);
+
+ jit.move(GPRInfo::tagTypeNumberRegister, m_result.payloadGPR());
+ m_endJumpList.append(jit.jump());
+
+ notDoubleZero.link(&jit);
+#endif
+ if (m_profilingCounter)
+ jit.add32(CCallHelpers::TrustedImm32(1), CCallHelpers::AbsoluteAddress(m_profilingCounter));
+ jit.boxDouble(m_leftFPR, m_result);
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITDivGeneratorh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/jit/JITDivGenerator.h (0 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITDivGenerator.h         (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITDivGenerator.h        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JITDivGenerator_h
+#define JITDivGenerator_h
+
+#if ENABLE(JIT)
+
+#include "CCallHelpers.h"
+#include "SnippetOperand.h"
+
+namespace JSC {
+
+class JITDivGenerator {
+public:
+ JITDivGenerator(SnippetOperand leftOperand, SnippetOperand rightOperand,
+ JSValueRegs result, JSValueRegs left, JSValueRegs right,
+ FPRReg leftFPR, FPRReg rightFPR, GPRReg scratchGPR, FPRReg scratchFPR,
+ uint32_t* profilingCounter = nullptr)
+ : m_leftOperand(leftOperand)
+ , m_rightOperand(rightOperand)
+ , m_result(result)
+ , m_left(left)
+ , m_right(right)
+ , m_leftFPR(leftFPR)
+ , m_rightFPR(rightFPR)
+ , m_scratchGPR(scratchGPR)
+ , m_scratchFPR(scratchFPR)
+ , m_profilingCounter(profilingCounter)
+ {
+ ASSERT(!m_leftOperand.isConstInt32() || !m_rightOperand.isConstInt32());
+ }
+
+ void generateFastPath(CCallHelpers&);
+
+ bool didEmitFastPath() const { return m_didEmitFastPath; }
+ CCallHelpers::JumpList& endJumpList() { return m_endJumpList; }
+ CCallHelpers::JumpList& slowPathJumpList() { return m_slowPathJumpList; }
+
+private:
+ void loadOperand(CCallHelpers&, SnippetOperand&, JSValueRegs opRegs, FPRReg destFPR);
+
+ SnippetOperand m_leftOperand;
+ SnippetOperand m_rightOperand;
+ JSValueRegs m_result;
+ JSValueRegs m_left;
+ JSValueRegs m_right;
+ FPRReg m_leftFPR;
+ FPRReg m_rightFPR;
+ GPRReg m_scratchGPR;
+ FPRReg m_scratchFPR;
+ uint32_t* m_profilingCounter;
+ bool m_didEmitFastPath { false };
+
+ CCallHelpers::JumpList m_endJumpList;
+ CCallHelpers::JumpList m_slowPathJumpList;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // JITDivGenerator_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITInlines.h (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITInlines.h        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/jit/JITInlines.h        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -980,6 +980,11 @@
</span><span class="cx"> return getConstantOperand(src).asInt32();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ALWAYS_INLINE double JIT::getOperandConstantDouble(int src)
+{
+ return getConstantOperand(src).asDouble();
+}
+
</ins><span class="cx"> #if USE(JSVALUE32_64)
</span><span class="cx">
</span><span class="cx"> inline void JIT::emitLoadTag(int index, RegisterID tag)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitSnippetOperandh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/jit/SnippetOperand.h (0 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/SnippetOperand.h         (rev 0)
+++ trunk/Source/JavaScriptCore/jit/SnippetOperand.h        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SnippetOperand_h
+#define SnippetOperand_h
+
+#if ENABLE(JIT)
+
+#include "ResultType.h"
+
+namespace JSC {
+
+class SnippetOperand {
+ enum ConstOrVarType {
+ Variable,
+ ConstInt32,
+ ConstDouble
+ };
+
+public:
+ SnippetOperand(ResultType resultType)
+ : m_resultType(resultType)
+ { }
+
+ bool mightBeNumber() const { return m_resultType.mightBeNumber(); }
+ bool definitelyIsNumber() const { return m_resultType.definitelyIsNumber(); }
+
+ bool isConst() const { return m_type != Variable; }
+ bool isConstInt32() const { return m_type == ConstInt32; }
+ bool isConstDouble() const { return m_type == ConstDouble; }
+
+ int64_t asRawBits() const { return m_val.rawBits; }
+
+ int32_t asConstInt32() const
+ {
+ ASSERT(m_type == ConstInt32);
+ return m_val.int32Val;
+ }
+
+ double asConstDouble() const
+ {
+ ASSERT(m_type == ConstDouble);
+ return m_val.doubleVal;
+ }
+
+ void setConstInt32(int32_t value)
+ {
+ m_type = ConstInt32;
+ m_val.int32Val = value;
+ }
+
+ void setConstDouble(double value)
+ {
+ m_type = ConstDouble;
+ m_val.doubleVal = value;
+ }
+
+private:
+ ResultType m_resultType;
+ ConstOrVarType m_type { Variable };
+ union {
+ int32_t int32Val;
+ double doubleVal;
+ int64_t rawBits;
+ } m_val;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // SnippetOperand_h
+
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserResultTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ResultType.h (192835 => 192836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ResultType.h        2015-11-30 23:06:27 UTC (rev 192835)
+++ trunk/Source/JavaScriptCore/parser/ResultType.h        2015-11-30 23:13:41 UTC (rev 192836)
</span><span class="lines">@@ -49,32 +49,32 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public:
</span><del>- bool isInt32()
</del><ins>+ bool isInt32() const
</ins><span class="cx"> {
</span><span class="cx"> return m_type & TypeInt32;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool definitelyIsNumber()
</del><ins>+ bool definitelyIsNumber() const
</ins><span class="cx"> {
</span><span class="cx"> return (m_type & TypeBits) == TypeMaybeNumber;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool definitelyIsString()
</del><ins>+ bool definitelyIsString() const
</ins><span class="cx"> {
</span><span class="cx"> return (m_type & TypeBits) == TypeMaybeString;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool definitelyIsBoolean()
</del><ins>+ bool definitelyIsBoolean() const
</ins><span class="cx"> {
</span><span class="cx"> return (m_type & TypeBits) == TypeMaybeBool;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool mightBeNumber()
</del><ins>+ bool mightBeNumber() const
</ins><span class="cx"> {
</span><span class="cx"> return m_type & TypeMaybeNumber;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool isNotNumber()
</del><ins>+ bool isNotNumber() const
</ins><span class="cx"> {
</span><span class="cx"> return !mightBeNumber();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>