Skip to content

Commit f132a4a

Browse files
OSR entry: delay outer-loop compilation when at inner-loop
https://bugs.webkit.org/show_bug.cgi?id=167149 Reviewed by Filip Pizlo. JSTests: Try to be mean to OSR entry by using nested loops, and having non-int32 types or truly varying types. Mandelbrot currently never tiers up to FTL because it exits too many times before this. That shouldn't happen because it's just numbers and int32s. I'll file a bug to fix this. * microbenchmarks/mandelbrot.js: Added. (mandelbrot): (printable): * microbenchmarks/nonude.js: Added. (Array.prototype.remove): (const.u): (const.load): (const.scan): (const.main): Source/JavaScriptCore: As of https://bugs.webkit.org/show_bug.cgi?id=155217 OSR compilation can be kicked off for an entry into an outer-loop, while executing an inner-loop. This is desirable because often the codegen from an inner-entry isn't as good as the codegen from an outer-entry, but execution from an inner-loop is often pretty hot and likely to kick off compilation. This approach provided nice speedups on Kraken because we'd select to enter to the outer-loop very reliably, which reduces variability (the inner-loop was selected roughly 1/5 times from my unscientific measurements). When compilation starts we take a snapshot of the JSValues at the current execution state using OSR's recovery mechanism. These values are passed to the compiler and are used as way to perform type profiling, and could be used to observe cell types as well as to perform predictions such as through constant propagation. It's therefore desired to enter from the outer-loop when we can, but we need to be executing from that location to capture the right JSValues, otherwise we're confusing the compiler and giving it inaccurate JSValues which can lead it to predict the wrong things, leading to suboptimal code or recompilation due to misprediction, or in super-corner-cases a crash. These effects are pretty hard to measure: Fil points out that marsalis-osr-entry really needs mustHandleValues (the JSValues from the point of execution) because right now it just happens to correctly guess int32. I tried removing mustHandleValues entirely and saw no slowdowns, but our benchmarks probably aren't sufficient to reliably find issues, sometimes because we happen to have sufficient mitigations. DFG tier-up was added here: https://bugs.webkit.org/show_bug.cgi?id=112838 * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGJITCode.h: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::JITCompiler): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSREntry.h: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGTierUpEntryTrigger.h: Copied from Source/JavaScriptCore/ftl/FTLOSREntry.h. * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp: (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback): (JSC::DFG::Ref<ToFTLForOSREntryDeferredCompilationCallback>ToFTLForOSREntryDeferredCompilationCallback::create): (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously): (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete): * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h: * ftl/FTLOSREntry.cpp: (JSC::FTL::prepareOSREntry): * ftl/FTLOSREntry.h: * jit/JITOperations.cpp: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@211224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent a878db3 commit f132a4a

18 files changed

+613
-81
lines changed

JSTests/ChangeLog

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2017-01-26 JF Bastien <[email protected]>
2+
3+
OSR entry: delay outer-loop compilation when at inner-loop
4+
https://bugs.webkit.org/show_bug.cgi?id=167149
5+
6+
Reviewed by Filip Pizlo.
7+
8+
Try to be mean to OSR entry by using nested loops, and having
9+
non-int32 types or truly varying types.
10+
11+
Mandelbrot currently never tiers up to FTL because it exits too
12+
many times before this. That shouldn't happen because it's just
13+
numbers and int32s. I'll file a bug to fix this.
14+
15+
* microbenchmarks/mandelbrot.js: Added.
16+
(mandelbrot):
17+
(printable):
18+
* microbenchmarks/nonude.js: Added.
19+
(Array.prototype.remove):
20+
(const.u):
21+
(const.load):
22+
(const.scan):
23+
(const.main):
24+
125
2017-01-25 Saam Barati <[email protected]>
226

327
WebAssembly JS API: coerce return values from imports

