<!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>[158681] 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/158681">158681</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2013-11-05 10:56:06 -0800 (Tue, 05 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>FTL should support PutById
https://bugs.webkit.org/show_bug.cgi?id=123784

Reviewed by Geoffrey Garen.

* ftl/FTLAbbreviations.h:
(JSC::FTL::buildCall):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLCompile.cpp:
(JSC::FTL::generateICFastPath):
(JSC::FTL::fixFunctionBasedOnStackMaps):
* ftl/FTLInlineCacheDescriptor.h:
(JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
(JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
(JSC::FTL::PutByIdDescriptor::PutByIdDescriptor):
(JSC::FTL::PutByIdDescriptor::ecmaMode):
(JSC::FTL::PutByIdDescriptor::putKind):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compilePutById):
* ftl/FTLOutput.h:
(JSC::FTL::Output::call):
* ftl/FTLSlowPathCall.cpp:
(JSC::FTL::callOperation):
* ftl/FTLSlowPathCall.h:
* ftl/FTLState.h:
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArguments):
* runtime/Executable.h:
(JSC::ScriptExecutable::ecmaMode):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLAbbreviationsh">trunk/Source/JavaScriptCore/ftl/FTLAbbreviations.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCompilecpp">trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLInlineCacheDescriptorh">trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLIntrinsicRepositoryh">trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLOutputh">trunk/Source/JavaScriptCore/ftl/FTLOutput.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLSlowPathCallcpp">trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLSlowPathCallh">trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLStateh">trunk/Source/JavaScriptCore/ftl/FTLState.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitCCallHelpersh">trunk/Source/JavaScriptCore/jit/CCallHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutableh">trunk/Source/JavaScriptCore/runtime/Executable.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ChangeLog        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -1,5 +1,40 @@
</span><span class="cx"> 2013-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        FTL should support PutById
+        https://bugs.webkit.org/show_bug.cgi?id=123784
+
+        Reviewed by Geoffrey Garen.
+
+        * ftl/FTLAbbreviations.h:
+        (JSC::FTL::buildCall):
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLCompile.cpp:
+        (JSC::FTL::generateICFastPath):
+        (JSC::FTL::fixFunctionBasedOnStackMaps):
+        * ftl/FTLInlineCacheDescriptor.h:
+        (JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
+        (JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
+        (JSC::FTL::PutByIdDescriptor::PutByIdDescriptor):
+        (JSC::FTL::PutByIdDescriptor::ecmaMode):
+        (JSC::FTL::PutByIdDescriptor::putKind):
+        * ftl/FTLIntrinsicRepository.h:
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileNode):
+        (JSC::FTL::LowerDFGToLLVM::compilePutById):
+        * ftl/FTLOutput.h:
+        (JSC::FTL::Output::call):
+        * ftl/FTLSlowPathCall.cpp:
+        (JSC::FTL::callOperation):
+        * ftl/FTLSlowPathCall.h:
+        * ftl/FTLState.h:
+        * jit/CCallHelpers.h:
+        (JSC::CCallHelpers::setupArguments):
+        * runtime/Executable.h:
+        (JSC::ScriptExecutable::ecmaMode):
+
+2013-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
</ins><span class="cx">         GetById-&gt;GetByOffset and PutById-&gt;PutByOffset folding should mark haveStructures since it may result in structure transition watchpoints
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=123788
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLAbbreviationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLAbbreviations.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLAbbreviations.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLAbbreviations.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -259,6 +259,16 @@
</span><span class="cx">     LValue args[] = { arg1, arg2, arg3, arg4, arg5, arg6 };
</span><span class="cx">     return buildCall(builder, function, args, 6);
</span><span class="cx"> }
</span><ins>+static inline LValue buildCall(LBuilder builder, LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4, LValue arg5, LValue arg6, LValue arg7)
+{
+    LValue args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7 };
+    return buildCall(builder, function, args, 7);
+}
+static inline LValue buildCall(LBuilder builder, LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4, LValue arg5, LValue arg6, LValue arg7, LValue arg8)
+{
+    LValue args[] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 };
+    return buildCall(builder, function, args, 8);
+}
</ins><span class="cx"> enum TailCallMode { IsNotTailCall, IsTailCall };
</span><span class="cx"> static inline void setTailCall(LValue call, TailCallMode mode) { llvm-&gt;SetTailCall(call, mode == IsTailCall); }
</span><span class="cx"> static inline LValue buildExtractValue(LBuilder builder, LValue aggVal, unsigned index) { return llvm-&gt;BuildExtractValue(builder, aggVal, index, &quot;&quot;); }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -99,6 +99,7 @@
</span><span class="cx">         // These are OK.
</span><span class="cx">         break;
</span><span class="cx">     case GetById:
</span><ins>+    case PutById:
</ins><span class="cx">         if (node-&gt;child1().useKind() == CellUse)
</span><span class="cx">             break;
</span><span class="cx">         return CannotCompile;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCompilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -106,6 +106,42 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename DescriptorType&gt;
+void generateICFastPath(
+    State&amp; state, CodeBlock* codeBlock, GeneratedFunction generatedFunction,
+    StackMaps::RecordMap&amp; recordMap, DescriptorType&amp; ic, size_t sizeOfIC)
+{
+    VM&amp; vm = state.graph.m_vm;
+
+    StackMaps::RecordMap::iterator iter = recordMap.find(ic.stackmapID());
+    if (iter == recordMap.end()) {
+        // It was optimized out.
+        return;
+    }
+    
+    StackMaps::Record&amp; record = iter-&gt;value;
+
+    CCallHelpers fastPathJIT(&amp;vm, codeBlock);
+    ic.m_generator.generateFastPath(fastPathJIT);
+
+    char* startOfIC =
+        bitwise_cast&lt;char*&gt;(generatedFunction) + record.instructionOffset;
+            
+    LinkBuffer linkBuffer(vm, &amp;fastPathJIT, startOfIC, sizeOfIC);
+    // Note: we could handle the !isValid() case. We just don't appear to have a
+    // reason to do so, yet.
+    RELEASE_ASSERT(linkBuffer.isValid());
+    
+    state.finalizer-&gt;sideCodeLinkBuffer-&gt;link(
+        ic.m_slowPathDone, CodeLocationLabel(startOfIC + sizeOfIC));
+            
+    linkBuffer.link(
+        ic.m_generator.slowPathJump(),
+        state.finalizer-&gt;sideCodeLinkBuffer-&gt;locationOf(ic.m_generator.slowPathBegin()));
+            
+    ic.m_generator.finalize(linkBuffer, *state.finalizer-&gt;sideCodeLinkBuffer);
+}
+
</ins><span class="cx"> static void fixFunctionBasedOnStackMaps(
</span><span class="cx">     State&amp; state, CodeBlock* codeBlock, JITCode* jitCode, GeneratedFunction generatedFunction,
</span><span class="cx">     StackMaps::RecordMap&amp; recordMap)
</span><span class="lines">@@ -138,7 +174,7 @@
</span><span class="cx">         state.finalizer-&gt;exitThunksLinkBuffer = linkBuffer.release();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!state.getByIds.isEmpty()) {
</del><ins>+    if (!state.getByIds.isEmpty() || !state.putByIds.isEmpty()) {
</ins><span class="cx">         CCallHelpers slowPathJIT(&amp;vm, codeBlock);
</span><span class="cx">         
</span><span class="cx">         for (unsigned i = state.getByIds.size(); i--;) {
</span><span class="lines">@@ -177,41 +213,56 @@
</span><span class="cx">             getById.m_generator = gen;
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        state.finalizer-&gt;sideCodeLinkBuffer = adoptPtr(
-            new LinkBuffer(vm, &amp;slowPathJIT, codeBlock, JITCompilationMustSucceed));
-        
-        for (unsigned i = state.getByIds.size(); i--;) {
-            GetByIdDescriptor&amp; getById = state.getByIds[i];
</del><ins>+        for (unsigned i = state.putByIds.size(); i--;) {
+            PutByIdDescriptor&amp; putById = state.putByIds[i];
</ins><span class="cx">             
</span><del>-            StackMaps::RecordMap::iterator iter = recordMap.find(getById.stackmapID());
</del><ins>+            StackMaps::RecordMap::iterator iter = recordMap.find(putById.stackmapID());
</ins><span class="cx">             if (iter == recordMap.end()) {
</span><span class="cx">                 // It was optimized out.
</span><span class="cx">                 continue;
</span><span class="cx">             }
</span><span class="cx">             
</span><span class="cx">             StackMaps::Record&amp; record = iter-&gt;value;
</span><ins>+            
+            UNUSED_PARAM(record); // FIXME: use AnyRegs.
</ins><span class="cx"> 
</span><del>-            CCallHelpers fastPathJIT(&amp;vm, codeBlock);
-            getById.m_generator.generateFastPath(fastPathJIT);
-
-            char* startOfIC =
-                bitwise_cast&lt;char*&gt;(generatedFunction) + record.instructionOffset;
-            size_t sizeOfIC = sizeOfGetById();
</del><ins>+            // FIXME: LLVM should tell us which registers are live.
+            RegisterSet usedRegisters = RegisterSet::allRegisters();
</ins><span class="cx">             
</span><del>-            LinkBuffer linkBuffer(vm, &amp;fastPathJIT, startOfIC, sizeOfIC);
-            // Note: we could handle the !isValid() case. We just don't appear to have a
-            // reason to do so, yet.
-            RELEASE_ASSERT(linkBuffer.isValid());
</del><ins>+            GPRReg callFrameRegister = GPRInfo::argumentGPR0;
+            GPRReg base = GPRInfo::argumentGPR1;
+            GPRReg value = GPRInfo::argumentGPR2;
</ins><span class="cx">             
</span><del>-            state.finalizer-&gt;sideCodeLinkBuffer-&gt;link(
-                getById.m_slowPathDone, CodeLocationLabel(startOfIC + sizeOfIC));
</del><ins>+            JITPutByIdGenerator gen(
+                codeBlock, putById.codeOrigin(), usedRegisters, JSValueRegs(base),
+                JSValueRegs(value), GPRInfo::argumentGPR3, false, putById.ecmaMode(),
+                putById.putKind());
</ins><span class="cx">             
</span><del>-            linkBuffer.link(
-                getById.m_generator.slowPathJump(),
-                state.finalizer-&gt;sideCodeLinkBuffer-&gt;locationOf(getById.m_generator.slowPathBegin()));
</del><ins>+            MacroAssembler::Label begin = slowPathJIT.label();
</ins><span class="cx">             
</span><del>-            getById.m_generator.finalize(linkBuffer, *state.finalizer-&gt;sideCodeLinkBuffer);
</del><ins>+            MacroAssembler::Call call = callOperation(
+                state, usedRegisters, slowPathJIT, gen.slowPathFunction(), callFrameRegister,
+                gen.stubInfo(), value, base, putById.uid());
+            
+            gen.reportSlowPathCall(begin, call);
+            
+            putById.m_slowPathDone = slowPathJIT.jump();
+            putById.m_generator = gen;
</ins><span class="cx">         }
</span><ins>+        
+        state.finalizer-&gt;sideCodeLinkBuffer = adoptPtr(
+            new LinkBuffer(vm, &amp;slowPathJIT, codeBlock, JITCompilationMustSucceed));
+        
+        for (unsigned i = state.getByIds.size(); i--;) {
+            generateICFastPath(
+                state, codeBlock, generatedFunction, recordMap, state.getByIds[i],
+                sizeOfGetById());
+        }
+        for (unsigned i = state.putByIds.size(); i--;) {
+            generateICFastPath(
+                state, codeBlock, generatedFunction, recordMap, state.putByIds[i],
+                sizeOfPutById());
+        }
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     RepatchBuffer repatchBuffer(codeBlock);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLInlineCacheDescriptorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -39,14 +39,7 @@
</span><span class="cx"> public:
</span><span class="cx">     InlineCacheDescriptor() { }
</span><span class="cx">     
</span><del>-    MacroAssembler::Jump m_slowPathDone;
-};
-
-class GetByIdDescriptor : public InlineCacheDescriptor {
-public:
-    GetByIdDescriptor() { }
-    
-    GetByIdDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, StringImpl* uid)
</del><ins>+    InlineCacheDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, StringImpl* uid)
</ins><span class="cx">         : m_stackmapID(stackmapID)
</span><span class="cx">         , m_codeOrigin(codeOrigin)
</span><span class="cx">         , m_uid(uid)
</span><span class="lines">@@ -61,11 +54,46 @@
</span><span class="cx">     unsigned m_stackmapID;
</span><span class="cx">     CodeOrigin m_codeOrigin;
</span><span class="cx">     StringImpl* m_uid;
</span><ins>+    
+public:
+    MacroAssembler::Jump m_slowPathDone;
+};
</ins><span class="cx"> 
</span><ins>+class GetByIdDescriptor : public InlineCacheDescriptor {
</ins><span class="cx"> public:
</span><ins>+    GetByIdDescriptor() { }
+    
+    GetByIdDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, StringImpl* uid)
+        : InlineCacheDescriptor(stackmapID, codeOrigin, uid)
+    {
+    }
+    
</ins><span class="cx">     JITGetByIdGenerator m_generator;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+class PutByIdDescriptor : public InlineCacheDescriptor {
+public:
+    PutByIdDescriptor() { }
+    
+    PutByIdDescriptor(
+        unsigned stackmapID, CodeOrigin codeOrigin, StringImpl* uid,
+        ECMAMode ecmaMode, PutKind putKind)
+        : InlineCacheDescriptor(stackmapID, codeOrigin, uid)
+        , m_ecmaMode(ecmaMode)
+        , m_putKind(putKind)
+    {
+    }
+    
+    JITPutByIdGenerator m_generator;
+    
+    ECMAMode ecmaMode() const { return m_ecmaMode; }
+    PutKind putKind() const { return m_putKind; }
+
+private:
+    ECMAMode m_ecmaMode;
+    PutKind m_putKind;
+};
+
</ins><span class="cx"> } } // namespace JSC::FTL
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(FTL_JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLIntrinsicRepositoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     macro(subWithOverflow32, &quot;llvm.ssub.with.overflow.i32&quot;, functionType(structType(m_context, int32, boolean), int32, int32)) \
</span><span class="cx">     macro(subWithOverflow64, &quot;llvm.ssub.with.overflow.i64&quot;, functionType(structType(m_context, int64, boolean), int64, int64)) \
</span><span class="cx">     macro(patchpointInt64, &quot;llvm.experimental.patchpoint.i64&quot;, functionType(int64, int32, int32, ref8, int32, Variadic)) \
</span><ins>+    macro(patchpointVoid, &quot;llvm.experimental.patchpoint.void&quot;, functionType(voidType, int32, int32, ref8, int32, Variadic)) \
</ins><span class="cx">     macro(stackmap, &quot;llvm.experimental.stackmap&quot;, functionType(voidType, int32, int32, Variadic)) \
</span><span class="cx">     macro(trap, &quot;llvm.trap&quot;, functionType(voidType)) \
</span><span class="cx">     macro(osrExit, &quot;webkit_osr_exit&quot;, functionType(voidType, boolean, int32, Variadic))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -343,6 +343,9 @@
</span><span class="cx">         case GetById:
</span><span class="cx">             compileGetById();
</span><span class="cx">             break;
</span><ins>+        case PutById:
+            compilePutById();
+            break;
</ins><span class="cx">         case GetButterfly:
</span><span class="cx">             compileGetButterfly();
</span><span class="cx">             break;
</span><span class="lines">@@ -1259,6 +1262,28 @@
</span><span class="cx">         m_ftlState.getByIds.append(GetByIdDescriptor(stackmapID, m_node-&gt;codeOrigin, uid));
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    void compilePutById()
+    {
+        // See above; CellUse is easier so we do only that for now.
+        ASSERT(m_node-&gt;child1().useKind() == CellUse);
+
+        LValue base = lowCell(m_node-&gt;child1());
+        LValue value = lowJSValue(m_node-&gt;child2());
+        StringImpl* uid = m_graph.identifiers()[m_node-&gt;identifierNumber()];
+
+        // Arguments: id, bytes, target, numArgs, args...
+        unsigned stackmapID = m_stackmapIDs++;
+        m_out.call(
+            m_out.patchpointVoidIntrinsic(),
+            m_out.constInt32(stackmapID), m_out.constInt32(sizeOfPutById()),
+            constNull(m_out.ref8), m_out.constInt32(3), m_callFrame, base, value);
+        
+        m_ftlState.putByIds.append(PutByIdDescriptor(
+            stackmapID, m_node-&gt;codeOrigin, uid,
+            m_graph.executableFor(m_node-&gt;codeOrigin)-&gt;ecmaMode(),
+            m_node-&gt;op() == PutByIdDirect ? Direct : NotDirect));
+    }
+    
</ins><span class="cx">     void compileGetButterfly()
</span><span class="cx">     {
</span><span class="cx">         setStorage(m_out.loadPtr(lowCell(m_node-&gt;child1()), m_heaps.JSObject_butterfly));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLOutputh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLOutput.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLOutput.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLOutput.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -350,6 +350,8 @@
</span><span class="cx">     LValue call(LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4) { return buildCall(m_builder, function, arg1, arg2, arg3, arg4); }
</span><span class="cx">     LValue call(LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4, LValue arg5) { return buildCall(m_builder, function, arg1, arg2, arg3, arg4, arg5); }
</span><span class="cx">     LValue call(LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4, LValue arg5, LValue arg6) { return buildCall(m_builder, function, arg1, arg2, arg3, arg4, arg5, arg6); }
</span><ins>+    LValue call(LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4, LValue arg5, LValue arg6, LValue arg7) { return buildCall(m_builder, function, arg1, arg2, arg3, arg4, arg5, arg6, arg7); }
+    LValue call(LValue function, LValue arg1, LValue arg2, LValue arg3, LValue arg4, LValue arg5, LValue arg6, LValue arg7, LValue arg8) { return buildCall(m_builder, function, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); }
</ins><span class="cx">     
</span><span class="cx">     template&lt;typename FunctionType&gt;
</span><span class="cx">     LValue operation(FunctionType function)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLSlowPathCallcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -100,7 +100,8 @@
</span><span class="cx">     
</span><span class="cx">     ~CallContext()
</span><span class="cx">     {
</span><del>-        m_jit.move(GPRInfo::returnValueGPR, m_returnRegister);
</del><ins>+        if (m_returnRegister != InvalidGPRReg)
+            m_jit.move(GPRInfo::returnValueGPR, m_returnRegister);
</ins><span class="cx">         
</span><span class="cx">         for (unsigned i = std::min(NUMBER_OF_ARGUMENT_REGISTERS, m_numArgs); i--;) {
</span><span class="cx">             if (!m_usedRegisters.get(GPRInfo::toArgumentRegister(i)))
</span><span class="lines">@@ -163,6 +164,20 @@
</span><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=113622
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+MacroAssembler::Call callOperation(
+    State&amp; state, const RegisterSet&amp; usedRegisters, CCallHelpers&amp; jit, 
+    V_JITOperation_ESsiJJI operation, GPRReg callFrameRegister,
+    StructureStubInfo* stubInfo, GPRReg value, GPRReg object, StringImpl* uid)
+{
+    CallContext context(state, usedRegisters, jit, 5, InvalidGPRReg);
+    jit.setupArguments(
+        callFrameRegister, CCallHelpers::TrustedImmPtr(stubInfo), value, object,
+        CCallHelpers::TrustedImmPtr(uid));
+    return context.makeCall(bitwise_cast&lt;void*&gt;(operation));
+    // FIXME: FTL should support exceptions.
+    // https://bugs.webkit.org/show_bug.cgi?id=113622
+}
+
</ins><span class="cx"> } } // namespace JSC::FTL
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(FTL_JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLSlowPathCallh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLSlowPathCall.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -59,6 +59,10 @@
</span><span class="cx">     State&amp;, const RegisterSet&amp;, CCallHelpers&amp;, J_JITOperation_ESsiJI,
</span><span class="cx">     GPRReg result, GPRReg callFrameRegister, StructureStubInfo*, GPRReg object,
</span><span class="cx">     StringImpl* uid);
</span><ins>+MacroAssembler::Call callOperation(
+    State&amp;, const RegisterSet&amp;, CCallHelpers&amp;, V_JITOperation_ESsiJJI,
+    GPRReg callFrameRegister, StructureStubInfo*, GPRReg value, GPRReg object,
+    StringImpl* uid);
</ins><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::FTL
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLState.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLState.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/ftl/FTLState.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">     GeneratedFunction generatedFunction;
</span><span class="cx">     JITFinalizer* finalizer;
</span><span class="cx">     SegmentedVector&lt;GetByIdDescriptor&gt; getByIds;
</span><ins>+    SegmentedVector&lt;PutByIdDescriptor&gt; putByIds;
</ins><span class="cx">     Vector&lt;CString&gt; codeSectionNames;
</span><span class="cx">     Vector&lt;CString&gt; dataSectionNames;
</span><span class="cx">     RefCountedArray&lt;LSectionWord&gt; stackmapsSection;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitCCallHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/CCallHelpers.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/CCallHelpers.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/jit/CCallHelpers.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -913,6 +913,13 @@
</span><span class="cx">         move(arg4, GPRInfo::argumentGPR3);
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    ALWAYS_INLINE void setupArguments(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5)
+    {
+        setupThreeStubArgsGPR&lt;GPRInfo::argumentGPR0, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3&gt;(arg1, arg3, arg4);
+        move(arg2, GPRInfo::argumentGPR1);
+        move(arg5, GPRInfo::argumentGPR4);
+    }
+    
</ins><span class="cx">     ALWAYS_INLINE void setupArguments(TrustedImmPtr arg1)
</span><span class="cx">     {
</span><span class="cx">         move(arg1, GPRInfo::argumentGPR0);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.h (158680 => 158681)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.h        2013-11-05 18:53:04 UTC (rev 158680)
+++ trunk/Source/JavaScriptCore/runtime/Executable.h        2013-11-05 18:56:06 UTC (rev 158681)
</span><span class="lines">@@ -383,6 +383,7 @@
</span><span class="cx">     bool usesArguments() const { return m_features &amp; ArgumentsFeature; }
</span><span class="cx">     bool needsActivation() const { return m_hasCapturedVariables || m_features &amp; (EvalFeature | WithFeature | CatchFeature); }
</span><span class="cx">     bool isStrictMode() const { return m_features &amp; StrictModeFeature; }
</span><ins>+    ECMAMode ecmaMode() const { return isStrictMode() ? StrictMode : NotStrictMode; }
</ins><span class="cx">         
</span><span class="cx">     void setNeverInline(bool value) { m_neverInline = value; }
</span><span class="cx">     bool neverInline() const { return m_neverInline; }
</span></span></pre>
</div>
</div>

</body>
</html>