<!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>[180012] 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/180012">180012</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-12 14:20:18 -0800 (Thu, 12 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify the initialization of BytecodeGenerator a bit
https://bugs.webkit.org/show_bug.cgi?id=141505

Reviewed by Anders Carlsson.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/BytecodeGenerator.h:
Setup the default initialization at the declaration level
instead of the constructor.

Also made m_scopeNode and m_codeType const to make it explicit
that they are invariant after construction.

* parser/Nodes.cpp:
* runtime/Executable.cpp:
Remove 2 useless #includes.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodescpp">trunk/Source/JavaScriptCore/parser/Nodes.cpp</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 (180011 => 180012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-12 22:19:54 UTC (rev 180011)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-12 22:20:18 UTC (rev 180012)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2015-02-12  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        Simplify the initialization of BytecodeGenerator a bit
+        https://bugs.webkit.org/show_bug.cgi?id=141505
+
+        Reviewed by Anders Carlsson.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * bytecompiler/BytecodeGenerator.h:
+        Setup the default initialization at the declaration level
+        instead of the constructor.
+
+        Also made m_scopeNode and m_codeType const to make it explicit
+        that they are invariant after construction.
+
+        * parser/Nodes.cpp:
+        * runtime/Executable.cpp:
+        Remove 2 useless #includes.
+
+2015-02-12  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
</ins><span class="cx">         Move the generators for GetScope and SkipScope to the common core in DFGSpeculativeJIT
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=141506
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (180011 => 180012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-02-12 22:19:54 UTC (rev 180011)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-02-12 22:20:18 UTC (rev 180012)
</span><span class="lines">@@ -154,30 +154,11 @@
</span><span class="cx"> BytecodeGenerator::BytecodeGenerator(VM&amp; vm, ProgramNode* programNode, UnlinkedProgramCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode)
</span><span class="cx">     : m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn)
</span><span class="cx">     , m_shouldEmitProfileHooks(Options::forceProfilerBytecodeGeneration() || profilerMode == ProfilerOn)
</span><del>-    , m_symbolTable(0)
</del><span class="cx">     , m_scopeNode(programNode)
</span><span class="cx">     , m_codeBlock(vm, codeBlock)
</span><span class="cx">     , m_thisRegister(CallFrame::thisArgumentOffset())
</span><del>-    , m_scopeRegister(0)
-    , m_lexicalEnvironmentRegister(0)
-    , m_emptyValueRegister(0)
-    , m_globalObjectRegister(0)
-    , m_localArgumentsRegister(0)
-    , m_finallyDepth(0)
-    , m_localScopeDepth(0)
</del><span class="cx">     , m_codeType(GlobalCode)
</span><del>-    , m_nextConstantOffset(0)
-    , m_firstLazyFunction(0)
-    , m_lastLazyFunction(0)
-    , m_staticPropertyAnalyzer(&amp;m_instructions)
</del><span class="cx">     , m_vm(&amp;vm)
</span><del>-    , m_lastOpcodeID(op_end)
-#ifndef NDEBUG
-    , m_lastOpcodePosition(0)
-#endif
-    , m_usesExceptions(false)
-    , m_expressionTooDeep(false)
-    , m_isBuiltinFunction(false)
</del><span class="cx"> {
</span><span class="cx">     m_codeBlock-&gt;setNumParameters(1); // Allocate space for &quot;this&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -205,25 +186,8 @@
</span><span class="cx">     , m_symbolTable(codeBlock-&gt;symbolTable())
</span><span class="cx">     , m_scopeNode(functionNode)
</span><span class="cx">     , m_codeBlock(vm, codeBlock)
</span><del>-    , m_scopeRegister(0)
-    , m_lexicalEnvironmentRegister(0)
-    , m_emptyValueRegister(0)
-    , m_globalObjectRegister(0)
-    , m_localArgumentsRegister(0)
-    , m_finallyDepth(0)
-    , m_localScopeDepth(0)
</del><span class="cx">     , m_codeType(FunctionCode)
</span><del>-    , m_nextConstantOffset(0)
-    , m_firstLazyFunction(0)
-    , m_lastLazyFunction(0)
-    , m_staticPropertyAnalyzer(&amp;m_instructions)
</del><span class="cx">     , m_vm(&amp;vm)
</span><del>-    , m_lastOpcodeID(op_end)
-#ifndef NDEBUG
-    , m_lastOpcodePosition(0)
-#endif
-    , m_usesExceptions(false)
-    , m_expressionTooDeep(false)
</del><span class="cx">     , m_isBuiltinFunction(codeBlock-&gt;isBuiltinFunction())
</span><span class="cx"> {
</span><span class="cx">     if (m_isBuiltinFunction)
</span><span class="lines">@@ -445,26 +409,8 @@
</span><span class="cx">     , m_scopeNode(evalNode)
</span><span class="cx">     , m_codeBlock(vm, codeBlock)
</span><span class="cx">     , m_thisRegister(CallFrame::thisArgumentOffset())
</span><del>-    , m_scopeRegister(0)
-    , m_lexicalEnvironmentRegister(0)
-    , m_emptyValueRegister(0)
-    , m_globalObjectRegister(0)
-    , m_localArgumentsRegister(0)
-    , m_finallyDepth(0)
-    , m_localScopeDepth(0)
</del><span class="cx">     , m_codeType(EvalCode)
</span><del>-    , m_nextConstantOffset(0)
-    , m_firstLazyFunction(0)
-    , m_lastLazyFunction(0)
-    , m_staticPropertyAnalyzer(&amp;m_instructions)
</del><span class="cx">     , m_vm(&amp;vm)
</span><del>-    , m_lastOpcodeID(op_end)
-#ifndef NDEBUG
-    , m_lastOpcodePosition(0)
-#endif
-    , m_usesExceptions(false)
-    , m_expressionTooDeep(false)
-    , m_isBuiltinFunction(false)
</del><span class="cx"> {
</span><span class="cx">     m_symbolTable-&gt;setUsesNonStrictEval(codeBlock-&gt;usesEval() &amp;&amp; !codeBlock-&gt;isStrictMode());
</span><span class="cx">     m_codeBlock-&gt;setNumParameters(1);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (180011 => 180012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-02-12 22:19:54 UTC (rev 180011)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-02-12 22:20:18 UTC (rev 180012)
</span><span class="lines">@@ -255,6 +255,7 @@
</span><span class="cx"> 
</span><span class="cx">     class BytecodeGenerator {
</span><span class="cx">         WTF_MAKE_FAST_ALLOCATED;
</span><ins>+        WTF_MAKE_NONCOPYABLE(BytecodeGenerator);
</ins><span class="cx">     public:
</span><span class="cx">         typedef DeclarationStacks::VarStack VarStack;
</span><span class="cx">         typedef DeclarationStacks::FunctionStack FunctionStack;
</span><span class="lines">@@ -757,9 +758,9 @@
</span><span class="cx">         bool m_shouldEmitDebugHooks;
</span><span class="cx">         bool m_shouldEmitProfileHooks;
</span><span class="cx"> 
</span><del>-        SymbolTable* m_symbolTable;
</del><ins>+        SymbolTable* m_symbolTable { nullptr };
</ins><span class="cx"> 
</span><del>-        ScopeNode* m_scopeNode;
</del><ins>+        ScopeNode* const m_scopeNode;
</ins><span class="cx">         Strong&lt;UnlinkedCodeBlock&gt; m_codeBlock;
</span><span class="cx"> 
</span><span class="cx">         // Some of these objects keep pointers to one another. They are arranged
</span><span class="lines">@@ -768,11 +769,11 @@
</span><span class="cx">         RegisterID m_ignoredResultRegister;
</span><span class="cx">         RegisterID m_thisRegister;
</span><span class="cx">         RegisterID m_calleeRegister;
</span><del>-        RegisterID* m_scopeRegister;
-        RegisterID* m_lexicalEnvironmentRegister;
-        RegisterID* m_emptyValueRegister;
-        RegisterID* m_globalObjectRegister;
-        RegisterID* m_localArgumentsRegister;
</del><ins>+        RegisterID* m_scopeRegister { nullptr };
+        RegisterID* m_lexicalEnvironmentRegister { nullptr };
+        RegisterID* m_emptyValueRegister { nullptr };
+        RegisterID* m_globalObjectRegister { nullptr };
+        RegisterID* m_localArgumentsRegister { nullptr };
</ins><span class="cx"> 
</span><span class="cx">         Vector&lt;Identifier, 16&gt; m_watchableVariables;
</span><span class="cx">         SegmentedVector&lt;RegisterID, 32&gt; m_constantPoolRegisters;
</span><span class="lines">@@ -780,9 +781,9 @@
</span><span class="cx">         SegmentedVector&lt;RegisterID, 32&gt; m_parameters;
</span><span class="cx">         SegmentedVector&lt;Label, 32&gt; m_labels;
</span><span class="cx">         LabelScopeStore m_labelScopes;
</span><del>-        int m_finallyDepth;
-        int m_localScopeDepth;
-        CodeType m_codeType;
</del><ins>+        int m_finallyDepth { 0 };
+        int m_localScopeDepth { 0 };
+        const CodeType m_codeType;
</ins><span class="cx"> 
</span><span class="cx">         Vector&lt;ControlFlowContext, 0, UnsafeVectorOverflow&gt; m_scopeContextStack;
</span><span class="cx">         Vector&lt;SwitchInfo&gt; m_switchContextStack;
</span><span class="lines">@@ -793,10 +794,10 @@
</span><span class="cx">         Vector&lt;TryRange&gt; m_tryRanges;
</span><span class="cx">         SegmentedVector&lt;TryData, 8&gt; m_tryData;
</span><span class="cx"> 
</span><del>-        int m_nextConstantOffset;
</del><ins>+        int m_nextConstantOffset { 0 };
</ins><span class="cx"> 
</span><del>-        int m_firstLazyFunction;
-        int m_lastLazyFunction;
</del><ins>+        int m_firstLazyFunction { 0 };
+        int m_lastLazyFunction { 0 };
</ins><span class="cx">         HashMap&lt;unsigned int, FunctionBodyNode*, WTF::IntHash&lt;unsigned int&gt;, WTF::UnsignedWithZeroKeyHashTraits&lt;unsigned int&gt;&gt; m_lazyFunctions;
</span><span class="cx">         typedef HashMap&lt;FunctionBodyNode*, unsigned&gt; FunctionOffsetMap;
</span><span class="cx">         FunctionOffsetMap m_functionOffsets;
</span><span class="lines">@@ -807,18 +808,18 @@
</span><span class="cx">         NumberMap m_numberMap;
</span><span class="cx">         IdentifierStringMap m_stringMap;
</span><span class="cx"> 
</span><del>-        StaticPropertyAnalyzer m_staticPropertyAnalyzer;
</del><ins>+        StaticPropertyAnalyzer m_staticPropertyAnalyzer { &amp;m_instructions };
</ins><span class="cx"> 
</span><span class="cx">         VM* m_vm;
</span><span class="cx"> 
</span><del>-        OpcodeID m_lastOpcodeID;
</del><ins>+        OpcodeID m_lastOpcodeID = op_end;
</ins><span class="cx"> #ifndef NDEBUG
</span><del>-        size_t m_lastOpcodePosition;
</del><ins>+        size_t m_lastOpcodePosition { 0 };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-        bool m_usesExceptions;
-        bool m_expressionTooDeep;
-        bool m_isBuiltinFunction;
</del><ins>+        bool m_usesExceptions { false };
+        bool m_expressionTooDeep { false };
+        bool m_isBuiltinFunction { false };
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Nodes.cpp (180011 => 180012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Nodes.cpp        2015-02-12 22:19:54 UTC (rev 180011)
+++ trunk/Source/JavaScriptCore/parser/Nodes.cpp        2015-02-12 22:20:18 UTC (rev 180012)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include &quot;Nodes.h&quot;
</span><span class="cx"> #include &quot;NodeConstructors.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;BytecodeGenerator.h&quot;
</del><span class="cx"> #include &quot;CallFrame.h&quot;
</span><span class="cx"> #include &quot;Debugger.h&quot;
</span><span class="cx"> #include &quot;JIT.h&quot;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (180011 => 180012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-02-12 22:19:54 UTC (rev 180011)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-02-12 22:20:18 UTC (rev 180012)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include &quot;Executable.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BatchedTransitionOptimizer.h&quot;
</span><del>-#include &quot;BytecodeGenerator.h&quot;
</del><span class="cx"> #include &quot;CodeBlock.h&quot;
</span><span class="cx"> #include &quot;DFGDriver.h&quot;
</span><span class="cx"> #include &quot;JIT.h&quot;
</span></span></pre>
</div>
</div>

</body>
</html>