Title: [240113] trunk/Source/_javascript_Core
- Revision
- 240113
- Author
- [email protected]
- Date
- 2019-01-17 09:32:38 -0800 (Thu, 17 Jan 2019)
Log Message
[JSC] Add generateHeapSnapshotForGCDebugging function to dump GCDebugging data
https://bugs.webkit.org/show_bug.cgi?id=193526
Reviewed by Michael Saboff.
This patch adds generateHeapSnapshotForGCDebugging to JSC shell to dump heap snapshot JSON string with GCDebugging option.
GCDebuggingSnapshot mode is slightly different from InspectorSnapshot in terms of both the output data and the behavior.
It always takes full snapshot, and it reports internal data too. This is useful to view the live heap objects after running
the code. Also, generateHeapSnapshotForGCDebugging returns String instead of parsing it to JSObject internally by calling
JSON.parse. If we convert the String to bunch of objects by using JSON.parse, it is difficult to call generateHeapSnapshotForGCDebugging
multiple times for debugging. Currently, it only generates a large string, which is easily distinguishable in the heap inspector tool.
* jsc.cpp:
(GlobalObject::finishCreation):
(functionGenerateHeapSnapshotForGCDebugging):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (240112 => 240113)
--- trunk/Source/_javascript_Core/ChangeLog 2019-01-17 16:36:31 UTC (rev 240112)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-01-17 17:32:38 UTC (rev 240113)
@@ -1,5 +1,23 @@
2019-01-17 Yusuke Suzuki <[email protected]>
+ [JSC] Add generateHeapSnapshotForGCDebugging function to dump GCDebugging data
+ https://bugs.webkit.org/show_bug.cgi?id=193526
+
+ Reviewed by Michael Saboff.
+
+ This patch adds generateHeapSnapshotForGCDebugging to JSC shell to dump heap snapshot JSON string with GCDebugging option.
+ GCDebuggingSnapshot mode is slightly different from InspectorSnapshot in terms of both the output data and the behavior.
+ It always takes full snapshot, and it reports internal data too. This is useful to view the live heap objects after running
+ the code. Also, generateHeapSnapshotForGCDebugging returns String instead of parsing it to JSObject internally by calling
+ JSON.parse. If we convert the String to bunch of objects by using JSON.parse, it is difficult to call generateHeapSnapshotForGCDebugging
+ multiple times for debugging. Currently, it only generates a large string, which is easily distinguishable in the heap inspector tool.
+
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionGenerateHeapSnapshotForGCDebugging):
+
+2019-01-17 Yusuke Suzuki <[email protected]>
+
[JSC] ToThis omission in DFGByteCodeParser is wrong
https://bugs.webkit.org/show_bug.cgi?id=193513
<rdar://problem/45842236>
Modified: trunk/Source/_javascript_Core/jsc.cpp (240112 => 240113)
--- trunk/Source/_javascript_Core/jsc.cpp 2019-01-17 16:36:31 UTC (rev 240112)
+++ trunk/Source/_javascript_Core/jsc.cpp 2019-01-17 17:32:38 UTC (rev 240113)
@@ -328,6 +328,7 @@
static EncodedJSValue JSC_HOST_CALL functionCheckModuleSyntax(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionPlatformSupportsSamplingProfiler(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionGenerateHeapSnapshot(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionGenerateHeapSnapshotForGCDebugging(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionResetSuperSamplerState(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionEnsureArrayStorage(ExecState*);
#if ENABLE(SAMPLING_PROFILER)
@@ -562,6 +563,7 @@
addFunction(vm, "platformSupportsSamplingProfiler", functionPlatformSupportsSamplingProfiler, 0);
addFunction(vm, "generateHeapSnapshot", functionGenerateHeapSnapshot, 0);
+ addFunction(vm, "generateHeapSnapshotForGCDebugging", functionGenerateHeapSnapshotForGCDebugging, 0);
addFunction(vm, "resetSuperSamplerState", functionResetSuperSamplerState, 0);
addFunction(vm, "ensureArrayStorage", functionEnsureArrayStorage, 0);
#if ENABLE(SAMPLING_PROFILER)
@@ -2119,6 +2121,24 @@
return result;
}
+EncodedJSValue JSC_HOST_CALL functionGenerateHeapSnapshotForGCDebugging(ExecState* exec)
+{
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ String jsonString;
+ {
+ DeferGCForAWhile deferGC(vm.heap); // Prevent concurrent GC from interfering with the full GC that the snapshot does.
+
+ HeapSnapshotBuilder snapshotBuilder(vm.ensureHeapProfiler(), HeapSnapshotBuilder::SnapshotType::GCDebuggingSnapshot);
+ snapshotBuilder.buildSnapshot();
+
+ jsonString = snapshotBuilder.json();
+ }
+ scope.releaseAssertNoException();
+ return JSValue::encode(jsString(&vm, jsonString));
+}
+
EncodedJSValue JSC_HOST_CALL functionResetSuperSamplerState(ExecState*)
{
resetSuperSamplerState();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes