Bug 998490 - OdinMonkey: add common AssemblerShared base class, hoist some things into it (r=bbouvier,jandem)

--HG--
extra : rebase_source : 0ee188f547bddf5e191e9cab041cb5489828f999
This commit is contained in:
Luke Wagner 2014-04-16 16:05:39 -05:00
Родитель b5769eaec7
Коммит 944b7150c6
15 изменённых файлов: 122 добавлений и 163 удалений

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

@ -1036,7 +1036,6 @@ class MOZ_STACK_CLASS ModuleCompiler
FuncPtrTableVector funcPtrTables_;
ExitMap exits_;
MathNameMap standardLibraryMathNames_;
GlobalAccessVector globalAccesses_;
Label stackOverflowLabel_;
Label interruptLabel_;
@ -1077,7 +1076,6 @@ class MOZ_STACK_CLASS ModuleCompiler
funcPtrTables_(cx),
exits_(cx),
standardLibraryMathNames_(cx),
globalAccesses_(cx),
errorString_(nullptr),
errorOffset_(UINT32_MAX),
errorOverRecursed_(false),
@ -1414,9 +1412,6 @@ class MOZ_STACK_CLASS ModuleCompiler
return false;
return exits_.add(p, Move(exitDescriptor), *exitIndex);
}
bool addGlobalAccess(AsmJSGlobalAccess access) {
return globalAccesses_.append(access);
}
// Note a constraint on the minimum size of the heap. The heap size is
// constrained when linking to be at least the maximum of all such constraints.
@ -1430,14 +1425,6 @@ class MOZ_STACK_CLASS ModuleCompiler
return moduleLifo_;
}
bool collectAccesses(MIRGenerator &gen) {
if (!module_->addHeapAccesses(gen.heapAccesses()))
return false;
if (!globalAccesses_.appendAll(gen.globalAccesses()))
return false;
return true;
}
#if defined(MOZ_VTUNE) || defined(JS_ION_PERF)
bool trackProfiledFunction(const Func &func, unsigned endCodeOffset) {
unsigned lineno = 0U, columnIndex = 0U;
@ -1524,6 +1511,8 @@ class MOZ_STACK_CLASS ModuleCompiler
if (masm_.oom())
return false;
module_->assignHeapAccesses(masm_.extractAsmJSHeapAccesses());
#if defined(JS_CODEGEN_ARM)
// Now that compilation has finished, we need to update offsets to
// reflect actual offsets (an ARM distinction).
@ -1605,8 +1594,8 @@ class MOZ_STACK_CLASS ModuleCompiler
// Global data accesses in x86 need to be patched with the absolute
// address of the global. Globals are allocated sequentially after the
// code section so we can just use an RelativeLink.
for (unsigned i = 0; i < globalAccesses_.length(); i++) {
AsmJSGlobalAccess a = globalAccesses_[i];
for (unsigned i = 0; i < masm_.numAsmJSGlobalAccesses(); i++) {
AsmJSGlobalAccess a = masm_.asmJSGlobalAccesses(i);
AsmJSModule::RelativeLink link;
link.patchAtOffset = masm_.labelOffsetToPatchOffset(a.patchAt.offset());
link.targetOffset = module_->offsetOfGlobalData() + a.globalDataOffset;
@ -1619,8 +1608,8 @@ class MOZ_STACK_CLASS ModuleCompiler
// Global data accesses on x64 use rip-relative addressing and thus do
// not need patching after deserialization.
uint8_t *code = module_->codeBase();
for (unsigned i = 0; i < globalAccesses_.length(); i++) {
AsmJSGlobalAccess a = globalAccesses_[i];
for (unsigned i = 0; i < masm_.numAsmJSGlobalAccesses(); i++) {
AsmJSGlobalAccess a = masm_.asmJSGlobalAccess(i);
masm_.patchAsmJSGlobalAccess(a.patchAt, code, module_->globalData(), a.globalDataOffset);
}
#endif
@ -5472,9 +5461,6 @@ GenerateCode(ModuleCompiler &m, ModuleCompiler::Func &func, MIRGenerator &mir, L
if (!codegen || !codegen->generateAsmJS(&m.stackOverflowLabel()))
return m.fail(nullptr, "internal codegen failure (probably out of memory)");
if (!m.collectAccesses(mir))
return false;
jit::IonScriptCounts *counts = codegen->extractUnassociatedScriptCounts();
if (counts && !m.addFunctionCounts(counts)) {
js_delete(counts);
@ -6529,10 +6515,10 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
unsigned globalDataOffset = m.module().exitIndexToGlobalDataOffset(exitIndex);
#if defined(JS_CODEGEN_X64)
CodeOffsetLabel label2 = masm.leaRipRelative(callee);
m.addGlobalAccess(AsmJSGlobalAccess(label2.offset(), globalDataOffset));
m.masm().append(AsmJSGlobalAccess(label2.offset(), globalDataOffset));
#elif defined(JS_CODEGEN_X86)
CodeOffsetLabel label2 = masm.movlWithPatch(Imm32(0), callee);
m.addGlobalAccess(AsmJSGlobalAccess(label2.offset(), globalDataOffset));
m.masm().append(AsmJSGlobalAccess(label2.offset(), globalDataOffset));
#else
masm.lea(Operand(GlobalReg, globalDataOffset), callee);
#endif

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

@ -764,18 +764,19 @@ class AsmJSModule
return pc >= code_ && pc < (code_ + functionBytes());
}
bool addHeapAccesses(const jit::AsmJSHeapAccessVector &accesses) {
return heapAccesses_.appendAll(accesses);
void assignHeapAccesses(jit::AsmJSHeapAccessVector &&accesses) {
heapAccesses_ = Move(accesses);
}
unsigned numHeapAccesses() const {
return heapAccesses_.length();
}
jit::AsmJSHeapAccess &heapAccess(unsigned i) {
return heapAccesses_[i];
}
const jit::AsmJSHeapAccess &heapAccess(unsigned i) const {
return heapAccesses_[i];
}
jit::AsmJSHeapAccess &heapAccess(unsigned i) {
return heapAccesses_[i];
}
void initHeap(Handle<ArrayBufferObject*> heap, JSContext *cx);
void requireHeapLengthToBeAtLeast(uint32_t len) {

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

@ -120,24 +120,12 @@ class MIRGenerator
JS_ASSERT(compilingAsmJS());
return performsAsmJSCall_;
}
bool noteHeapAccess(AsmJSHeapAccess heapAccess) {
return asmJSHeapAccesses_.append(heapAccess);
}
const Vector<AsmJSHeapAccess, 0, IonAllocPolicy> &heapAccesses() const {
return asmJSHeapAccesses_;
}
void noteMinAsmJSHeapLength(uint32_t len) {
minAsmJSHeapLength_ = len;
}
uint32_t minAsmJSHeapLength() const {
return minAsmJSHeapLength_;
}
bool noteGlobalAccess(unsigned offset, unsigned globalDataOffset) {
return asmJSGlobalAccesses_.append(AsmJSGlobalAccess(offset, globalDataOffset));
}
const Vector<AsmJSGlobalAccess, 0, IonAllocPolicy> &globalAccesses() const {
return asmJSGlobalAccesses_;
}
bool modifiesFrameArguments() const {
return modifiesFrameArguments_;
@ -159,8 +147,6 @@ class MIRGenerator
uint32_t maxAsmJSStackArgBytes_;
bool performsCall_;
bool performsAsmJSCall_;
AsmJSHeapAccessVector asmJSHeapAccesses_;
AsmJSGlobalAccessVector asmJSGlobalAccesses_;
uint32_t minAsmJSHeapLength_;
// Keep track of whether frame arguments are modified during execution.

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

@ -29,8 +29,6 @@ MIRGenerator::MIRGenerator(CompileCompartment *compartment, const JitCompileOpti
maxAsmJSStackArgBytes_(0),
performsCall_(false),
performsAsmJSCall_(false),
asmJSHeapAccesses_(*alloc),
asmJSGlobalAccesses_(*alloc),
minAsmJSHeapLength_(AsmJSAllocationGranularity),
modifiesFrameArguments_(false),
options(options)

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

@ -801,72 +801,6 @@ class ABIArg
AnyRegister reg() const { return kind_ == GPR ? AnyRegister(gpr()) : AnyRegister(fpu()); }
};
// Summarizes a heap access made by asm.js code that needs to be patched later
// and/or looked up by the asm.js signal handlers. Different architectures need
// to know different things (x64: offset and length, ARM: where to patch in
// heap length, x86: where to patch in heap length and base) hence the massive
// #ifdefery.
class AsmJSHeapAccess
{
uint32_t offset_;
#if defined(JS_CODEGEN_X86)
uint8_t cmpDelta_; // the number of bytes from the cmp to the load/store instruction
#endif
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
uint8_t opLength_; // the length of the load/store instruction
uint8_t isFloat32Load_;
AnyRegister::Code loadedReg_ : 8;
#endif
JS_STATIC_ASSERT(AnyRegister::Total < UINT8_MAX);
public:
AsmJSHeapAccess() {}
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
// If 'cmp' equals 'offset' or if it is not supplied then the
// cmpDelta_ is zero indicating that there is no length to patch.
AsmJSHeapAccess(uint32_t offset, uint32_t after, ArrayBufferView::ViewType vt,
AnyRegister loadedReg, uint32_t cmp = UINT32_MAX)
: offset_(offset),
# if defined(JS_CODEGEN_X86)
cmpDelta_(cmp == UINT32_MAX ? 0 : offset - cmp),
# endif
opLength_(after - offset),
isFloat32Load_(vt == ArrayBufferView::TYPE_FLOAT32),
loadedReg_(loadedReg.code())
{}
AsmJSHeapAccess(uint32_t offset, uint8_t after, uint32_t cmp = UINT32_MAX)
: offset_(offset),
# if defined(JS_CODEGEN_X86)
cmpDelta_(cmp == UINT32_MAX ? 0 : offset - cmp),
# endif
opLength_(after - offset),
isFloat32Load_(false),
loadedReg_(UINT8_MAX)
{}
#elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
explicit AsmJSHeapAccess(uint32_t offset)
: offset_(offset)
{}
#endif
uint32_t offset() const { return offset_; }
void setOffset(uint32_t offset) { offset_ = offset; }
#if defined(JS_CODEGEN_X86)
bool hasLengthCheck() const { return cmpDelta_ > 0; }
void *patchLengthAt(uint8_t *code) const { return code + (offset_ - cmpDelta_); }
void *patchOffsetAt(uint8_t *code) const { return code + (offset_ + opLength_); }
#endif
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
unsigned opLength() const { return opLength_; }
bool isLoad() const { return loadedReg_ != UINT8_MAX; }
bool isFloat32Load() const { return isFloat32Load_; }
AnyRegister loadedReg() const { return AnyRegister::FromCode(loadedReg_); }
#endif
};
typedef Vector<AsmJSHeapAccess, 0, IonAllocPolicy> AsmJSHeapAccessVector;
} // namespace jit
} // namespace js

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

@ -1126,7 +1126,7 @@ class InstructionIterator;
class Assembler;
typedef js::jit::AssemblerBufferWithConstantPool<1024, 4, Instruction, Assembler, 1> ARMBuffer;
class Assembler
class Assembler : public AssemblerShared
{
public:
// ARM conditional constants
@ -1261,7 +1261,6 @@ class Assembler
js::Vector<BufferOffset, 0, SystemAllocPolicy> tmpJumpRelocations_;
js::Vector<BufferOffset, 0, SystemAllocPolicy> tmpDataRelocations_;
js::Vector<BufferOffset, 0, SystemAllocPolicy> tmpPreBarriers_;
AsmJSAbsoluteLinkVector asmJSAbsoluteLinks_;
CompactBufferWriter jumpRelocations_;
CompactBufferWriter dataRelocations_;
@ -1383,13 +1382,6 @@ class Assembler
return codeLabels_[i];
}
size_t numAsmJSAbsoluteLinks() const {
return asmJSAbsoluteLinks_.length();
}
AsmJSAbsoluteLink asmJSAbsoluteLink(size_t i) const {
return asmJSAbsoluteLinks_[i];
}
// Size of the instruction stream, in bytes.
size_t size() const;
// Size of the jump relocation table, in bytes.

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

@ -2029,7 +2029,7 @@ CodeGeneratorARM::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
masm.ma_mov(Imm32(0), d, NoSetCond, Assembler::AboveOrEqual);
masm.ma_dataTransferN(IsLoad, size, isSigned, HeapReg, ptrReg, d, Offset, Assembler::Below);
}
return gen->noteHeapAccess(AsmJSHeapAccess(bo.getOffset()));
return masm.append(AsmJSHeapAccess(bo.getOffset()));
}
bool
@ -2096,7 +2096,7 @@ CodeGeneratorARM::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
masm.ma_dataTransferN(IsStore, size, isSigned, HeapReg, ptrReg,
ToRegister(ins->value()), Offset, Assembler::Below);
}
return gen->noteHeapAccess(AsmJSHeapAccess(bo.getOffset()));
return masm.append(AsmJSHeapAccess(bo.getOffset()));
}
bool

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

@ -2041,8 +2041,7 @@ MacroAssemblerARMCompat::movePtr(const AsmJSImmPtr &imm, const Register &dest)
else
rs = L_LDR;
AsmJSAbsoluteLink link(nextOffset().getOffset(), imm.kind());
enoughMemory_ &= asmJSAbsoluteLinks_.append(link);
enoughMemory_ &= append(AsmJSAbsoluteLink(nextOffset().getOffset(), imm.kind()));
ma_movPatchable(Imm32(-1), dest, Always, rs);
}
void

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

