mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 13:23:07 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1247104 - BaldrMonkey: Outline a method to reduce indenetation. r=luke (43aae99318) - Bug 1247104 - BaldrMonkey: Enclose most of WasmText.cpp in anonymous namespaces. r=luke (50a93211ef) - Bug 1247104 - BaldrMonkey: Parsing, encoding, and decoding for load+store. r=luke (bf87e68074) - Bug 1247846 - Baldr: add type declaration to text language (r=sunfish) (4333417275) - Bug 1245112 - Part 1: Move MacroAssembler::branchPrivatePtr into generic macro assembler. r=nbp (ba4b42bca0) - Bug 1245112 - Part 2: Move MacroAssembler::branchPtr into generic macro assembler. r=nbp (863dbbb121) - Bug 1245112 - Part 3: Move MacroAssembler::branch32 into generic macro assembler. r=nbp (e8464ab752) - Bug 1245112 - Part 4: Move MacroAssembler::branchTest64 into generic macro assembler. r=nbp (6ac2817f78) - Bug 1245112 - Part 5: Move MacroAssembler::branchTestPtr into generic macro assembler. r=nbp (5498a461ec) - Bug 1245112 - Part 6: Move MacroAssembler::branchTest32 into generic macro assembler. r=nbp (3f80771dfd) - Bug 1245112 - Part 7: Move MacroAssembler::branchFloat into generic macro assembler. r=bbouvier (bfe366f03d) - Bug 1245112 - Part 8: Move MacroAssembler::branchTruncateFloat32 into generic macro assembler. r=bbouvier (a2953d2eb1) - Bug 1245112 - Part 9: Move MacroAssembler::branchDouble into generic macro assembler. r=nbp (68910e9b54) - Bug 1245112 - Part 10: Move MacroAssembler::branchTruncateDouble into generic macro assembler. r=nbp (cb176293fe) - Bug 1245112 - Part 11: Move generic MacroAssembler methods into check_macroassembler_style block. r=nbp (faa0180389) - Bug 1246957: Make the data section require the memory section; r=luke (9337d637ab) - Bug 1247846 - Baldr: add indirect function table and call_indirect (r=sunfish) (a379696e7f) - Bug 1247247 - Factor essential wasmEval code into public helper function. r=luke (606562c29b) - Bug 1240127 - Fold MTableSwitch with constant int32 operand. r=nbp (350accb1cc) - Bug 1246658 part 1 - Refactor MDefinition::constantValue and friends. r=bbouvier (fea967ef6e) - Bug 1246658 part 2 - Rewrite MConstant::valueToBoolean to not depend on js::Value. r=luke (8b6cddbd7c)
This commit is contained in:
@@ -36,6 +36,8 @@ using mozilla::MakeEnumeratedRange;
|
||||
static const unsigned GENERATOR_LIFO_DEFAULT_CHUNK_SIZE = 4 * 1024;
|
||||
static const unsigned COMPILATION_LIFO_DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||
|
||||
const unsigned ModuleGenerator::BadIndirectCall;
|
||||
|
||||
ModuleGenerator::ModuleGenerator(ExclusiveContext* cx)
|
||||
: cx_(cx),
|
||||
jcx_(CompileRuntime::get(cx->compartment()->runtimeFromAnyThread())),
|
||||
@@ -108,7 +110,7 @@ ParallelCompilationEnabled(ExclusiveContext* cx)
|
||||
}
|
||||
|
||||
bool
|
||||
ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars filename, ModuleKind kind)
|
||||
ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars filename)
|
||||
{
|
||||
if (!funcIndexToExport_.init())
|
||||
return false;
|
||||
@@ -119,7 +121,7 @@ ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars filename, Mo
|
||||
|
||||
module_->globalBytes = InitialGlobalDataBytes;
|
||||
module_->compileArgs = CompileArgs(cx_);
|
||||
module_->kind = kind;
|
||||
module_->kind = shared->kind;
|
||||
module_->heapUsage = HeapUsage::None;
|
||||
module_->filename = Move(filename);
|
||||
|
||||
@@ -127,15 +129,18 @@ ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars filename, Mo
|
||||
if (!exportMap_)
|
||||
return false;
|
||||
|
||||
shared_ = Move(shared);
|
||||
|
||||
// For asm.js, the Vectors in ModuleGeneratorData are max-sized reservations
|
||||
// and will be initialized in a linear order via init* functions as the
|
||||
// module is generated. For wasm, the Vectors are correctly-sized and
|
||||
// already initialized.
|
||||
shared_ = Move(shared);
|
||||
if (kind == ModuleKind::Wasm) {
|
||||
|
||||
if (module_->kind == ModuleKind::Wasm) {
|
||||
numSigs_ = shared_->sigs.length();
|
||||
module_->numFuncs = shared_->funcSigs.length();
|
||||
module_->globalBytes = AlignBytes(module_->globalBytes, sizeof(void*));
|
||||
|
||||
for (ImportModuleGeneratorData& import : shared_->imports) {
|
||||
MOZ_ASSERT(!import.globalDataOffset);
|
||||
import.globalDataOffset = module_->globalBytes;
|
||||
@@ -143,6 +148,17 @@ ModuleGenerator::init(UniqueModuleGeneratorData shared, UniqueChars filename, Mo
|
||||
if (!addImport(*import.sig, import.globalDataOffset))
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(module_->globalBytes % sizeof(void*) == 0);
|
||||
|
||||
for (TableModuleGeneratorData& table : shared_->sigToTable) {
|
||||
MOZ_ASSERT(table.numElems == table.elemFuncIndices.length());
|
||||
if (!table.numElems)
|
||||
continue;
|
||||
MOZ_ASSERT(!table.globalDataOffset);
|
||||
table.globalDataOffset = module_->globalBytes;
|
||||
module_->globalBytes += table.numElems * sizeof(void*);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -346,6 +362,7 @@ ModuleGenerator::finishCodegen(StaticLinkData* link)
|
||||
Vector<ProfilingOffsets> interpExits(cx_);
|
||||
Vector<ProfilingOffsets> jitExits(cx_);
|
||||
EnumeratedArray<JumpTarget, JumpTarget::Limit, Offsets> jumpTargets;
|
||||
ProfilingOffsets badIndirectCallExit;
|
||||
Offsets interruptExit;
|
||||
|
||||
{
|
||||
@@ -372,6 +389,7 @@ ModuleGenerator::finishCodegen(StaticLinkData* link)
|
||||
for (JumpTarget target : MakeEnumeratedRange(JumpTarget::Limit))
|
||||
jumpTargets[target] = GenerateJumpTarget(masm, target);
|
||||
|
||||
badIndirectCallExit = GenerateBadIndirectCallExit(masm);
|
||||
interruptExit = GenerateInterruptStub(masm);
|
||||
|
||||
if (masm.oom() || !masm_.asmMergeWith(masm))
|
||||
@@ -406,15 +424,40 @@ ModuleGenerator::finishCodegen(StaticLinkData* link)
|
||||
return false;
|
||||
}
|
||||
|
||||
badIndirectCallExit.offsetBy(offsetInWhole);
|
||||
if (!module_->codeRanges.emplaceBack(CodeRange::ErrorExit, badIndirectCallExit))
|
||||
return false;
|
||||
|
||||
interruptExit.offsetBy(offsetInWhole);
|
||||
if (!module_->codeRanges.emplaceBack(CodeRange::Inline, interruptExit))
|
||||
return false;
|
||||
|
||||
// The signal handler redirects PC to the out-of-bounds and interrupt stubs.
|
||||
// Fill in StaticLinkData with the offsets of these stubs.
|
||||
|
||||
link->pod.outOfBoundsOffset = jumpTargets[JumpTarget::OutOfBounds].begin;
|
||||
link->pod.interruptOffset = interruptExit.begin;
|
||||
|
||||
for (uint32_t sigIndex = 0; sigIndex < numSigs_; sigIndex++) {
|
||||
const TableModuleGeneratorData& table = shared_->sigToTable[sigIndex];
|
||||
if (table.elemFuncIndices.empty())
|
||||
continue;
|
||||
|
||||
Uint32Vector elemOffsets;
|
||||
if (!elemOffsets.resize(table.elemFuncIndices.length()))
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < table.elemFuncIndices.length(); i++) {
|
||||
uint32_t funcIndex = table.elemFuncIndices[i];
|
||||
if (funcIndex == BadIndirectCall)
|
||||
elemOffsets[i] = badIndirectCallExit.begin;
|
||||
else
|
||||
elemOffsets[i] = funcEntry(funcIndex);
|
||||
}
|
||||
|
||||
if (!link->funcPtrTables.emplaceBack(table.globalDataOffset, Move(elemOffsets)))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only call convertOutOfRangeBranchesToThunks after all other codegen that may
|
||||
// emit new jumps to JumpTargets has finished.
|
||||
|
||||
@@ -503,24 +546,6 @@ ModuleGenerator::finishStaticLinkData(uint8_t* code, uint32_t codeBytes, StaticL
|
||||
}
|
||||
#endif
|
||||
|
||||
// Convert the function pointer table elements from function-indices to code
|
||||
// offsets that static linking will convert to absolute addresses.
|
||||
for (uint32_t sigIndex = 0; sigIndex < numSigs_; sigIndex++) {
|
||||
const TableModuleGeneratorData& table = shared_->sigToTable[sigIndex];
|
||||
if (table.elemFuncIndices.empty())
|
||||
continue;
|
||||
|
||||
Uint32Vector elemOffsets;
|
||||
if (!elemOffsets.resize(table.elemFuncIndices.length()))
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < table.elemFuncIndices.length(); i++)
|
||||
elemOffsets[i] = funcEntry(table.elemFuncIndices[i]);
|
||||
|
||||
if (!link->funcPtrTables.emplaceBack(table.globalDataOffset, Move(elemOffsets)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -793,8 +818,7 @@ ModuleGenerator::finishFuncDef(uint32_t funcIndex, unsigned generateTime, Functi
|
||||
Move(fg->locals_),
|
||||
fg->lineOrBytecode_,
|
||||
Move(fg->callSiteLineNums_),
|
||||
generateTime,
|
||||
module_->kind);
|
||||
generateTime);
|
||||
if (!func)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user