Bug 1633527 - Use field initializers in JitRuntime. r=iain

This also makes sure `disambiguationId_` is properly initialized.

Differential Revision: https://phabricator.services.mozilla.com/D72735
This commit is contained in:
Ted Campbell 2020-04-27 21:30:26 +00:00
Родитель f357380d86
Коммит 93f86eedd0
2 изменённых файлов: 27 добавлений и 51 удалений

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

@ -80,30 +80,6 @@ using mozilla::DebugOnly;
using namespace js;
using namespace js::jit;
JitRuntime::JitRuntime()
: nextCompilationId_(0),
exceptionTailOffset_(0),
bailoutTailOffset_(0),
profilerExitFrameTailOffset_(0),
enterJITOffset_(0),
bailoutHandlerOffset_(0),
argumentsRectifierOffset_(0),
argumentsRectifierReturnOffset_(0),
invalidatorOffset_(0),
lazyLinkStubOffset_(0),
interpreterStubOffset_(0),
doubleToInt32ValueStubOffset_(0),
debugTrapHandlers_(),
baselineInterpreter_(),
trampolineCode_(nullptr),
jitcodeGlobalTable_(nullptr),
#ifdef DEBUG
ionBailAfter_(0),
#endif
numFinishedOffThreadTasks_(0),
ionLazyLinkListSize_(0) {
}
JitRuntime::~JitRuntime() {
MOZ_ASSERT(numFinishedOffThreadTasks_ == 0);
MOZ_ASSERT(ionLazyLinkListSize_ == 0);

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

@ -129,24 +129,24 @@ class JitRuntime {
private:
friend class JitRealm;
MainThreadData<uint64_t> nextCompilationId_;
MainThreadData<uint64_t> nextCompilationId_{0};
// Buffer for OSR from baseline to Ion. To avoid holding on to this for too
// long it's also freed in EnterBaseline and EnterJit (after returning from
// JIT code).
MainThreadData<js::UniquePtr<uint8_t>> ionOsrTempData_;
MainThreadData<js::UniquePtr<uint8_t>> ionOsrTempData_{nullptr};
// Shared exception-handler tail.
WriteOnceData<uint32_t> exceptionTailOffset_;
WriteOnceData<uint32_t> exceptionTailOffset_{0};
// Shared post-bailout-handler tail.
WriteOnceData<uint32_t> bailoutTailOffset_;
WriteOnceData<uint32_t> bailoutTailOffset_{0};
// Shared profiler exit frame tail.
WriteOnceData<uint32_t> profilerExitFrameTailOffset_;
WriteOnceData<uint32_t> profilerExitFrameTailOffset_{0};
// Trampoline for entering JIT code.
WriteOnceData<uint32_t> enterJITOffset_;
WriteOnceData<uint32_t> enterJITOffset_{0};
// Vector mapping frame class sizes to bailout tables.
struct BailoutTable {
@ -159,35 +159,35 @@ class JitRuntime {
WriteOnceData<BailoutTableVector> bailoutTables_;
// Generic bailout table; used if the bailout table overflows.
WriteOnceData<uint32_t> bailoutHandlerOffset_;
WriteOnceData<uint32_t> bailoutHandlerOffset_{0};
// Argument-rectifying thunk, in the case of insufficient arguments passed
// to a function call site.
WriteOnceData<uint32_t> argumentsRectifierOffset_;
WriteOnceData<uint32_t> argumentsRectifierReturnOffset_;
WriteOnceData<uint32_t> argumentsRectifierOffset_{0};
WriteOnceData<uint32_t> argumentsRectifierReturnOffset_{0};
// Thunk that invalides an (Ion compiled) caller on the Ion stack.
WriteOnceData<uint32_t> invalidatorOffset_;
WriteOnceData<uint32_t> invalidatorOffset_{0};
// Thunk that calls the GC pre barrier.
WriteOnceData<uint32_t> valuePreBarrierOffset_;
WriteOnceData<uint32_t> stringPreBarrierOffset_;
WriteOnceData<uint32_t> objectPreBarrierOffset_;
WriteOnceData<uint32_t> shapePreBarrierOffset_;
WriteOnceData<uint32_t> objectGroupPreBarrierOffset_;
WriteOnceData<uint32_t> valuePreBarrierOffset_{0};
WriteOnceData<uint32_t> stringPreBarrierOffset_{0};
WriteOnceData<uint32_t> objectPreBarrierOffset_{0};
WriteOnceData<uint32_t> shapePreBarrierOffset_{0};
WriteOnceData<uint32_t> objectGroupPreBarrierOffset_{0};
// Thunk to call malloc/free.
WriteOnceData<uint32_t> freeStubOffset_;
WriteOnceData<uint32_t> freeStubOffset_{0};
// Thunk called to finish compilation of an IonScript.
WriteOnceData<uint32_t> lazyLinkStubOffset_;
WriteOnceData<uint32_t> lazyLinkStubOffset_{0};
// Thunk to enter the interpreter from JIT code.
WriteOnceData<uint32_t> interpreterStubOffset_;
WriteOnceData<uint32_t> interpreterStubOffset_{0};
// Thunk to convert the value in R0 to int32 if it's a double.
// Note: this stub treats -0 as +0 and may clobber R1.scratchReg().
WriteOnceData<uint32_t> doubleToInt32ValueStubOffset_;
WriteOnceData<uint32_t> doubleToInt32ValueStubOffset_{0};
// Thunk used by the debugger for breakpoint and step mode.
mozilla::EnumeratedArray<DebugTrapHandlerKind, DebugTrapHandlerKind::Count,
@ -198,12 +198,12 @@ class JitRuntime {
BaselineInterpreter baselineInterpreter_;
// Code for trampolines and VMFunction wrappers.
WriteOnceData<JitCode*> trampolineCode_;
WriteOnceData<JitCode*> trampolineCode_{nullptr};
// Map VMFunction addresses to the offset of the wrapper in
// trampolineCode_.
using VMWrapperMap = HashMap<const VMFunction*, uint32_t, VMFunction>;
WriteOnceData<VMWrapperMap*> functionWrappers_;
WriteOnceData<VMWrapperMap*> functionWrappers_{nullptr};
// Maps VMFunctionId to the offset of the wrapper code in trampolineCode_.
using VMWrapperOffsets = Vector<uint32_t, 0, SystemAllocPolicy>;
@ -216,12 +216,12 @@ class JitRuntime {
MainThreadData<BaselineICFallbackCode> baselineICFallbackCode_;
// Global table of jitcode native address => bytecode address mappings.
UnprotectedData<JitcodeGlobalTable*> jitcodeGlobalTable_;
UnprotectedData<JitcodeGlobalTable*> jitcodeGlobalTable_{nullptr};
#ifdef DEBUG
// The number of possible bailing places encounters before forcefully bailing
// in that place. Zero means inactive.
MainThreadData<uint32_t> ionBailAfter_;
MainThreadData<uint32_t> ionBailAfter_{false};
#endif
// Number of Ion compilations which were finished off thread and are
@ -229,15 +229,15 @@ class JitRuntime {
// thread state lock, but may be read from at other times.
typedef mozilla::Atomic<size_t, mozilla::SequentiallyConsistent>
NumFinishedOffThreadTasksType;
NumFinishedOffThreadTasksType numFinishedOffThreadTasks_;
NumFinishedOffThreadTasksType numFinishedOffThreadTasks_{0};
// List of Ion compilation waiting to get linked.
using IonCompileTaskList = mozilla::LinkedList<js::jit::IonCompileTask>;
MainThreadData<IonCompileTaskList> ionLazyLinkList_;
MainThreadData<size_t> ionLazyLinkListSize_;
MainThreadData<size_t> ionLazyLinkListSize_{0};
// Counter used to help dismbiguate stubs in CacheIR
MainThreadData<uint64_t> disambiguationId_;
MainThreadData<uint64_t> disambiguationId_{0};
#ifdef DEBUG
// Flag that can be set from JIT code to indicate it's invalid to call
@ -295,7 +295,7 @@ class JitRuntime {
}
public:
JitRuntime();
JitRuntime() = default;
~JitRuntime();
MOZ_MUST_USE bool initialize(JSContext* cx);