<!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>[189494] 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/189494">189494</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-08 10:39:35 -0700 (Tue, 08 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add initial support for doubles in WebAssembly
https://bugs.webkit.org/show_bug.cgi?id=148913

Patch by Sukolsak Sakshuwong &lt;sukolsak@gmail.com&gt; on 2015-09-08
Reviewed by Filip Pizlo.

Implement the ConstantPoolIndex, Immediate, and GetLocal instructions
for doubles (float64) in WebAssembly.

* tests/stress/wasm-arithmetic-float64.js: Added.
(shouldBe):
* tests/stress/wasm/arithmetic-float64.wasm: Added.
* wasm/WASMConstants.h:
* wasm/WASMFunctionCompiler.h:
(JSC::WASMFunctionCompiler::buildSetLocal):
(JSC::WASMFunctionCompiler::buildReturn):
(JSC::WASMFunctionCompiler::buildImmediateI32):
(JSC::WASMFunctionCompiler::buildImmediateF64):
(JSC::WASMFunctionCompiler::buildGetLocal):
* wasm/WASMFunctionParser.cpp:
(JSC::WASMFunctionParser::parseExpression):
(JSC::WASMFunctionParser::parseExpressionF64):
(JSC::WASMFunctionParser::parseConstantPoolIndexExpressionF64):
(JSC::WASMFunctionParser::parseImmediateExpressionF64):
(JSC::WASMFunctionParser::parseGetLocalExpressionF64):
* wasm/WASMFunctionParser.h:
* wasm/WASMFunctionSyntaxChecker.h:
(JSC::WASMFunctionSyntaxChecker::buildImmediateF64):
* wasm/WASMReader.cpp:
(JSC::WASMReader::readOpExpressionF64):
* wasm/WASMReader.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMConstantsh">trunk/Source/JavaScriptCore/wasm/WASMConstants.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionCompilerh">trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParsercpp">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParserh">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionSyntaxCheckerh">trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMReadercpp">trunk/Source/JavaScriptCore/wasm/WASMReader.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMReaderh">trunk/Source/JavaScriptCore/wasm/WASMReader.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticfloat64wasm">trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-float64.wasm</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticfloat64js">trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-float64.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-09-08  Sukolsak Sakshuwong  &lt;sukolsak@gmail.com&gt;
+
+        Add initial support for doubles in WebAssembly
+        https://bugs.webkit.org/show_bug.cgi?id=148913
+
+        Reviewed by Filip Pizlo.
+
+        Implement the ConstantPoolIndex, Immediate, and GetLocal instructions
+        for doubles (float64) in WebAssembly.
+
+        * tests/stress/wasm-arithmetic-float64.js: Added.
+        (shouldBe):
+        * tests/stress/wasm/arithmetic-float64.wasm: Added.
+        * wasm/WASMConstants.h:
+        * wasm/WASMFunctionCompiler.h:
+        (JSC::WASMFunctionCompiler::buildSetLocal):
+        (JSC::WASMFunctionCompiler::buildReturn):
+        (JSC::WASMFunctionCompiler::buildImmediateI32):
+        (JSC::WASMFunctionCompiler::buildImmediateF64):
+        (JSC::WASMFunctionCompiler::buildGetLocal):
+        * wasm/WASMFunctionParser.cpp:
+        (JSC::WASMFunctionParser::parseExpression):
+        (JSC::WASMFunctionParser::parseExpressionF64):
+        (JSC::WASMFunctionParser::parseConstantPoolIndexExpressionF64):
+        (JSC::WASMFunctionParser::parseImmediateExpressionF64):
+        (JSC::WASMFunctionParser::parseGetLocalExpressionF64):
+        * wasm/WASMFunctionParser.h:
+        * wasm/WASMFunctionSyntaxChecker.h:
+        (JSC::WASMFunctionSyntaxChecker::buildImmediateF64):
+        * wasm/WASMReader.cpp:
+        (JSC::WASMReader::readOpExpressionF64):
+        * wasm/WASMReader.h:
+
</ins><span class="cx"> 2015-09-06  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         CallLinkInfo inside StructureStubInfo should not use polymorphic stubs
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticfloat64wasm"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-float64.wasm (0 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-float64.wasm                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-float64.wasm        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+wasm\xF4\x80\xCD\xCC\xCC\xCC\xCC\xCC@number
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticfloat64js"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-float64.js (0 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-float64.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-float64.js        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+//@ skip
+
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+/*
+wasm/arithmetic-float64.wasm is generated by pack-asmjs &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt; from the following script:
+
+function asmModule(global, env, buffer) {
+    &quot;use asm&quot;;
+
+    function number() {
+        return 4.2;
+    }
+
+    return {
+        number: number,
+    };
+}
+*/
+
+var module = loadWebAssembly(&quot;wasm/arithmetic-float64.wasm&quot;);
+
+shouldBe(module.number(), 4.2);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMConstantsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMConstants.h (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMConstants.h        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMConstants.h        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -170,6 +170,56 @@
</span><span class="cx">     NumberOfWASMOpExpressionI32WithImmediates
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+enum class WASMOpExpressionF64 : uint8_t {
+    ConstantPoolIndex,
+    Immediate,
+    GetLocal,
+    GetGlobal,
+    SetLocal,
+    SetGlobal,
+    Load,
+    LoadWithOffset,
+    Store,
+    StoreWithOffset,
+    CallInternal,
+    CallIndirect,
+    CallImport,
+    Conditional,
+    Comma,
+    FromS32,
+    FromU32,
+    FromF32,
+    Negate,
+    Add,
+    Sub,
+    Mul,
+    Div,
+    Mod,
+    Min,
+    Max,
+    Abs,
+    Ceil,
+    Floor,
+    Sqrt,
+    Cos,
+    Sin,
+    Tan,
+    ACos,
+    ASin,
+    ATan,
+    ATan2,
+    Exp,
+    Ln,
+    Pow,
+    NumberOfWASMOpExpressionF64s
+};
+
+enum class WASMOpExpressionF64WithImmediate : uint8_t {
+    ConstantPoolIndex,
+    GetLocal,
+    NumberOfWASMOpExpressionF64WithImmediates
+};
+
</ins><span class="cx"> enum class WASMVariableTypes : uint8_t {
</span><span class="cx">     I32 = 1 &lt;&lt; 0,
</span><span class="cx">     F32 = 1 &lt;&lt; 1,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionCompilerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -183,6 +183,11 @@
</span><span class="cx">             m_tempStackTop--;
</span><span class="cx">             store32(GPRInfo::regT0, localAddress(localIndex));
</span><span class="cx">             break;
</span><ins>+        case WASMType::F64:
+            loadDouble(temporaryAddress(m_tempStackTop - 1), FPRInfo::fpRegT0);
+            m_tempStackTop--;
+            storeDouble(FPRInfo::fpRegT0, localAddress(localIndex));
+            break;
</ins><span class="cx">         default:
</span><span class="cx">             ASSERT_NOT_REACHED();
</span><span class="cx">         }
</span><span class="lines">@@ -193,9 +198,22 @@
</span><span class="cx">         switch (returnType) {
</span><span class="cx">         case WASMExpressionType::I32:
</span><span class="cx">             load32(temporaryAddress(m_tempStackTop - 1), GPRInfo::returnValueGPR);
</span><ins>+#if USE(JSVALUE64)
</ins><span class="cx">             or64(GPRInfo::tagTypeNumberRegister, GPRInfo::returnValueGPR);
</span><ins>+#else
+            move(TrustedImm32(JSValue::Int32Tag), GPRInfo::returnValueGPR2);
+#endif
</ins><span class="cx">             m_tempStackTop--;
</span><span class="cx">             break;
</span><ins>+        case WASMExpressionType::F64:
+            loadDouble(temporaryAddress(m_tempStackTop - 1), FPRInfo::fpRegT0);
+#if USE(JSVALUE64)
+            boxDouble(FPRInfo::fpRegT0, GPRInfo::returnValueGPR);
+#else
+            boxDouble(FPRInfo::fpRegT0, GPRInfo::returnValueGPR2, GPRInfo::returnValueGPR);
+#endif
+            m_tempStackTop--;
+            break;
</ins><span class="cx">         case WASMExpressionType::Void:
</span><span class="cx">             move(TrustedImm64(JSValue::encode(jsUndefined())), GPRInfo::returnValueGPR);
</span><span class="cx">             break;
</span><span class="lines">@@ -208,18 +226,37 @@
</span><span class="cx"> 
</span><span class="cx">     int buildImmediateI32(uint32_t immediate)
</span><span class="cx">     {
</span><del>-        store32(TrustedImm32(immediate), temporaryAddress(m_tempStackTop++));
</del><ins>+        store32(Imm32(immediate), temporaryAddress(m_tempStackTop++));
</ins><span class="cx">         return UNUSED;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    int buildImmediateF64(double immediate)
+    {
+#if USE(JSVALUE64)
+        store64(Imm64(bitwise_cast&lt;int64_t&gt;(immediate)), temporaryAddress(m_tempStackTop++));
+#else
+        union {
+            double doubleValue;
+            int32_t int32Values[2];
+        } u = { immediate };
+        m_tempStackTop++;
+        store32(Imm32(u.int32Values[0]), temporaryAddress(m_tempStackTop - 1));
+        store32(Imm32(u.int32Values[1]), temporaryAddress(m_tempStackTop - 1).withOffset(4));
+#endif
+        return UNUSED;
+    }
+
</ins><span class="cx">     int buildGetLocal(uint32_t localIndex, WASMType type)
</span><span class="cx">     {
</span><span class="cx">         switch (type) {
</span><span class="cx">         case WASMType::I32:
</span><span class="cx">             load32(localAddress(localIndex), GPRInfo::regT0);
</span><del>-            m_tempStackTop++;
-            store32(GPRInfo::regT0, temporaryAddress(m_tempStackTop - 1));
</del><ins>+            store32(GPRInfo::regT0, temporaryAddress(m_tempStackTop++));
</ins><span class="cx">             break;
</span><ins>+        case WASMType::F64:
+            loadDouble(localAddress(localIndex), FPRInfo::fpRegT0);
+            storeDouble(FPRInfo::fpRegT0, temporaryAddress(m_tempStackTop++));
+            break;
</ins><span class="cx">         default:
</span><span class="cx">             ASSERT_NOT_REACHED();
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -34,10 +34,12 @@
</span><span class="cx"> 
</span><span class="cx"> #define PROPAGATE_ERROR() do { if (!m_errorMessage.isNull()) return 0; } while (0)
</span><span class="cx"> #define FAIL_WITH_MESSAGE(errorMessage) do {  m_errorMessage = errorMessage; return 0; } while (0)
</span><ins>+#define READ_DOUBLE_OR_FAIL(result, errorMessage) do { if (!m_reader.readDouble(result)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</ins><span class="cx"> #define READ_COMPACT_INT32_OR_FAIL(result, errorMessage) do { if (!m_reader.readCompactInt32(result)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><span class="cx"> #define READ_COMPACT_UINT32_OR_FAIL(result, errorMessage) do { if (!m_reader.readCompactUInt32(result)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><span class="cx"> #define READ_OP_STATEMENT_OR_FAIL(hasImmediate, op, opWithImmediate, immediate, errorMessage) do { if (!m_reader.readOpStatement(hasImmediate, op, opWithImmediate, immediate)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><span class="cx"> #define READ_OP_EXPRESSION_I32_OR_FAIL(hasImmediate, op, opWithImmediate, immediate, errorMessage) do { if (!m_reader.readOpExpressionI32(hasImmediate, op, opWithImmediate, immediate)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><ins>+#define READ_OP_EXPRESSION_F64_OR_FAIL(hasImmediate, op, opWithImmediate, immediate, errorMessage) do { if (!m_reader.readOpExpressionF64(hasImmediate, op, opWithImmediate, immediate)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</ins><span class="cx"> #define READ_VARIABLE_TYPES_OR_FAIL(hasImmediate, variableTypes, variableTypesWithImmediate, immediate, errorMessage) do { if (!m_reader.readVariableTypes(hasImmediate, variableTypes, variableTypesWithImmediate, immediate)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><span class="cx"> #define READ_SWITCH_CASE_OR_FAIL(result, errorMessage) do { if (!m_reader.readSwitchCase(result)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><span class="cx"> #define FAIL_IF_FALSE(condition, errorMessage) do { if (!(condition)) FAIL_WITH_MESSAGE(errorMessage); } while (0)
</span><span class="lines">@@ -403,8 +405,9 @@
</span><span class="cx">     switch (expressionType) {
</span><span class="cx">     case WASMExpressionType::I32:
</span><span class="cx">         return parseExpressionI32(context);
</span><ins>+    case WASMExpressionType::F64:
+        return parseExpressionF64(context);
</ins><span class="cx">     case WASMExpressionType::F32:
</span><del>-    case WASMExpressionType::F64:
</del><span class="cx">     case WASMExpressionType::Void:
</span><span class="cx">         // FIXME: Implement these instructions.
</span><span class="cx">         FAIL_WITH_MESSAGE(&quot;Unsupported instruction.&quot;);
</span><span class="lines">@@ -587,6 +590,116 @@
</span><span class="cx">     return context.buildRelationalI32(left, right, op);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseExpressionF64(Context&amp; context)
+{
+    bool hasImmediate;
+    WASMOpExpressionF64 op;
+    WASMOpExpressionF64WithImmediate opWithImmediate;
+    uint8_t immediate;
+    READ_OP_EXPRESSION_F64_OR_FAIL(hasImmediate, op, opWithImmediate, immediate, &quot;Cannot read the float64 expression opcode.&quot;);
+    if (!hasImmediate) {
+        switch (op) {
+        case WASMOpExpressionF64::ConstantPoolIndex:
+            return parseConstantPoolIndexExpressionF64(context);
+        case WASMOpExpressionF64::Immediate:
+            return parseImmediateExpressionF64(context);
+        case WASMOpExpressionF64::GetLocal:
+            return parseGetLocalExpressionF64(context);
+        case WASMOpExpressionF64::GetGlobal:
+        case WASMOpExpressionF64::SetLocal:
+        case WASMOpExpressionF64::SetGlobal:
+        case WASMOpExpressionF64::Load:
+        case WASMOpExpressionF64::LoadWithOffset:
+        case WASMOpExpressionF64::Store:
+        case WASMOpExpressionF64::StoreWithOffset:
+        case WASMOpExpressionF64::CallInternal:
+        case WASMOpExpressionF64::CallIndirect:
+        case WASMOpExpressionF64::CallImport:
+        case WASMOpExpressionF64::Conditional:
+        case WASMOpExpressionF64::Comma:
+        case WASMOpExpressionF64::FromS32:
+        case WASMOpExpressionF64::FromU32:
+        case WASMOpExpressionF64::FromF32:
+        case WASMOpExpressionF64::Negate:
+        case WASMOpExpressionF64::Add:
+        case WASMOpExpressionF64::Sub:
+        case WASMOpExpressionF64::Mul:
+        case WASMOpExpressionF64::Div:
+        case WASMOpExpressionF64::Mod:
+        case WASMOpExpressionF64::Min:
+        case WASMOpExpressionF64::Max:
+        case WASMOpExpressionF64::Abs:
+        case WASMOpExpressionF64::Ceil:
+        case WASMOpExpressionF64::Floor:
+        case WASMOpExpressionF64::Sqrt:
+        case WASMOpExpressionF64::Cos:
+        case WASMOpExpressionF64::Sin:
+        case WASMOpExpressionF64::Tan:
+        case WASMOpExpressionF64::ACos:
+        case WASMOpExpressionF64::ASin:
+        case WASMOpExpressionF64::ATan:
+        case WASMOpExpressionF64::ATan2:
+        case WASMOpExpressionF64::Exp:
+        case WASMOpExpressionF64::Ln:
+        case WASMOpExpressionF64::Pow:
+            // FIXME: Implement these instructions.
+            FAIL_WITH_MESSAGE(&quot;Unsupported instruction.&quot;);
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    } else {
+        switch (opWithImmediate) {
+        case WASMOpExpressionF64WithImmediate::ConstantPoolIndex:
+            return parseConstantPoolIndexExpressionF64(context, immediate);
+        case WASMOpExpressionF64WithImmediate::GetLocal:
+            return parseGetLocalExpressionF64(context, immediate);
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    }
+    return 0;
+}
+
+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseConstantPoolIndexExpressionF64(Context&amp; context, uint32_t constantIndex)
+{
+    FAIL_IF_FALSE(constantIndex &lt; m_module-&gt;f64Constants().size(), &quot;The constant index is incorrect.&quot;);
+    return context.buildImmediateF64(m_module-&gt;f64Constants()[constantIndex]);
+}
+
+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseConstantPoolIndexExpressionF64(Context&amp; context)
+{
+    uint32_t constantIndex;
+    READ_COMPACT_UINT32_OR_FAIL(constantIndex, &quot;Cannot read the constant index.&quot;);
+    return parseConstantPoolIndexExpressionF64(context, constantIndex);
+}
+
+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseImmediateExpressionF64(Context&amp; context)
+{
+    double immediate;
+    READ_DOUBLE_OR_FAIL(immediate, &quot;Cannot read the immediate.&quot;);
+    return context.buildImmediateF64(immediate);
+}
+
+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseGetLocalExpressionF64(Context&amp; context, uint32_t localIndex)
+{
+    FAIL_IF_FALSE(localIndex &lt; m_localTypes.size(), &quot;The local variable index is incorrect.&quot;);
+    FAIL_IF_FALSE(m_localTypes[localIndex] == WASMType::F64, &quot;Expected a local variable of type float64.&quot;);
+    return context.buildGetLocal(localIndex, WASMType::F64);
+}
+
+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseGetLocalExpressionF64(Context&amp; context)
+{
+    uint32_t localIndex;
+    READ_COMPACT_UINT32_OR_FAIL(localIndex, &quot;Cannot read the local index.&quot;);
+    return parseGetLocalExpressionF64(context, localIndex);
+}
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -87,6 +87,13 @@
</span><span class="cx">     template &lt;class Context&gt; ContextExpression parseBinaryExpressionI32(Context&amp;, WASMOpExpressionI32);
</span><span class="cx">     template &lt;class Context&gt; ContextExpression parseRelationalI32ExpressionI32(Context&amp;, WASMOpExpressionI32);
</span><span class="cx"> 
</span><ins>+    template &lt;class Context&gt; ContextExpression parseExpressionF64(Context&amp;);
+    template &lt;class Context&gt; ContextExpression parseConstantPoolIndexExpressionF64(Context&amp;, uint32_t constantIndex);
+    template &lt;class Context&gt; ContextExpression parseConstantPoolIndexExpressionF64(Context&amp;);
+    template &lt;class Context&gt; ContextExpression parseImmediateExpressionF64(Context&amp;);
+    template &lt;class Context&gt; ContextExpression parseGetLocalExpressionF64(Context&amp;, uint32_t localIndex);
+    template &lt;class Context&gt; ContextExpression parseGetLocalExpressionF64(Context&amp;);
+
</ins><span class="cx">     JSWASMModule* m_module;
</span><span class="cx">     WASMReader m_reader;
</span><span class="cx">     size_t m_functionIndex;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionSyntaxCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -65,6 +65,13 @@
</span><span class="cx">         return UNUSED;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    int buildImmediateF64(uint32_t)
+    {
+        m_tempStackTop++;
+        updateTempStackHeight();
+        return UNUSED;
+    }
+
</ins><span class="cx">     int buildGetLocal(uint32_t, WASMType)
</span><span class="cx">     {
</span><span class="cx">         m_tempStackTop++;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMReadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMReader.cpp (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMReader.cpp        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMReader.cpp        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -189,6 +189,13 @@
</span><span class="cx">         static_cast&lt;uint8_t&gt;(WASMOpExpressionI32WithImmediate::NumberOfWASMOpExpressionI32WithImmediates));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WASMReader::readOpExpressionF64(bool&amp; hasImmediate, WASMOpExpressionF64&amp; op, WASMOpExpressionF64WithImmediate&amp; opWithImmediate, uint8_t&amp; immediate)
+{
+    return readOp(hasImmediate, op, opWithImmediate, immediate,
+        static_cast&lt;uint8_t&gt;(WASMOpExpressionF64::NumberOfWASMOpExpressionF64s),
+        static_cast&lt;uint8_t&gt;(WASMOpExpressionF64WithImmediate::NumberOfWASMOpExpressionF64WithImmediates));
+}
+
</ins><span class="cx"> bool WASMReader::readVariableTypes(bool&amp; hasImmediate, WASMVariableTypes&amp; variableTypes, WASMVariableTypesWithImmediate&amp; variableTypesWithImmediate, uint8_t&amp; immediate)
</span><span class="cx"> {
</span><span class="cx">     return readOp(hasImmediate, variableTypes, variableTypesWithImmediate, immediate,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMReaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMReader.h (189493 => 189494)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMReader.h        2015-09-08 17:25:28 UTC (rev 189493)
+++ trunk/Source/JavaScriptCore/wasm/WASMReader.h        2015-09-08 17:39:35 UTC (rev 189494)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     bool readExportFormat(WASMExportFormat&amp; result);
</span><span class="cx">     bool readOpStatement(bool&amp; hasImmediate, WASMOpStatement&amp;, WASMOpStatementWithImmediate&amp;, uint8_t&amp; immediate);
</span><span class="cx">     bool readOpExpressionI32(bool&amp; hasImmediate, WASMOpExpressionI32&amp;, WASMOpExpressionI32WithImmediate&amp;, uint8_t&amp; immediate);
</span><ins>+    bool readOpExpressionF64(bool&amp; hasImmediate, WASMOpExpressionF64&amp;, WASMOpExpressionF64WithImmediate&amp;, uint8_t&amp; immediate);
</ins><span class="cx">     bool readVariableTypes(bool&amp; hasImmediate, WASMVariableTypes&amp;, WASMVariableTypesWithImmediate&amp;, uint8_t&amp; immediate);
</span><span class="cx">     bool readSwitchCase(WASMSwitchCase&amp; result);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>