JSTests/microbenchmarks/mandelbrot.js

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
const max_s = 255;
2+
const hysterisis = 3;
3+
4+
function mandelbrot(x, y, w, h, scene_i, scene_z, X, Y, iterations) {
5+
const max_z = 2.0;
6+
7+
for (let i = X; i; --i)
8+
for (let j = Y; j; --j) {
9+
let real = x + (i - 1) / (1.0 * (X - 1) * w);
10+
let imag = y + (j - 1) / (1.0 * (Y - 1) * h);
11+
let z_real = 0.0;
12+
let z_imag = 0.0;
13+
14+
let it = iterations;
15+
while (--it && Math.sqrt(z_real**2 + z_imag**2) < max_z) {
16+
const next_real = z_real**2 - z_imag**2 + real;
17+
const next_imag = 2 * (z_real * z_imag) + imag;
18+
z_real = next_real;
19+
z_imag = next_imag;
20+
}
21+
22+
const idx = (j - 1) * X + (i - 1);
23+
const new_i = max_s * it / (1.0 * iterations);
24+
scene_i[idx] = ((scene_i[idx] + new_i * hysterisis) / (hysterisis + 1)) | 0;
25+
const new_z = max_s * Math.min(max_z, Math.sqrt(z_real**2 + z_imag**2)) / max_z;
26+
scene_z[idx] = ((scene_z[idx] + new_z * hysterisis) / (hysterisis + 1)) | 0;
27+
}
28+
}
29+
30+
const shades = ['█', '▉', '▊', '▋', '▌', '▍', '▎', '▏', '▓', '▒', '░'];
31+
const shade = i => shades[Math.round((i * (shades.length - 1)) / max_s)];
32+
33+
function printable(scene_i, scene_z, X, Y) {
34+
let s = "";
35+
for (let i = 0; i < X; ++i) {
36+
for (let j = 0; j < Y; ++j) {
37+
const idx = j * X + i;
38+
s += shade((scene_i[idx] + scene_z[idx]) / 2);
39+
if (j == Y - 1)
40+
s += '\n';
41+
}
42+
}
43+
return s;
44+
}
45+
46+
const width = 80, height = 80;
47+
let scene_i = Array.of(width * height).fill(0);
48+
let scene_z = Array.of(width * height).fill(0);
49+
50+
for (let i = 1; i < 64; ++i) {
51+
mandelbrot(-0.5, -0.5, 0.5, 0.5, scene_i, scene_z, width, height, i);
52+
}
53+
54+
const result = printable(scene_i, scene_z, width, height);
55+
56+
let seen = false;
57+
for (let i = 0; i < result.length; ++i)
58+
if (result[i] === shades[0])
59+
seen = true;
60+
61+
if (!seen)
62+
throw new Error(`Unexpected mandelbrot:\n${result}`);

JSTests/microbenchmarks/nonude.js

+136
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/JavaScriptCore/ChangeLog

