mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
[JAEGER] Added JSOP_GOTO support.
This commit is contained in:
parent
2dedfa5219
commit
b482f72bf4
1026
js/src/imacros.c.out
1026
js/src/imacros.c.out
File diff suppressed because it is too large
Load Diff
@ -63,7 +63,7 @@ NotCheckedSSE2;
|
||||
mjit::Compiler::Compiler(JSContext *cx, JSScript *script, JSFunction *fun, JSObject *scopeChain)
|
||||
: CompilerBase(cx), cx(cx), script(script), scopeChain(scopeChain),
|
||||
globalObj(scopeChain->getGlobal()), fun(fun), analysis(cx, script), jumpMap(NULL),
|
||||
frame(cx, script, masm), cg(masm, frame)
|
||||
frame(cx, script, masm), cg(masm, frame), branchPatches(ContextAllocPolicy(cx))
|
||||
{
|
||||
}
|
||||
|
||||
@ -175,6 +175,9 @@ mjit::Compiler::generateMethod()
|
||||
OpcodeStatus &opinfo = analysis[PC];
|
||||
if (opinfo.nincoming) {
|
||||
opinfo.safePoint = true;
|
||||
frame.flush();
|
||||
frame.forceStackDepth(opinfo.stackDepth);
|
||||
jumpMap[uint32(PC - script->code)] = masm.label();
|
||||
}
|
||||
|
||||
if (!opinfo.visited) {
|
||||
@ -195,11 +198,21 @@ mjit::Compiler::generateMethod()
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_ASSERT(frame.stackDepth() == opinfo.stackDepth);
|
||||
|
||||
/**********************
|
||||
* BEGIN COMPILER OPS *
|
||||
**********************/
|
||||
|
||||
switch (op) {
|
||||
BEGIN_CASE(JSOP_GOTO)
|
||||
{
|
||||
frame.flush();
|
||||
Jump j = masm.jump();
|
||||
jumpInScript(j, PC + GET_JUMP_OFFSET(PC));
|
||||
}
|
||||
END_CASE(JSOP_GOTO)
|
||||
|
||||
BEGIN_CASE(JSOP_TRACE)
|
||||
END_CASE(JSOP_TRACE)
|
||||
|
||||
@ -274,6 +287,14 @@ mjit::Compiler::generateMethod()
|
||||
#undef END_CASE
|
||||
#undef BEGIN_CASE
|
||||
|
||||
const JSC::MacroAssembler::Label &
|
||||
mjit::Compiler::labelOf(jsbytecode *pc)
|
||||
{
|
||||
uint32 offs = uint32(pc - script->code);
|
||||
JS_ASSERT(jumpMap[offs].isValid());
|
||||
return jumpMap[offs];
|
||||
}
|
||||
|
||||
uint32
|
||||
mjit::Compiler::fullAtomIndex(jsbytecode *pc)
|
||||
{
|
||||
@ -285,6 +306,19 @@ mjit::Compiler::fullAtomIndex(jsbytecode *pc)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mjit::Compiler::jumpInScript(Jump j, jsbytecode *pc)
|
||||
{
|
||||
JS_ASSERT(pc >= script->code && uint32(pc - script->code) < script->length);
|
||||
|
||||
/* :TODO: OOM failure possible here. */
|
||||
|
||||
if (pc < PC)
|
||||
j.linkTo(jumpMap[uint32(pc - script->code)], &masm);
|
||||
else
|
||||
branchPatches.append(BranchPatch(j, pc));
|
||||
}
|
||||
|
||||
CompileStatus
|
||||
mjit::Compiler::generateEpilogue()
|
||||
{
|
||||
@ -294,6 +328,11 @@ mjit::Compiler::generateEpilogue()
|
||||
CompileStatus
|
||||
mjit::Compiler::finishThisUp()
|
||||
{
|
||||
for (size_t i = 0; i < branchPatches.length(); i++) {
|
||||
Label label = labelOf(branchPatches[i].pc);
|
||||
branchPatches[i].jump.linkTo(label, &masm);
|
||||
}
|
||||
|
||||
JSC::ExecutablePool *execPool = getExecPool(masm.size());
|
||||
if (!execPool)
|
||||
return Compile_Abort;
|
||||
|
@ -58,8 +58,18 @@ class Compiler : public CompilerBase
|
||||
typedef JSC::MacroAssembler::ImmPtr ImmPtr;
|
||||
typedef JSC::MacroAssembler::RegisterID RegisterID;
|
||||
typedef JSC::MacroAssembler::Address Address;
|
||||
typedef JSC::MacroAssembler::Jump Jump;
|
||||
typedef JSC::MacroAssembler MacroAssembler;
|
||||
|
||||
struct BranchPatch {
|
||||
BranchPatch(const Jump &j, jsbytecode *pc)
|
||||
: jump(j), pc(pc)
|
||||
{ }
|
||||
|
||||
Jump jump;
|
||||
jsbytecode *pc;
|
||||
};
|
||||
|
||||
JSContext *cx;
|
||||
JSScript *script;
|
||||
JSObject *scopeChain;
|
||||
@ -71,6 +81,8 @@ class Compiler : public CompilerBase
|
||||
MacroAssembler masm;
|
||||
FrameState frame;
|
||||
CodeGenerator cg;
|
||||
js::Vector<BranchPatch, 64> branchPatches;
|
||||
|
||||
public:
|
||||
// Special atom index used to indicate that the atom is 'length'. This
|
||||
// follows interpreter usage in JSOP_LENGTH.
|
||||
@ -88,7 +100,9 @@ class Compiler : public CompilerBase
|
||||
CompileStatus finishThisUp();
|
||||
|
||||
/* Non-emitting helpers. */
|
||||
const Label &labelOf(jsbytecode *pc);
|
||||
uint32 fullAtomIndex(jsbytecode *pc);
|
||||
void jumpInScript(Jump j, jsbytecode *pc);
|
||||
|
||||
/* Opcode handlers. */
|
||||
void jsop_bindname(uint32 index);
|
||||
|
@ -81,6 +81,7 @@ struct RematInfo {
|
||||
synced_ = true;
|
||||
location_ = PhysLoc_Memory;
|
||||
}
|
||||
bool synced() { return synced_; }
|
||||
|
||||
RegisterID reg_;
|
||||
PhysLoc location_;
|
||||
|
@ -96,3 +96,24 @@ FrameState::assertValidRegisterState()
|
||||
JS_ASSERT(temp == regalloc);
|
||||
}
|
||||
|
||||
void
|
||||
FrameState::invalidate(FrameEntry *fe)
|
||||
{
|
||||
if (!fe->type.synced()) {
|
||||
JS_NOT_REACHED("wat");
|
||||
}
|
||||
if (!fe->data.synced()) {
|
||||
JS_NOT_REACHED("wat2");
|
||||
}
|
||||
fe->type.setMemory();
|
||||
fe->data.setMemory();
|
||||
fe->copies = 0;
|
||||
}
|
||||
|
||||
void
|
||||
FrameState::flush()
|
||||
{
|
||||
for (FrameEntry *fe = base; fe < sp; fe++)
|
||||
invalidate(fe);
|
||||
}
|
||||
|
||||
|
@ -164,10 +164,21 @@ class FrameState
|
||||
return Address(FpReg, 0);
|
||||
}
|
||||
|
||||
void forceStackDepth(uint32 newDepth) {
|
||||
uint32 oldDepth = stackDepth();
|
||||
FrameEntry *spBase = locals + script->nfixed;
|
||||
sp = spBase + newDepth;
|
||||
if (oldDepth <= newDepth)
|
||||
return;
|
||||
memset(spBase, 0, sizeof(FrameEntry) * (newDepth - oldDepth));
|
||||
}
|
||||
|
||||
void flush();
|
||||
void assertValidRegisterState();
|
||||
|
||||
private:
|
||||
void evictSomething();
|
||||
void invalidate(FrameEntry *fe);
|
||||
RegisterID getDataReg(FrameEntry *vi, FrameEntry *backing);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user