extern "C" {
+void __qmljs_init_closure(Context *ctx, Value *result, IR::Function *clos)
+{
+ __qmljs_init_object(ctx, result, new ScriptFunction(clos));
+}
+
void __qmljs_string_literal_undefined(Context *ctx, Value *result)
{
__qmljs_init_string(ctx, result, String::get(ctx, QLatin1String("undefined")));
void __qmljs_init_number(Context *ctx, Value *result, double number);
void __qmljs_init_string(Context *ctx, Value *result, String *string);
void __qmljs_init_object(Context *ctx, Value *result, Object *object);
+void __qmljs_init_closure(Context *, Value *result, IR::Function *clos);
bool __qmljs_is_function(Context *ctx, const Value *value);
using namespace QQmlJS::x86_64;
using namespace QQmlJS::VM;
+namespace {
+QTextStream qout(stdout, QIODevice::WriteOnly);
+}
+
static inline void
amd64_patch (unsigned char* code, gpointer target)
{
#ifndef NO_UDIS86
static bool showCode = !qgetenv("SHOW_CODE").isNull();
if (showCode) {
+ printf("code size: %ld bytes\n", (_codePtr - _code));
ud_t ud_obj;
ud_init(&ud_obj);
amd64_mov_reg_imm(_codePtr, AMD64_RDX, new String(*str->value));
amd64_call_code(_codePtr, __qmljs_init_string);
return;
+ } else if (IR::Closure *clos = s->source->asClosure()) {
+ amd64_mov_reg_reg(_codePtr, AMD64_RDI, AMD64_R14, 8);
+ loadTempAddress(AMD64_RSI, t);
+ amd64_mov_reg_imm(_codePtr, AMD64_RDX, clos->value);
+ amd64_call_code(_codePtr, __qmljs_init_closure);
+ return;
} else if (IR::New *ctor = s->source->asNew()) {
constructActivationProperty(ctor, t);
return;
} else {
// inplace assignment, e.g. x += 1, ++x, ...
}
+
Q_UNIMPLEMENTED();
+ s->dump(qout, IR::Stmt::MIR);
+ qout << endl;
assert(!"TODO");
}