+65
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
2017-01-26 JF Bastien <[email protected]>
2+
3+
OSR entry: delay outer-loop compilation when at inner-loop
4+
https://bugs.webkit.org/show_bug.cgi?id=167149
5+
6+
Reviewed by Filip Pizlo.
7+
8+
As of https://bugs.webkit.org/show_bug.cgi?id=155217 OSR
9+
compilation can be kicked off for an entry into an outer-loop,
10+
while executing an inner-loop. This is desirable because often the
11+
codegen from an inner-entry isn't as good as the codegen from an
12+
outer-entry, but execution from an inner-loop is often pretty hot
13+
and likely to kick off compilation. This approach provided nice
14+
speedups on Kraken because we'd select to enter to the outer-loop
15+
very reliably, which reduces variability (the inner-loop was
16+
selected roughly 1/5 times from my unscientific measurements).
17+
18+
When compilation starts we take a snapshot of the JSValues at the
19+
current execution state using OSR's recovery mechanism. These
20+
values are passed to the compiler and are used as way to perform
21+
type profiling, and could be used to observe cell types as well as
22+
to perform predictions such as through constant propagation.
23+
24+
It's therefore desired to enter from the outer-loop when we can,
25+
but we need to be executing from that location to capture the
26+
right JSValues, otherwise we're confusing the compiler and giving
27+
it inaccurate JSValues which can lead it to predict the wrong
28+
things, leading to suboptimal code or recompilation due to
29+
misprediction, or in super-corner-cases a crash.
30+
31+
These effects are pretty hard to measure: Fil points out that
32+
marsalis-osr-entry really needs mustHandleValues (the JSValues
33+
from the point of execution) because right now it just happens to
34+
correctly guess int32. I tried removing mustHandleValues entirely
35+
and saw no slowdowns, but our benchmarks probably aren't
36+
sufficient to reliably find issues, sometimes because we happen to
37+
have sufficient mitigations.
38+
39+
DFG tier-up was added here:
40+
https://bugs.webkit.org/show_bug.cgi?id=112838
41+
42+
* JavaScriptCore.xcodeproj/project.pbxproj:
43+
* dfg/DFGJITCode.h:
44+
* dfg/DFGJITCompiler.cpp:
45+
(JSC::DFG::JITCompiler::JITCompiler):
46+
* dfg/DFGOSREntry.cpp:
47+
(JSC::DFG::prepareOSREntry):
48+
* dfg/DFGOSREntry.h:
49+
(JSC::DFG::prepareOSREntry):
50+
* dfg/DFGOperations.cpp:
51+
* dfg/DFGOperations.h:
52+
* dfg/DFGSpeculativeJIT64.cpp:
53+
(JSC::DFG::SpeculativeJIT::compile):
54+
* dfg/DFGTierUpEntryTrigger.h: Copied from Source/JavaScriptCore/ftl/FTLOSREntry.h.
55+
* dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp:
56+
(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback):
57+
(JSC::DFG::Ref<ToFTLForOSREntryDeferredCompilationCallback>ToFTLForOSREntryDeferredCompilationCallback::create):
58+
(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously):
59+
(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete):
60+
* dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h:
61+
* ftl/FTLOSREntry.cpp:
62+
(JSC::FTL::prepareOSREntry):
63+
* ftl/FTLOSREntry.h:
64+
* jit/JITOperations.cpp:
65+
166
2017-01-25 Saam Barati <[email protected]>
267

368
WebAssembly JS API: coerce return values from imports

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,7 @@
20592059
ADE8029B1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADE802961E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.cpp */; };
20602060
ADE8029C1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = ADE802971E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
20612061
ADE8029E1E08F2280058DE78 /* WebAssemblyLinkErrorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADE8029D1E08F2260058DE78 /* WebAssemblyLinkErrorConstructor.cpp */; };
2062+
ADFF2F701E319DE3001EA54E /* DFGTierUpEntryTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = ADFF2F6F1E319DD0001EA54E /* DFGTierUpEntryTrigger.h */; };
20622063
B59F89391891F29F00D5CCDC /* UnlinkedInstructionStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */; };
20632064
BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
20642065
BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4571,6 +4572,7 @@
45714572
ADE802961E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyLinkErrorPrototype.cpp; path = js/WebAssemblyLinkErrorPrototype.cpp; sourceTree = "<group>"; };
45724573
ADE802971E08F1C90058DE78 /* WebAssemblyLinkErrorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyLinkErrorPrototype.h; path = js/WebAssemblyLinkErrorPrototype.h; sourceTree = "<group>"; };
45734574
ADE8029D1E08F2260058DE78 /* WebAssemblyLinkErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyLinkErrorConstructor.cpp; path = js/WebAssemblyLinkErrorConstructor.cpp; sourceTree = "<group>"; };
4575+
ADFF2F6F1E319DD0001EA54E /* DFGTierUpEntryTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGTierUpEntryTrigger.h; path = dfg/DFGTierUpEntryTrigger.h; sourceTree = "<group>"; };
45744576
B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedInstructionStream.h; sourceTree = "<group>"; };
45754577
B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkedInstructionStream.cpp; sourceTree = "<group>"; };
45764578
BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ToolExecutable.xcconfig; sourceTree = "<group>"; };
@@ -7129,6 +7131,7 @@
71297131
0FC097A0146B28C700CF2442 /* DFGThunks.h */,
71307132
0FD8A31F17D51F5700CA2C40 /* DFGTierUpCheckInjectionPhase.cpp */,
71317133
0FD8A32017D51F5700CA2C40 /* DFGTierUpCheckInjectionPhase.h */,
7134+
ADFF2F6F1E319DD0001EA54E /* DFGTierUpEntryTrigger.h */,
71327135
0FD8A32117D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.cpp */,
71337136
0FD8A32217D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.h */,
71347137
0FD8A32317D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.cpp */,
@@ -8811,6 +8814,7 @@
88118814
86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */,
88128815
A1A009C01831A22D00CF8711 /* MacroAssemblerARM64.h in Headers */,
88138816
86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */,
8817+
ADFF2F701E319DE3001EA54E /* DFGTierUpEntryTrigger.h in Headers */,
88148818
863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */,
88158819
E32AB2441DCD75F400D7533A /* MacroAssemblerHelpers.h in Headers */,
88168820
86C568E111A213EE0007F7F0 /* MacroAssemblerMIPS.h in Headers */,