@ -565,7 +565,7 @@ PatchJump(CodeLocationJump &jump_, CodeLocationLabel label);
class Assembler;
typedef js::jit::AssemblerBuffer<1024, Instruction> MIPSBuffer;
class Assembler
class Assembler : public AssemblerShared
{
public:
@ -670,7 +670,6 @@ class Assembler
js::Vector<CodeLabel, 0, SystemAllocPolicy> codeLabels_;
js::Vector<RelativePatch, 8, SystemAllocPolicy> jumps_;
js::Vector<uint32_t, 8, SystemAllocPolicy> longJumps_;
AsmJSAbsoluteLinkVector asmJSAbsoluteLinks_;
CompactBufferWriter jumpRelocations_;
CompactBufferWriter dataRelocations_;
@ -732,13 +731,6 @@ class Assembler
return codeLabels_[i];
}
size_t numAsmJSAbsoluteLinks() const {
return asmJSAbsoluteLinks_.length();
}
AsmJSAbsoluteLink asmJSAbsoluteLink(size_t i) const {
return asmJSAbsoluteLinks_[i];
}
// Size of the instruction stream, in bytes.
size_t size() const;
// Size of the jump relocation table, in bytes.

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

@ -663,6 +663,72 @@ class CodeLocationLabel
}
};
// Summarizes a heap access made by asm.js code that needs to be patched later
// and/or looked up by the asm.js signal handlers. Different architectures need
// to know different things (x64: offset and length, ARM: where to patch in
// heap length, x86: where to patch in heap length and base) hence the massive
// #ifdefery.
class AsmJSHeapAccess
{
uint32_t offset_;
#if defined(JS_CODEGEN_X86)
uint8_t cmpDelta_; // the number of bytes from the cmp to the load/store instruction
#endif
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
uint8_t opLength_; // the length of the load/store instruction
uint8_t isFloat32Load_;
AnyRegister::Code loadedReg_ : 8;
#endif
JS_STATIC_ASSERT(AnyRegister::Total < UINT8_MAX);
public:
AsmJSHeapAccess() {}
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
// If 'cmp' equals 'offset' or if it is not supplied then the
// cmpDelta_ is zero indicating that there is no length to patch.
AsmJSHeapAccess(uint32_t offset, uint32_t after, ArrayBufferView::ViewType vt,
AnyRegister loadedReg, uint32_t cmp = UINT32_MAX)
: offset_(offset),
# if defined(JS_CODEGEN_X86)
cmpDelta_(cmp == UINT32_MAX ? 0 : offset - cmp),
# endif
opLength_(after - offset),
isFloat32Load_(vt == ArrayBufferView::TYPE_FLOAT32),
loadedReg_(loadedReg.code())
{}
AsmJSHeapAccess(uint32_t offset, uint8_t after, uint32_t cmp = UINT32_MAX)
: offset_(offset),
# if defined(JS_CODEGEN_X86)
cmpDelta_(cmp == UINT32_MAX ? 0 : offset - cmp),
# endif
opLength_(after - offset),
isFloat32Load_(false),
loadedReg_(UINT8_MAX)
{}
#elif defined(JS_CODEGEN_ARM)
explicit AsmJSHeapAccess(uint32_t offset)
: offset_(offset)
{}
#endif
uint32_t offset() const { return offset_; }
void setOffset(uint32_t offset) { offset_ = offset; }
#if defined(JS_CODEGEN_X86)
bool hasLengthCheck() const { return cmpDelta_ > 0; }
void *patchLengthAt(uint8_t *code) const { return code + (offset_ - cmpDelta_); }
void *patchOffsetAt(uint8_t *code) const { return code + (offset_ + opLength_); }
#endif
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
unsigned opLength() const { return opLength_; }
bool isLoad() const { return loadedReg_ != UINT8_MAX; }
bool isFloat32Load() const { return isFloat32Load_; }
AnyRegister loadedReg() const { return AnyRegister::FromCode(loadedReg_); }
#endif
};
typedef Vector<AsmJSHeapAccess, 0, SystemAllocPolicy> AsmJSHeapAccessVector;
struct AsmJSGlobalAccess
{
CodeOffsetLabel patchAt;
@ -673,8 +739,6 @@ struct AsmJSGlobalAccess
{}
};
typedef Vector<AsmJSGlobalAccess, 0, IonAllocPolicy> AsmJSGlobalAccessVector;
// Describes the intended pointee of an immediate to be embedded in asm.js
// code. By representing the pointee as a symbolic enum, the pointee can be
// patched after deserialization when the address of global things has changed.
@ -747,7 +811,25 @@ struct AsmJSAbsoluteLink
AsmJSImmKind target;
};
typedef Vector<AsmJSAbsoluteLink, 0, SystemAllocPolicy> AsmJSAbsoluteLinkVector;
// The base class of all Assemblers for all archs.
class AssemblerShared
{
Vector<AsmJSHeapAccess, 0, SystemAllocPolicy> asmJSHeapAccesses_;
Vector<AsmJSGlobalAccess, 0, SystemAllocPolicy> asmJSGlobalAccesses_;
Vector<AsmJSAbsoluteLink, 0, SystemAllocPolicy> asmJSAbsoluteLinks_;
public:
bool append(AsmJSHeapAccess access) { return asmJSHeapAccesses_.append(access); }
AsmJSHeapAccessVector &&extractAsmJSHeapAccesses() { return Move(asmJSHeapAccesses_); }
bool append(AsmJSGlobalAccess access) { return asmJSGlobalAccesses_.append(access); }
size_t numAsmJSGlobalAccesses() const { return asmJSGlobalAccesses_.length(); }
AsmJSGlobalAccess asmJSGlobalAccess(size_t i) const { return asmJSGlobalAccesses_[i]; }
bool append(AsmJSAbsoluteLink link) { return asmJSAbsoluteLinks_.append(link); }
size_t numAsmJSAbsoluteLinks() const { return asmJSAbsoluteLinks_.length(); }
AsmJSAbsoluteLink asmJSAbsoluteLink(size_t i) const { return asmJSAbsoluteLinks_[i]; }
};
} // namespace jit
} // namespace js

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

