From 1056456cb580d6eed1c6344c4114695ef315d7fd Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 14 Feb 2013 14:07:57 +0100 Subject: Move call/construct over into the new vtable. Change-Id: I4f58a1fac25440695bdc62a49adb51a887616a5c Reviewed-by: Simon Hausmann --- tools/v4/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index 7a6e7361..998a315d 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -74,10 +74,11 @@ using namespace QQmlJS::VM; struct Print: FunctionObject { Print(ExecutionContext *scope): FunctionObject(scope) { + vtbl = &static_vtbl; name = scope->engine->newString("print"); } - virtual Value call(ExecutionContext *ctx, Value, Value *args, int argc) + static Value call(Managed *, ExecutionContext *ctx, const Value &, Value *args, int argc) { for (int i = 0; i < argc; ++i) { String *s = args[i].toString(ctx); @@ -88,22 +89,31 @@ struct Print: FunctionObject std::cout << std::endl; return Value::undefinedValue(); } + + static const ManagedVTable static_vtbl; }; +DEFINE_MANAGED_VTABLE(Print); + struct GC: public FunctionObject { GC(ExecutionContext* scope) : FunctionObject(scope) { + vtbl = &static_vtbl; name = scope->engine->newString("gc"); } - virtual Value call(ExecutionContext *ctx, Value, Value *, int) + static Value call(Managed *, ExecutionContext *ctx, const Value &, Value *args, int argc) { ctx->engine->memoryManager->runGC(); return Value::undefinedValue(); } + + static const ManagedVTable static_vtbl; }; +DEFINE_MANAGED_VTABLE(GC); + } // builtins static void showException(QQmlJS::VM::ExecutionContext *ctx) -- cgit v1.2.3