Source/JavaScriptCore/dfg/DFGJITCode.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "DFGMinifiedGraph.h"
3434
#include "DFGOSREntry.h"
3535
#include "DFGOSRExit.h"
36+
#include "DFGTierUpEntryTrigger.h"
3637
#include "DFGVariableEventStream.h"
3738
#include "ExecutionCounter.h"
3839
#include "JITCode.h"
@@ -154,7 +155,7 @@ class JITCode : public DirectJITCode {
154155
// Map each bytecode of CheckTierUpAndOSREnter to its trigger forcing OSR Entry.
155156
// This can never be modified after it has been initialized since the addresses of the triggers
156157
// are used by the JIT.
157-
HashMap<unsigned, uint8_t> tierUpEntryTriggers;
158+
HashMap<unsigned, TierUpEntryTrigger> tierUpEntryTriggers;
158159

159160
// Set of bytecode that were the target of a TierUp operation.
160161
HashSet<unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> tierUpEntrySeen;

Source/JavaScriptCore/dfg/DFGJITCompiler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ JITCompiler::JITCompiler(Graph& dfg)
6060
#if ENABLE(FTL_JIT)
6161
m_jitCode->tierUpInLoopHierarchy = WTFMove(m_graph.m_plan.tierUpInLoopHierarchy);
6262
for (unsigned tierUpBytecode : m_graph.m_plan.tierUpAndOSREnterBytecodes)
63-
m_jitCode->tierUpEntryTriggers.add(tierUpBytecode, 0);
63+
m_jitCode->tierUpEntryTriggers.add(tierUpBytecode, TierUpEntryTrigger::None);
6464
#endif
6565
}
6666

Source/JavaScriptCore/dfg/DFGOSREntry.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ void OSREntryData::dump(PrintStream& out) const
9191
}
9292

9393
SUPPRESS_ASAN
94-
void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIndex)
94+
Expected<void*, OSREntryFail> prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIndex)
9595
{
9696
ASSERT(JITCode::isOptimizingJIT(codeBlock->jitType()));
9797
ASSERT(codeBlock->alternative());
9898
ASSERT(codeBlock->alternative()->jitType() == JITCode::BaselineJIT);
9999
ASSERT(!codeBlock->jitCodeMap());
100100

101101
if (!Options::useOSREntryToDFG())
102-
return 0;
102+
return makeUnexpected(OSREntryFail::Disabled);
103103

104104
if (Options::verboseOSR()) {
105105
dataLog(
@@ -136,7 +136,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
136136

137137
if (Options::verboseOSR())
138138
dataLog(" OSR failed because the target code block is not DFG.\n");
139-
return 0;
139+
return makeUnexpected(OSREntryFail::TargetNotDFG);
140140
}
141141

142142
JITCode* jitCode = codeBlock->jitCode()->dfg();
@@ -145,7 +145,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
145145
if (!entry) {
146146
if (Options::verboseOSR())
147147
dataLogF(" OSR failed because the entrypoint was optimized out.\n");
148-
return 0;
148+
return makeUnexpected(OSREntryFail::TargetOptimizedOut);
149149
}
150150

151151
ASSERT(entry->m_bytecodeIndex == bytecodeIndex);
@@ -181,7 +181,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
181181
entry->m_expectedValues.argument(argument).dump(WTF::dataFile());
182182
dataLogF(".\n");
183183
}
184-
return 0;
184+
return makeUnexpected(OSREntryFail::BadPrediction);
185185
}
186186