@ -114,7 +114,7 @@ class Operand
}
};
class AssemblerX86Shared
class AssemblerX86Shared : public AssemblerShared
{
protected:
struct RelativePatch {
@ -131,7 +131,6 @@ class AssemblerX86Shared
Vector<CodeLabel, 0, SystemAllocPolicy> codeLabels_;
Vector<RelativePatch, 8, SystemAllocPolicy> jumps_;
AsmJSAbsoluteLinkVector asmJSAbsoluteLinks_;
CompactBufferWriter jumpRelocations_;
CompactBufferWriter dataRelocations_;
CompactBufferWriter preBarriers_;
@ -293,13 +292,6 @@ class AssemblerX86Shared
return codeLabels_[i];
}
size_t numAsmJSAbsoluteLinks() const {
return asmJSAbsoluteLinks_.length();
}
const AsmJSAbsoluteLink &asmJSAbsoluteLink(size_t i) const {
return asmJSAbsoluteLinks_[i];
}
// Size of the instruction stream, in bytes.
size_t size() const {
return masm.size();

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

@ -528,8 +528,7 @@ class Assembler : public AssemblerX86Shared
}
void mov(AsmJSImmPtr imm, const Register &dest) {
masm.movq_i64r(-1, dest.code());
AsmJSAbsoluteLink link(masm.currentOffset(), imm.kind());
enoughMemory_ &= asmJSAbsoluteLinks_.append(link);
enoughMemory_ &= append(AsmJSAbsoluteLink(masm.currentOffset(), imm.kind()));
}
void mov(const Operand &src, const Register &dest) {
movq(src, dest);

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

@ -422,7 +422,7 @@ CodeGeneratorX64::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
default: MOZ_ASSUME_UNREACHABLE("unexpected array type");
}
uint32_t after = masm.size();
return skipNote || gen->noteHeapAccess(AsmJSHeapAccess(before, after, vt, ToAnyRegister(ins->output())));
return skipNote || masm.append(AsmJSHeapAccess(before, after, vt, ToAnyRegister(ins->output())));
}
bool
@ -470,7 +470,7 @@ CodeGeneratorX64::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
}
}
uint32_t after = masm.size();
return skipNote || gen->noteHeapAccess(AsmJSHeapAccess(before, after));
return skipNote || masm.append(AsmJSHeapAccess(before, after));
}
bool
@ -484,7 +484,7 @@ CodeGeneratorX64::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins)
else
label = masm.loadRipRelativeDouble(ToFloatRegister(ins->output()));
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
bool
@ -501,7 +501,7 @@ CodeGeneratorX64::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins)
else
label = masm.storeRipRelativeDouble(ToFloatRegister(ins->value()));
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
bool
@ -516,7 +516,7 @@ CodeGeneratorX64::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins)
CodeOffsetLabel label = masm.leaRipRelative(tmp);
masm.loadPtr(Operand(tmp, index, TimesEight, 0), out);
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
bool
@ -526,7 +526,7 @@ CodeGeneratorX64::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins)
CodeOffsetLabel label = masm.loadRipRelativeInt64(ToRegister(ins->output()));
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
void

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

