Bug 1570259 part 1 - Document and clean up JitContext constructors. r=luke

The next patch will simplify the constructor code a bit more.

Differential Revision: https://phabricator.services.mozilla.com/D41377

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-08-09 15:26:03 +00:00
parent ec806131cb
commit 883264b018
2 changed files with 20 additions and 3 deletions

View File

@ -100,7 +100,7 @@ JitContext::JitContext(CompileRuntime* rt, CompileRealm* realm,
prev_(CurrentJitContext()),
realm_(realm),
#ifdef DEBUG
isCompilingWasm_(!realm),
isCompilingWasm_(false),
oom_(false),
#endif
assemblerCount_(0) {
@ -122,9 +122,20 @@ JitContext::JitContext(JSContext* cx, TempAllocator* temp)
}
JitContext::JitContext(TempAllocator* temp)
: JitContext(nullptr, nullptr, temp) {}
: cx(nullptr),
temp(temp),
runtime(nullptr),
prev_(CurrentJitContext()),
realm_(nullptr),
#ifdef DEBUG
isCompilingWasm_(true),
oom_(false),
#endif
assemblerCount_(0) {
SetJitContext(this);
}
JitContext::JitContext() : JitContext(nullptr, nullptr, nullptr) {}
JitContext::JitContext() : JitContext(nullptr) {}
JitContext::~JitContext() { SetJitContext(prev_); }

View File

@ -54,10 +54,16 @@ static_assert(sizeof(AbortReasonOr<bool>) <= sizeof(uintptr_t),
class JitContext {
public:
// Constructor for compilations happening on the main thread.
JitContext(JSContext* cx, TempAllocator* temp);
// Constructor for off-thread Ion compilations.
JitContext(CompileRuntime* rt, CompileRealm* realm, TempAllocator* temp);
// Constructors for Wasm compilation.
explicit JitContext(TempAllocator* temp);
JitContext();
~JitContext();
// Running context when executing on the main thread. Not available during