<!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>[161219] branches/jsCStack/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/161219">161219</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-01-02 12:42:13 -0800 (Thu, 02 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>CStack: Get the C Loop LLINT to build again.
https://bugs.webkit.org/show_bug.cgi?id=126393.

Not yet reviewed.

* jit/JITCode.cpp:
(JSC::DirectJITCode::addressForCall):
- #if ENABLE(JIT) out the use of RegisterPreservationWrappers.

* llint/LLIntCLoop.cpp:
(JSC::LLInt::CLoop::initialize):
- Update CLoop::initialize() to call the new CLoop::execute().

* llint/LLIntCLoop.h:
- CLoop::execute() now takes the arguments for callToJavaScript, and it
  effectively acts as the gateway for re-entering the VM in place for
  callToJavaScript (and callToNativeFunction).

  CLoop::execute() should set up the &quot;CPU&quot; execution environment i.e.
  CLoopRegisters should be initialized with the incoming args, stack
  pointer, base pointer, and return address. We'll take care of this
  part in a subsequent patch.

* llint/LLIntOpcode.h:
- Added C loop only llint opcodes llint_call_to_javascript, and
  llint_call_to_native_function. These will be used as the opcodeID for
  the llint interpreter blob for callToJavaScript and callToNativeFunction.

  Meanwhile, the LLINT thunk will provide C functions for callToJavaScript
  and callToNativeFunction which calls CLoop::execute() with the opcodeID
  for llint_call_to_javascript and llint_call_to_native_function
  respectively.

* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_throw_stack_overflow_error):
- Changed llint_throw_stack_overflow_error()'s return type so that it
  is easier for the C Loop LLINT to generate boilerplate code to call it.

  The return value is not used by anyone. But since this is code that
  rarely executed, we'll opt to take this small hit of returning an
  unused value rather than having to spin some way to make the C Loop
  offlineasm smarter only for handling this one case.

* llint/LLIntSlowPaths.h:
* llint/LLIntThunks.cpp:
(JSC::callToJavaScript):
(JSC::callToNativeFunction):
- Updated to call the new CLoop::execute().

  We're going to try to use the doCallToJavaScript code defined in the
  LLINT assembly instead of spinning our own version in C++ as we did
  previously.

* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter.cpp:
(JSC::CLoopRegister::operator ExecState*):
(JSC::CLoopRegister::operator Instruction*):
(JSC::CLoopRegister::operator VM*):
(JSC::CLoopRegister::operator ProtoCallFrame*):
- Added these cast operators to the CLoopRegister to simplify the C Loop
  call slow path boilerplate.

(JSC::CLoop::execute):
* llint/LowLevelInterpreter64.asm:
* offlineasm/cloop.rb:
- Define C Loop registers to match ARM as expected by the code.
- Replaced a #error with a RELEASE_ASSERT_NOT_REACHED().
- Reworked the call slow path boilerplate to take advantage of the CLoopRegister
  cast operators. We need this in order to be able to call slow path functions
  that take different argument types e.g. llint_throw_stack_overflow_error().

