Skip to content

Commit 48c752d

Browse files
committed
Unreviewed, Revert 287449@main
https://bugs.webkit.org/show_bug.cgi?id=284271 rdar://problem/141135443 Broke JSC sampling profilers. Canonical link: https://commits.webkit.org/287539@main
1 parent 2866cb2 commit 48c752d

65 files changed

Lines changed: 126 additions & 164 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/JSContextRef.cpp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,15 @@ JSStringRef JSContextGroupTakeSamplesFromSamplingProfiler(JSContextGroupRef grou
508508
JSLockHolder locker(&vm);
509509

510510
#if ENABLE(SAMPLING_PROFILER)
511-
auto samples = vm.takeSamplingProfilerSamplesAsJSONString();
512-
if (samples.isNull())
511+
auto json = vm.takeSamplingProfilerSamplesAsJSON();
512+
if (UNLIKELY(!json))
513513
return nullptr;
514514

515-
return OpaqueJSString::tryCreate(WTFMove(samples)).leakRef();
515+
auto jsonData = json->toJSONString();
516+
if (UNLIKELY(jsonData.isNull()))
517+
return nullptr;
518+
519+
return OpaqueJSString::tryCreate(WTFMove(jsonData)).leakRef();
516520
#else
517521
return nullptr;
518522
#endif

‎Source/JavaScriptCore/heap/IsoAlignedMemoryAllocator.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "IsoAlignedMemoryAllocator.h"
2828

2929
#include "MarkedBlock.h"
30-
#include <wtf/text/CString.h>
3130

3231
#if ENABLE(MALLOC_HEAP_BREAKDOWN)
3332
#include <wtf/text/MakeString.h>

‎Source/JavaScriptCore/inspector/ConsoleMessage.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232

3333
#include "ConsoleTypes.h"
3434
#include "Strong.h"
35+
#include <wtf/Forward.h>
3536
#include <wtf/Logger.h>
3637
#include <wtf/Noncopyable.h>
3738
#include <wtf/TZoneMalloc.h>
38-
#include <wtf/WallTime.h>
3939
#include <wtf/text/WTFString.h>
4040

4141
namespace JSC {

‎Source/JavaScriptCore/inspector/ScriptFunctionCall.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@
3232
#pragma once
3333

3434
#include "ArgList.h"
35+
#include "Exception.h"
3536
#include "JSCJSValue.h"
3637
#include "JSCJSValueInlines.h"
3738
#include "JSObject.h"
3839
#include "Strong.h"
3940
#include "StrongInlines.h"
4041
#include <wtf/Expected.h>
42+
#include <wtf/JSONValues.h>
4143
#include <wtf/text/WTFString.h>
4244

4345
namespace JSC {

‎Source/JavaScriptCore/jsc.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3227,7 +3227,9 @@ JSC_DEFINE_HOST_FUNCTION(functionSamplingProfilerStackTraces, (JSGlobalObject* g
32273227
if (!vm.samplingProfiler())
32283228
return JSValue::encode(throwException(globalObject, scope, createError(globalObject, "Sampling profiler was never started"_s)));
32293229

3230-
EncodedJSValue result = JSValue::encode(JSONParse(globalObject, vm.samplingProfiler()->stackTracesAsJSONString()));
3230+
auto json = vm.samplingProfiler()->stackTracesAsJSON();
3231+
auto jsonString = json->toJSONString();
3232+
EncodedJSValue result = JSValue::encode(JSONParse(globalObject, WTFMove(jsonString)));
32313233
scope.releaseAssertNoException();
32323234
return result;
32333235
}

‎Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
#include "ProfilerBytecode.h"
2929
#include <wtf/Vector.h>
30+
#include <wtf/text/CString.h>
31+
#include <wtf/text/WTFString.h>
3032

3133
namespace JSC {
3234

‎Source/JavaScriptCore/profiler/ProfilerBytecodes.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "CodeBlockHash.h"
2929
#include "JSCJSValue.h"
3030
#include "ProfilerBytecodeSequence.h"
31-
#include <wtf/JSONValues.h>
31+
#include <wtf/PrintStream.h>
3232
#include <wtf/text/WTFString.h>
3333

3434
namespace JSC { namespace Profiler {

‎Source/JavaScriptCore/profiler/ProfilerEvent.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "ProfilerBytecodes.h"
3232
#include "ProfilerCompilation.h"
3333
#include "ProfilerDumper.h"
34+
#include "ProfilerUID.h"
3435

3536
namespace JSC { namespace Profiler {
3637

‎Source/JavaScriptCore/profiler/ProfilerEvent.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#pragma once
2727

2828
#include "JSCJSValue.h"
29-
#include <wtf/JSONValues.h>
29+
#include <wtf/PrintStream.h>
3030
#include <wtf/WallTime.h>
3131
#include <wtf/text/CString.h>
3232

‎Source/JavaScriptCore/profiler/ProfilerOSRExit.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#pragma once
2727

2828
#include "ExitKind.h"
29+
#include "JSCJSValue.h"
2930
#include "ProfilerOriginStack.h"
3031

3132
namespace JSC { namespace Profiler {

0 commit comments

Comments
 (0)