@ -260,8 +260,7 @@ class Assembler : public AssemblerX86Shared
}
void mov(AsmJSImmPtr imm, Register dest) {
masm.movl_i32r(-1, dest.code());
AsmJSAbsoluteLink link(masm.currentOffset(), imm.kind());
enoughMemory_ &= asmJSAbsoluteLinks_.append(link);
enoughMemory_ &= append(AsmJSAbsoluteLink(masm.currentOffset(), imm.kind()));
}
void mov(const Operand &src, const Register &dest) {
movl(src, dest);
@ -342,8 +341,7 @@ class Assembler : public AssemblerX86Shared
}
void cmpl(const AsmJSAbsoluteAddress &lhs, const Register &rhs) {
masm.cmpl_rm_force32(rhs.code(), (void*)-1);
AsmJSAbsoluteLink link(masm.currentOffset(), lhs.kind());
enoughMemory_ &= asmJSAbsoluteLinks_.append(link);
enoughMemory_ &= append(AsmJSAbsoluteLink(masm.currentOffset(), lhs.kind()));
}
CodeOffsetLabel cmplWithPatch(const Register &lhs, Imm32 rhs) {
masm.cmpl_ir_force32(rhs.value, lhs.code());

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

@ -444,7 +444,7 @@ CodeGeneratorX86::loadAndNoteViewTypeElement(ArrayBufferView::ViewType vt, const
uint32_t before = masm.size();
loadViewTypeElement(vt, srcAddr, out);
uint32_t after = masm.size();
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, vt, ToAnyRegister(out)));
return masm.append(AsmJSHeapAccess(before, after, vt, ToAnyRegister(out)));
}
bool
@ -517,7 +517,7 @@ CodeGeneratorX86::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
loadViewTypeElement(vt, srcAddr, out);
uint32_t after = masm.size();
masm.bind(ool->rejoin());
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, vt, ToAnyRegister(out), cmp.offset()));
return masm.append(AsmJSHeapAccess(before, after, vt, ToAnyRegister(out), cmp.offset()));
}
bool
@ -563,7 +563,7 @@ CodeGeneratorX86::storeAndNoteViewTypeElement(ArrayBufferView::ViewType vt, cons
uint32_t before = masm.size();
storeViewTypeElement(vt, value, dstAddr);
uint32_t after = masm.size();
return gen->noteHeapAccess(AsmJSHeapAccess(before, after));
return masm.append(AsmJSHeapAccess(before, after));
}
bool
@ -616,7 +616,7 @@ CodeGeneratorX86::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
storeViewTypeElement(vt, value, dstAddr);
uint32_t after = masm.size();
masm.bind(&rejoin);
return gen->noteHeapAccess(AsmJSHeapAccess(before, after, cmp.offset()));
return masm.append(AsmJSHeapAccess(before, after, cmp.offset()));
}
bool
@ -634,7 +634,7 @@ CodeGeneratorX86::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins)
else
label = masm.movsdWithPatch(PatchedAbsoluteAddress(), ToFloatRegister(ins->output()));
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
bool
@ -653,7 +653,7 @@ CodeGeneratorX86::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins)
else
label = masm.movsdWithPatch(ToFloatRegister(ins->value()), PatchedAbsoluteAddress());
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
bool
@ -665,7 +665,7 @@ CodeGeneratorX86::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins)
Register out = ToRegister(ins->output());
CodeOffsetLabel label = masm.movlWithPatch(PatchedAbsoluteAddress(), index, TimesFour, out);
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
bool
@ -676,7 +676,7 @@ CodeGeneratorX86::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins)
Register out = ToRegister(ins->output());
CodeOffsetLabel label = masm.movlWithPatch(PatchedAbsoluteAddress(), out);
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
return masm.append(AsmJSGlobalAccess(label.offset(), mir->globalDataOffset()));
}
void