<!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>[181213] 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/181213">181213</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-07 14:10:10 -0800 (Sat, 07 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>The code to link FunctionExecutable is duplicated everywhere
https://bugs.webkit.org/show_bug.cgi?id=142436

Reviewed by Darin Adler.

Reduced code duplication by factoring out linkInsideExecutable and linkGlobalCode.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock): Calls linkInsideExecutable.

* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedFunctionExecutable::linkInsideExecutable): Renamed from link. Now takes care of startOffset.
This change was needed to use this function in CodeBlock::CodeBlock. Also, this function no longer takes
lineOffset since this information is already stored in the source code.
(JSC::UnlinkedFunctionExecutable::linkGlobalCode): Extracted from FunctionExecutable::fromGlobalCode.

* bytecode/UnlinkedCodeBlock.h:

* generate-js-builtins: Calls linkGlobalCode.

* runtime/Executable.cpp:
(JSC::ProgramExecutable::initializeGlobalProperties): Calls linkGlobalCode.
(JSC::FunctionExecutable::fromGlobalCode): Calls linkGlobalCode.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoregeneratejsbuiltins">trunk/Source/JavaScriptCore/generate-js-builtins</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (181212 => 181213)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-03-07 21:51:33 UTC (rev 181212)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-03-07 22:10:10 UTC (rev 181213)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-03-07  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        The code to link FunctionExecutable is duplicated everywhere
+        https://bugs.webkit.org/show_bug.cgi?id=142436
+
+        Reviewed by Darin Adler.
+
+        Reduced code duplication by factoring out linkInsideExecutable and linkGlobalCode.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::CodeBlock): Calls linkInsideExecutable.
+
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedFunctionExecutable::linkInsideExecutable): Renamed from link. Now takes care of startOffset.
+        This change was needed to use this function in CodeBlock::CodeBlock. Also, this function no longer takes
+        lineOffset since this information is already stored in the source code.
+        (JSC::UnlinkedFunctionExecutable::linkGlobalCode): Extracted from FunctionExecutable::fromGlobalCode.
+
+        * bytecode/UnlinkedCodeBlock.h:
+
+        * generate-js-builtins: Calls linkGlobalCode.
+
+        * runtime/Executable.cpp:
+        (JSC::ProgramExecutable::initializeGlobalProperties): Calls linkGlobalCode.
+        (JSC::FunctionExecutable::fromGlobalCode): Calls linkGlobalCode.
+
</ins><span class="cx"> 2015-03-06  Geoffrey Garen  &lt;ggaren@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use FastMalloc (bmalloc) instead of BlockAllocator for GC pages
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (181212 => 181213)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2015-03-07 21:51:33 UTC (rev 181212)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2015-03-07 22:10:10 UTC (rev 181213)
</span><span class="lines">@@ -1746,17 +1746,7 @@
</span><span class="cx">         UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock-&gt;functionDecl(i);
</span><span class="cx">         if (vm()-&gt;typeProfiler() || vm()-&gt;controlFlowProfiler())
</span><span class="cx">             vm()-&gt;functionHasExecutedCache()-&gt;insertUnexecutedRange(m_ownerExecutable-&gt;sourceID(), unlinkedExecutable-&gt;typeProfilingStartOffset(), unlinkedExecutable-&gt;typeProfilingEndOffset());
</span><del>-        unsigned lineCount = unlinkedExecutable-&gt;lineCount();
-        unsigned firstLine = ownerExecutable-&gt;lineNo() + unlinkedExecutable-&gt;firstLineOffset();
-        bool startColumnIsOnOwnerStartLine = !unlinkedExecutable-&gt;firstLineOffset();
-        unsigned startColumn = unlinkedExecutable-&gt;unlinkedBodyStartColumn() + (startColumnIsOnOwnerStartLine ? ownerExecutable-&gt;startColumn() : 1);
-        bool endColumnIsOnStartLine = !lineCount;
-        unsigned endColumn = unlinkedExecutable-&gt;unlinkedBodyEndColumn() + (endColumnIsOnStartLine ? startColumn : 1);
-        unsigned startOffset = sourceOffset + unlinkedExecutable-&gt;startOffset();
-        unsigned sourceLength = unlinkedExecutable-&gt;sourceLength();
-        SourceCode code(m_source, startOffset, startOffset + sourceLength, firstLine, startColumn);
-        FunctionExecutable* executable = FunctionExecutable::create(*m_vm, code, unlinkedExecutable, firstLine, firstLine + lineCount, startColumn, endColumn);
-        m_functionDecls[i].set(*m_vm, ownerExecutable, executable);
</del><ins>+        m_functionDecls[i].set(*m_vm, ownerExecutable, unlinkedExecutable-&gt;linkInsideExecutable(*m_vm, ownerExecutable-&gt;source()));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_functionExprs.resizeToFit(unlinkedCodeBlock-&gt;numberOfFunctionExprs());
</span><span class="lines">@@ -1764,17 +1754,7 @@
</span><span class="cx">         UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock-&gt;functionExpr(i);
</span><span class="cx">         if (vm()-&gt;typeProfiler() || vm()-&gt;controlFlowProfiler())
</span><span class="cx">             vm()-&gt;functionHasExecutedCache()-&gt;insertUnexecutedRange(m_ownerExecutable-&gt;sourceID(), unlinkedExecutable-&gt;typeProfilingStartOffset(), unlinkedExecutable-&gt;typeProfilingEndOffset());
</span><del>-        unsigned lineCount = unlinkedExecutable-&gt;lineCount();
-        unsigned firstLine = ownerExecutable-&gt;lineNo() + unlinkedExecutable-&gt;firstLineOffset();
-        bool startColumnIsOnOwnerStartLine = !unlinkedExecutable-&gt;firstLineOffset();
-        unsigned startColumn = unlinkedExecutable-&gt;unlinkedBodyStartColumn() + (startColumnIsOnOwnerStartLine ? ownerExecutable-&gt;startColumn() : 1);
-        bool endColumnIsOnStartLine = !lineCount;
-        unsigned endColumn = unlinkedExecutable-&gt;unlinkedBodyEndColumn() + (endColumnIsOnStartLine ? startColumn : 1);
-        unsigned startOffset = sourceOffset + unlinkedExecutable-&gt;startOffset();
-        unsigned sourceLength = unlinkedExecutable-&gt;sourceLength();
-        SourceCode code(m_source, startOffset, startOffset + sourceLength, firstLine, startColumn);
-        FunctionExecutable* executable = FunctionExecutable::create(*m_vm, code, unlinkedExecutable, firstLine, firstLine + lineCount, startColumn, endColumn);
-        m_functionExprs[i].set(*m_vm, ownerExecutable, executable);
</del><ins>+        m_functionExprs[i].set(*m_vm, ownerExecutable, unlinkedExecutable-&gt;linkInsideExecutable(*m_vm, ownerExecutable-&gt;source()));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (unlinkedCodeBlock-&gt;hasRareData()) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (181212 => 181213)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-03-07 21:51:33 UTC (rev 181212)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-03-07 22:10:10 UTC (rev 181213)
</span><span class="lines">@@ -118,17 +118,40 @@
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_symbolTableForConstruct);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FunctionExecutable* UnlinkedFunctionExecutable::link(VM&amp; vm, const SourceCode&amp; source, size_t lineOffset)
</del><ins>+FunctionExecutable* UnlinkedFunctionExecutable::linkInsideExecutable(VM&amp; vm, const SourceCode&amp; source)
</ins><span class="cx"> {
</span><del>-    unsigned firstLine = lineOffset + m_firstLineOffset;
</del><ins>+    unsigned firstLine = source.firstLine() + m_firstLineOffset;
+    unsigned startOffset = source.startOffset() + m_startOffset;
+
</ins><span class="cx">     bool startColumnIsOnFirstSourceLine = !m_firstLineOffset;
</span><span class="cx">     unsigned startColumn = m_unlinkedBodyStartColumn + (startColumnIsOnFirstSourceLine ? source.startColumn() : 1);
</span><span class="cx">     bool endColumnIsOnStartLine = !m_lineCount;
</span><span class="cx">     unsigned endColumn = m_unlinkedBodyEndColumn + (endColumnIsOnStartLine ? startColumn : 1);
</span><del>-    SourceCode code(source.provider(), m_startOffset, m_startOffset + m_sourceLength, firstLine, startColumn);
</del><ins>+
+    SourceCode code(source.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn);
</ins><span class="cx">     return FunctionExecutable::create(vm, code, this, firstLine, firstLine + m_lineCount, startColumn, endColumn);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FunctionExecutable* UnlinkedFunctionExecutable::linkGlobalCode(VM&amp; vm, const SourceCode&amp; source)
+{
+    unsigned firstLine = source.firstLine() + m_firstLineOffset;
+    unsigned startOffset = source.startOffset() + m_startOffset;
+
+    // We don't have any owner executable. The source string is effectively like a global
+    // string (like in the handling of eval). Hence, the startColumn is always 1.
+    unsigned startColumn = 1;
+    bool endColumnIsOnStartLine = !m_lineCount;
+    // The unlinkedBodyEndColumn is 0-based. Hence, we need to add 1 to it. But if the
+    // endColumn is on the startLine, then we need to subtract back the adjustment for
+    // the open brace resulting in an adjustment of 0.
+    unsigned endColumnExcludingBraces = m_unlinkedBodyEndColumn + (endColumnIsOnStartLine ? 0 : 1);
+    unsigned startOffsetExcludingOpenBrace = startOffset + 1;
+    unsigned endOffsetExcludingCloseBrace = startOffset + m_sourceLength - 1;
+    SourceCode code(source.provider(), startOffsetExcludingOpenBrace, endOffsetExcludingCloseBrace, firstLine, startColumn);
+
+    return FunctionExecutable::create(vm, code, this, firstLine, firstLine + m_lineCount, startColumn, endColumnExcludingBraces, false);
+}
+
</ins><span class="cx"> UnlinkedFunctionExecutable* UnlinkedFunctionExecutable::fromGlobalCode(const Identifier&amp; name, ExecState&amp; exec, const SourceCode&amp; source, JSObject*&amp; exception)
</span><span class="cx"> {
</span><span class="cx">     ParserError error;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (181212 => 181213)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-03-07 21:51:33 UTC (rev 181212)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-03-07 22:10:10 UTC (rev 181213)
</span><span class="lines">@@ -117,8 +117,6 @@
</span><span class="cx">         return JSParseNormal;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    unsigned firstLineOffset() const { return m_firstLineOffset; }
-    unsigned lineCount() const { return m_lineCount; }
</del><span class="cx">     unsigned unlinkedFunctionNameStart() const { return m_unlinkedFunctionNameStart; }
</span><span class="cx">     unsigned unlinkedBodyStartColumn() const { return m_unlinkedBodyStartColumn; }
</span><span class="cx">     unsigned unlinkedBodyEndColumn() const { return m_unlinkedBodyEndColumn; }
</span><span class="lines">@@ -133,7 +131,8 @@
</span><span class="cx"> 
</span><span class="cx">     static UnlinkedFunctionExecutable* fromGlobalCode(const Identifier&amp;, ExecState&amp;, const SourceCode&amp;, JSObject*&amp; exception);
</span><span class="cx"> 
</span><del>-    FunctionExecutable* link(VM&amp;, const SourceCode&amp;, size_t lineOffset);
</del><ins>+    FunctionExecutable* linkInsideExecutable(VM&amp;, const SourceCode&amp;);
+    FunctionExecutable* linkGlobalCode(VM&amp;, const SourceCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void clearCodeForRecompilation()
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoregeneratejsbuiltins"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/generate-js-builtins (181212 => 181213)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/generate-js-builtins        2015-03-07 21:51:33 UTC (rev 181212)
+++ trunk/Source/JavaScriptCore/generate-js-builtins        2015-03-07 22:10:10 UTC (rev 181213)
</span><span class="lines">@@ -264,24 +264,10 @@
</span><span class="cx">     builtinsImplementation.write(&quot;const int s_%sLength = %d;\n\n&quot; % (codeReference, sourceLength + 1)) # + 1 for \n
</span><span class="cx"> 
</span><span class="cx"> builtinsImplementation.write(&quot;&quot;&quot;
</span><del>-FunctionExecutable* createBuiltinExecutable(VM&amp; vm, UnlinkedFunctionExecutable* unlinkedExecutable, const SourceCode&amp; source)
-{
-    unsigned lineCount = unlinkedExecutable-&gt;lineCount();
-    unsigned startColumn = 1;
-    unsigned sourceLength = unlinkedExecutable-&gt;sourceLength();
-    bool endColumnIsOnStartLine = !lineCount;
-    unsigned endColumnExcludingBraces = unlinkedExecutable-&gt;unlinkedBodyEndColumn() + (endColumnIsOnStartLine ? 0 : 1);
-    unsigned startOffset = unlinkedExecutable-&gt;startOffset();
-    unsigned startOffsetExcludingOpenBrace = startOffset + 1;
-    unsigned endOffsetExcludingCloseBrace = startOffset + sourceLength - 1;
-    SourceCode bodySource(source.provider(), startOffsetExcludingOpenBrace, endOffsetExcludingCloseBrace, 0, startColumn);
-    return FunctionExecutable::create(vm, bodySource, unlinkedExecutable, 0, lineCount, startColumn, endColumnExcludingBraces, false);
-}
-
</del><span class="cx"> #define JSC_DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
</span><span class="cx"> FunctionExecutable* codeName##Generator(VM&amp; vm) \\
</span><span class="cx"> { \\
</span><del>-    return createBuiltinExecutable(vm, vm.builtinExecutables()-&gt;codeName##Executable(), vm.builtinExecutables()-&gt;codeName##Source()); \\
</del><ins>+    return vm.builtinExecutables()-&gt;codeName##Executable()-&gt;linkGlobalCode(vm, vm.builtinExecutables()-&gt;codeName##Source()); \\
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSC_FOREACH_BUILTIN(JSC_DEFINE_BUILTIN_GENERATOR)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (181212 => 181213)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-03-07 21:51:33 UTC (rev 181212)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-03-07 22:10:10 UTC (rev 181213)
</span><span class="lines">@@ -503,7 +503,7 @@
</span><span class="cx"> 
</span><span class="cx">     for (size_t i = 0; i &lt; functionDeclarations.size(); ++i) {
</span><span class="cx">         UnlinkedFunctionExecutable* unlinkedFunctionExecutable = functionDeclarations[i].second.get();
</span><del>-        JSValue value = JSFunction::create(vm, unlinkedFunctionExecutable-&gt;link(vm, m_source, lineNo()), scope);
</del><ins>+        JSValue value = JSFunction::create(vm, unlinkedFunctionExecutable-&gt;linkInsideExecutable(vm, m_source), scope);
</ins><span class="cx">         globalObject-&gt;addFunction(callFrame, functionDeclarations[i].first, value);
</span><span class="cx">         if (vm.typeProfiler() || vm.controlFlowProfiler()) {
</span><span class="cx">             vm.functionHasExecutedCache()-&gt;insertUnexecutedRange(sourceID(), 
</span><span class="lines">@@ -608,25 +608,8 @@
</span><span class="cx"> {
</span><span class="cx">     UnlinkedFunctionExecutable* unlinkedExecutable = UnlinkedFunctionExecutable::fromGlobalCode(name, exec, source, exception);
</span><span class="cx">     if (!unlinkedExecutable)
</span><del>-        return 0;
-    unsigned lineCount = unlinkedExecutable-&gt;lineCount();
-    unsigned firstLine = source.firstLine() + unlinkedExecutable-&gt;firstLineOffset();
-    unsigned startOffset = source.startOffset() + unlinkedExecutable-&gt;startOffset();
-
-    // We don't have any owner executable. The source string is effectively like a global
-    // string (like in the handling of eval). Hence, the startColumn is always 1.
-    unsigned startColumn = 1;
-    unsigned sourceLength = unlinkedExecutable-&gt;sourceLength();
-    bool endColumnIsOnStartLine = !lineCount;
-    // The unlinkedBodyEndColumn is based-0. Hence, we need to add 1 to it. But if the
-    // endColumn is on the startLine, then we need to subtract back the adjustment for
-    // the open brace resulting in an adjustment of 0.
-    unsigned endColumnExcludingBraces = unlinkedExecutable-&gt;unlinkedBodyEndColumn() + (endColumnIsOnStartLine ? 0 : 1);
-    unsigned startOffsetExcludingOpenBrace = startOffset + 1;
-    unsigned endOffsetExcludingCloseBrace = startOffset + sourceLength - 1;
-    SourceCode bodySource(source.provider(), startOffsetExcludingOpenBrace, endOffsetExcludingCloseBrace, firstLine, startColumn);
-
-    return FunctionExecutable::create(exec.vm(), bodySource, unlinkedExecutable, firstLine, firstLine + lineCount, startColumn, endColumnExcludingBraces, false);
</del><ins>+        return nullptr;
+    return unlinkedExecutable-&gt;linkGlobalCode(exec.vm(), source);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String FunctionExecutable::paramString() const
</span></span></pre>
</div>
</div>

</body>
</html>