<!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>[199939] trunk</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/199939">199939</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-22 17:40:43 -0700 (Fri, 22 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Source directives lost when using Function constructor repeatedly
https://bugs.webkit.org/show_bug.cgi?id=156863
&lt;rdar://problem/25861064&gt;

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2016-04-22
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Source directives (sourceURL and sourceMappingURL) are normally accessed through
the SourceProvider and normally set when the script is parsed. However, when a
CodeCache lookup skips parsing, the new SourceProvider never gets the directives
(sourceURL/sourceMappingURL). This patch stores the directives on the UnlinkedCodeBlock
and UnlinkedFunctionExecutable when entering the cache, and copies to the new providers
when the cache is used.

* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::sourceURLDirective):
(JSC::UnlinkedCodeBlock::sourceMappingURLDirective):
(JSC::UnlinkedCodeBlock::setSourceURLDirective):
(JSC::UnlinkedCodeBlock::setSourceMappingURLDirective):
* bytecode/UnlinkedFunctionExecutable.h:
* parser/SourceProvider.h:
* runtime/CodeCache.cpp:
(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/CodeCache.h:
Store directives on the unlinked code block / executable when adding
to the cache, so they can be used to update new providers when the
cache gets used.

* runtime/JSGlobalObject.cpp:
Add needed header after CodeCache header cleanup.

LayoutTests:

* inspector/debugger/sourceURL-repeated-identical-executions-expected.txt: Added.
* inspector/debugger/sourceURL-repeated-identical-executions.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutableh">trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserSourceProviderh">trunk/Source/JavaScriptCore/parser/SourceProvider.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCachecpp">trunk/Source/JavaScriptCore/runtime/CodeCache.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCacheh">trunk/Source/JavaScriptCore/runtime/CodeCache.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectordebuggersourceURLrepeatedidenticalexecutionsexpectedtxt">trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggersourceURLrepeatedidenticalexecutionshtml">trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/LayoutTests/ChangeLog        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-04-22  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Source directives lost when using Function constructor repeatedly
+        https://bugs.webkit.org/show_bug.cgi?id=156863
+        &lt;rdar://problem/25861064&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        * inspector/debugger/sourceURL-repeated-identical-executions-expected.txt: Added.
+        * inspector/debugger/sourceURL-repeated-identical-executions.html: Added.
+
</ins><span class="cx"> 2016-04-22  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         javascript jit bug affecting Google Maps.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggersourceURLrepeatedidenticalexecutionsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions-expected.txt (0 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions-expected.txt        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Tests for the Debugger.scriptParsed messages for identical content should have source directives each time.
+
+
+== Running test suite: Debugger.scriptParsed.sourceURLRepeatedIdenticalExecutions
+-- Running test case: CheckFunctionConstructorMultipleTimes
+PASS: Should see 3 Scripts with sourceURL
+
+-- Running test case: CheckProgramMultipleTimes
+PASS: Should see 3 Scripts with sourceURL
+
+-- Running test case: CheckEvalMultipleTimes
+PASS: Should see 3 Scripts with sourceURL
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggersourceURLrepeatedidenticalexecutionshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html (0 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html                                (rev 0)
+++ trunk/LayoutTests/inspector/debugger/sourceURL-repeated-identical-executions.html        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function triggerFunctionConstructorMultipleTimes() {
+    let sum = 0;
+    sum += Function(&quot;\n//# sourceURL=test-Function-constructor.js\nreturn 1+1&quot;)();
+    sum += Function(&quot;\n//# sourceURL=test-Function-constructor.js\nreturn 1+1&quot;)();
+    sum += Function(&quot;\n//# sourceURL=test-Function-constructor.js\nreturn 1+1&quot;)();
+    return sum;
+}
+
+function triggerProgramMultipleTimes() {
+    for (let i = 0; i &lt; 3; ++i) {
+        let script = document.createElement(&quot;script&quot;);
+        script.text = &quot;\n//# sourceURL=test-program.js\n1+1&quot;;
+        document.head.appendChild(script);
+    }
+}
+
+function triggerEvalMultipleTimes() {
+    let sum = 0;
+    sum += eval(&quot;\n//# sourceURL=test-eval.js\n1+1&quot;);
+    sum += eval(&quot;\n//# sourceURL=test-eval.js\n1+1&quot;);
+    sum += eval(&quot;\n//# sourceURL=test-eval.js\n1+1&quot;);
+    return sum;
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite(&quot;Debugger.scriptParsed.sourceURLRepeatedIdenticalExecutions&quot;);
+
+    // Disable breakpoints to ensure we do not avoid the CodeCache.
+    DebuggerAgent.setBreakpointsActive(false);
+
+    suite.addTestCase({
+        name: &quot;CheckFunctionConstructorMultipleTimes&quot;,
+        description: &quot;Trigger multiple Function constructor calls with the same source and expect multiple Scripts added with sourceURLs.&quot;,
+        test: (resolve, reject) =&gt; {
+            let seen = 0;
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) =&gt; {
+                if (event.data.script.sourceURL === &quot;test-Function-constructor.js&quot;)
+                    seen++;
+            });
+            InspectorTest.evaluateInPage(&quot;triggerFunctionConstructorMultipleTimes()&quot;, () =&gt; {
+                InspectorTest.expectThat(seen === 3, &quot;Should see 3 Scripts with sourceURL&quot;);
+                resolve();
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;CheckProgramMultipleTimes&quot;,
+        description: &quot;Trigger multiple program executions with the same source and expect multiple Scripts added with sourceURLs.&quot;,
+        test: (resolve, reject) =&gt; {
+            let seen = 0;
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) =&gt; {
+                if (event.data.script.sourceURL === &quot;test-program.js&quot;)
+                    seen++;
+            });
+            InspectorTest.evaluateInPage(&quot;triggerProgramMultipleTimes()&quot;, () =&gt; {
+                InspectorTest.expectThat(seen === 3, &quot;Should see 3 Scripts with sourceURL&quot;);
+                resolve();
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;CheckEvalMultipleTimes&quot;,
+        description: &quot;Trigger eval with the same source and expect multiple Scripts added with sourceURLs.&quot;,
+        test: (resolve, reject) =&gt; {
+            let seen = 0;
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) =&gt; {
+                if (event.data.script.sourceURL === &quot;test-eval.js&quot;)
+                    seen++;
+            });
+            InspectorTest.evaluateInPage(&quot;triggerEvalMultipleTimes()&quot;, () =&gt; {
+                InspectorTest.expectThat(seen === 3, &quot;Should see 3 Scripts with sourceURL&quot;);
+                resolve();
+            });
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;Tests for the Debugger.scriptParsed messages for identical content should have source directives each time.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2016-04-22  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Source directives lost when using Function constructor repeatedly
+        https://bugs.webkit.org/show_bug.cgi?id=156863
+        &lt;rdar://problem/25861064&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        Source directives (sourceURL and sourceMappingURL) are normally accessed through
+        the SourceProvider and normally set when the script is parsed. However, when a
+        CodeCache lookup skips parsing, the new SourceProvider never gets the directives
+        (sourceURL/sourceMappingURL). This patch stores the directives on the UnlinkedCodeBlock
+        and UnlinkedFunctionExecutable when entering the cache, and copies to the new providers
+        when the cache is used.
+
+        * bytecode/UnlinkedCodeBlock.h:
+        (JSC::UnlinkedCodeBlock::sourceURLDirective):
+        (JSC::UnlinkedCodeBlock::sourceMappingURLDirective):
+        (JSC::UnlinkedCodeBlock::setSourceURLDirective):
+        (JSC::UnlinkedCodeBlock::setSourceMappingURLDirective):
+        * bytecode/UnlinkedFunctionExecutable.h:
+        * parser/SourceProvider.h:
+        * runtime/CodeCache.cpp:
+        (JSC::CodeCache::getGlobalCodeBlock):
+        (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
+        * runtime/CodeCache.h:
+        Store directives on the unlinked code block / executable when adding
+        to the cache, so they can be used to update new providers when the
+        cache gets used.
+
+        * runtime/JSGlobalObject.cpp:
+        Add needed header after CodeCache header cleanup.
+
</ins><span class="cx"> 2016-04-22  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         javascript jit bug affecting Google Maps.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -339,6 +339,11 @@
</span><span class="cx">         m_endColumn = endColumn;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    const String&amp; sourceURLDirective() const { return m_sourceURLDirective; }
+    const String&amp; sourceMappingURLDirective() const { return m_sourceMappingURLDirective; }
+    void setSourceURLDirective(const String&amp; sourceURL) { m_sourceURLDirective = sourceURL; }
+    void setSourceMappingURLDirective(const String&amp; sourceMappingURL) { m_sourceMappingURLDirective = sourceMappingURL; }
+
</ins><span class="cx">     CodeFeatures codeFeatures() const { return m_features; }
</span><span class="cx">     bool hasCapturedVariables() const { return m_hasCapturedVariables; }
</span><span class="cx">     unsigned firstLine() const { return m_firstLine; }
</span><span class="lines">@@ -390,6 +395,9 @@
</span><span class="cx">     VirtualRegister m_scopeRegister;
</span><span class="cx">     VirtualRegister m_globalObjectRegister;
</span><span class="cx"> 
</span><ins>+    String m_sourceURLDirective;
+    String m_sourceMappingURLDirective;
+
</ins><span class="cx">     unsigned m_usesEval : 1;
</span><span class="cx">     unsigned m_isStrictMode : 1;
</span><span class="cx">     unsigned m_isConstructor : 1;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -136,7 +136,12 @@
</span><span class="cx">     bool isArrowFunction() const { return parseMode() == SourceParseMode::ArrowFunctionMode; }
</span><span class="cx"> 
</span><span class="cx">     JSC::DerivedContextType derivedContextType() const {return static_cast&lt;JSC::DerivedContextType&gt;(m_derivedContextType); }
</span><del>-    
</del><ins>+
+    const String&amp; sourceURLDirective() const { return m_sourceURLDirective; }
+    const String&amp; sourceMappingURLDirective() const { return m_sourceMappingURLDirective; }
+    void setSourceURLDirective(const String&amp; sourceURL) { m_sourceURLDirective = sourceURL; }
+    void setSourceMappingURLDirective(const String&amp; sourceMappingURL) { m_sourceMappingURLDirective = sourceMappingURL; }
+
</ins><span class="cx"> private:
</span><span class="cx">     UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&amp;, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&amp;,  JSC::DerivedContextType);
</span><span class="cx"> 
</span><span class="lines">@@ -171,6 +176,9 @@
</span><span class="cx">     RefPtr&lt;SourceProvider&gt; m_sourceOverride;
</span><span class="cx">     SourceCode m_classSource;
</span><span class="cx"> 
</span><ins>+    String m_sourceURLDirective;
+    String m_sourceMappingURLDirective;
+
</ins><span class="cx">     VariableEnvironment m_parentScopeTDZVariables;
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserSourceProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/SourceProvider.h (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/SourceProvider.h        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/parser/SourceProvider.h        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -65,12 +65,10 @@
</span><span class="cx">         bool isValid() const { return m_validated; }
</span><span class="cx">         void setValid() { m_validated = true; }
</span><span class="cx"> 
</span><del>-    private:
-        template &lt;typename T&gt; friend class Parser;
-
</del><span class="cx">         void setSourceURLDirective(const String&amp; sourceURL) { m_sourceURLDirective = sourceURL; }
</span><span class="cx">         void setSourceMappingURLDirective(const String&amp; sourceMappingURL) { m_sourceMappingURLDirective = sourceMappingURL; }
</span><span class="cx"> 
</span><ins>+    private:
</ins><span class="cx">         JS_EXPORT_PRIVATE void getID();
</span><span class="cx"> 
</span><span class="cx">         String m_url;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.cpp (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -24,12 +24,9 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-
</del><span class="cx"> #include &quot;CodeCache.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BytecodeGenerator.h&quot;
</span><del>-#include &quot;CodeSpecializationKind.h&quot;
-#include &quot;ExecutableInfo.h&quot;
</del><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;Parser.h&quot;
</span><span class="cx"> #include &quot;StrongInlines.h&quot;
</span><span class="lines">@@ -99,6 +96,8 @@
</span><span class="cx">         bool endColumnIsOnStartLine = !lineCount;
</span><span class="cx">         unsigned endColumn = unlinkedCodeBlock-&gt;endColumn() + (endColumnIsOnStartLine ? startColumn : 1);
</span><span class="cx">         executable-&gt;recordParse(unlinkedCodeBlock-&gt;codeFeatures(), unlinkedCodeBlock-&gt;hasCapturedVariables(), firstLine, firstLine + lineCount, startColumn, endColumn);
</span><ins>+        source.provider()-&gt;setSourceURLDirective(unlinkedCodeBlock-&gt;sourceURLDirective());
+        source.provider()-&gt;setSourceMappingURLDirective(unlinkedCodeBlock-&gt;sourceMappingURLDirective());
</ins><span class="cx">         return unlinkedCodeBlock;
</span><span class="cx">     }
</span><span class="cx">     typedef typename CacheTypes&lt;UnlinkedCodeBlockType&gt;::RootNode RootNode;
</span><span class="lines">@@ -118,6 +117,8 @@
</span><span class="cx"> 
</span><span class="cx">     UnlinkedCodeBlockType* unlinkedCodeBlock = UnlinkedCodeBlockType::create(&amp;vm, executable-&gt;executableInfo());
</span><span class="cx">     unlinkedCodeBlock-&gt;recordParse(rootNode-&gt;features(), rootNode-&gt;hasCapturedVariables(), rootNode-&gt;firstLine() - source.firstLine(), lineCount, unlinkedEndColumn);
</span><ins>+    unlinkedCodeBlock-&gt;setSourceURLDirective(source.provider()-&gt;sourceURL());
+    unlinkedCodeBlock-&gt;setSourceMappingURLDirective(source.provider()-&gt;sourceMappingURL());
</ins><span class="cx"> 
</span><span class="cx">     error = BytecodeGenerator::generate(vm, rootNode.get(), unlinkedCodeBlock, debuggerMode, profilerMode, variablesUnderTDZ);
</span><span class="cx"> 
</span><span class="lines">@@ -156,8 +157,12 @@
</span><span class="cx">         JSParserBuiltinMode::NotBuiltin, 
</span><span class="cx">         JSParserStrictMode::NotStrict);
</span><span class="cx">     SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
</span><del>-    if (cache)
-        return jsCast&lt;UnlinkedFunctionExecutable*&gt;(cache-&gt;cell.get());
</del><ins>+    if (cache) {
+        UnlinkedFunctionExecutable* executable = jsCast&lt;UnlinkedFunctionExecutable*&gt;(cache-&gt;cell.get());
+        source.provider()-&gt;setSourceURLDirective(executable-&gt;sourceURLDirective());
+        source.provider()-&gt;setSourceMappingURLDirective(executable-&gt;sourceMappingURLDirective());
+        return executable;
+    }
</ins><span class="cx"> 
</span><span class="cx">     JSTextPosition positionBeforeLastNewline;
</span><span class="cx">     std::unique_ptr&lt;ProgramNode&gt; program = parse&lt;ProgramNode&gt;(
</span><span class="lines">@@ -193,6 +198,9 @@
</span><span class="cx">     VariableEnvironment emptyTDZVariables;
</span><span class="cx">     UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&amp;vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, DerivedContextType::None);
</span><span class="cx"> 
</span><ins>+    functionExecutable-&gt;setSourceURLDirective(source.provider()-&gt;sourceURL());
+    functionExecutable-&gt;setSourceMappingURLDirective(source.provider()-&gt;sourceMappingURL());
+
</ins><span class="cx">     m_sourceCode.addCache(key, SourceCodeValue(vm, functionExecutable, m_sourceCode.age()));
</span><span class="cx">     return functionExecutable;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.h (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.h        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.h        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #ifndef CodeCache_h
</span><span class="cx"> #define CodeCache_h
</span><span class="cx"> 
</span><del>-#include &quot;CodeSpecializationKind.h&quot;
</del><span class="cx"> #include &quot;ExecutableInfo.h&quot;
</span><span class="cx"> #include &quot;ParserModes.h&quot;
</span><span class="cx"> #include &quot;SourceCode.h&quot;
</span><span class="lines">@@ -34,28 +33,22 @@
</span><span class="cx"> #include &quot;Strong.h&quot;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><del>-#include &lt;wtf/RandomNumber.h&gt;
-#include &lt;wtf/WeakRandom.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class EvalExecutable;
</span><del>-class FunctionMetadataNode;
</del><span class="cx"> class Identifier;
</span><del>-class JSScope;
</del><ins>+class ModuleProgramExecutable;
</ins><span class="cx"> class ParserError;
</span><span class="cx"> class ProgramExecutable;
</span><del>-class ModuleProgramExecutable;
</del><ins>+class SourceCode;
</ins><span class="cx"> class UnlinkedCodeBlock;
</span><span class="cx"> class UnlinkedEvalCodeBlock;
</span><del>-class UnlinkedModuleProgramCodeBlock;
-class UnlinkedFunctionCodeBlock;
</del><span class="cx"> class UnlinkedFunctionExecutable;
</span><ins>+class UnlinkedModuleProgramCodeBlock;
</ins><span class="cx"> class UnlinkedProgramCodeBlock;
</span><span class="cx"> class VM;
</span><del>-class SourceCode;
-class SourceProvider;
</del><span class="cx"> class VariableEnvironment;
</span><span class="cx"> 
</span><span class="cx"> struct SourceCodeValue {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (199938 => 199939)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-04-23 00:07:44 UTC (rev 199938)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-04-23 00:40:43 UTC (rev 199939)
</span><span class="lines">@@ -154,6 +154,7 @@
</span><span class="cx"> #include &quot;WeakMapPrototype.h&quot;
</span><span class="cx"> #include &quot;WeakSetConstructor.h&quot;
</span><span class="cx"> #include &quot;WeakSetPrototype.h&quot;
</span><ins>+#include &lt;wtf/RandomNumber.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(INTL)
</span><span class="cx"> #include &quot;IntlObject.h&quot;
</span></span></pre>
</div>
</div>

</body>
</html>