From 7578373f465339e45342b75d6112bd0f74c94cc7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 30 Jan 2013 15:10:39 +0100 Subject: [PATCH] Convert a few more builtins into versions that don't need a context Change-Id: I24920f3952cd356d50a056891dc075e56c951775 Reviewed-by: Simon Hausmann --- src/v4/qv4booleanobject.cpp | 4 ++-- src/v4/qv4booleanobject.h | 2 +- src/v4/qv4numberobject.cpp | 4 ++-- src/v4/qv4numberobject.h | 2 +- src/v4/qv4stringobject.cpp | 8 ++++---- src/v4/qv4stringobject.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/v4/qv4booleanobject.cpp b/src/v4/qv4booleanobject.cpp index 9df0f23..640773d 100644 --- a/src/v4/qv4booleanobject.cpp +++ b/src/v4/qv4booleanobject.cpp @@ -54,9 +54,9 @@ Value BooleanCtor::construct(ExecutionContext *ctx) return Value::fromObject(ctx->engine->newBooleanObject(Value::fromBoolean(n))); } -Value BooleanCtor::call(ExecutionContext *ctx) +Value BooleanCtor::call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc) { - bool value = ctx->argumentCount ? ctx->argument(0).toBoolean(ctx) : 0; + bool value = argc ? argv[0].toBoolean(parentCtx) : 0; return Value::fromBoolean(value); } diff --git a/src/v4/qv4booleanobject.h b/src/v4/qv4booleanobject.h index 44d87b1..97dfc50 100644 --- a/src/v4/qv4booleanobject.h +++ b/src/v4/qv4booleanobject.h @@ -53,7 +53,7 @@ struct BooleanCtor: FunctionObject BooleanCtor(ExecutionContext *scope); virtual Value construct(ExecutionContext *ctx); - virtual Value call(ExecutionContext *ctx); + virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc); }; struct BooleanPrototype: BooleanObject diff --git a/src/v4/qv4numberobject.cpp b/src/v4/qv4numberobject.cpp index 08711a8..d732297 100644 --- a/src/v4/qv4numberobject.cpp +++ b/src/v4/qv4numberobject.cpp @@ -60,9 +60,9 @@ Value NumberCtor::construct(ExecutionContext *ctx) return Value::fromObject(ctx->engine->newNumberObject(Value::fromDouble(d))); } -Value NumberCtor::call(ExecutionContext *ctx) +Value NumberCtor::call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc) { - double d = ctx->argumentCount ? ctx->argument(0).toNumber(ctx) : 0; + double d = argc ? argv[0].toNumber(parentCtx) : 0.; return Value::fromDouble(d); } diff --git a/src/v4/qv4numberobject.h b/src/v4/qv4numberobject.h index 85f9e1f..83fb4ad 100644 --- a/src/v4/qv4numberobject.h +++ b/src/v4/qv4numberobject.h @@ -53,7 +53,7 @@ struct NumberCtor: FunctionObject NumberCtor(ExecutionContext *scope); virtual Value construct(ExecutionContext *ctx); - virtual Value call(ExecutionContext *ctx); + virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc); }; struct NumberPrototype: NumberObject diff --git a/src/v4/qv4stringobject.cpp b/src/v4/qv4stringobject.cpp index 4b46fc1..4e0285c 100644 --- a/src/v4/qv4stringobject.cpp +++ b/src/v4/qv4stringobject.cpp @@ -122,13 +122,13 @@ Value StringCtor::construct(ExecutionContext *ctx) return Value::fromObject(ctx->engine->newStringObject(ctx, value)); } -Value StringCtor::call(ExecutionContext *ctx) +Value StringCtor::call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc) { Value value; - if (ctx->argumentCount) - value = Value::fromString(ctx->argument(0).toString(ctx)); + if (argc) + value = Value::fromString(argv[0].toString(parentCtx)); else - value = Value::fromString(ctx, QString()); + value = Value::fromString(parentCtx, QString()); return value; } diff --git a/src/v4/qv4stringobject.h b/src/v4/qv4stringobject.h index 1becd97..306f00c 100644 --- a/src/v4/qv4stringobject.h +++ b/src/v4/qv4stringobject.h @@ -64,7 +64,7 @@ struct StringCtor: FunctionObject StringCtor(ExecutionContext *scope); virtual Value construct(ExecutionContext *ctx); - virtual Value call(ExecutionContext *ctx); + virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc); }; struct StringPrototype: StringObject -- 2.7.4