};
struct instr_loadClosure {
MOTH_INSTR_HEADER
- QV4::Function *value;
+ int value;
Param result;
};
struct instr_loadName {
void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
- QV4::Function *vmFunc = _irToVM[closure->value];
- assert(vmFunc);
- generateFunctionCall(Assembler::Void, __qmljs_init_closure, Assembler::ContextRegister, Assembler::PointerToValue(target), Assembler::TrustedImmPtr(vmFunc));
+ int id = jsUnitGenerator.irModule->functions.indexOf(closure->value);
+ generateFunctionCall(Assembler::Void, __qmljs_init_closure, Assembler::ContextRegister, Assembler::PointerToValue(target), Assembler::TrustedImm32(id));
}
void InstructionSelection::getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target)
void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
- QV4::Function *vmFunc = _irToVM[closure->value];
- assert(vmFunc);
+ int id = jsUnitGenerator.irModule->functions.indexOf(closure->value);
Instruction::LoadClosure load;
- load.value = vmFunc;
+ load.value = id;
load.result = getResultParam(target);
addInstruction(load);
}
result->prepend(QLatin1Char('-'));
}
-void __qmljs_init_closure(ExecutionContext *ctx, Value *result, Function *clos)
+void __qmljs_init_closure(ExecutionContext *ctx, Value *result, int functionId)
{
+ const QV4::Function *runtimeFunction = ctx->runtimeFunction();
+ QV4::Function *clos = runtimeFunction->compilationUnit->runtimeFunctions[functionId];
assert(clos);
*result = Value::fromObject(ctx->engine->newScriptFunction(ctx, clos));
}
void __qmljs_lookup_runtime_regexp(QV4::ExecutionContext *ctx, QV4::Value *result, int id);
// constructors
-void __qmljs_init_closure(QV4::ExecutionContext *ctx, QV4::Value *result, QV4::Function *clos);
+void __qmljs_init_closure(QV4::ExecutionContext *ctx, QV4::Value *result, int functionId);
// strings
Q_QML_EXPORT double __qmljs_string_to_number(const QString &s);