187187
JSValue value;
@@ -196,7 +196,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
196196
" OSR failed because argument ", argument, " is ", value,
197197
", expected ", entry->m_expectedValues.argument(argument), ".\n");
198198
}
199-
return 0;
199+
return makeUnexpected(OSREntryFail::BadPrediction);
200200
}
201201
}
202202

@@ -209,7 +209,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
209209
" OSR failed because variable ", localOffset, " is ",
210210
exec->registers()[localOffset].asanUnsafeJSValue(), ", expected number.\n");
211211
}
212-
return 0;
212+
return makeUnexpected(OSREntryFail::BadPrediction);
213213
}
214214
continue;
215215
}
@@ -221,7 +221,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
221221
exec->registers()[localOffset].asanUnsafeJSValue(), ", expected ",
222222
"machine int.\n");
223223
}
224-
return 0;
224+
return makeUnexpected(OSREntryFail::BadPrediction);
225225
}
226226
continue;
227227
}
@@ -232,7 +232,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
232232
exec->registers()[localOffset].asanUnsafeJSValue(), ", expected ",
233233
entry->m_expectedValues.local(local), ".\n");
234234
}
235-
return 0;
235+
return makeUnexpected(OSREntryFail::BadPrediction);
236236
}
237237
}
238238

@@ -247,7 +247,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
247247
if (UNLIKELY(!vm->ensureStackCapacityFor(&exec->registers()[virtualRegisterForLocal(frameSizeForCheck - 1).offset()]))) {
248248
if (Options::verboseOSR())
249249
dataLogF(" OSR failed because stack growth failed.\n");
250-
return 0;
250+
return makeUnexpected(OSREntryFail::StackGrowthFailed);
251251
}
252252

253253
if (Options::verboseOSR())

Source/JavaScriptCore/dfg/DFGOSREntry.h

+12-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "DFGAbstractValue.h"
2929
#include "Operands.h"
3030
#include <wtf/BitVector.h>
31+
#include <wtf/Expected.h>
3132

3233
namespace JSC {
3334

@@ -36,6 +37,14 @@ class CodeBlock;
3637

3738
namespace DFG {
3839

40+
enum class OSREntryFail {
41+
Disabled,
42+
TargetNotDFG,
43+
TargetOptimizedOut,
44+
BadPrediction,
45+
StackGrowthFailed,
46+
};
47+
3948
#if ENABLE(DFG_JIT)
4049
struct OSREntryReshuffling {
4150
OSREntryReshuffling() { }
@@ -69,11 +78,10 @@ inline unsigned getOSREntryDataBytecodeIndex(OSREntryData* osrEntryData)
6978
return osrEntryData->m_bytecodeIndex;
7079
}
7180

72-
// Returns a pointer to a data buffer that the OSR entry thunk will recognize and
73-
// parse. If this returns null, it means
74-
void* prepareOSREntry(ExecState*, CodeBlock*, unsigned bytecodeIndex);
81+
// Returns a pointer to a data buffer that the OSR entry thunk will recognize and parse.
82+
Expected<void*, OSREntryFail> prepareOSREntry(ExecState*, CodeBlock*, unsigned bytecodeIndex);
7583
#else
76-
inline void* prepareOSREntry(ExecState*, CodeBlock*, unsigned) { return 0; }
84+
inline Expected<void*, OSREntryFail> prepareOSREntry(ExecState*, CodeBlock*, unsigned) { return makeUnexpected(OSREntryFail::Disabled); }
7785
#endif
7886

7987
} } // namespace JSC::DFG

0 commit comments

Comments
 (0)