<!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>[180637] 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/180637">180637</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-25 14:29:26 -0800 (Wed, 25 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make ParserError immutable by design
https://bugs.webkit.org/show_bug.cgi?id=141955

Reviewed by Geoffrey Garen.

This patch enforce that no field of ParserError can
be modified after the constructor.

* parser/ParserError.h:
Move the attributes to pack the integer + 2 bytes together.
This is irrelevant for memory impact, it is to remve a load-store
when copying by value.

Also move the attributes to be private.

(JSC::ParserError::isValid):
To client of the interface cared about the type of the error,
the only information needed was: is there an error.

(JSC::ParserError::ParserError):
(JSC::ParserError::syntaxErrorType):
(JSC::ParserError::token):
(JSC::ParserError::message):
(JSC::ParserError::line):
(JSC::ParserError::toErrorObject):
* API/JSScriptRef.cpp:
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createBuiltinExecutable):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::generateFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::fromGlobalCode):
(JSC::UnlinkedFunctionExecutable::codeBlockFor):
* bytecode/UnlinkedCodeBlock.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::parse):
* jsc.cpp:
(runInteractive):
* parser/Parser.h:
(JSC::parse):
* runtime/CodeCache.cpp:
(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/CodeCache.h:
* runtime/Completion.h:
* runtime/Executable.cpp:
(JSC::ProgramExecutable::checkSyntax):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::createProgramCodeBlock):
(JSC::JSGlobalObject::createEvalCodeBlock):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSScriptRefcpp">trunk/Source/JavaScriptCore/API/JSScriptRef.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsBuiltinExecutablescpp">trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.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="#trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserErrorh">trunk/Source/JavaScriptCore/parser/ParserError.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="#trunkSourceJavaScriptCoreruntimeCompletionh">trunk/Source/JavaScriptCore/runtime/Completion.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSScriptRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSScriptRef.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSScriptRef.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/API/JSScriptRef.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -89,10 +89,10 @@
</span><span class="cx">     ParserError error;
</span><span class="cx">     if (!parseScript(vm, SourceCode(result), error)) {
</span><span class="cx">         if (errorMessage)
</span><del>-            *errorMessage = OpaqueJSString::create(error.m_message).leakRef();
</del><ins>+            *errorMessage = OpaqueJSString::create(error.message()).leakRef();
</ins><span class="cx">         if (errorLine)
</span><del>-            *errorLine = error.m_line;
-        return 0;
</del><ins>+            *errorLine = error.line();
+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return result.release().leakRef();
</span><span class="lines">@@ -110,10 +110,10 @@
</span><span class="cx">     ParserError error;
</span><span class="cx">     if (!parseScript(vm, SourceCode(result), error)) {
</span><span class="cx">         if (errorMessage)
</span><del>-            *errorMessage = OpaqueJSString::create(error.m_message).leakRef();
</del><ins>+            *errorMessage = OpaqueJSString::create(error.message()).leakRef();
</ins><span class="cx">         if (errorLine)
</span><del>-            *errorLine = error.m_line;
-        return 0;
</del><ins>+            *errorLine = error.line();
+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return result.release().leakRef();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2015-02-25  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        Make ParserError immutable by design
+        https://bugs.webkit.org/show_bug.cgi?id=141955
+
+        Reviewed by Geoffrey Garen.
+
+        This patch enforce that no field of ParserError can
+        be modified after the constructor.
+
+        * parser/ParserError.h:
+        Move the attributes to pack the integer + 2 bytes together.
+        This is irrelevant for memory impact, it is to remve a load-store
+        when copying by value.
+
+        Also move the attributes to be private.
+
+        (JSC::ParserError::isValid):
+        To client of the interface cared about the type of the error,
+        the only information needed was: is there an error.
+
+        (JSC::ParserError::ParserError):
+        (JSC::ParserError::syntaxErrorType):
+        (JSC::ParserError::token):
+        (JSC::ParserError::message):
+        (JSC::ParserError::line):
+        (JSC::ParserError::toErrorObject):
+        * API/JSScriptRef.cpp:
+        * builtins/BuiltinExecutables.cpp:
+        (JSC::BuiltinExecutables::createBuiltinExecutable):
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::generateFunctionCodeBlock):
+        (JSC::UnlinkedFunctionExecutable::fromGlobalCode):
+        (JSC::UnlinkedFunctionExecutable::codeBlockFor):
+        * bytecode/UnlinkedCodeBlock.h:
+        * inspector/agents/InspectorRuntimeAgent.cpp:
+        (Inspector::InspectorRuntimeAgent::parse):
+        * jsc.cpp:
+        (runInteractive):
+        * parser/Parser.h:
+        (JSC::parse):
+        * runtime/CodeCache.cpp:
+        (JSC::CodeCache::getGlobalCodeBlock):
+        (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
+        * runtime/CodeCache.h:
+        * runtime/Completion.h:
+        * runtime/Executable.cpp:
+        (JSC::ProgramExecutable::checkSyntax):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::createProgramCodeBlock):
+        (JSC::JSGlobalObject::createEvalCodeBlock):
+
</ins><span class="cx"> 2015-02-25  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Need to pass RTLD_DEEPBIND to dlopen() to ensure that our LLVMOverrides take effect on Linux
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsBuiltinExecutablescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">     std::unique_ptr&lt;ProgramNode&gt; program = parse&lt;ProgramNode&gt;(&amp;m_vm, source, 0, Identifier(), JSParseBuiltin, JSParseProgramCode, error, &amp;positionBeforeLastNewline);
</span><span class="cx"> 
</span><span class="cx">     if (!program) {
</span><del>-        dataLog(&quot;Fatal error compiling builtin function '&quot;, name.string(), &quot;': &quot;, error.m_message);
</del><ins>+        dataLog(&quot;Fatal error compiling builtin function '&quot;, name.string(), &quot;': &quot;, error.message());
</ins><span class="cx">         CRASH();
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -54,8 +54,8 @@
</span><span class="cx">     std::unique_ptr&lt;FunctionNode&gt; function = parse&lt;FunctionNode&gt;(&amp;vm, source, executable-&gt;parameters(), executable-&gt;name(), executable-&gt;toStrictness(), JSParseFunctionCode, error, 0, bodyIncludesBraces);
</span><span class="cx"> 
</span><span class="cx">     if (!function) {
</span><del>-        ASSERT(error.m_type != ParserError::ErrorNone);
-        return 0;
</del><ins>+        ASSERT(error.isValid());
+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function-&gt;finishParsing(executable-&gt;parameters(), executable-&gt;name(), executable-&gt;functionMode());
</span><span class="lines">@@ -64,8 +64,8 @@
</span><span class="cx">     UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&amp;vm, FunctionCode, ExecutableInfo(function-&gt;needsActivation(), function-&gt;usesEval(), function-&gt;isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction));
</span><span class="cx">     auto generator(std::make_unique&lt;BytecodeGenerator&gt;(vm, function.get(), result, debuggerMode, profilerMode));
</span><span class="cx">     error = generator-&gt;generate();
</span><del>-    if (error.m_type != ParserError::ErrorNone)
-        return 0;
</del><ins>+    if (error.isValid())
+        return nullptr;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -137,11 +137,11 @@
</span><span class="cx">     UnlinkedFunctionExecutable* executable = codeCache-&gt;getFunctionExecutableFromGlobalCode(vm, name, source, error);
</span><span class="cx"> 
</span><span class="cx">     if (exec-&gt;lexicalGlobalObject()-&gt;hasDebugger())
</span><del>-        exec-&gt;lexicalGlobalObject()-&gt;debugger()-&gt;sourceParsed(exec, source.provider(), error.m_line, error.m_message);
</del><ins>+        exec-&gt;lexicalGlobalObject()-&gt;debugger()-&gt;sourceParsed(exec, source.provider(), error.line(), error.message());
</ins><span class="cx"> 
</span><del>-    if (error.m_type != ParserError::ErrorNone) {
</del><ins>+    if (error.isValid()) {
</ins><span class="cx">         *exception = error.toErrorObject(exec-&gt;lexicalGlobalObject(), source);
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return executable;
</span><span class="lines">@@ -162,8 +162,8 @@
</span><span class="cx"> 
</span><span class="cx">     UnlinkedFunctionCodeBlock* result = generateFunctionCodeBlock(vm, this, source, specializationKind, debuggerMode, profilerMode, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, bodyIncludesBraces, error);
</span><span class="cx">     
</span><del>-    if (error.m_type != ParserError::ErrorNone)
-        return 0;
</del><ins>+    if (error.isValid())
+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     switch (specializationKind) {
</span><span class="cx">     case CodeForCall:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> class FunctionExecutable;
</span><span class="cx"> class FunctionParameters;
</span><span class="cx"> class JSScope;
</span><del>-struct ParserError;
</del><ins>+class ParserError;
</ins><span class="cx"> class ScriptExecutable;
</span><span class="cx"> class SourceCode;
</span><span class="cx"> class SourceProvider;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     ParserError error;
</span><span class="cx">     checkSyntax(vm, JSC::makeSource(expression), error);
</span><span class="cx"> 
</span><del>-    switch (error.m_syntaxErrorType) {
</del><ins>+    switch (error.syntaxErrorType()) {
</ins><span class="cx">     case ParserError::SyntaxErrorNone:
</span><span class="cx">         *result = Inspector::Protocol::Runtime::SyntaxErrorType::None;
</span><span class="cx">         break;
</span><span class="lines">@@ -108,9 +108,9 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (error.m_syntaxErrorType != ParserError::SyntaxErrorNone) {
-        *message = error.m_message;
-        range = buildErrorRangeObject(error.m_token.m_location);
</del><ins>+    if (error.syntaxErrorType() != ParserError::SyntaxErrorNone) {
+        *message = error.message();
+        range = buildErrorRangeObject(error.token().m_location);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -1319,10 +1319,10 @@
</span><span class="cx">             if (!line[0])
</span><span class="cx">                 break;
</span><span class="cx">             add_history(line);
</span><del>-        } while (error.m_syntaxErrorType == ParserError::SyntaxErrorRecoverable);
</del><ins>+        } while (error.syntaxErrorType() == ParserError::SyntaxErrorRecoverable);
</ins><span class="cx">         
</span><del>-        if (error.m_type != ParserError::ErrorNone) {
-            printf(&quot;%s:%d\n&quot;, error.m_message.utf8().data(), error.m_line);
</del><ins>+        if (error.isValid()) {
+            printf(&quot;%s:%d\n&quot;, error.message().utf8().data(), error.line());
</ins><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -972,7 +972,7 @@
</span><span class="cx">             *positionBeforeLastNewline = parser.positionBeforeLastNewline();
</span><span class="cx">         if (strictness == JSParseBuiltin) {
</span><span class="cx">             if (!result)
</span><del>-                WTF::dataLog(&quot;Error compiling builtin: &quot;, error.m_message, &quot;\n&quot;);
</del><ins>+                WTF::dataLog(&quot;Error compiling builtin: &quot;, error.message(), &quot;\n&quot;);
</ins><span class="cx">             RELEASE_ASSERT(result);
</span><span class="cx">             result-&gt;setClosedVariables(parser.closedVariables());
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ParserError.h (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ParserError.h        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/parser/ParserError.h        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -34,7 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-struct ParserError {
</del><ins>+class ParserError {
+public:
</ins><span class="cx">     enum SyntaxErrorType {
</span><span class="cx">         SyntaxErrorNone,
</span><span class="cx">         SyntaxErrorIrrecoverable,
</span><span class="lines">@@ -50,47 +51,45 @@
</span><span class="cx">         SyntaxError
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ErrorType m_type;
-    SyntaxErrorType m_syntaxErrorType;
-    JSToken m_token;
-    String m_message;
-    int m_line;
</del><span class="cx">     ParserError()
</span><span class="cx">         : m_type(ErrorNone)
</span><span class="cx">         , m_syntaxErrorType(SyntaxErrorNone)
</span><del>-        , m_line(-1)
</del><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     explicit ParserError(ErrorType type)
</span><span class="cx">         : m_type(type)
</span><span class="cx">         , m_syntaxErrorType(SyntaxErrorNone)
</span><del>-        , m_line(-1)
</del><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ParserError(ErrorType type, SyntaxErrorType syntaxError, JSToken token)
</span><del>-        : m_type(type)
</del><ins>+        : m_token(token)
+        , m_type(type)
</ins><span class="cx">         , m_syntaxErrorType(syntaxError)
</span><del>-        , m_token(token)
-        , m_line(-1)
</del><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ParserError(ErrorType type, SyntaxErrorType syntaxError, JSToken token, String msg, int line)
</span><del>-        : m_type(type)
-        , m_syntaxErrorType(syntaxError)
-        , m_token(token)
</del><ins>+        : m_token(token)
</ins><span class="cx">         , m_message(msg)
</span><span class="cx">         , m_line(line)
</span><ins>+        , m_type(type)
+        , m_syntaxErrorType(syntaxError)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    bool isValid() const { return m_type != ErrorNone; }
+    SyntaxErrorType syntaxErrorType() const { return m_syntaxErrorType; }
+    const JSToken&amp; token() const { return m_token; }
+    const String&amp; message() const { return m_message; }
+    int line() const { return m_line; }
+
</ins><span class="cx">     JSObject* toErrorObject(JSGlobalObject* globalObject, const SourceCode&amp; source)
</span><span class="cx">     {
</span><span class="cx">         switch (m_type) {
</span><span class="cx">         case ErrorNone:
</span><del>-            return 0;
</del><ins>+            return nullptr;
</ins><span class="cx">         case SyntaxError:
</span><span class="cx">             return addErrorInfo(globalObject-&gt;globalExec(), createSyntaxError(globalObject, m_message), m_line, source);
</span><span class="cx">         case EvalError:
</span><span class="lines">@@ -103,9 +102,15 @@
</span><span class="cx">             return createOutOfMemoryError(globalObject);
</span><span class="cx">         }
</span><span class="cx">         CRASH();
</span><del>-        return createOutOfMemoryError(globalObject); // Appease Qt bot
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><del>-#undef GET_ERROR_CODE
</del><ins>+
+private:
+    JSToken m_token;
+    String m_message;
+    int m_line { -1 };
+    ErrorType m_type;
+    SyntaxErrorType m_syntaxErrorType;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -109,9 +109,9 @@
</span><span class="cx"> 
</span><span class="cx">     auto generator = std::make_unique&lt;BytecodeGenerator&gt;(vm, rootNode.get(), unlinkedCodeBlock, debuggerMode, profilerMode);
</span><span class="cx">     error = generator-&gt;generate();
</span><del>-    if (error.m_type != ParserError::ErrorNone) {
</del><ins>+    if (error.isValid()) {
</ins><span class="cx">         m_sourceCode.remove(addResult.iterator);
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!canCache) {
</span><span class="lines">@@ -143,9 +143,9 @@
</span><span class="cx">     JSTextPosition positionBeforeLastNewline;
</span><span class="cx">     std::unique_ptr&lt;ProgramNode&gt; program = parse&lt;ProgramNode&gt;(&amp;vm, source, 0, Identifier(), JSParseNormal, JSParseProgramCode, error, &amp;positionBeforeLastNewline);
</span><span class="cx">     if (!program) {
</span><del>-        RELEASE_ASSERT(error.m_type != ParserError::ErrorNone);
</del><ins>+        RELEASE_ASSERT(error.isValid());
</ins><span class="cx">         m_sourceCode.remove(addResult.iterator);
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // This function assumes an input string that would result in a single anonymous function expression.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.h (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.h        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.h        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> class FunctionBodyNode;
</span><span class="cx"> class Identifier;
</span><span class="cx"> class JSScope;
</span><ins>+class ParserError;
</ins><span class="cx"> class ProgramExecutable;
</span><span class="cx"> class UnlinkedCodeBlock;
</span><span class="cx"> class UnlinkedEvalCodeBlock;
</span><span class="lines">@@ -49,7 +50,6 @@
</span><span class="cx"> class UnlinkedFunctionExecutable;
</span><span class="cx"> class UnlinkedProgramCodeBlock;
</span><span class="cx"> class VM;
</span><del>-struct ParserError;
</del><span class="cx"> class SourceCode;
</span><span class="cx"> class SourceProvider;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCompletionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Completion.h (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Completion.h        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/runtime/Completion.h        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -27,9 +27,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx">     
</span><del>-struct ParserError;
</del><span class="cx"> class ExecState;
</span><span class="cx"> class JSScope;
</span><ins>+class ParserError;
</ins><span class="cx"> class SourceCode;
</span><span class="cx"> class VM;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -468,7 +468,7 @@
</span><span class="cx">     std::unique_ptr&lt;ProgramNode&gt; programNode = parse&lt;ProgramNode&gt;(vm, m_source, 0, Identifier(), JSParseNormal, JSParseProgramCode, error);
</span><span class="cx">     if (programNode)
</span><span class="cx">         return 0;
</span><del>-    ASSERT(error.m_type != ParserError::ErrorNone);
</del><ins>+    ASSERT(error.isValid());
</ins><span class="cx">     return error.toErrorObject(lexicalGlobalObject, m_source);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (180636 => 180637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-02-25 21:27:37 UTC (rev 180636)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-02-25 22:29:26 UTC (rev 180637)
</span><span class="lines">@@ -781,11 +781,11 @@
</span><span class="cx">     UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()-&gt;getProgramCodeBlock(vm(), executable, executable-&gt;source(), strictness, debuggerMode, profilerMode, error);
</span><span class="cx"> 
</span><span class="cx">     if (hasDebugger())
</span><del>-        debugger()-&gt;sourceParsed(callFrame, executable-&gt;source().provider(), error.m_line, error.m_message);
</del><ins>+        debugger()-&gt;sourceParsed(callFrame, executable-&gt;source().provider(), error.line(), error.message());
</ins><span class="cx"> 
</span><del>-    if (error.m_type != ParserError::ErrorNone) {
</del><ins>+    if (error.isValid()) {
</ins><span class="cx">         *exception = error.toErrorObject(this, executable-&gt;source());
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     return unlinkedCodeBlock;
</span><span class="lines">@@ -800,11 +800,11 @@
</span><span class="cx">     UnlinkedEvalCodeBlock* unlinkedCodeBlock = vm().codeCache()-&gt;getEvalCodeBlock(vm(), executable, executable-&gt;source(), strictness, debuggerMode, profilerMode, error);
</span><span class="cx"> 
</span><span class="cx">     if (hasDebugger())
</span><del>-        debugger()-&gt;sourceParsed(callFrame, executable-&gt;source().provider(), error.m_line, error.m_message);
</del><ins>+        debugger()-&gt;sourceParsed(callFrame, executable-&gt;source().provider(), error.line(), error.message());
</ins><span class="cx"> 
</span><del>-    if (error.m_type != ParserError::ErrorNone) {
</del><ins>+    if (error.isValid()) {
</ins><span class="cx">         throwVMError(callFrame, error.toErrorObject(this, executable-&gt;source()));
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return unlinkedCodeBlock;
</span></span></pre>
</div>
</div>

</body>
</html>