Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (208967 => 208968)
--- trunk/Source/_javascript_Core/ChangeLog 2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-11-22 20:52:05 UTC (rev 208968)
@@ -1,3 +1,22 @@
+2016-11-18 Mark Lam <[email protected]>
+
+ 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):
+
2016-11-22 Mark Lam <[email protected]>
Fix exception scope verification failures in JSONObject.cpp.
Modified: trunk/Source/_javascript_Core/profiler/ProfilerBytecodeSequence.cpp (208967 => 208968)
--- trunk/Source/_javascript_Core/profiler/ProfilerBytecodeSequence.cpp 2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/_javascript_Core/profiler/ProfilerBytecodeSequence.cpp 2016-11-22 20:52:05 UTC (rev 208968)
@@ -82,14 +82,18 @@
auto scope = DECLARE_THROW_SCOPE(vm);
JSArray* header = constructEmptyArray(exec, 0);
RETURN_IF_EXCEPTION(scope, void());
- for (unsigned i = 0; i < m_header.size(); ++i)
+ for (unsigned i = 0; i < m_header.size(); ++i) {
header->putDirectIndex(exec, i, jsString(exec, String::fromUTF8(m_header[i])));
+ RETURN_IF_EXCEPTION(scope, void());
+ }
result->putDirect(vm, exec->propertyNames().header, header);
JSArray* sequence = constructEmptyArray(exec, 0);
RETURN_IF_EXCEPTION(scope, void());
- for (unsigned i = 0; i < m_sequence.size(); ++i)
+ for (unsigned i = 0; i < m_sequence.size(); ++i) {
sequence->putDirectIndex(exec, i, m_sequence[i].toJS(exec));
+ RETURN_IF_EXCEPTION(scope, void());
+ }
result->putDirect(vm, exec->propertyNames().bytecode, sequence);
}
Modified: trunk/Source/_javascript_Core/profiler/ProfilerCompilation.cpp (208967 => 208968)
--- trunk/Source/_javascript_Core/profiler/ProfilerCompilation.cpp 2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/_javascript_Core/profiler/ProfilerCompilation.cpp 2016-11-22 20:52:05 UTC (rev 208968)
@@ -117,42 +117,60 @@
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSObject* result = constructEmptyObject(exec);
- RETURN_IF_EXCEPTION(scope, JSValue());
+ RETURN_IF_EXCEPTION(scope, { });
result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id()));
result->putDirect(vm, exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind))));
JSArray* profiledBytecodes = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i)
- profiledBytecodes->putDirectIndex(exec, i, m_profiledBytecodes[i].toJS(exec));
+ 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, { });
+ }
result->putDirect(vm, exec->propertyNames().profiledBytecodes, profiledBytecodes);
JSArray* descriptions = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_descriptions.size(); ++i)
- descriptions->putDirectIndex(exec, i, m_descriptions[i].toJS(exec));
+ 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, { });
+ }
result->putDirect(vm, exec->propertyNames().descriptions, descriptions);
JSArray* counters = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
+ RETURN_IF_EXCEPTION(scope, { });
for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) {
JSObject* counterEntry = constructEmptyObject(exec);
- counterEntry->putDirect(vm, exec->propertyNames().origin, it->key.toJS(exec));
+ RETURN_IF_EXCEPTION(scope, { });
+ auto value = it->key.toJS(exec);
+ RETURN_IF_EXCEPTION(scope, { });
+ counterEntry->putDirect(vm, exec->propertyNames().origin, value);
counterEntry->putDirect(vm, exec->propertyNames().executionCount, jsNumber(it->value->count()));
counters->push(exec, counterEntry);
+ RETURN_IF_EXCEPTION(scope, { });
}
result->putDirect(vm, exec->propertyNames().counters, counters);
JSArray* exitSites = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_osrExitSites.size(); ++i)
- exitSites->putDirectIndex(exec, i, m_osrExitSites[i].toJS(exec));
+ 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, { });
+ }
result->putDirect(vm, exec->propertyNames().osrExitSites, exitSites);
JSArray* exits = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_osrExits.size(); ++i)
+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_osrExits.size(); ++i) {
exits->putDirectIndex(exec, i, m_osrExits[i].toJS(exec));
+ RETURN_IF_EXCEPTION(scope, { });
+ }
result->putDirect(vm, exec->propertyNames().osrExits, exits);
result->putDirect(vm, exec->propertyNames().numInlinedGetByIds, jsNumber(m_numInlinedGetByIds));
Modified: trunk/Source/_javascript_Core/profiler/ProfilerDatabase.cpp (208967 => 208968)
--- trunk/Source/_javascript_Core/profiler/ProfilerDatabase.cpp 2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/_javascript_Core/profiler/ProfilerDatabase.cpp 2016-11-22 20:52:05 UTC (rev 208968)
@@ -104,21 +104,33 @@
JSObject* result = constructEmptyObject(exec);
JSArray* bytecodes = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_bytecodes.size(); ++i)
- bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec));
+ 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, { });
+ }
result->putDirect(vm, exec->propertyNames().bytecodes, bytecodes);
JSArray* compilations = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_compilations.size(); ++i)
- compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec));
+ 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, { });
+ }
result->putDirect(vm, exec->propertyNames().compilations, compilations);
JSArray* events = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_events.size(); ++i)
- events->putDirectIndex(exec, i, m_events[i].toJS(exec));
+ 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, { });
+ }
result->putDirect(vm, exec->propertyNames().events, events);
return result;
@@ -126,10 +138,14 @@
String Database::toJSON() const
{
+ auto scope = DECLARE_THROW_SCOPE(m_vm);
JSGlobalObject* globalObject = JSGlobalObject::create(
m_vm, JSGlobalObject::createStructure(m_vm, jsNull()));
-
- return JSONStringify(globalObject->globalExec(), toJS(globalObject->globalExec()), 0);
+
+ auto value = toJS(globalObject->globalExec());
+ RETURN_IF_EXCEPTION(scope, String());
+ scope.release();
+ return JSONStringify(globalObject->globalExec(), value, 0);
}
bool Database::save(const char* filename) const
Modified: trunk/Source/_javascript_Core/profiler/ProfilerOSRExitSite.cpp (208967 => 208968)
--- trunk/Source/_javascript_Core/profiler/ProfilerOSRExitSite.cpp 2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/_javascript_Core/profiler/ProfilerOSRExitSite.cpp 2016-11-22 20:52:05 UTC (rev 208968)
@@ -39,9 +39,11 @@
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSArray* result = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
- for (unsigned i = 0; i < m_codeAddresses.size(); ++i)
+ RETURN_IF_EXCEPTION(scope, { });
+ for (unsigned i = 0; i < m_codeAddresses.size(); ++i) {
result->putDirectIndex(exec, i, jsString(exec, toString(RawPointer(m_codeAddresses[i]))));
+ RETURN_IF_EXCEPTION(scope, { });
+ }
return result;
}
Modified: trunk/Source/_javascript_Core/profiler/ProfilerOriginStack.cpp (208967 => 208968)
--- trunk/Source/_javascript_Core/profiler/ProfilerOriginStack.cpp 2016-11-22 20:13:38 UTC (rev 208967)
+++ trunk/Source/_javascript_Core/profiler/ProfilerOriginStack.cpp 2016-11-22 20:52:05 UTC (rev 208968)
@@ -103,10 +103,12 @@
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSArray* result = constructEmptyArray(exec, 0);
- RETURN_IF_EXCEPTION(scope, JSValue());
+ RETURN_IF_EXCEPTION(scope, { });
- for (unsigned i = 0; i < m_stack.size(); ++i)
+ for (unsigned i = 0; i < m_stack.size(); ++i) {
result->putDirectIndex(exec, i, m_stack[i].toJS(exec));
+ RETURN_IF_EXCEPTION(scope, { });
+ }
return result;
}