<!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>[163397] 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/163397">163397</a></dd>
<dt>Author</dt> <dd>mhahnenberg@apple.com</dd>
<dt>Date</dt> <dd>2014-02-04 13:27:19 -0800 (Tue, 04 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>JSC needs to be able to parse DWARF debug_line info
https://bugs.webkit.org/show_bug.cgi?id=127394

Reviewed by Geoffrey Garen.

If we want to encode IR maps in the DWARF debug line info metadata generated by LLVM, 
we'll need to know how to decode the .debug_line DWARF section. This patch implements 
an interpreter for the .debug_line DWARF section in accordance with the version 3 spec 
published at http://www.dwarfstd.org.

* JavaScriptCore.xcodeproj/project.pbxproj:
* ftl/FTLDWARFDebugLineInfo.cpp: Added.
(JSC::FTL::DebugLineInterpreter::DebugLineInterpreter):
(JSC::FTL::read):
(JSC::FTL::DebugLineInterpreter::parseULEB128):
(JSC::FTL::DebugLineInterpreter::parseSLEB128):
(JSC::FTL::DebugLineInterpreter::run):
(JSC::FTL::DebugLineInterpreter::parsePrologue):
(JSC::FTL::DebugLineInterpreter::parseIncludeDirectories):
(JSC::FTL::DebugLineInterpreter::parseFileEntries):
(JSC::FTL::DebugLineInterpreter::parseFileEntry):
(JSC::FTL::DebugLineInterpreter::interpretStatementProgram):
(JSC::FTL::DebugLineInterpreter::interpretOpcode):
(JSC::FTL::DebugLineInterpreter::printLineInfo):
(JSC::FTL::DebugLineInterpreter::resetInterpreterState):
* ftl/FTLDWARFDebugLineInfo.h: Added.
(JSC::FTL::DebugLineInterpreter::Prologue::Prologue):
* ftl/FTLValueRange.cpp: Random build fix for !ENABLE(FTL_JIT).</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreGNUmakefilelistam">trunk/Source/JavaScriptCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreftlFTLDWARFDebugLineInfocpp">trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLDWARFDebugLineInfoh">trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (163396 => 163397)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2014-02-04 20:28:49 UTC (rev 163396)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2014-02-04 21:27:19 UTC (rev 163397)
</span><span class="lines">@@ -677,6 +677,7 @@
</span><span class="cx">         ftl/FTLCapabilities.cpp
</span><span class="cx">         ftl/FTLCommonValues.cpp
</span><span class="cx">         ftl/FTLCompile.cpp
</span><ins>+        ftl/FTLDWARFDebugLineInfo.cpp
</ins><span class="cx">         ftl/FTLExitArgument.cpp
</span><span class="cx">         ftl/FTLExitArgumentForOperand.cpp
</span><span class="cx">         ftl/FTLExitThunkGenerator.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (163396 => 163397)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-04 20:28:49 UTC (rev 163396)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-04 21:27:19 UTC (rev 163397)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-01-21  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
+
+        JSC needs to be able to parse DWARF debug_line info
+        https://bugs.webkit.org/show_bug.cgi?id=127394
+
+        Reviewed by Geoffrey Garen.
+
+        If we want to encode IR maps in the DWARF debug line info metadata generated by LLVM, 
+        we'll need to know how to decode the .debug_line DWARF section. This patch implements 
+        an interpreter for the .debug_line DWARF section in accordance with the version 3 spec 
+        published at http://www.dwarfstd.org.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * ftl/FTLDWARFDebugLineInfo.cpp: Added.
+        (JSC::FTL::DebugLineInterpreter::DebugLineInterpreter):
+        (JSC::FTL::read):
+        (JSC::FTL::DebugLineInterpreter::parseULEB128):
+        (JSC::FTL::DebugLineInterpreter::parseSLEB128):
+        (JSC::FTL::DebugLineInterpreter::run):
+        (JSC::FTL::DebugLineInterpreter::parsePrologue):
+        (JSC::FTL::DebugLineInterpreter::parseIncludeDirectories):
+        (JSC::FTL::DebugLineInterpreter::parseFileEntries):
+        (JSC::FTL::DebugLineInterpreter::parseFileEntry):
+        (JSC::FTL::DebugLineInterpreter::interpretStatementProgram):
+        (JSC::FTL::DebugLineInterpreter::interpretOpcode):
+        (JSC::FTL::DebugLineInterpreter::printLineInfo):
+        (JSC::FTL::DebugLineInterpreter::resetInterpreterState):
+        * ftl/FTLDWARFDebugLineInfo.h: Added.
+        (JSC::FTL::DebugLineInterpreter::Prologue::Prologue):
+        * ftl/FTLValueRange.cpp: Random build fix for !ENABLE(FTL_JIT).
+
</ins><span class="cx"> 2014-02-04  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename String::getCharacters to String::characters
</span><span class="lines">@@ -12,6 +43,40 @@
</span><span class="cx"> 
</span><span class="cx"> 2014-02-04  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
</span><span class="cx"> 
</span><ins>+&lt;&lt;&lt;&lt;&lt;&lt;&lt; .mine
+        JSC needs to be able to parse DWARF debug_line info
+        https://bugs.webkit.org/show_bug.cgi?id=127394
+
+        Reviewed by Geoffrey Garen.
+
+        If we want to encode IR maps in the DWARF debug line info metadata generated by LLVM, 
+        we'll need to know how to decode the .debug_line DWARF section. This patch implements 
+        an interpreter for the .debug_line DWARF section in accordance with the version 3 spec 
+        published at http://www.dwarfstd.org.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * ftl/FTLDWARFDebugLineInfo.cpp: Added.
+        (JSC::FTL::DebugLineInterpreter::DebugLineInterpreter):
+        (JSC::FTL::read):
+        (JSC::FTL::DebugLineInterpreter::parseULEB128):
+        (JSC::FTL::DebugLineInterpreter::parseSLEB128):
+        (JSC::FTL::DebugLineInterpreter::run):
+        (JSC::FTL::DebugLineInterpreter::parsePrologue):
+        (JSC::FTL::DebugLineInterpreter::parseIncludeDirectories):
+        (JSC::FTL::DebugLineInterpreter::parseFileEntries):
+        (JSC::FTL::DebugLineInterpreter::parseFileEntry):
+        (JSC::FTL::DebugLineInterpreter::interpretStatementProgram):
+        (JSC::FTL::DebugLineInterpreter::interpretOpcode):
+        (JSC::FTL::DebugLineInterpreter::printLineInfo):
+        (JSC::FTL::DebugLineInterpreter::resetInterpreterState):
+        * ftl/FTLDWARFDebugLineInfo.h: Added.
+        (JSC::FTL::DebugLineInterpreter::Prologue::Prologue):
+
+2014-02-04  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
+
+=======
</ins><span class="cx">         ASSERT in speculateMachineInt on 32-bit platforms
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=128155
</span><span class="cx"> 
</span><span class="lines">@@ -22,6 +87,7 @@
</span><span class="cx"> 
</span><span class="cx"> 2014-02-04  Mark Hahnenberg  &lt;mhahnenberg@apple.com&gt;
</span><span class="cx"> 
</span><ins>+&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r163396
</ins><span class="cx">         GC timer should always do a FullCollection
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=128186
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/GNUmakefile.list.am (163396 => 163397)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/GNUmakefile.list.am        2014-02-04 20:28:49 UTC (rev 163396)
+++ trunk/Source/JavaScriptCore/GNUmakefile.list.am        2014-02-04 21:27:19 UTC (rev 163397)
</span><span class="lines">@@ -449,6 +449,8 @@
</span><span class="cx">         Source/JavaScriptCore/ftl/FTLCommonValues.h \
</span><span class="cx">         Source/JavaScriptCore/ftl/FTLCompile.cpp \
</span><span class="cx">         Source/JavaScriptCore/ftl/FTLCompile.h \
</span><ins>+        Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.cpp \
+        Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.h \
</ins><span class="cx">         Source/JavaScriptCore/ftl/FTLExitArgument.cpp \
</span><span class="cx">         Source/JavaScriptCore/ftl/FTLExitArgumentForOperand.cpp \
</span><span class="cx">         Source/JavaScriptCore/ftl/FTLExitArgumentForOperand.h \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (163396 => 163397)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-02-04 20:28:49 UTC (rev 163396)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-02-04 21:27:19 UTC (rev 163397)
</span><span class="lines">@@ -747,6 +747,8 @@
</span><span class="cx">                 2A6F462617E959CE00C45C98 /* HeapOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A6F462517E959CE00C45C98 /* HeapOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2A7A58EF1808A4C40020BDF7 /* DeferGC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A58EE1808A4C40020BDF7 /* DeferGC.cpp */; };
</span><span class="cx">                 2AAD964A18569417001F93BE /* RecursiveAllocationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AAD964918569417001F93BE /* RecursiveAllocationScope.h */; };
</span><ins>+                2AC922BB18A16182003CE0FB /* FTLDWARFDebugLineInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC922B918A16182003CE0FB /* FTLDWARFDebugLineInfo.cpp */; };
+                2AC922BC18A16182003CE0FB /* FTLDWARFDebugLineInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AC922BA18A16182003CE0FB /* FTLDWARFDebugLineInfo.h */; };
</ins><span class="cx">                 2ACCF3DE185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ACCF3DC185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.cpp */; };
</span><span class="cx">                 2ACCF3DF185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ACCF3DD185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.h */; };
</span><span class="cx">                 2AD8932B17E3868F00668276 /* HeapIterationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AD8932917E3868F00668276 /* HeapIterationScope.h */; };
</span><span class="lines">@@ -2131,6 +2133,8 @@
</span><span class="cx">                 2A6F462517E959CE00C45C98 /* HeapOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapOperation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2A7A58EE1808A4C40020BDF7 /* DeferGC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeferGC.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2AAD964918569417001F93BE /* RecursiveAllocationScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecursiveAllocationScope.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2AC922B918A16182003CE0FB /* FTLDWARFDebugLineInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLDWARFDebugLineInfo.cpp; path = ftl/FTLDWARFDebugLineInfo.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                2AC922BA18A16182003CE0FB /* FTLDWARFDebugLineInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLDWARFDebugLineInfo.h; path = ftl/FTLDWARFDebugLineInfo.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2ACCF3DC185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStoreBarrierElisionPhase.cpp; path = dfg/DFGStoreBarrierElisionPhase.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2ACCF3DD185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStoreBarrierElisionPhase.h; path = dfg/DFGStoreBarrierElisionPhase.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2AD8932917E3868F00668276 /* HeapIterationScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapIterationScope.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3048,6 +3052,8 @@
</span><span class="cx">                 0FEA09FC1705137F00BB722C /* ftl */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                2AC922B918A16182003CE0FB /* FTLDWARFDebugLineInfo.cpp */,
+                                2AC922BA18A16182003CE0FB /* FTLDWARFDebugLineInfo.h */,
</ins><span class="cx">                                 0FDB2CC7173DA51E007B3C1B /* FTLAbbreviatedTypes.h */,
</span><span class="cx">                                 0FEA09FD170513DB00BB722C /* FTLAbbreviations.h */,
</span><span class="cx">                                 0FEA0A171708B00700BB722C /* FTLAbstractHeap.cpp */,
</span><span class="lines">@@ -5267,6 +5273,7 @@
</span><span class="cx">                                 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */,
</span><span class="cx">                                 0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
</span><span class="cx">                                 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */,
</span><ins>+                                2AC922BC18A16182003CE0FB /* FTLDWARFDebugLineInfo.h in Headers */,
</ins><span class="cx">                                 A513E5B8185B8BD3007E95AD /* InjectedScript.h in Headers */,
</span><span class="cx">                                 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
</span><span class="cx">                                 C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */,
</span><span class="lines">@@ -6034,6 +6041,7 @@
</span><span class="cx">                                 0F24E55517F0B71C00ABB217 /* InlineCallFrameSet.cpp in Sources */,
</span><span class="cx">                                 A78853F917972629001440E4 /* IntendedStructureChain.cpp in Sources */,
</span><span class="cx">                                 147F39CF107EC37600427A48 /* InternalFunction.cpp in Sources */,
</span><ins>+                                2AC922BB18A16182003CE0FB /* FTLDWARFDebugLineInfo.cpp in Sources */,
</ins><span class="cx">                                 2ACCF3DE185FE26B0083E2AD /* DFGStoreBarrierElisionPhase.cpp in Sources */,
</span><span class="cx">                                 1429D7D40ED2128200B89619 /* Interpreter.cpp in Sources */,
</span><span class="cx">                                 1429D92F0ED22D7000B89619 /* JIT.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLDWARFDebugLineInfocpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.cpp (0 => 163397)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.cpp        2014-02-04 21:27:19 UTC (rev 163397)
</span><span class="lines">@@ -0,0 +1,332 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;FTLDWARFDebugLineInfo.h&quot;
+
+#include &lt;wtf/DataLog.h&gt;
+
+namespace JSC { namespace FTL {
+
+DebugLineInterpreter::DebugLineInterpreter(const char* program)
+    : m_program(program)
+    , m_logResults(false)
+{
+    resetInterpreterState();
+}
+
+template &lt;typename T&gt; inline T read(const char*&amp; program)
+{
+    T result = *reinterpret_cast&lt;const T*&gt;(program);
+    program += sizeof(T);
+    return result;
+}
+
+uint32_t DebugLineInterpreter::parseULEB128(const char*&amp; offset)
+{
+    uint32_t result = 0;
+    uint8_t byte;
+    unsigned shiftAmount = 0;
+    do {
+        byte = read&lt;uint8_t&gt;(offset);
+        result |= (byte &amp; ~0x80) &lt;&lt; shiftAmount;
+        shiftAmount += 7;
+    } while (byte &amp; 0x80);
+    return result;
+}
+
+int32_t DebugLineInterpreter::parseSLEB128(const char*&amp; offset)
+{
+    int32_t result = 0;
+    uint8_t byte;
+    unsigned shiftAmount = 0;
+    do {
+        byte = read&lt;uint8_t&gt;(offset);
+        result |= (byte &amp; ~0x80) &lt;&lt; shiftAmount;
+        shiftAmount += 7;
+    } while (byte &amp; 0x80);
+    
+    // If the sign bit (in this case, the second MSB) on the last byte is set we need to zero extend.
+    if (byte &amp; 0x40)
+        result |= -(1 &lt;&lt; shiftAmount);
+    return result;
+}
+
+void DebugLineInterpreter::run()
+{
+    parsePrologue();
+    interpretStatementProgram();
+    if (m_logResults)
+        printLineInfo();
+}
+
+void DebugLineInterpreter::parsePrologue()
+{
+    const char* currentProgramOffset = m_program;
+    m_prologue.totalLength = read&lt;uint32_t&gt;(currentProgramOffset);
+    if (m_prologue.totalLength == 0xffffffff) {
+        // This is 64-bit DWARF format.
+        m_prologue.format = SixtyFourBit;
+        m_prologue.totalLength = read&lt;uint64_t&gt;(currentProgramOffset);
+    } else
+        m_prologue.format = ThirtyTwoBit;
+    m_prologue.version = read&lt;uint16_t&gt;(currentProgramOffset);
+    
+    if (m_prologue.format == ThirtyTwoBit)
+        m_prologue.prologueLength = read&lt;uint32_t&gt;(currentProgramOffset);
+    else
+        m_prologue.prologueLength = read&lt;uint64_t&gt;(currentProgramOffset);
+    const char* afterLengthOffset = currentProgramOffset;
+    
+    m_prologue.minimumInstructionLength = read&lt;uint8_t&gt;(currentProgramOffset);
+    m_prologue.defaultIsStatement = read&lt;uint8_t&gt;(currentProgramOffset);
+    m_prologue.lineBase = read&lt;int8_t&gt;(currentProgramOffset);
+    m_prologue.lineRange = read&lt;uint8_t&gt;(currentProgramOffset);
+    m_prologue.opcodeBase = read&lt;uint8_t&gt;(currentProgramOffset);
+    for (unsigned i = 1; i &lt; m_prologue.opcodeBase; ++i)
+        m_prologue.standardOpcodeLengths.append(read&lt;uint8_t&gt;(currentProgramOffset));
+    parseIncludeDirectories(currentProgramOffset);
+    parseFileEntries(currentProgramOffset);
+    
+    m_program = afterLengthOffset + m_prologue.prologueLength;
+
+    if (!m_logResults)
+        return;
+
+    dataLog(&quot;\nPrologue:\n&quot;);
+    dataLog(&quot;totalLength = &quot;, m_prologue.totalLength, &quot;\n&quot;);
+    dataLog(&quot;version = &quot;, m_prologue.version, &quot;\n&quot;);
+    dataLog(&quot;prologueLength = &quot;, m_prologue.prologueLength, &quot;\n&quot;);
+    dataLog(&quot;minimumInstructionLength = &quot;, m_prologue.minimumInstructionLength, &quot;\n&quot;);
+    dataLog(&quot;defaultIsStatement = &quot;, m_prologue.defaultIsStatement, &quot;\n&quot;);
+    dataLog(&quot;lineBase = &quot;, m_prologue.lineBase, &quot;\n&quot;);
+    dataLog(&quot;lineRange = &quot;, m_prologue.lineRange, &quot;\n&quot;);
+    dataLog(&quot;opcodeBase = &quot;, m_prologue.opcodeBase, &quot;\n&quot;);
+    
+    dataLog(&quot;\nStandard Opcode Lengths:\n&quot;);
+    for (unsigned i = 1; i &lt; m_prologue.opcodeBase; ++i)
+        dataLog(&quot;standardOpcodeLengths[&quot;, i - 1, &quot;] = &quot;, m_prologue.standardOpcodeLengths[i - 1], &quot;\n&quot;);
+    
+    dataLog(&quot;\nInclude Directories:\n&quot;);
+    for (unsigned i = 0; i &lt; m_prologue.includeDirectories.size(); ++i)
+        dataLog(&quot;includeDirectories[&quot;, i, &quot;] = &quot;, m_prologue.includeDirectories[i], &quot;\n&quot;);
+    
+    dataLog(&quot;\nFiles:\n&quot;);
+    for (unsigned i = 0; i &lt; m_prologue.fileEntries.size(); ++i) {
+        FileEntry&amp; entry = m_prologue.fileEntries[i];
+        dataLog(&quot;fileEntries[&quot;, i, &quot;] = {name: \&quot;&quot;, entry.name, &quot;\&quot;, dir_index: &quot;, entry.directoryIndex, &quot;, last_modified: &quot;, entry.lastModified, &quot;, size: &quot;, entry.size, &quot;}\n&quot;);
+    }
+}
+
+void DebugLineInterpreter::parseIncludeDirectories(const char*&amp; offset)
+{
+    size_t length = 0;
+    while ((length = strlen(offset))) {
+        m_prologue.includeDirectories.append(offset);
+        offset += length + 1;
+    }
+    
+    // Extra increment to get past the last null byte.
+    offset += 1;
+}
+
+void DebugLineInterpreter::parseFileEntries(const char*&amp; offset)
+{
+    while (true) {
+        DebugLineInterpreter::FileEntry nextEntry;
+        if (!parseFileEntry(offset, nextEntry))
+            break;
+        m_prologue.fileEntries.append(nextEntry);
+    }
+}
+
+bool DebugLineInterpreter::parseFileEntry(const char*&amp; offset, FileEntry&amp; entry)
+{
+    size_t length = strlen(offset);
+    if (!length) {
+        offset += 1;
+        return false;
+    }
+    entry.name = offset;
+    offset += length + 1;
+    entry.directoryIndex = parseULEB128(offset);
+    entry.lastModified = parseULEB128(offset);
+    entry.size = parseULEB128(offset);
+    
+    return true;
+}
+
+void DebugLineInterpreter::interpretStatementProgram()
+{
+    const char* currentProgramOffset = m_program;
+    bool keepGoing = true;
+    do {
+        keepGoing = interpretOpcode(currentProgramOffset);
+    } while (keepGoing);
+}
+
+bool DebugLineInterpreter::interpretOpcode(const char*&amp; offset)
+{
+    uint8_t nextOpcode = read&lt;uint8_t&gt;(offset);
+    switch (nextOpcode) {
+    case ExtendedOpcodes: {
+        uint32_t length = parseULEB128(offset);
+        if (!length)
+            return false;
+        uint8_t extendedOpcode = read&lt;uint8_t&gt;(offset);
+        switch (extendedOpcode) {
+        case DW_LNE_end_sequence: {
+            m_currentState.endSequence = true;
+            m_lineInfoMatrix.append(m_currentState);
+            resetInterpreterState();
+            break;
+        }
+        case DW_LNE_set_address: {
+            m_currentState.address = read&lt;size_t&gt;(offset);
+            break;
+        }
+        case DW_LNE_define_file: {
+            fprintf(stderr, &quot;Unimplemented extended opcode DW_LNE_define_file.\n&quot;);
+            RELEASE_ASSERT_NOT_REACHED();
+            break;
+        }
+        default: {
+            fprintf(stderr, &quot;Unknown extended opcode.\n&quot;);
+            RELEASE_ASSERT_NOT_REACHED();
+            break;
+        }
+        }
+        break;
+    }
+        /* Standard opcodes */
+    case DW_LNS_copy: {
+        m_lineInfoMatrix.append(m_currentState);
+        m_currentState.isBasicBlock = false;
+        m_currentState.prologueEnd = false;
+        m_currentState.epilogueBegin = false;
+        break;
+    }
+    case DW_LNS_advance_pc: {
+        uint32_t advance = parseULEB128(offset);
+        m_currentState.address += advance * m_prologue.minimumInstructionLength;
+        break;
+    }
+    case DW_LNS_advance_line: {
+        int32_t advance = parseSLEB128(offset);
+        m_currentState.line += advance;
+        break;
+    }
+    case DW_LNS_set_file: {
+        uint32_t fileIndex = parseULEB128(offset);
+        m_currentState.file = fileIndex;
+        break;
+    }
+    case DW_LNS_set_column: {
+        m_currentState.column = parseULEB128(offset);
+        break;
+    }
+    case DW_LNS_negate_stmt: {
+        m_currentState.isStatement = !m_currentState.isStatement;
+        break;
+    }
+    case DW_LNS_set_basic_block: {
+        m_currentState.isBasicBlock = true;
+        break;
+    }
+    case DW_LNS_const_add_pc: {
+        uint8_t adjustedOpcode = nextOpcode - m_prologue.opcodeBase;
+        uint32_t addressIncrement = (adjustedOpcode / m_prologue.lineRange) * m_prologue.minimumInstructionLength;
+        m_currentState.address += addressIncrement;
+        break;
+    }
+    case DW_LNS_fixed_advance_pc: {
+        uint16_t advance = read&lt;uint16_t&gt;(offset);
+        m_currentState.address += advance;
+        break;
+    }
+    case DW_LNS_set_prologue_end: {
+        m_currentState.prologueEnd = true;
+        break;
+    }
+    case DW_LNS_set_epilogue_begin: {
+        m_currentState.epilogueBegin = true;
+        break;
+    }
+    case DW_LNS_set_isa: {
+        m_currentState.isa = parseULEB128(offset);
+        break;
+    }
+        /* Special opcodes */
+    default: {
+        uint8_t adjustedOpcode = nextOpcode - m_prologue.opcodeBase;
+        uint32_t addressIncrement = (adjustedOpcode / m_prologue.lineRange) * m_prologue.minimumInstructionLength;
+        int32_t lineIncrement = m_prologue.lineBase + (adjustedOpcode % m_prologue.lineRange);
+        m_currentState.address += addressIncrement;
+        m_currentState.line += lineIncrement;
+        m_lineInfoMatrix.append(m_currentState);
+        m_currentState.isBasicBlock = false;
+        m_currentState.prologueEnd = false;
+        m_currentState.epilogueBegin = false;
+        break;
+    }
+    }
+    return true;
+}
+
+void DebugLineInterpreter::printLineInfo()
+{
+    dataLog(&quot;\nLine Info Matrix:\n&quot;);
+    for (unsigned i = 0; i &lt; m_lineInfoMatrix.size(); ++i)
+        printLineInfo(m_lineInfoMatrix[i]);
+    dataLog(&quot;\n&quot;);
+}
+
+void DebugLineInterpreter::printLineInfo(LineInfo&amp; info)
+{
+    dataLogF(&quot;address: %p&quot;, reinterpret_cast&lt;void*&gt;(info.address));
+    dataLog(&quot;  file: &quot;, info.file, &quot;  line: &quot;, info.line, &quot;  column: &quot;, info.column, &quot;  isa: &quot;, info.isa, &quot;  &quot;);
+    dataLog(&quot;  statement?: &quot;, info.isStatement);
+    dataLog(&quot;  basic block?: &quot;, info.isBasicBlock);
+    dataLog(&quot;  end sequence?: &quot;, info.endSequence);
+    dataLog(&quot;  prologue end?: &quot;, info.prologueEnd);
+    dataLog(&quot;  epilogue begin?: &quot;, info.epilogueBegin);
+    dataLog(&quot;\n&quot;);
+}
+
+void DebugLineInterpreter::resetInterpreterState()
+{
+    m_currentState.address = 0;
+    m_currentState.file = 1;
+    m_currentState.line = 1;
+    m_currentState.column = 0;
+    m_currentState.isa = 0;
+    m_currentState.isStatement = false;
+    m_currentState.isBasicBlock = false;
+    m_currentState.endSequence = false;
+    m_currentState.prologueEnd = false;
+    m_currentState.epilogueBegin = false;
+}
+
+} } // namespace JSC::FTL
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLDWARFDebugLineInfoh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.h (0 => 163397)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/ftl/FTLDWARFDebugLineInfo.h        2014-02-04 21:27:19 UTC (rev 163397)
</span><span class="lines">@@ -0,0 +1,138 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FTLDWARFDebugLineInfo_h
+#define FTLDWARFDebugLineInfo_h
+
+#include &lt;wtf/Vector.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace JSC { namespace FTL {
+
+class DebugLineInterpreter {
+public:
+    DebugLineInterpreter(const char* program);
+
+    void run();
+
+private:
+    struct FileEntry {
+        String name;
+        uint32_t directoryIndex;
+        uint32_t lastModified;
+        uint32_t size;
+    };
+
+    void resetInterpreterState();
+    void interpretStatementProgram();
+    bool interpretOpcode(const char*&amp;);
+    void parsePrologue();
+    void parseIncludeDirectories(const char*&amp;);
+    void parseFileEntries(const char*&amp;);
+    bool parseFileEntry(const char*&amp;, DebugLineInterpreter::FileEntry&amp;);
+    uint32_t parseULEB128(const char*&amp;);
+    int32_t parseSLEB128(const char*&amp;);
+
+    const char* m_program;
+    bool m_logResults;
+
+    struct LineInfo {
+        size_t address;
+        uint32_t file;
+        uint32_t line;
+        uint32_t column;
+        uint32_t isa;
+        bool isStatement;
+        bool isBasicBlock;
+        bool endSequence;
+        bool prologueEnd;
+        bool epilogueBegin;
+    };
+    
+    void printLineInfo(LineInfo&amp;);
+    void printLineInfo();
+
+    LineInfo m_currentState;
+    Vector&lt;LineInfo&gt; m_lineInfoMatrix;
+
+    enum DwarfFormat {
+        SixtyFourBit,
+        ThirtyTwoBit
+    };
+
+    struct Prologue {
+        Prologue()
+            : totalLength(0)
+            , format(ThirtyTwoBit)
+            , version(0)
+            , prologueLength(0)
+            , minimumInstructionLength(0)
+            , defaultIsStatement(0)
+            , lineBase(0)
+            , lineRange(0)
+            , opcodeBase(0)
+        {
+        }
+
+        uint32_t totalLength;
+        DwarfFormat format;
+        uint16_t version;
+        size_t prologueLength;
+        uint8_t minimumInstructionLength;
+        uint8_t defaultIsStatement;
+        int8_t lineBase;
+        uint8_t lineRange;
+        uint8_t opcodeBase;
+        Vector&lt;uint8_t&gt; standardOpcodeLengths;
+        Vector&lt;String&gt; includeDirectories;
+        Vector&lt;FileEntry&gt; fileEntries;
+    } m_prologue;
+
+    enum ExtendedOpcode {
+        DW_LNE_end_sequence = 0x1,
+        DW_LNE_set_address  = 0x2,
+        DW_LNE_define_file  = 0x3
+    };
+
+    enum StandardOpcode {
+        ExtendedOpcodes             = 0x0,
+        DW_LNS_copy                 = 0x1,
+        DW_LNS_advance_pc           = 0x2,
+        DW_LNS_advance_line         = 0x3,
+        DW_LNS_set_file             = 0x4,
+        DW_LNS_set_column           = 0x5,
+        DW_LNS_negate_stmt          = 0x6,
+        DW_LNS_set_basic_block      = 0x7,
+        DW_LNS_const_add_pc         = 0x8,
+        DW_LNS_fixed_advance_pc     = 0x9,
+        DW_LNS_set_prologue_end     = 0xa,
+        DW_LNS_set_epilogue_begin   = 0xb,
+        DW_LNS_set_isa              = 0xc
+    };
+};
+
+} } // namespace JSC::FTL
+    
+#endif // FTLDWARFDebugLineInfo_h
</ins></span></pre>
</div>
</div>

</body>
</html>