<!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>[208968] 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/208968">208968</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2016-11-22 12:52:05 -0800 (Tue, 22 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix exception scope verification failures in JSC profiler files.
https://bugs.webkit.org/show_bug.cgi?id=164971
Reviewed by Saam Barati.
* profiler/ProfilerBytecodeSequence.cpp:
(JSC::Profiler::BytecodeSequence::addSequenceProperties):
* profiler/ProfilerCompilation.cpp:
(JSC::Profiler::Compilation::toJS):
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::toJS):
(JSC::Profiler::Database::toJSON):
* profiler/ProfilerOSRExitSite.cpp:
(JSC::Profiler::OSRExitSite::toJS):
* profiler/ProfilerOriginStack.cpp:
(JSC::Profiler::OriginStack::toJS):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerBytecodeSequencecpp">trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerCompilationcpp">trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerDatabasecpp">trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerOSRExitSitecpp">trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerOriginStackcpp">trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (208967 => 208968)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-22 20:52:05 UTC (rev 208968)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-11-18 Mark Lam <mark.lam@apple.com>
+
+ Fix exception scope verification failures in JSC profiler files.
+ https://bugs.webkit.org/show_bug.cgi?id=164971
+
+ Reviewed by Saam Barati.
+
+ * profiler/ProfilerBytecodeSequence.cpp:
+ (JSC::Profiler::BytecodeSequence::addSequenceProperties):
+ * profiler/ProfilerCompilation.cpp:
+ (JSC::Profiler::Compilation::toJS):
+ * profiler/ProfilerDatabase.cpp:
+ (JSC::Profiler::Database::toJS):
+ (JSC::Profiler::Database::toJSON):
+ * profiler/ProfilerOSRExitSite.cpp:
+ (JSC::Profiler::OSRExitSite::toJS):
+ * profiler/ProfilerOriginStack.cpp:
+ (JSC::Profiler::OriginStack::toJS):
+
</ins><span class="cx"> 2016-11-22 Mark Lam <mark.lam@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix exception scope verification failures in JSONObject.cpp.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerBytecodeSequencecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp (208967 => 208968)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp        2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp        2016-11-22 20:52:05 UTC (rev 208968)
</span><span class="lines">@@ -82,14 +82,18 @@
</span><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> JSArray* header = constructEmptyArray(exec, 0);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, void());
</span><del>- for (unsigned i = 0; i < m_header.size(); ++i)
</del><ins>+ for (unsigned i = 0; i < m_header.size(); ++i) {
</ins><span class="cx"> header->putDirectIndex(exec, i, jsString(exec, String::fromUTF8(m_header[i])));
</span><ins>+ RETURN_IF_EXCEPTION(scope, void());
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().header, header);
</span><span class="cx">
</span><span class="cx"> JSArray* sequence = constructEmptyArray(exec, 0);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, void());
</span><del>- for (unsigned i = 0; i < m_sequence.size(); ++i)
</del><ins>+ for (unsigned i = 0; i < m_sequence.size(); ++i) {
</ins><span class="cx"> sequence->putDirectIndex(exec, i, m_sequence[i].toJS(exec));
</span><ins>+ RETURN_IF_EXCEPTION(scope, void());
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().bytecode, sequence);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerCompilationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp (208967 => 208968)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp        2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp        2016-11-22 20:52:05 UTC (rev 208968)
</span><span class="lines">@@ -117,42 +117,60 @@
</span><span class="cx"> VM& vm = exec->vm();
</span><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> JSObject* result = constructEmptyObject(exec);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id()));
</span><span class="cx"> result->putDirect(vm, exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind))));
</span><span class="cx">
</span><span class="cx"> JSArray* profiledBytecodes = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i)
- profiledBytecodes->putDirectIndex(exec, i, m_profiledBytecodes[i].toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i) {
+ auto value = m_profiledBytecodes[i].toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ profiledBytecodes->putDirectIndex(exec, i, value);
+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().profiledBytecodes, profiledBytecodes);
</span><span class="cx">
</span><span class="cx"> JSArray* descriptions = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_descriptions.size(); ++i)
- descriptions->putDirectIndex(exec, i, m_descriptions[i].toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_descriptions.size(); ++i) {
+ auto value = m_descriptions[i].toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ descriptions->putDirectIndex(exec, i, value);
+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().descriptions, descriptions);
</span><span class="cx">
</span><span class="cx"> JSArray* counters = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
</ins><span class="cx"> for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) {
</span><span class="cx"> JSObject* counterEntry = constructEmptyObject(exec);
</span><del>- counterEntry->putDirect(vm, exec->propertyNames().origin, it->key.toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ auto value = it->key.toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ counterEntry->putDirect(vm, exec->propertyNames().origin, value);
</ins><span class="cx"> counterEntry->putDirect(vm, exec->propertyNames().executionCount, jsNumber(it->value->count()));
</span><span class="cx"> counters->push(exec, counterEntry);
</span><ins>+ RETURN_IF_EXCEPTION(scope, { });
</ins><span class="cx"> }
</span><span class="cx"> result->putDirect(vm, exec->propertyNames().counters, counters);
</span><span class="cx">
</span><span class="cx"> JSArray* exitSites = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_osrExitSites.size(); ++i)
- exitSites->putDirectIndex(exec, i, m_osrExitSites[i].toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_osrExitSites.size(); ++i) {
+ auto value = m_osrExitSites[i].toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ exitSites->putDirectIndex(exec, i, value);
+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().osrExitSites, exitSites);
</span><span class="cx">
</span><span class="cx"> JSArray* exits = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_osrExits.size(); ++i)
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_osrExits.size(); ++i) {
</ins><span class="cx"> exits->putDirectIndex(exec, i, m_osrExits[i].toJS(exec));
</span><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().osrExits, exits);
</span><span class="cx">
</span><span class="cx"> result->putDirect(vm, exec->propertyNames().numInlinedGetByIds, jsNumber(m_numInlinedGetByIds));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp (208967 => 208968)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp        2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp        2016-11-22 20:52:05 UTC (rev 208968)
</span><span class="lines">@@ -104,21 +104,33 @@
</span><span class="cx"> JSObject* result = constructEmptyObject(exec);
</span><span class="cx">
</span><span class="cx"> JSArray* bytecodes = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_bytecodes.size(); ++i)
- bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_bytecodes.size(); ++i) {
+ auto value = m_bytecodes[i].toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ bytecodes->putDirectIndex(exec, i, value);
+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().bytecodes, bytecodes);
</span><span class="cx">
</span><span class="cx"> JSArray* compilations = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_compilations.size(); ++i)
- compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_compilations.size(); ++i) {
+ auto value = m_compilations[i]->toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ compilations->putDirectIndex(exec, i, value);
+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().compilations, compilations);
</span><span class="cx">
</span><span class="cx"> JSArray* events = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_events.size(); ++i)
- events->putDirectIndex(exec, i, m_events[i].toJS(exec));
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_events.size(); ++i) {
+ auto value = m_events[i].toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ events->putDirectIndex(exec, i, value);
+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> result->putDirect(vm, exec->propertyNames().events, events);
</span><span class="cx">
</span><span class="cx"> return result;
</span><span class="lines">@@ -126,10 +138,14 @@
</span><span class="cx">
</span><span class="cx"> String Database::toJSON() const
</span><span class="cx"> {
</span><ins>+ auto scope = DECLARE_THROW_SCOPE(m_vm);
</ins><span class="cx"> JSGlobalObject* globalObject = JSGlobalObject::create(
</span><span class="cx"> m_vm, JSGlobalObject::createStructure(m_vm, jsNull()));
</span><del>-
- return JSONStringify(globalObject->globalExec(), toJS(globalObject->globalExec()), 0);
</del><ins>+
+ auto value = toJS(globalObject->globalExec());
+ RETURN_IF_EXCEPTION(scope, String());
+ scope.release();
+ return JSONStringify(globalObject->globalExec(), value, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Database::save(const char* filename) const
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerOSRExitSitecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp (208967 => 208968)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp        2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp        2016-11-22 20:52:05 UTC (rev 208968)
</span><span class="lines">@@ -39,9 +39,11 @@
</span><span class="cx"> VM& vm = exec->vm();
</span><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> JSArray* result = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_codeAddresses.size(); ++i)
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_codeAddresses.size(); ++i) {
</ins><span class="cx"> result->putDirectIndex(exec, i, jsString(exec, toString(RawPointer(m_codeAddresses[i]))));
</span><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerOriginStackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp (208967 => 208968)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp        2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp        2016-11-22 20:52:05 UTC (rev 208968)
</span><span class="lines">@@ -103,10 +103,12 @@
</span><span class="cx"> VM& vm = exec->vm();
</span><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> JSArray* result = constructEmptyArray(exec, 0);
</span><del>- RETURN_IF_EXCEPTION(scope, JSValue());
</del><ins>+ RETURN_IF_EXCEPTION(scope, { });
</ins><span class="cx">
</span><del>- for (unsigned i = 0; i < m_stack.size(); ++i)
</del><ins>+ for (unsigned i = 0; i < m_stack.size(); ++i) {
</ins><span class="cx"> result->putDirectIndex(exec, i, m_stack[i].toJS(exec));
</span><ins>+ RETURN_IF_EXCEPTION(scope, { });
+ }
</ins><span class="cx">
</span><span class="cx"> return result;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>