* runtime/CommonSlowPaths.cpp:
(JSC::setupArityCheckData):
* runtime/VM.cpp:
(JSC::VM::getHostFunction):
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::requiredCapacity):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesjsCStackSourceJavaScriptCoreChangeLog">branches/jsCStack/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorejitJITCodecpp">branches/jsCStack/Source/JavaScriptCore/jit/JITCode.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLLIntCLoopcpp">branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLLIntCLooph">branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLLIntOpcodeh">branches/jsCStack/Source/JavaScriptCore/llint/LLIntOpcode.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLLIntSlowPathscpp">branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLLIntSlowPathsh">branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLLIntThunkscpp">branches/jsCStack/Source/JavaScriptCore/llint/LLIntThunks.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLowLevelInterpreterasm">branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.asm</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLowLevelInterpretercpp">branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCorellintLowLevelInterpreter64asm">branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreofflineasmclooprb">branches/jsCStack/Source/JavaScriptCore/offlineasm/cloop.rb</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreruntimeCommonSlowPathscpp">branches/jsCStack/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreruntimeVMcpp">branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreruntimeVMEntryScopecpp">branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesjsCStackSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ChangeLog (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -1,3 +1,83 @@
</span><ins>+2014-01-02  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        CStack: Get the C Loop LLINT to build again.
+        https://bugs.webkit.org/show_bug.cgi?id=126393.
+
+        Not yet reviewed.
+
+        * jit/JITCode.cpp:
+        (JSC::DirectJITCode::addressForCall):
+        - #if ENABLE(JIT) out the use of RegisterPreservationWrappers.
+
+        * llint/LLIntCLoop.cpp:
+        (JSC::LLInt::CLoop::initialize):
+        - Update CLoop::initialize() to call the new CLoop::execute().
+
+        * llint/LLIntCLoop.h:
+        - CLoop::execute() now takes the arguments for callToJavaScript, and it
+          effectively acts as the gateway for re-entering the VM in place for
+          callToJavaScript (and callToNativeFunction).
+
+          CLoop::execute() should set up the &quot;CPU&quot; execution environment i.e.
+          CLoopRegisters should be initialized with the incoming args, stack
+          pointer, base pointer, and return address. We'll take care of this
+          part in a subsequent patch.
+
+        * llint/LLIntOpcode.h:
+        - Added C loop only llint opcodes llint_call_to_javascript, and
+          llint_call_to_native_function. These will be used as the opcodeID for
+          the llint interpreter blob for callToJavaScript and callToNativeFunction.
+
+          Meanwhile, the LLINT thunk will provide C functions for callToJavaScript
+          and callToNativeFunction which calls CLoop::execute() with the opcodeID
+          for llint_call_to_javascript and llint_call_to_native_function
+          respectively.
+
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::llint_throw_stack_overflow_error):
+        - Changed llint_throw_stack_overflow_error()'s return type so that it
+          is easier for the C Loop LLINT to generate boilerplate code to call it.
+
+          The return value is not used by anyone. But since this is code that
+          rarely executed, we'll opt to take this small hit of returning an
+          unused value rather than having to spin some way to make the C Loop
+          offlineasm smarter only for handling this one case.
+
+        * llint/LLIntSlowPaths.h:
+        * llint/LLIntThunks.cpp:
+        (JSC::callToJavaScript):
+        (JSC::callToNativeFunction):
+        - Updated to call the new CLoop::execute().
+
+          We're going to try to use the doCallToJavaScript code defined in the
+          LLINT assembly instead of spinning our own version in C++ as we did
+          previously.
+
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter.cpp:
+        (JSC::CLoopRegister::operator ExecState*):
+        (JSC::CLoopRegister::operator Instruction*):
+        (JSC::CLoopRegister::operator VM*):
+        (JSC::CLoopRegister::operator ProtoCallFrame*):
+        - Added these cast operators to the CLoopRegister to simplify the C Loop
+          call slow path boilerplate.
+
+        (JSC::CLoop::execute):
+        * llint/LowLevelInterpreter64.asm:
+        * offlineasm/cloop.rb:
+        - Define C Loop registers to match ARM as expected by the code.
+        - Replaced a #error with a RELEASE_ASSERT_NOT_REACHED().
+        - Reworked the call slow path boilerplate to take advantage of the CLoopRegister
+          cast operators. We need this in order to be able to call slow path functions
+          that take different argument types e.g. llint_throw_stack_overflow_error().
+
+        * runtime/CommonSlowPaths.cpp:
+        (JSC::setupArityCheckData):
+        * runtime/VM.cpp:
+        (JSC::VM::getHostFunction):
+        * runtime/VMEntryScope.cpp:
+        (JSC::VMEntryScope::requiredCapacity):
+
</ins><span class="cx"> 2014-01-02  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Some crashes in C stack on Mountain Lion, for example on crypto-aes, due to misaligned stack
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorejitJITCodecpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/jit/JITCode.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/jit/JITCode.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/jit/JITCode.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -161,10 +161,16 @@
</span><span class="cx">             RELEASE_ASSERT(m_ref);
</span><span class="cx">             return m_ref.code();
</span><span class="cx">         case MustPreserveRegisters: {
</span><ins>+#if ENABLE(JIT)
</ins><span class="cx">             RegisterPreservationWrappers* wrappers = ensureWrappers();
</span><span class="cx">             if (!wrappers-&gt;withoutArityCheck)
</span><span class="cx">                 wrappers-&gt;withoutArityCheck = generateRegisterPreservationWrapper(vm, executable, m_ref.code());
</span><span class="cx">             return wrappers-&gt;withoutArityCheck.code();
</span><ins>+#else
+            UNUSED_PARAM(vm);
+            UNUSED_PARAM(executable);
+            RELEASE_ASSERT_NOT_REACHED();
+#endif
</ins><span class="cx">         } }
</span><span class="cx">     case MustCheckArity:
</span><span class="cx">         switch (registers) {
</span><span class="lines">@@ -172,10 +178,14 @@
</span><span class="cx">             RELEASE_ASSERT(m_withArityCheck);
</span><span class="cx">             return m_withArityCheck;
</span><span class="cx">         case MustPreserveRegisters: {
</span><ins>+#if ENABLE(JIT)
</ins><span class="cx">             RegisterPreservationWrappers* wrappers = ensureWrappers();
</span><span class="cx">             if (!wrappers-&gt;withArityCheck)
</span><span class="cx">                 wrappers-&gt;withArityCheck = generateRegisterPreservationWrapper(vm, executable, m_withArityCheck);
</span><span class="cx">             return wrappers-&gt;withArityCheck.code();
</span><ins>+#else
+            RELEASE_ASSERT_NOT_REACHED();
+#endif
</ins><span class="cx">         } }
</span><span class="cx">     }
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLLIntCLoopcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CLoop::initialize()
</span><span class="cx"> {
</span><del>-    execute(0, getOpcode(llint_unused), true);
</del><ins>+    execute(llint_unused, 0, 0, 0, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace LLInt
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLLIntCLooph"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.h (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.h        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LLIntCLoop.h        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CallFrame.h&quot;
</span><span class="cx"> #include &quot;JSCJSValue.h&quot;
</span><span class="cx"> #include &quot;Opcode.h&quot;
</span><ins>+#include &quot;ProtoCallFrame.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> namespace LLInt {
</span><span class="lines">@@ -40,7 +41,7 @@
</span><span class="cx"> class CLoop {
</span><span class="cx"> public:
</span><span class="cx">     static void initialize();
</span><del>-    static JSValue execute(CallFrame*, Opcode entryOpcode, bool isInitializationPass = false);
</del><ins>+    static JSValue execute(OpcodeID entryOpcodeID, void* executableAddress, VM*, ProtoCallFrame*, bool isInitializationPass = false);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::LLInt
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLLIntOpcodeh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LLIntOpcode.h (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LLIntOpcode.h        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LLIntOpcode.h        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> #define FOR_EACH_LLINT_NOJIT_NATIVE_HELPER(macro) \
</span><span class="cx">     macro(getHostCallReturnValue, 1) \
</span><ins>+    macro(llint_call_to_javascript, 1) \
+    macro(llint_call_to_native_function, 1) \
</ins><span class="cx">     macro(handleUncaughtException, 1)
</span><span class="cx"> 
</span><span class="cx"> #else // !ENABLE(LLINT_C_LOOP)
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLLIntSlowPathscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -1414,12 +1414,13 @@
</span><span class="cx">     LLINT_END();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void llint_throw_stack_overflow_error(VM* vm, ProtoCallFrame* protoFrame)
</del><ins>+SlowPathReturnType llint_throw_stack_overflow_error(VM* vm, ProtoCallFrame* protoFrame)
</ins><span class="cx"> {
</span><span class="cx">     ExecState* exec = vm-&gt;topCallFrame;
</span><span class="cx">     if (!exec)
</span><span class="cx">         exec = protoFrame-&gt;scope()-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     throwStackOverflowError(exec);
</span><ins>+    return encodeResult(0, 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::LLInt
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLLIntSlowPathsh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.h (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.h        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.h        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_resolve_scope);
</span><span class="cx"> LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_from_scope);
</span><span class="cx"> LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_to_scope);
</span><del>-extern &quot;C&quot; void llint_throw_stack_overflow_error(VM*, ProtoCallFrame*);
</del><ins>+extern &quot;C&quot; SlowPathReturnType llint_throw_stack_overflow_error(VM*, ProtoCallFrame*);
</ins><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::LLInt
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLLIntThunkscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LLIntThunks.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LLIntThunks.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LLIntThunks.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -94,60 +94,18 @@
</span><span class="cx"> 
</span><span class="cx"> // Non-JIT (i.e. C Loop LLINT) case:
</span><span class="cx"> 
</span><del>-typedef JSValue (*ExecuteCode) (CallFrame*, void* executableAddress);
-
-template&lt;ExecuteCode execute&gt;
-EncodedJSValue doCallToJavaScript(void* executableAddress, ProtoCallFrame* protoCallFrame)
</del><ins>+EncodedJSValue callToJavaScript(void* executableAddress, VM* vm, ProtoCallFrame* protoCallFrame)
</ins><span class="cx"> {
</span><del>-    CodeBlock* codeBlock = protoCallFrame-&gt;codeBlock();
-    JSScope* scope = protoCallFrame-&gt;scope();
-    JSObject* callee = protoCallFrame-&gt;callee();
-    int argCountIncludingThis = protoCallFrame-&gt;argumentCountIncludingThis();
-    int argCount = protoCallFrame-&gt;argumentCount();
-    JSValue thisValue = protoCallFrame-&gt;thisValue();
-    JSStack&amp; stack = scope-&gt;vm()-&gt;interpreter-&gt;stack();
-
-    CallFrame* newCallFrame = stack.pushFrame(codeBlock, scope, argCountIncludingThis, callee);
-    if (UNLIKELY(!newCallFrame)) {
-        JSGlobalObject* globalObject = scope-&gt;globalObject();
-        ExecState* exec = globalObject-&gt;globalExec();
-        return JSValue::encode(throwStackOverflowError(exec));
-    }
-
-    // Set the arguments for the callee:
-    newCallFrame-&gt;setThisValue(thisValue);
-    for (int i = 0; i &lt; argCount; ++i)
-        newCallFrame-&gt;setArgument(i, protoCallFrame-&gt;argument(i));
-
-    JSValue result = execute(newCallFrame, executableAddress);
-
-    stack.popFrame(newCallFrame);
-
</del><ins>+    JSValue result = CLoop::execute(llint_call_to_javascript, executableAddress, vm, protoCallFrame);
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline JSValue executeJS(CallFrame* newCallFrame, void* executableAddress)
</del><ins>+EncodedJSValue callToNativeFunction(void* executableAddress, VM* vm, ProtoCallFrame* protoCallFrame)
</ins><span class="cx"> {
</span><del>-    Opcode entryOpcode = *reinterpret_cast&lt;Opcode*&gt;(&amp;executableAddress);
-    return CLoop::execute(newCallFrame, entryOpcode);
</del><ins>+    JSValue result = CLoop::execute(llint_call_to_native_function, executableAddress, vm, protoCallFrame);
+    return JSValue::encode(result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EncodedJSValue callToJavaScript(void* executableAddress, ExecState**, ProtoCallFrame* protoCallFrame, Register*)
-{
-    return doCallToJavaScript&lt;executeJS&gt;(executableAddress, protoCallFrame);
-}
-
-static inline JSValue executeNative(CallFrame* newCallFrame, void* executableAddress)
-{
-    NativeFunction function = reinterpret_cast&lt;NativeFunction&gt;(executableAddress);
-    return JSValue::decode(function(newCallFrame));
-}
-
-EncodedJSValue callToNativeFunction(void* executableAddress, ExecState**, ProtoCallFrame* protoCallFrame, Register*)
-{
-    return doCallToJavaScript&lt;executeNative&gt;(executableAddress, protoCallFrame);
-}
-
</del><span class="cx"> #endif // ENABLE(JIT)
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLowLevelInterpreterasm"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.asm (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -517,18 +517,25 @@
</span><span class="cx">     ret
</span><span class="cx"> end
</span><span class="cx"> 
</span><del>-if C_LOOP
-else
</del><span class="cx"> # stub to call into JavaScript or Native functions
</span><span class="cx"> # EncodedJSValue callToJavaScript(void* code, ExecState** vmTopCallFrame, ProtoCallFrame* protoFrame)
</span><span class="cx"> # EncodedJSValue callToNativeFunction(void* code, ExecState** vmTopCallFrame, ProtoCallFrame* protoFrame)
</span><span class="cx"> # Note, if these stubs or one of their related macros are changed, make the
</span><span class="cx"> # equivalent changes in jit/JITStubsX86.h and/or jit/JITStubsMSVC64.asm
</span><ins>+
+if C_LOOP
+_llint_call_to_javascript:
+else
</ins><span class="cx"> _callToJavaScript:
</span><ins>+end
</ins><span class="cx">     doCallToJavaScript(makeJavaScriptCall)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+if C_LOOP
+_llint_call_to_native_function:
+else
</ins><span class="cx"> _callToNativeFunction:
</span><ins>+end
</ins><span class="cx">     doCallToJavaScript(makeHostFunctionCall)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -560,8 +567,8 @@
</span><span class="cx"> .zeroFillDone:
</span><span class="cx">     storep sp, VM::m_lastStackTop[vm]
</span><span class="cx">     ret
</span><del>-end
</del><span class="cx"> 
</span><ins>+
</ins><span class="cx"> # Indicate the beginning of LLInt.
</span><span class="cx"> _llint_begin:
</span><span class="cx">     crash()
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLowLevelInterpretercpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -216,6 +216,8 @@
</span><span class="cx">         void* vp;
</span><span class="cx">         ExecState* execState;
</span><span class="cx">         void* instruction;
</span><ins>+        VM* vm;
+        ProtoCallFrame* protoCallFrame;
</ins><span class="cx">         NativeFunction nativeFunc;
</span><span class="cx"> #if USE(JSVALUE64)
</span><span class="cx">         int64_t i64;
</span><span class="lines">@@ -226,6 +228,11 @@
</span><span class="cx">         Opcode opcode;
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    operator ExecState*() { return execState; }
+    operator Instruction*() { return reinterpret_cast&lt;Instruction*&gt;(instruction); }
+    operator VM*() { return vm; }
+    operator ProtoCallFrame*() { return protoCallFrame; }
+
</ins><span class="cx"> #if USE(JSVALUE64)
</span><span class="cx">     inline void clearHighWord() { i32padding = 0; }
</span><span class="cx"> #else
</span><span class="lines">@@ -237,7 +244,7 @@
</span><span class="cx"> // The llint C++ interpreter loop:
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-JSValue CLoop::execute(CallFrame* callFrame, Opcode entryOpcode, bool isInitializationPass)
</del><ins>+JSValue CLoop::execute(OpcodeID entryOpcodeID, void* executableAddress, VM* vm, ProtoCallFrame* protoCallFrame, bool isInitializationPass)
</ins><span class="cx"> {
</span><span class="cx">     #define CAST reinterpret_cast
</span><span class="cx">     #define SIGN_BIT32(x) ((x) &amp; 0x80000000)
</span><span class="lines">@@ -272,8 +279,6 @@
</span><span class="cx">         return JSValue();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ASSERT(callFrame-&gt;vm().topCallFrame == callFrame);
-
</del><span class="cx">     // Define the pseudo registers used by the LLINT C Loop backend:
</span><span class="cx">     ASSERT(sizeof(CLoopRegister) == sizeof(intptr_t));
</span><span class="cx"> 
</span><span class="lines">@@ -315,25 +320,17 @@
</span><span class="cx">     CLoopRegister rRetVPC;
</span><span class="cx">     CLoopDoubleRegister d0, d1;
</span><span class="cx"> 
</span><del>-    // Keep the compiler happy. We don't really need this, but the compiler
-    // will complain. This makes the warning go away.
-    t0.i = 0;
-    t1.i = 0;
-
-    VM* vm = &amp;callFrame-&gt;vm();
-
-    CodeBlock* codeBlock = callFrame-&gt;codeBlock();
</del><span class="cx">     Instruction* vPC;
</span><span class="cx"> 
</span><span class="cx">     // rPC is an alias for vPC. Set up the alias:
</span><span class="cx">     CLoopRegister&amp; rPC = *CAST&lt;CLoopRegister*&gt;(&amp;vPC);
</span><span class="cx"> 
</span><del>-#if USE(JSVALUE32_64)
-    vPC = codeBlock-&gt;instructions().begin();
-#else // USE(JSVALUE64)
-    vPC = 0;
-    rBasePC.vp = codeBlock-&gt;instructions().begin();
</del><ins>+    // Initialize the incoming args for doCallToJavaScript:
+    t0.vp = executableAddress;
+    t1.vm = vm;
+    t2.protoCallFrame = protoCallFrame;
</ins><span class="cx"> 
</span><ins>+#if USE(JSVALUE64)
</ins><span class="cx">     // For the ASM llint, JITStubs takes care of this initialization. We do
</span><span class="cx">     // it explicitly here for the C loop:
</span><span class="cx">     tagTypeNumber.i = 0xFFFF000000000000;
</span><span class="lines">@@ -341,6 +338,7 @@
</span><span class="cx"> #endif // USE(JSVALUE64)
</span><span class="cx"> 
</span><span class="cx">     // cfr is an alias for callFrame. Set up this alias:
</span><ins>+    CallFrame* callFrame;
</ins><span class="cx">     CLoopRegister&amp; cfr = *CAST&lt;CLoopRegister*&gt;(&amp;callFrame);
</span><span class="cx"> 
</span><span class="cx">     // Simulate a native return PC which should never be used:
</span><span class="lines">@@ -349,10 +347,8 @@
</span><span class="cx">     // Interpreter variables for value passing between opcodes and/or helpers:
</span><span class="cx">     NativeFunction nativeFunc = 0;
</span><span class="cx">     JSValue functionReturnValue;
</span><del>-    Opcode opcode;
</del><ins>+    Opcode opcode = getOpcode(entryOpcodeID);
</ins><span class="cx"> 
</span><del>-    opcode = entryOpcode;
-
</del><span class="cx">     #if ENABLE(OPCODE_STATS)
</span><span class="cx">         #define RECORD_OPCODE_STATS(__opcode) \
</span><span class="cx">             OpcodeStats::recordInstruction(__opcode)
</span><span class="lines">@@ -431,11 +427,6 @@
</span><span class="cx">             goto doReturnHelper;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        OFFLINE_ASM_GLUE_LABEL(handleUncaughtException)
-        {
-            return vm-&gt;exception();
-        }
-
</del><span class="cx"> #if !ENABLE(COMPUTED_GOTO_OPCODES)
</span><span class="cx">     default:
</span><span class="cx">         ASSERT(false);
</span><span class="lines">@@ -478,7 +469,7 @@
</span><span class="cx">         // bytecode offset before we dispatch via the usual dispatch mechanism
</span><span class="cx">         // i.e. NEXT_INSTRUCTION():
</span><span class="cx"> 
</span><del>-        codeBlock = callFrame-&gt;codeBlock();
</del><ins>+        CodeBlock* codeBlock = callFrame-&gt;codeBlock();
</ins><span class="cx">         ASSERT(codeBlock);
</span><span class="cx">         rPC.vp = callFrame-&gt;currentVPC();
</span><span class="cx">         rPC.i = rPC.i8p - reinterpret_cast&lt;int8_t*&gt;(codeBlock-&gt;instructions().begin());
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCorellintLowLevelInterpreter64asm"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">         const temp1 = t0
</span><span class="cx">         const temp2 = t3
</span><span class="cx">         const temp3 = t6
</span><del>-    elsif ARM64
</del><ins>+    elsif ARM64 or C_LOOP
</ins><span class="cx">         const entry = a0
</span><span class="cx">         const vm = a1
</span><span class="cx">         const protoCallFrame = a2
</span><span class="lines">@@ -1874,7 +1874,10 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> _llint_throw_during_call_trampoline:
</span><ins>+if C_LOOP
+else
</ins><span class="cx">     pop t2
</span><ins>+end
</ins><span class="cx">     jmp _llint_throw_from_slow_path_trampoline
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreofflineasmclooprb"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/offlineasm/cloop.rb (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/offlineasm/cloop.rb        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/offlineasm/cloop.rb        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -68,22 +68,17 @@
</span><span class="cx"> class RegisterID
</span><span class="cx">     def clDump
</span><span class="cx">         case name
</span><ins>+        # The cloop is modelled on the ARM implementation. Hence, the a0-a3
+        # registers are aliases for r0-r3 i.e. t0-t3 in our case.
</ins><span class="cx">         when &quot;a0&quot;
</span><del>-            &quot;a0&quot;
</del><ins>+            &quot;t0&quot;
</ins><span class="cx">         when &quot;a1&quot;
</span><del>-            &quot;a1&quot;
</del><ins>+            &quot;t1&quot;
</ins><span class="cx">         when &quot;a2&quot;
</span><del>-            &quot;a2&quot;
</del><ins>+            &quot;t2&quot;
</ins><span class="cx">         when &quot;a3&quot;
</span><del>-            &quot;a3&quot;
-        when &quot;a4&quot;
-            &quot;a4&quot;
-        when &quot;a5&quot;
-            &quot;a5&quot;
-        when &quot;a6&quot;
-            &quot;a6&quot;
-        when &quot;a6&quot;
-            &quot;a6&quot;
</del><ins>+            &quot;t3&quot;
+
</ins><span class="cx">         when &quot;t0&quot;
</span><span class="cx">             &quot;t0&quot;
</span><span class="cx">         when &quot;t1&quot;
</span><span class="lines">@@ -557,9 +552,7 @@
</span><span class="cx"> # operands: callTarget, currentFrame, currentPC
</span><span class="cx"> def cloopEmitCallSlowPath(operands)
</span><span class="cx">     $asm.putc &quot;{&quot;
</span><del>-    $asm.putc &quot;    ExecState* exec = CAST&lt;ExecState*&gt;(#{operands[1].clValue(:voidPtr)});&quot;
-    $asm.putc &quot;    Instruction* pc = CAST&lt;Instruction*&gt;(#{operands[2].clValue(:voidPtr)});&quot;
-    $asm.putc &quot;    SlowPathReturnType result = #{operands[0].cLabel}(exec, pc);&quot;
</del><ins>+    $asm.putc &quot;    SlowPathReturnType result = #{operands[0].cLabel}(#{operands[1].clDump}, #{operands[2].clDump});&quot;
</ins><span class="cx">     $asm.putc &quot;    decodeResult(result, t0.instruction, t1.vp);&quot;
</span><span class="cx">     $asm.putc &quot;}&quot;
</span><span class="cx"> end
</span><span class="lines">@@ -1100,7 +1093,8 @@
</span><span class="cx">             
</span><span class="cx">         when &quot;memfence&quot;
</span><span class="cx">         when &quot;pop&quot;
</span><del>-            $asm.putc &quot;#error FIXME: Need implementation for pop&quot;
</del><ins>+            $asm.putc &quot;RELEASE_ASSERT_NOT_REACHED(); // pop not implemented.&quot;
+
</ins><span class="cx">         when &quot;pushCalleeSaves&quot;
</span><span class="cx">         when &quot;popCalleeSaves&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreruntimeCommonSlowPathscpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -174,10 +174,13 @@
</span><span class="cx"> {
</span><span class="cx">     CommonSlowPaths::ArityCheckData* result = vm.arityCheckData.get();
</span><span class="cx">     result-&gt;paddedStackSpace = slotsToAdd;
</span><ins>+#if ENABLE(JIT)
</ins><span class="cx">     if (vm.canUseJIT()) {
</span><span class="cx">         result-&gt;thunkToCall = vm.getCTIStub(arityFixup).code().executableAddress();
</span><span class="cx">         result-&gt;returnPC = vm.arityCheckFailReturnThunks-&gt;returnPCFor(vm, slotsToAdd * stackAlignmentRegisters()).executableAddress();
</span><del>-    } else {
</del><ins>+    } else
+#endif
+    {
</ins><span class="cx">         result-&gt;thunkToCall = 0;
</span><span class="cx">         result-&gt;returnPC = 0;
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/runtime/VM.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include &quot;Identifier.h&quot;
</span><span class="cx"> #include &quot;IncrementalSweeper.h&quot;
</span><span class="cx"> #include &quot;Interpreter.h&quot;
</span><ins>+#include &quot;JITCode.h&quot;
</ins><span class="cx"> #include &quot;JSAPIValueWrapper.h&quot;
</span><span class="cx"> #include &quot;JSActivation.h&quot;
</span><span class="cx"> #include &quot;JSArray.h&quot;
</span><span class="lines">@@ -467,8 +468,8 @@
</span><span class="cx"> NativeExecutable* VM::getHostFunction(NativeFunction function, NativeFunction constructor)
</span><span class="cx"> {
</span><span class="cx">     return NativeExecutable::create(*this,
</span><del>-        MacroAssemblerCodeRef::createLLIntCodeRef(llint_native_call_trampoline), function,
-        MacroAssemblerCodeRef::createLLIntCodeRef(llint_native_construct_trampoline), constructor,
</del><ins>+        adoptRef(new NativeJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_native_call_trampoline), JITCode::HostCallThunk)), function,
+        adoptRef(new NativeJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_native_construct_trampoline), JITCode::HostCallThunk)), constructor,
</ins><span class="cx">         NoIntrinsic);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreruntimeVMEntryScopecpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp (161218 => 161219)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp        2014-01-02 20:15:25 UTC (rev 161218)
+++ branches/jsCStack/Source/JavaScriptCore/runtime/VMEntryScope.cpp        2014-01-02 20:42:13 UTC (rev 161219)
</span><span class="lines">@@ -169,6 +169,7 @@
</span><span class="cx">             excessCStackSize = availableCStack - availableJSStack;
</span><span class="cx">     }
</span><span class="cx"> #else
</span><ins>+    UNUSED_PARAM(topOfStack);
</ins><span class="cx">     UNUSED_PARAM(type);
</span><span class="cx">     ASSERT(type == NativeStackCapacity);
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>