WebKit Bugzilla
Attachment 359346 Details for
Bug 193526
: [JSC] Add generateHeapSnapshotForGCDebugging function to dump GCDebugging data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193526-20190116204617.patch (text/plain), 3.84 KB, created by
Yusuke Suzuki
on 2019-01-16 20:46:18 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-01-16 20:46:18 PST
Size:
3.84 KB
patch
obsolete
>Subversion Revision: 240102 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 347fa49aa02a81b56932835e99c3d950d849432b..fa24d60721e8d00a63338ff1300101055c59c684 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,21 @@ >+2019-01-16 Yusuke Suzuki <yusukesuzuki@slowstart.org> >+ >+ [JSC] Add generateHeapSnapshotForGCDebugging function to dump GCDebugging data >+ https://bugs.webkit.org/show_bug.cgi?id=193526 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-16 Mark Lam <mark.lam@apple.com> > > Refactor new bytecode structs so that the fields are prefixed with "m_". >diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp >index b46730785da199c2e20f5a0dbc5df6324112360f..b5d47dd3db9ad8ba6f845bb32114fb0daf8d8f65 100644 >--- a/Source/JavaScriptCore/jsc.cpp >+++ b/Source/JavaScriptCore/jsc.cpp >@@ -328,6 +328,7 @@ static EncodedJSValue JSC_HOST_CALL functionIs32BitPlatform(ExecState*); > 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 @@ class GlobalObject : public JSGlobalObject { > > 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 @@ EncodedJSValue JSC_HOST_CALL functionGenerateHeapSnapshot(ExecState* exec) > 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();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193526
: 359346