зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1284056 - Baldr: rename CompileArgs to UseSignal (r=bbouvier)
MozReview-Commit-ID: 8H6jCv8QfCw --HG-- extra : rebase_source : c49a9de4bc4be5897d1e3aa4ca0554ddb55bf736
This commit is contained in:
Родитель
73ec0ca7ec
Коммит
0c68d72e21
|
@ -7795,15 +7795,9 @@ CheckBuffer(JSContext* cx, const AsmJSMetadata& metadata, HandleValue bufferVal,
|
|||
return LinkFail(cx, msg.get());
|
||||
}
|
||||
|
||||
// Shell builtins may have disabled signal handlers since the module we're
|
||||
// cloning was compiled. LookupAsmJSModuleInCache checks for signal handlers
|
||||
// as well for the caching case.
|
||||
if (metadata.compileArgs != CompileArgs(cx))
|
||||
return LinkFail(cx, "Signals have been toggled since compilation");
|
||||
|
||||
if (buffer->is<ArrayBufferObject>()) {
|
||||
Rooted<ArrayBufferObject*> abheap(cx, &buffer->as<ArrayBufferObject>());
|
||||
bool useSignalHandlers = metadata.compileArgs.useSignalHandlersForOOB;
|
||||
bool useSignalHandlers = metadata.usesSignal.forOOB;
|
||||
if (!ArrayBufferObject::prepareForAsmJS(cx, abheap, useSignalHandlers))
|
||||
return LinkFail(cx, "Unable to prepare ArrayBuffer for asm.js use");
|
||||
}
|
||||
|
@ -8406,7 +8400,7 @@ LookupAsmJSModuleInCache(ExclusiveContext* cx, AsmJSParser& parser, bool* loaded
|
|||
if (!atEnd)
|
||||
return true;
|
||||
|
||||
if (asmJSMetadata->compileArgs != CompileArgs(cx))
|
||||
if (asmJSMetadata->usesSignal != SignalUsage(cx))
|
||||
return true;
|
||||
|
||||
if (!parser.tokenStream.advance(asmJSMetadata->srcEndBeforeCurly()))
|
||||
|
|
|
@ -2071,7 +2071,7 @@ class BaseCompiler
|
|||
|
||||
void addInterruptCheck()
|
||||
{
|
||||
if (mg_.args.useSignalHandlersForInterrupt)
|
||||
if (mg_.usesSignal.forInterrupt)
|
||||
return;
|
||||
|
||||
// FIXME - implement this.
|
||||
|
@ -2739,7 +2739,7 @@ class BaseCompiler
|
|||
// can't (yet) use the signal handlers.
|
||||
|
||||
#if defined(ASMJS_MAY_USE_SIGNAL_HANDLERS_FOR_OOB)
|
||||
if (mg_.args.useSignalHandlersForOOB && !access.isAtomicAccess())
|
||||
if (mg_.usesSignal.forOOB && !access.isAtomicAccess())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -412,9 +412,9 @@ typedef Vector<char16_t, 64> TwoByteName;
|
|||
struct MetadataCacheablePod
|
||||
{
|
||||
ModuleKind kind;
|
||||
SignalUsage usesSignal;
|
||||
HeapUsage heapUsage;
|
||||
uint32_t initialHeapLength;
|
||||
CompileArgs compileArgs;
|
||||
|
||||
MetadataCacheablePod() { mozilla::PodZero(this); }
|
||||
};
|
||||
|
|
|
@ -128,8 +128,8 @@ ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars file, Metada
|
|||
return false;
|
||||
}
|
||||
|
||||
metadata_->compileArgs = shared->args;
|
||||
metadata_->kind = shared->kind;
|
||||
metadata_->usesSignal = shared->usesSignal;
|
||||
metadata_->heapUsage = HeapUsage::None;
|
||||
metadata_->filename = Move(file);
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ typedef Vector<ImportModuleGeneratorData, 0, SystemAllocPolicy> ImportModuleGene
|
|||
|
||||
struct ModuleGeneratorData
|
||||
{
|
||||
CompileArgs args;
|
||||
ModuleKind kind;
|
||||
SignalUsage usesSignal;
|
||||
mozilla::Atomic<uint32_t> minHeapLength;
|
||||
|
||||
DeclaredSigVector sigs;
|
||||
|
@ -78,7 +78,7 @@ struct ModuleGeneratorData
|
|||
}
|
||||
|
||||
explicit ModuleGeneratorData(ExclusiveContext* cx, ModuleKind kind = ModuleKind::Wasm)
|
||||
: args(cx), kind(kind), minHeapLength(0)
|
||||
: kind(kind), usesSignal(cx), minHeapLength(0)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -145,7 +145,7 @@ class MOZ_STACK_CLASS ModuleGenerator
|
|||
Metadata* maybeMetadata = nullptr);
|
||||
|
||||
bool isAsmJS() const { return metadata_->kind == ModuleKind::AsmJS; }
|
||||
CompileArgs args() const { return metadata_->compileArgs; }
|
||||
SignalUsage usesSignal() const { return metadata_->usesSignal; }
|
||||
jit::MacroAssembler& masm() { return masm_; }
|
||||
|
||||
// Heap usage:
|
||||
|
@ -241,7 +241,7 @@ class MOZ_STACK_CLASS FunctionGenerator
|
|||
}
|
||||
|
||||
bool usesSignalsForInterrupts() const {
|
||||
return m_->args().useSignalHandlersForInterrupt;
|
||||
return m_->usesSignal().forInterrupt;
|
||||
}
|
||||
|
||||
Bytes& bytes() {
|
||||
|
|
|
@ -691,7 +691,7 @@ class FunctionCompiler
|
|||
|
||||
void addInterruptCheck()
|
||||
{
|
||||
if (mg_.args.useSignalHandlersForInterrupt)
|
||||
if (mg_.usesSignal.forInterrupt)
|
||||
return;
|
||||
|
||||
if (inDeadCode())
|
||||
|
@ -3388,7 +3388,7 @@ wasm::IonCompileFunction(IonCompileTask* task)
|
|||
CompileInfo compileInfo(locals.length());
|
||||
MIRGenerator mir(nullptr, options, &results.alloc(), &graph, &compileInfo,
|
||||
IonOptimizations.get(OptimizationLevel::AsmJS));
|
||||
mir.initUsesSignalHandlersForAsmJSOOB(task->mg().args.useSignalHandlersForOOB);
|
||||
mir.initUsesSignalHandlersForAsmJSOOB(task->mg().usesSignal.forOOB);
|
||||
mir.initMinAsmJSHeapLength(task->mg().minHeapLength);
|
||||
|
||||
// Build MIR graph
|
||||
|
|
|
@ -338,8 +338,8 @@ Module::instantiate(JSContext* cx,
|
|||
Rooted<ArrayBufferObjectMaybeShared*> heap(cx, asmJSHeap);
|
||||
if (metadata_->usesHeap() && !heap) {
|
||||
MOZ_ASSERT(!metadata_->isAsmJS());
|
||||
bool signalsForOOB = metadata_->compileArgs.useSignalHandlersForOOB;
|
||||
heap = ArrayBufferObject::createForWasm(cx, metadata_->initialHeapLength, signalsForOOB);
|
||||
heap = ArrayBufferObject::createForWasm(cx, metadata_->initialHeapLength,
|
||||
metadata_->usesSignal.forOOB);
|
||||
if (!heap)
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -604,7 +604,7 @@ EmulateHeapAccess(EMULATOR_CONTEXT* context, uint8_t* pc, uint8_t* faultingAddre
|
|||
const MemoryAccess* memoryAccess, const Instance& instance)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(instance.codeSegment().containsFunctionPC(pc));
|
||||
MOZ_RELEASE_ASSERT(instance.metadata().compileArgs.useSignalHandlersForOOB);
|
||||
MOZ_RELEASE_ASSERT(instance.metadata().usesSignal.forOOB);
|
||||
MOZ_RELEASE_ASSERT(memoryAccess->insnOffset() == (pc - instance.codeSegment().code()));
|
||||
|
||||
// Disassemble the instruction which caused the trap so that we can extract
|
||||
|
|
|
@ -271,23 +271,22 @@ wasm::AddressOf(SymbolicAddress imm, ExclusiveContext* cx)
|
|||
MOZ_CRASH("Bad SymbolicAddress");
|
||||
}
|
||||
|
||||
CompileArgs::CompileArgs(ExclusiveContext* cx)
|
||||
SignalUsage::SignalUsage(ExclusiveContext* cx)
|
||||
:
|
||||
#ifdef ASMJS_MAY_USE_SIGNAL_HANDLERS_FOR_OOB
|
||||
// Signal-handling is only used to eliminate bounds checks when the OS page
|
||||
// size is an even divisor of the WebAssembly page size.
|
||||
useSignalHandlersForOOB(cx->canUseSignalHandlers() &&
|
||||
gc::SystemPageSize() <= PageSize &&
|
||||
PageSize % gc::SystemPageSize() == 0),
|
||||
forOOB(cx->canUseSignalHandlers() &&
|
||||
gc::SystemPageSize() <= PageSize &&
|
||||
PageSize % gc::SystemPageSize() == 0),
|
||||
#else
|
||||
useSignalHandlersForOOB(false),
|
||||
forOOB(false),
|
||||
#endif
|
||||
useSignalHandlersForInterrupt(cx->canUseSignalHandlers())
|
||||
forInterrupt(cx->canUseSignalHandlers())
|
||||
{}
|
||||
|
||||
bool
|
||||
CompileArgs::operator==(CompileArgs rhs) const
|
||||
SignalUsage::operator==(SignalUsage rhs) const
|
||||
{
|
||||
return useSignalHandlersForOOB == rhs.useSignalHandlersForOOB &&
|
||||
useSignalHandlersForInterrupt == rhs.useSignalHandlersForInterrupt;
|
||||
return forOOB == rhs.forOOB && forInterrupt == rhs.forInterrupt;
|
||||
}
|
||||
|
|
|
@ -768,19 +768,19 @@ enum class JumpTarget
|
|||
|
||||
typedef EnumeratedArray<JumpTarget, JumpTarget::Limit, Uint32Vector> JumpSiteArray;
|
||||
|
||||
// The CompileArgs struct captures global parameters that affect all wasm code
|
||||
// The SignalUsage struct captures global parameters that affect all wasm code
|
||||
// generation. It also currently is the single source of truth for whether or
|
||||
// not to use signal handlers for different purposes.
|
||||
|
||||
struct CompileArgs
|
||||
struct SignalUsage
|
||||
{
|
||||
bool useSignalHandlersForOOB;
|
||||
bool useSignalHandlersForInterrupt;
|
||||
bool forOOB;
|
||||
bool forInterrupt;
|
||||
|
||||
CompileArgs() = default;
|
||||
explicit CompileArgs(ExclusiveContext* cx);
|
||||
bool operator==(CompileArgs rhs) const;
|
||||
bool operator!=(CompileArgs rhs) const { return !(*this == rhs); }
|
||||
SignalUsage() = default;
|
||||
explicit SignalUsage(ExclusiveContext* cx);
|
||||
bool operator==(SignalUsage rhs) const;
|
||||
bool operator!=(SignalUsage rhs) const { return !(*this == rhs); }
|
||||
};
|
||||
|
||||
// A Module can either be asm.js or wasm.
|
||||
|
|
Загрузка…
Ссылка в новой задаче