Bug 1570259 part 2 - Group JitContext fields and use new initializer syntax. r=luke

Depends on D41377

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-08-09 15:26:35 +00:00
Родитель 883264b018
Коммит 93adc5cc85
2 изменённых файлов: 30 добавлений и 47 удалений

Просмотреть файл

@ -94,44 +94,27 @@ JitContext* jit::MaybeGetJitContext() { return CurrentJitContext(); }
JitContext::JitContext(CompileRuntime* rt, CompileRealm* realm,
TempAllocator* temp)
: cx(nullptr),
temp(temp),
runtime(rt),
prev_(CurrentJitContext()),
realm_(realm),
#ifdef DEBUG
isCompilingWasm_(false),
oom_(false),
#endif
assemblerCount_(0) {
: prev_(CurrentJitContext()), realm_(realm), temp(temp), runtime(rt) {
MOZ_ASSERT(rt);
MOZ_ASSERT(realm);
MOZ_ASSERT(temp);
SetJitContext(this);
}
JitContext::JitContext(JSContext* cx, TempAllocator* temp)
: cx(cx),
temp(temp),
runtime(CompileRuntime::get(cx->runtime())),
prev_(CurrentJitContext()),
: prev_(CurrentJitContext()),
realm_(CompileRealm::get(cx->realm())),
#ifdef DEBUG
isCompilingWasm_(false),
oom_(false),
#endif
assemblerCount_(0) {
cx(cx),
temp(temp),
runtime(CompileRuntime::get(cx->runtime())) {
SetJitContext(this);
}
JitContext::JitContext(TempAllocator* temp)
: cx(nullptr),
temp(temp),
runtime(nullptr),
prev_(CurrentJitContext()),
realm_(nullptr),
: prev_(CurrentJitContext()), temp(temp) {
#ifdef DEBUG
isCompilingWasm_(true),
oom_(false),
isCompilingWasm_ = true;
#endif
assemblerCount_(0) {
SetJitContext(this);
}

Просмотреть файл

@ -53,7 +53,27 @@ static_assert(sizeof(AbortReasonOr<bool>) <= sizeof(uintptr_t),
// will not be nullptr.
class JitContext {
JitContext* prev_ = nullptr;
CompileRealm* realm_ = nullptr;
int assemblerCount_ = 0;
#ifdef DEBUG
bool isCompilingWasm_ = false;
bool oom_ = false;
#endif
public:
// Running context when executing on the main thread. Not available during
// compilation.
JSContext* cx = nullptr;
// Allocator for temporary memory during compilation.
TempAllocator* temp = nullptr;
// Wrappers with information about the current runtime/realm for use
// during compilation.
CompileRuntime* runtime = nullptr;
// Constructor for compilations happening on the main thread.
JitContext(JSContext* cx, TempAllocator* temp);
@ -66,17 +86,6 @@ class JitContext {
~JitContext();
// Running context when executing on the main thread. Not available during
// compilation.
JSContext* cx;
// Allocator for temporary memory during compilation.
TempAllocator* temp;
// Wrappers with information about the current runtime/realm for use
// during compilation.
CompileRuntime* runtime;
int getNextAssemblerId() { return assemblerCount_++; }
CompileRealm* maybeRealm() const { return realm_; }
@ -90,15 +99,6 @@ class JitContext {
bool hasOOM() { return oom_; }
void setOOM() { oom_ = true; }
#endif
private:
JitContext* prev_;
CompileRealm* realm_;
#ifdef DEBUG
bool isCompilingWasm_;
bool oom_;
#endif
int assemblerCount_;
};
// Process-wide initialization of JIT data structures.