Cleanup function prototypes.
authorRoberto Raggi <roberto.raggi@nokia.com>
Tue, 15 May 2012 08:53:20 +0000 (10:53 +0200)
committerRoberto Raggi <roberto.raggi@nokia.com>
Tue, 15 May 2012 08:53:33 +0000 (10:53 +0200)
main.cpp
qmljs_objects.cpp
qmljs_objects.h
qmljs_runtime.cpp
qmljs_runtime.h
qv4ecmaobjects.cpp
qv4isel.cpp

index e2feac9..dec537a 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -89,12 +89,12 @@ void evaluate(QQmlJS::VM::ExecutionEngine *vm, QQmlJS::Engine *engine, const QSt
         VM::Context *ctx = vm->rootContext;
 
         globalObject->put(vm->identifier(QLatin1String("print")),
-                          VM::Value::object(ctx, new builtins::Print(ctx)));
+                          VM::Value::fromObject(new builtins::Print(ctx)));
 
         foreach (IR::Function *function, module.functions) {
             if (function->name && ! function->name->isEmpty()) {
                 globalObject->put(vm->identifier(*function->name),
-                                  VM::Value::object(ctx, ctx->engine->newScriptFunction(ctx, function)));
+                                  VM::Value::fromObject(ctx->engine->newScriptFunction(ctx, function)));
             }
         }
         codeByName.value(QLatin1String("%entry"))->code(ctx);
index fd9647e..2e77b4d 100644 (file)
@@ -25,7 +25,7 @@ void Object::setProperty(Context *ctx, const QString &name, const Value &value)
 void Object::setProperty(Context *ctx, const QString &name, void (*code)(Context *), int count)
 {
     Q_UNUSED(count);
-    setProperty(ctx, name, Value::object(ctx, ctx->engine->newNativeFunction(ctx, code)));
+    setProperty(ctx, name, Value::fromObject(ctx->engine->newNativeFunction(ctx, code)));
 }
 
 bool Object::get(String *name, Value *result)
@@ -35,7 +35,7 @@ bool Object::get(String *name, Value *result)
         return true;
     }
 
-    __qmljs_init_undefined(0, result);
+    __qmljs_init_undefined(result);
     return false;
 }
 
@@ -107,11 +107,11 @@ void Object::defaultValue(Context *ctx, Value *result, int typeHint)
 {
     if (typeHint == STRING_HINT) {
         if (asFunctionObject() != 0)
-            __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("function")));
+            __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("function")));
         else
-            __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("object")));
+            __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("object")));
     } else {
-        __qmljs_init_undefined(ctx, result);
+        __qmljs_init_undefined(result);
     }
 }
 
@@ -129,7 +129,7 @@ void FunctionObject::call(Context *ctx)
 
 void FunctionObject::construct(Context *ctx)
 {
-    __qmljs_init_object(ctx, &ctx->thisObject, ctx->engine->newObject());
+    __qmljs_init_object(&ctx->thisObject, ctx->engine->newObject());
     call(ctx);
 }
 
@@ -159,7 +159,7 @@ void ScriptFunction::call(VM::Context *ctx)
 
 void ScriptFunction::construct(VM::Context *ctx)
 {
-    __qmljs_init_object(ctx, &ctx->thisObject, ctx->engine->newObject());
+    __qmljs_init_object(&ctx->thisObject, ctx->engine->newObject());
     function->code(ctx);
 }
 
@@ -189,8 +189,8 @@ ExecutionEngine::ExecutionEngine()
     // set up the global object
     //
     VM::Object *glo = newArgumentsObject(rootContext);
-    __qmljs_init_object(rootContext, &globalObject, glo);
-    __qmljs_init_object(rootContext, &rootContext->activation, glo);
+    __qmljs_init_object(&globalObject, glo);
+    __qmljs_init_object(&rootContext->activation, glo);
 
     objectCtor = ObjectCtor::create(this);
     stringCtor = StringCtor::create(this);
@@ -202,10 +202,10 @@ ExecutionEngine::ExecutionEngine()
     stringCtor.objectValue->get(prototype, &stringPrototype);
     numberCtor.objectValue->get(prototype, &numberPrototype);
 
-    glo->put(VM::String::get(rootContext, QLatin1String("Object")), objectCtor);
-    glo->put(VM::String::get(rootContext, QLatin1String("String")), stringCtor);
-    glo->put(VM::String::get(rootContext, QLatin1String("Number")), numberCtor);
-    glo->put(VM::String::get(rootContext, QLatin1String("Math")), Value::object(rootContext, newMathObject(rootContext)));
+    glo->put(identifier(QLatin1String("Object")), objectCtor);
+    glo->put(identifier(QLatin1String("String")), stringCtor);
+    glo->put(identifier(QLatin1String("Number")), numberCtor);
+    glo->put(identifier(QLatin1String("Math")), Value::fromObject(newMathObject(rootContext)));
 }
 
 Context *ExecutionEngine::newContext()
index 26987a2..9326e9a 100644 (file)
@@ -316,7 +316,7 @@ struct Context {
         if (index < argumentCount)
             *result = arguments[index];
         else
-            __qmljs_init_undefined(this, result);
+            __qmljs_init_undefined(result);
     }
 
     void init(ExecutionEngine *eng)
index 4f7418f..8054a60 100644 (file)
@@ -9,9 +9,9 @@
 namespace QQmlJS {
 namespace VM {
 
-Value Value::string(Context *ctx, const QString &s)
+Value Value::fromString(Context *ctx, const QString &s)
 {
-    return string(ctx, String::get(ctx, s));
+    return fromString(ctx->engine->newString(s));
 }
 
 int Value::toInt32(double number)
@@ -74,52 +74,52 @@ extern "C" {
 
 void __qmljs_init_closure(Context *ctx, Value *result, IR::Function *clos)
 {
-    __qmljs_init_object(ctx, result, ctx->engine->newScriptFunction(ctx, clos));
+    __qmljs_init_object(result, ctx->engine->newScriptFunction(ctx, clos));
 }
 
 void __qmljs_string_literal_undefined(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("undefined")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("undefined")));
 }
 
 void __qmljs_string_literal_null(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("null")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("null")));
 }
 
 void __qmljs_string_literal_true(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("true")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("true")));
 }
 
 void __qmljs_string_literal_false(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("false")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("false")));
 }
 
 void __qmljs_string_literal_object(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("object")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("object")));
 }
 
 void __qmljs_string_literal_boolean(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("boolean")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("boolean")));
 }
 
 void __qmljs_string_literal_number(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("number")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("number")));
 }
 
 void __qmljs_string_literal_string(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("string")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("string")));
 }
 
 void __qmljs_string_literal_function(Context *ctx, Value *result)
 {
-    __qmljs_init_string(ctx, result, ctx->engine->identifier(QLatin1String("function")));
+    __qmljs_init_string(result, ctx->engine->identifier(QLatin1String("function")));
 }
 
 void __qmljs_delete(Context *ctx, Value *result, const Value *value)
@@ -136,7 +136,7 @@ void __qmljs_instanceof(Context *ctx, Value *result, const Value *left, const Va
     if (right->type == OBJECT_TYPE) {
         if (FunctionObject *function = right->objectValue->asFunctionObject()) {
             bool r = function->hasInstance(*left);
-            __qmljs_init_boolean(ctx, result, r);
+            __qmljs_init_boolean(result, r);
             return;
         }
     }
@@ -150,7 +150,7 @@ void __qmljs_in(Context *ctx, Value *result, const Value *left, const Value *rig
         Value s;
         __qmljs_to_string(ctx, &s, left);
         bool r = right->objectValue->hasProperty(s.stringValue);
-        __qmljs_init_boolean(ctx, result, r);
+        __qmljs_init_boolean(result, r);
     } else {
         __qmljs_throw_type_error(ctx, result);
     }
@@ -170,7 +170,7 @@ double __qmljs_string_to_number(Context *, String *string)
 void __qmljs_string_from_number(Context *ctx, Value *result, double number)
 {
     String *string = String::get(ctx, QString::number(number, 'g', 16));
-    __qmljs_init_string(ctx, result, string);
+    __qmljs_init_string(result, string);
 }
 
 bool __qmljs_string_compare(Context *, String *left, String *right)
@@ -203,29 +203,29 @@ void __qmljs_object_default_value(Context *ctx, Value *result, Object *object, i
 
 void __qmljs_throw_type_error(Context *ctx, Value *result)
 {
-    __qmljs_init_object(ctx, result, ctx->engine->newErrorObject(Value::string(ctx, QLatin1String("type error"))));
+    __qmljs_init_object(result, ctx->engine->newErrorObject(Value::fromString(ctx, QLatin1String("type error"))));
 }
 
 void __qmljs_new_boolean_object(Context *ctx, Value *result, bool boolean)
 {
     Value value;
-    __qmljs_init_boolean(ctx, &value, boolean);
-    __qmljs_init_object(ctx, result, ctx->engine->newBooleanObject(value));
+    __qmljs_init_boolean(&value, boolean);
+    __qmljs_init_object(result, ctx->engine->newBooleanObject(value));
 }
 
 void __qmljs_new_number_object(Context *ctx, Value *result, double number)
 {
     Value value;
-    __qmljs_init_number(ctx, &value, number);
-    __qmljs_init_object(ctx, result, ctx->engine->newNumberObject(value));
+    __qmljs_init_number(&value, number);
+    __qmljs_init_object(result, ctx->engine->newNumberObject(value));
     result->objectValue->prototype = ctx->engine->numberPrototype.objectValue;
 }
 
 void __qmljs_new_string_object(Context *ctx, Value *result, String *string)
 {
     Value value;
-    __qmljs_init_string(ctx, &value, string);
-    __qmljs_init_object(ctx, result, ctx->engine->newStringObject(value));
+    __qmljs_init_string(&value, string);
+    __qmljs_init_object(result, ctx->engine->newStringObject(value));
     result->objectValue->prototype = ctx->engine->stringPrototype.objectValue;
 }
 
@@ -238,21 +238,21 @@ void __qmljs_set_property(Context *ctx, Value *object, String *name, Value *valu
 void __qmljs_set_property_boolean(Context *ctx, Value *object, String *name, bool number)
 {
     Value value;
-    __qmljs_init_boolean(ctx, &value, number);
+    __qmljs_init_boolean(&value, number);
     object->objectValue->put(name, value, /*flag*/ 0);
 }
 
 void __qmljs_set_property_number(Context *ctx, Value *object, String *name, double number)
 {
     Value value;
-    __qmljs_init_number(ctx, &value, number);
+    __qmljs_init_number(&value, number);
     object->objectValue->put(name, value, /*flag*/ 0);
 }
 
 void __qmljs_set_property_string(Context *ctx, Value *object, String *name, String *s)
 {
     Value value;
-    __qmljs_init_string(ctx, &value, s);
+    __qmljs_init_string(&value, s);
     object->objectValue->put(name, value, /*flag*/ 0);
 }
 
@@ -282,21 +282,21 @@ void __qmljs_copy_activation_property(Context *ctx, String *name, String *other)
 void __qmljs_set_activation_property_boolean(Context *ctx, String *name, bool b)
 {
     Value value;
-    __qmljs_init_boolean(ctx, &value, b);
+    __qmljs_init_boolean(&value, b);
     __qmljs_set_activation_property(ctx, name, &value);
 }
 
 void __qmljs_set_activation_property_number(Context *ctx, String *name, double number)
 {
     Value value;
-    __qmljs_init_number(ctx, &value, number);
+    __qmljs_init_number(&value, number);
     __qmljs_set_activation_property(ctx, name, &value);
 }
 
 void __qmljs_set_activation_property_string(Context *ctx, String *name, String *string)
 {
     Value value;
-    __qmljs_init_string(ctx, &value, string);
+    __qmljs_init_string(&value, string);
     __qmljs_set_activation_property(ctx, name, &value);
 }
 
@@ -359,14 +359,14 @@ void __qmljs_compare(Context *ctx, Value *result, const Value *x, const Value *y
 
     if (px.type == STRING_TYPE && py.type == STRING_TYPE) {
         bool r = __qmljs_string_compare(ctx, px.stringValue, py.stringValue);
-        __qmljs_init_boolean(ctx, result, r);
+        __qmljs_init_boolean(result, r);
     } else {
         double nx = __qmljs_to_number(ctx, &px);
         double ny = __qmljs_to_number(ctx, &py);
         if (isnan(nx) || isnan(ny)) {
-            __qmljs_init_undefined(ctx, result);
+            __qmljs_init_undefined(result);
         } else {
-            __qmljs_init_boolean(ctx, result, nx < ny);
+            __qmljs_init_boolean(result, nx < ny);
         }
     }
 }
@@ -397,19 +397,19 @@ bool __qmljs_equal(Context *ctx, const Value *x, const Value *y)
             return true;
         } else if (x->type == NUMBER_TYPE && y->type == STRING_TYPE) {
             Value ny;
-            __qmljs_init_number(ctx, &ny, __qmljs_to_number(ctx, y));
+            __qmljs_init_number(&ny, __qmljs_to_number(ctx, y));
             return __qmljs_equal(ctx, x, &ny);
         } else if (x->type == STRING_TYPE && y->type == NUMBER_TYPE) {
             Value nx;
-            __qmljs_init_number(ctx, &nx, __qmljs_to_number(ctx, x));
+            __qmljs_init_number(&nx, __qmljs_to_number(ctx, x));
             return __qmljs_equal(ctx, &nx, y);
         } else if (x->type == BOOLEAN_TYPE) {
             Value nx;
-            __qmljs_init_number(ctx, &nx, (double) x->booleanValue);
+            __qmljs_init_number(&nx, (double) x->booleanValue);
             return __qmljs_equal(ctx, &nx, y);
         } else if (y->type == BOOLEAN_TYPE) {
             Value ny;
-            __qmljs_init_number(ctx, &ny, (double) y->booleanValue);
+            __qmljs_init_number(&ny, (double) y->booleanValue);
             return __qmljs_equal(ctx, x, &ny);
         } else if ((x->type == NUMBER_TYPE || x->type == STRING_TYPE) && y->type == OBJECT_TYPE) {
             Value py;
@@ -446,7 +446,7 @@ void __qmljs_call_property(Context *context, Value *result, const Value *base, S
         thisObject = baseObject;
     } else {
         baseObject = context->activation;
-        __qmljs_init_null(context, &thisObject);
+        __qmljs_init_null(&thisObject);
     }
     Value func;
     baseObject.objectValue->get(name, &func);
@@ -457,9 +457,9 @@ void __qmljs_call_property(Context *context, Value *result, const Value *base, S
             ctx->init(context->engine);
             ctx->parent = f->scope;
             if (f->needsActivation)
-                __qmljs_init_object(ctx, &ctx->activation, ctx->engine->newArgumentsObject(ctx));
+                __qmljs_init_object(&ctx->activation, ctx->engine->newArgumentsObject(ctx));
             else
-                __qmljs_init_null(ctx, &ctx->activation);
+                __qmljs_init_null(&ctx->activation);
             ctx->thisObject = thisObject;
             ctx->formals = f->formalParameterList;
             ctx->formalCount = f->formalParameterCount;
@@ -491,10 +491,10 @@ void __qmljs_call_value(Context *context, Value *result, const Value *func, Valu
             ctx->init(context->engine);
             ctx->parent = f->scope;
             if (f->needsActivation)
-                __qmljs_init_object(ctx, &ctx->activation, ctx->engine->newArgumentsObject(ctx));
+                __qmljs_init_object(&ctx->activation, ctx->engine->newArgumentsObject(ctx));
             else
-                __qmljs_init_null(ctx, &ctx->activation);
-            __qmljs_init_null(ctx, &ctx->thisObject);
+                __qmljs_init_null(&ctx->activation);
+            __qmljs_init_null(&ctx->thisObject);
             ctx->formals = f->formalParameterList;
             ctx->formalCount = f->formalParameterCount;
             ctx->arguments = args;
@@ -533,10 +533,10 @@ void __qmljs_construct_value(Context *context, Value *result, const Value *func,
             ctx->init(context->engine);
             ctx->parent = f->scope;
             if (f->needsActivation)
-                __qmljs_init_object(ctx, &ctx->activation, ctx->engine->newArgumentsObject(ctx));
+                __qmljs_init_object(&ctx->activation, ctx->engine->newArgumentsObject(ctx));
             else
-                __qmljs_init_null(ctx, &ctx->activation);
-            __qmljs_init_null(ctx, &ctx->thisObject);
+                __qmljs_init_null(&ctx->activation);
+            __qmljs_init_null(&ctx->thisObject);
             ctx->formals = f->formalParameterList;
             ctx->formalCount = f->formalParameterCount;
             ctx->arguments = args;
@@ -581,9 +581,9 @@ void __qmljs_construct_property(Context *context, Value *result, const Value *ba
             ctx->init(context->engine);
             ctx->parent = f->scope;
             if (f->needsActivation)
-                __qmljs_init_object(ctx, &ctx->activation, ctx->engine->newArgumentsObject(ctx));
+                __qmljs_init_object(&ctx->activation, ctx->engine->newArgumentsObject(ctx));
             else
-                __qmljs_init_null(ctx, &ctx->activation);
+                __qmljs_init_null(&ctx->activation);
             ctx->thisObject = thisObject;
             ctx->formals = f->formalParameterList;
             ctx->formalCount = f->formalParameterCount;
index 2a0f42d..b2b9987 100644 (file)
@@ -53,13 +53,13 @@ void __qmljs_construct_property(Context *context, Value *result, const Value *ba
 void __qmljs_construct_value(Context *context, Value *result, const Value *func, Value *args, int argc);
 
 // constructors
-void __qmljs_init_undefined(Context *ctx, Value *result);
-void __qmljs_init_null(Context *ctx, Value *result);
-void __qmljs_init_boolean(Context *ctx, Value *result, bool value);
-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);
+void __qmljs_init_undefined(Value *result);
+void __qmljs_init_null(Value *result);
+void __qmljs_init_boolean(Value *result, bool value);
+void __qmljs_init_number(Value *result, double number);
+void __qmljs_init_string(Value *result, String *string);
+void __qmljs_init_object(Value *result, Object *object);
+void __qmljs_init_closure(Context *ctx, Value *result, IR::Function *clos);
 
 bool __qmljs_is_function(Context *ctx, const Value *value);
 
@@ -174,33 +174,33 @@ struct Value {
     inline bool is(ValueType t) const { return type == t; }
     inline bool isNot(ValueType t) const { return type != t; }
 
-    static inline Value boolean(Context *ctx, bool value) {
+    static inline Value fromBoolean(bool value) {
         Value v;
-        __qmljs_init_boolean(ctx, &v, value);
+        __qmljs_init_boolean(&v, value);
         return v;
     }
 
-    static inline Value number(Context *ctx, double value) {
+    static inline Value fromNumber(double value) {
         Value v;
-        __qmljs_init_number(ctx, &v, value);
+        __qmljs_init_number(&v, value);
         return v;
     }
 
-    static inline Value object(Context *ctx, Object *value) {
+    static inline Value fromObject(Object *value) {
         Value v;
-        __qmljs_init_object(ctx, &v, value);
+        __qmljs_init_object(&v, value);
         return v;
     }
 
-    static inline Value string(Context *ctx, String *value) {
+    static inline Value fromString(String *value) {
         Value v;
-        __qmljs_init_string(ctx, &v, value);
+        __qmljs_init_string(&v, value);
         return v;
     }
 
-    static Value string(Context *ctx, const QString &string);
+    static Value fromString(Context *ctx, const QString &fromString);
 
-    static int toInteger(double number);
+    static int toInteger(double fromNumber);
     static int toInt32(double value);
     int toUInt16(Context *ctx);
     int toInt32(Context *ctx);
@@ -221,35 +221,35 @@ struct Value {
 extern "C" {
 
 // constructors
-inline void __qmljs_init_undefined(Context *, Value *result)
+inline void __qmljs_init_undefined(Value *result)
 {
     result->type = UNDEFINED_TYPE;
 }
 
-inline void __qmljs_init_null(Context *, Value *result)
+inline void __qmljs_init_null(Value *result)
 {
     result->type = NULL_TYPE;
 }
 
-inline void __qmljs_init_boolean(Context *, Value *result, bool value)
+inline void __qmljs_init_boolean(Value *result, bool value)
 {
     result->type = BOOLEAN_TYPE;
     result->booleanValue = value;
 }
 
-inline void __qmljs_init_number(Context *, Value *result, double value)
+inline void __qmljs_init_number(Value *result, double value)
 {
     result->type = NUMBER_TYPE;
     result->numberValue = value;
 }
 
-inline void __qmljs_init_string(Context *, Value *result, String *value)
+inline void __qmljs_init_string(Value *result, String *value)
 {
     result->type = STRING_TYPE;
     result->stringValue = value;
 }
 
-inline void __qmljs_init_object(Context *, Value *result, Object *object)
+inline void __qmljs_init_object(Value *result, Object *object)
 {
     result->type = OBJECT_TYPE;
     result->objectValue = object;
@@ -437,7 +437,7 @@ inline void __qmljs_default_value(Context *ctx, Value *result, const Value *valu
     if (value->type == OBJECT_TYPE)
         __qmljs_object_default_value(ctx, result, value->objectValue, typeHint);
     else
-        __qmljs_init_undefined(ctx, result);
+        __qmljs_init_undefined(result);
 }
 
 
@@ -472,25 +472,25 @@ inline void __qmljs_typeof(Context *ctx, Value *result, const Value *value)
 inline void __qmljs_uplus(Context *ctx, Value *result, const Value *value)
 {
     double n = __qmljs_to_number(ctx, value);
-    __qmljs_init_number(ctx, result, n);
+    __qmljs_init_number(result, n);
 }
 
 inline void __qmljs_uminus(Context *ctx, Value *result, const Value *value)
 {
     double n = __qmljs_to_number(ctx, value);
-    __qmljs_init_number(ctx, result, -n);
+    __qmljs_init_number(result, -n);
 }
 
 inline void __qmljs_compl(Context *ctx, Value *result, const Value *value)
 {
     int n = __qmljs_to_int32(ctx, value);
-    __qmljs_init_number(ctx, result, ~n);
+    __qmljs_init_number(result, ~n);
 }
 
 inline void __qmljs_not(Context *ctx, Value *result, const Value *value)
 {
     bool b = __qmljs_to_boolean(ctx, value);
-    __qmljs_init_number(ctx, result, !b);
+    __qmljs_init_number(result, !b);
 }
 
 // binary operators
@@ -498,21 +498,21 @@ inline void __qmljs_bit_or(Context *ctx, Value *result, const Value *left, const
 {
     int lval = __qmljs_to_int32(ctx, left);
     int rval = __qmljs_to_int32(ctx, right);
-    __qmljs_init_number(ctx, result, lval | rval);
+    __qmljs_init_number(result, lval | rval);
 }
 
 inline void __qmljs_bit_xor(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     int lval = __qmljs_to_int32(ctx, left);
     int rval = __qmljs_to_int32(ctx, right);
-    __qmljs_init_number(ctx, result, lval ^ rval);
+    __qmljs_init_number(result, lval ^ rval);
 }
 
 inline void __qmljs_bit_and(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     int lval = __qmljs_to_int32(ctx, left);
     int rval = __qmljs_to_int32(ctx, right);
-    __qmljs_init_number(ctx, result, lval & rval);
+    __qmljs_init_number(result, lval & rval);
 }
 
 inline void __qmljs_add(Context *ctx, Value *result, const Value *left, const Value *right)
@@ -526,11 +526,11 @@ inline void __qmljs_add(Context *ctx, Value *result, const Value *left, const Va
         if (pright.type != STRING_TYPE)
             __qmljs_to_string(ctx, &pright, &pright);
         String *string = __qmljs_string_concat(ctx, pleft.stringValue, pright.stringValue);
-        __qmljs_init_string(ctx, result, string);
+        __qmljs_init_string(result, string);
     } else {
         double x = __qmljs_to_number(ctx, &pleft);
         double y = __qmljs_to_number(ctx, &pright);
-        __qmljs_init_number(ctx, result, x + y);
+        __qmljs_init_number(result, x + y);
     }
 }
 
@@ -538,49 +538,49 @@ inline void __qmljs_sub(Context *ctx, Value *result, const Value *left, const Va
 {
     double lval = __qmljs_to_number(ctx, left);
     double rval = __qmljs_to_number(ctx, right);
-    __qmljs_init_number(ctx, result, lval - rval);
+    __qmljs_init_number(result, lval - rval);
 }
 
 inline void __qmljs_mul(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     double lval = __qmljs_to_number(ctx, left);
     double rval = __qmljs_to_number(ctx, right);
-    __qmljs_init_number(ctx, result, lval * rval);
+    __qmljs_init_number(result, lval * rval);
 }
 
 inline void __qmljs_div(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     double lval = __qmljs_to_number(ctx, left);
     double rval = __qmljs_to_number(ctx, right);
-    __qmljs_init_number(ctx, result, lval * rval);
+    __qmljs_init_number(result, lval * rval);
 }
 
 inline void __qmljs_mod(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     double lval = __qmljs_to_number(ctx, left);
     double rval = __qmljs_to_number(ctx, right);
-    __qmljs_init_number(ctx, result, fmod(lval, rval));
+    __qmljs_init_number(result, fmod(lval, rval));
 }
 
 inline void __qmljs_shl(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     int lval = __qmljs_to_int32(ctx, left);
     unsigned rval = __qmljs_to_uint32(ctx, right);
-    __qmljs_init_number(ctx, result, lval << rval);
+    __qmljs_init_number(result, lval << rval);
 }
 
 inline void __qmljs_shr(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     int lval = __qmljs_to_int32(ctx, left);
     unsigned rval = __qmljs_to_uint32(ctx, right);
-    __qmljs_init_number(ctx, result, lval >> rval);
+    __qmljs_init_number(result, lval >> rval);
 }
 
 inline void __qmljs_ushr(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     unsigned lval = __qmljs_to_uint32(ctx, left);
     unsigned rval = __qmljs_to_uint32(ctx, right);
-    __qmljs_init_number(ctx, result, lval << rval);
+    __qmljs_init_number(result, lval << rval);
 }
 
 inline void __qmljs_gt(Context *ctx, Value *result, const Value *left, const Value *right)
@@ -588,7 +588,7 @@ inline void __qmljs_gt(Context *ctx, Value *result, const Value *left, const Val
     __qmljs_compare(ctx, result, left, right, false);
 
     if (result->type == UNDEFINED_TYPE)
-        __qmljs_init_boolean(ctx, result, false);
+        __qmljs_init_boolean(result, false);
 }
 
 inline void __qmljs_lt(Context *ctx, Value *result, const Value *left, const Value *right)
@@ -596,7 +596,7 @@ inline void __qmljs_lt(Context *ctx, Value *result, const Value *left, const Val
     __qmljs_compare(ctx, result, left, right, true);
 
     if (result->type == UNDEFINED_TYPE)
-        __qmljs_init_boolean(ctx, result,false);
+        __qmljs_init_boolean(result, false);
 }
 
 inline void __qmljs_ge(Context *ctx, Value *result, const Value *left, const Value *right)
@@ -606,7 +606,7 @@ inline void __qmljs_ge(Context *ctx, Value *result, const Value *left, const Val
     bool r = ! (result->type == UNDEFINED_TYPE ||
                 (result->type == BOOLEAN_TYPE && result->booleanValue == true));
 
-    __qmljs_init_boolean(ctx, result, r);
+    __qmljs_init_boolean(result, r);
 }
 
 inline void __qmljs_le(Context *ctx, Value *result, const Value *left, const Value *right)
@@ -616,31 +616,31 @@ inline void __qmljs_le(Context *ctx, Value *result, const Value *left, const Val
     bool r = ! (result->type == UNDEFINED_TYPE ||
                 (result->type == BOOLEAN_TYPE && result->booleanValue == true));
 
-    __qmljs_init_boolean(ctx, result, r);
+    __qmljs_init_boolean(result, r);
 }
 
 inline void __qmljs_eq(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     bool r = __qmljs_equal(ctx, left, right);
-    __qmljs_init_boolean(ctx, result, r);
+    __qmljs_init_boolean(result, r);
 }
 
 inline void __qmljs_ne(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     bool r = ! __qmljs_equal(ctx, left, right);
-    __qmljs_init_boolean(ctx, result, r);
+    __qmljs_init_boolean(result, r);
 }
 
 inline void __qmljs_se(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     bool r = __qmljs_strict_equal(ctx, left, right);
-    __qmljs_init_boolean(ctx, result, r);
+    __qmljs_init_boolean(result, r);
 }
 
 inline void __qmljs_sne(Context *ctx, Value *result, const Value *left, const Value *right)
 {
     bool r = ! __qmljs_strict_equal(ctx, left, right);
-    __qmljs_init_boolean(ctx, result, r);
+    __qmljs_init_boolean(result, r);
 }
 
 inline bool __qmljs_strict_equal(Context *ctx, const Value *x, const Value *y)
index 33e444a..74d1484 100644 (file)
@@ -15,8 +15,8 @@ Value ObjectCtor::create(ExecutionEngine *engine)
 {
     Context *ctx = engine->rootContext;
     FunctionObject *ctor = ctx->engine->newObjectCtor(ctx);
-    ctor->setProperty(ctx, QLatin1String("prototype"), Value::object(ctx, ctx->engine->newObjectPrototype(ctx, ctor)));
-    return Value::object(ctx, ctor);
+    ctor->setProperty(ctx, QLatin1String("prototype"), Value::fromObject(ctx->engine->newObjectPrototype(ctx, ctor)));
+    return Value::fromObject(ctor);
 }
 
 ObjectCtor::ObjectCtor(Context *scope)
@@ -26,7 +26,7 @@ ObjectCtor::ObjectCtor(Context *scope)
 
 void ObjectCtor::construct(Context *ctx)
 {
-    __qmljs_init_object(ctx, &ctx->thisObject, ctx->engine->newObject());
+    __qmljs_init_object(&ctx->thisObject, ctx->engine->newObject());
 }
 
 void ObjectCtor::call(Context *)
@@ -36,7 +36,7 @@ void ObjectCtor::call(Context *)
 
 ObjectPrototype::ObjectPrototype(Context *ctx, FunctionObject *ctor)
 {
-    setProperty(ctx, QLatin1String("constructor"), Value::object(ctx, ctor));
+    setProperty(ctx, QLatin1String("constructor"), Value::fromObject(ctor));
 }
 
 //
@@ -46,8 +46,8 @@ Value StringCtor::create(ExecutionEngine *engine)
 {
     Context *ctx = engine->rootContext;
     FunctionObject *ctor = ctx->engine->newStringCtor(ctx);
-    ctor->setProperty(ctx, QLatin1String("prototype"), Value::object(ctx, ctx->engine->newStringPrototype(ctx, ctor)));
-    return Value::object(ctx, ctor);
+    ctor->setProperty(ctx, QLatin1String("prototype"), Value::fromObject(ctx->engine->newStringPrototype(ctx, ctor)));
+    return Value::fromObject(ctor);
 }
 
 StringCtor::StringCtor(Context *scope)
@@ -59,24 +59,24 @@ void StringCtor::construct(Context *ctx)
 {
     Value value;
     if (ctx->argumentCount)
-        value = Value::string(ctx, ctx->argument(0).toString(ctx));
+        value = Value::fromString(ctx->argument(0).toString(ctx));
     else
-        value = Value::string(ctx, QString());
-    __qmljs_init_object(ctx, &ctx->thisObject, ctx->engine->newStringObject(value));
+        value = Value::fromString(ctx, QString());
+    __qmljs_init_object(&ctx->thisObject, ctx->engine->newStringObject(value));
 }
 
 void StringCtor::call(Context *ctx)
 {
     const Value arg = ctx->argument(0);
     if (arg.is(UNDEFINED_TYPE))
-        __qmljs_init_string(ctx, &ctx->result, String::get(ctx, QString()));
+        __qmljs_init_string(&ctx->result, String::get(ctx, QString()));
     else
         __qmljs_to_string(ctx, &ctx->result, &arg);
 }
 
 StringPrototype::StringPrototype(Context *ctx, FunctionObject *ctor)
 {
-    setProperty(ctx, QLatin1String("constructor"), Value::object(ctx, ctor));
+    setProperty(ctx, QLatin1String("constructor"), Value::fromObject(ctor));
     setProperty(ctx, QLatin1String("toString"), method_toString);
     setProperty(ctx, QLatin1String("valueOf"), method_valueOf);
     setProperty(ctx, QLatin1String("charAt"), method_charAt);
@@ -129,7 +129,7 @@ void StringPrototype::method_charAt(Context *ctx)
     if (pos >= 0 && pos < str.length())
         result += str.at(pos);
 
-    ctx->result = Value::string(ctx, result);
+    ctx->result = Value::fromString(ctx, result);
 }
 
 void StringPrototype::method_charCodeAt(Context *ctx)
@@ -145,7 +145,7 @@ void StringPrototype::method_charCodeAt(Context *ctx)
     if (pos >= 0 && pos < str.length())
         result = str.at(pos).unicode();
 
-    __qmljs_init_number(ctx, &ctx->result, result);
+    __qmljs_init_number(&ctx->result, result);
 }
 
 void StringPrototype::method_concat(Context *ctx)
@@ -159,7 +159,7 @@ void StringPrototype::method_concat(Context *ctx)
         value += v.stringValue->toQString();
     }
 
-    ctx->result = Value::string(ctx, value);
+    ctx->result = Value::fromString(ctx, value);
 }
 
 void StringPrototype::method_indexOf(Context *ctx)
@@ -178,7 +178,7 @@ void StringPrototype::method_indexOf(Context *ctx)
     if (! value.isEmpty())
         index = value.indexOf(searchString, qMin(qMax(pos, 0), value.length()));
 
-    __qmljs_init_number(ctx, &ctx->result, index);
+    __qmljs_init_number(&ctx->result, index);
 }
 
 void StringPrototype::method_lastIndexOf(Context *ctx)
@@ -203,14 +203,14 @@ void StringPrototype::method_lastIndexOf(Context *ctx)
     if (!searchString.isEmpty() && pos == value.length())
         --pos;
     int index = value.lastIndexOf(searchString, pos);
-    __qmljs_init_number(ctx, &ctx->result, index);
+    __qmljs_init_number(&ctx->result, index);
 }
 
 void StringPrototype::method_localeCompare(Context *ctx)
 {
     const QString value = getThisString(ctx);
     const QString that = ctx->argument(0).toString(ctx)->toQString();
-    __qmljs_init_number(ctx, &ctx->result, QString::localeAwareCompare(value, that));
+    __qmljs_init_number(&ctx->result, QString::localeAwareCompare(value, that));
 }
 
 void StringPrototype::method_match(Context *)
@@ -251,7 +251,7 @@ void StringPrototype::method_slice(Context *ctx)
         end = qMin(end, length);
 
     int count = qMax(0, end - start);
-    ctx->result = Value::string(ctx, text.mid(start, count));
+    ctx->result = Value::fromString(ctx, text.mid(start, count));
 }
 
 void StringPrototype::method_split(Context *)
@@ -280,7 +280,7 @@ void StringPrototype::method_substr(Context *ctx)
 
     qint32 x = Value::toInt32(start);
     qint32 y = Value::toInt32(length);
-    ctx->result = Value::string(ctx, value.mid(x, y));
+    ctx->result = Value::fromString(ctx, value.mid(x, y));
 }
 
 void StringPrototype::method_substring(Context *ctx)
@@ -317,13 +317,13 @@ void StringPrototype::method_substring(Context *ctx)
 
     qint32 x = Value::toInt32(start);
     qint32 y = Value::toInt32(end - start);
-    ctx->result = Value::string(ctx, value.mid(x, y));
+    ctx->result = Value::fromString(ctx, value.mid(x, y));
 }
 
 void StringPrototype::method_toLowerCase(Context *ctx)
 {
     QString value = getThisString(ctx);
-    ctx->result = Value::string(ctx, value.toLower());
+    ctx->result = Value::fromString(ctx, value.toLower());
 }
 
 void StringPrototype::method_toLocaleLowerCase(Context *ctx)
@@ -334,7 +334,7 @@ void StringPrototype::method_toLocaleLowerCase(Context *ctx)
 void StringPrototype::method_toUpperCase(Context *ctx)
 {
     QString value = getThisString(ctx);
-    ctx->result = Value::string(ctx, value.toUpper());
+    ctx->result = Value::fromString(ctx, value.toUpper());
 }
 
 void StringPrototype::method_toLocaleUpperCase(Context *ctx)
@@ -349,7 +349,7 @@ void StringPrototype::method_fromCharCode(Context *ctx)
         QChar c(ctx->argument(i).toUInt16(ctx));
         str += c;
     }
-    ctx->result = Value::string(ctx, str);
+    ctx->result = Value::fromString(ctx, str);
 }
 
 //
@@ -359,8 +359,8 @@ Value NumberCtor::create(ExecutionEngine *engine)
 {
     Context *ctx = engine->rootContext;
     FunctionObject *ctor = ctx->engine->newNumberCtor(ctx);
-    ctor->setProperty(ctx, QLatin1String("prototype"), Value::object(ctx, ctx->engine->newNumberPrototype(ctx, ctor)));
-    return Value::object(ctx, ctor);
+    ctor->setProperty(ctx, QLatin1String("prototype"), Value::fromObject(ctx->engine->newNumberPrototype(ctx, ctor)));
+    return Value::fromObject(ctor);
 }
 
 NumberCtor::NumberCtor(Context *scope)
@@ -371,31 +371,31 @@ NumberCtor::NumberCtor(Context *scope)
 void NumberCtor::construct(Context *ctx)
 {
     const double n = ctx->argument(0).toNumber(ctx);
-    __qmljs_init_object(ctx, &ctx->thisObject, ctx->engine->newNumberObject(Value::number(ctx, n)));
+    __qmljs_init_object(&ctx->thisObject, ctx->engine->newNumberObject(Value::fromNumber(n)));
 }
 
 void NumberCtor::call(Context *ctx)
 {
     double value = ctx->argumentCount ? ctx->argument(0).toNumber(ctx) : 0;
-    __qmljs_init_number(ctx, &ctx->result, value);
+    __qmljs_init_number(&ctx->result, value);
 }
 
 NumberPrototype::NumberPrototype(Context *ctx, FunctionObject *ctor)
 {
-    ctor->setProperty(ctx, QLatin1String("NaN"), Value::number(ctx, qSNaN()));
-    ctor->setProperty(ctx, QLatin1String("NEGATIVE_INFINITY"), Value::number(ctx, -qInf()));
-    ctor->setProperty(ctx, QLatin1String("POSITIVE_INFINITY"), Value::number(ctx, qInf()));
-    ctor->setProperty(ctx, QLatin1String("MAX_VALUE"), Value::number(ctx, 1.7976931348623158e+308));
+    ctor->setProperty(ctx, QLatin1String("NaN"), Value::fromNumber(qSNaN()));
+    ctor->setProperty(ctx, QLatin1String("NEGATIVE_INFINITY"), Value::fromNumber(-qInf()));
+    ctor->setProperty(ctx, QLatin1String("POSITIVE_INFINITY"), Value::fromNumber(qInf()));
+    ctor->setProperty(ctx, QLatin1String("MAX_VALUE"), Value::fromNumber(1.7976931348623158e+308));
 #ifdef __INTEL_COMPILER
 # pragma warning( push )
 # pragma warning(disable: 239)
 #endif
-    ctor->setProperty(ctx, QLatin1String("MIN_VALUE"), Value::number(ctx, 5e-324));
+    ctor->setProperty(ctx, QLatin1String("MIN_VALUE"), Value::fromNumber(5e-324));
 #ifdef __INTEL_COMPILER
 # pragma warning( pop )
 #endif
 
-    setProperty(ctx, QLatin1String("constructor"), Value::object(ctx, ctor));
+    setProperty(ctx, QLatin1String("constructor"), Value::fromObject(ctor));
     setProperty(ctx, QLatin1String("toString"), method_toString);
     setProperty(ctx, QLatin1String("toLocalString"), method_toLocaleString);
     setProperty(ctx, QLatin1String("valueOf"), method_valueOf);
@@ -426,10 +426,10 @@ void NumberPrototype::method_toString(Context *ctx)
             QString str;
             double num = internalValue.toNumber(ctx);
             if (qIsNaN(num)) {
-                ctx->result = Value::string(ctx, QLatin1String("NaN"));
+                ctx->result = Value::fromString(ctx, QLatin1String("NaN"));
                 return;
             } else if (qIsInf(num)) {
-                ctx->result = Value::string(ctx, QLatin1String(num < 0 ? "-Infinity" : "Infinity"));
+                ctx->result = Value::fromString(ctx, QLatin1String(num < 0 ? "-Infinity" : "Infinity"));
                 return;
             }
             bool negative = false;
@@ -457,7 +457,7 @@ void NumberPrototype::method_toString(Context *ctx)
             }
             if (negative)
                 str.prepend(QLatin1Char('-'));
-            ctx->result = Value::string(ctx, str);
+            ctx->result = Value::fromString(ctx, str);
             return;
         }
     }
@@ -466,7 +466,7 @@ void NumberPrototype::method_toString(Context *ctx)
     self.objectValue->defaultValue(ctx, &internalValue, NUMBER_HINT);
 
     String *str = internalValue.toString(ctx);
-    ctx->result = Value::string(ctx, str);
+    ctx->result = Value::fromString(str);
 }
 
 void NumberPrototype::method_toLocaleString(Context *ctx)
@@ -480,7 +480,7 @@ void NumberPrototype::method_toLocaleString(Context *ctx)
     Value internalValue;
     self.objectValue->defaultValue(ctx, &internalValue, STRING_HINT);
     String *str = internalValue.toString(ctx);
-    ctx->result = Value::string(ctx, str);
+    ctx->result = Value::fromString(str);
 }
 
 void NumberPrototype::method_valueOf(Context *ctx)
@@ -523,7 +523,7 @@ void NumberPrototype::method_toFixed(Context *ctx)
         str = QString::fromLatin1(v < 0 ? "-Infinity" : "Infinity");
     else
         str = QString::number(v, 'f', int (fdigits));
-    ctx->result = Value::string(ctx, str);
+    ctx->result = Value::fromString(ctx, str);
 }
 
 void NumberPrototype::method_toExponential(Context *ctx)
@@ -544,7 +544,7 @@ void NumberPrototype::method_toExponential(Context *ctx)
 
     double v = internalValue.toNumber(ctx);
     QString z = QString::number(v, 'e', int (fdigits));
-    ctx->result = Value::string(ctx, z);
+    ctx->result = Value::fromString(ctx, z);
 }
 
 void NumberPrototype::method_toPrecision(Context *ctx)
@@ -564,7 +564,7 @@ void NumberPrototype::method_toPrecision(Context *ctx)
     self.objectValue->defaultValue(ctx, &internalValue, NUMBER_HINT);
 
     double v = internalValue.toNumber(ctx);
-    ctx->result = Value::string(ctx, QString::number(v, 'g', int (fdigits)));
+    ctx->result = Value::fromString(ctx, QString::number(v, 'g', int (fdigits)));
 }
 
 //
@@ -572,14 +572,14 @@ void NumberPrototype::method_toPrecision(Context *ctx)
 //
 MathObject::MathObject(Context *ctx)
 {
-    setProperty(ctx, QLatin1String("E"), Value::number(ctx, ::exp(1.0)));
-    setProperty(ctx, QLatin1String("LN2"), Value::number(ctx, ::log(2.0)));
-    setProperty(ctx, QLatin1String("LN10"), Value::number(ctx, ::log(10.0)));
-    setProperty(ctx, QLatin1String("LOG2E"), Value::number(ctx, 1.0/::log(2.0)));
-    setProperty(ctx, QLatin1String("LOG10E"), Value::number(ctx, 1.0/::log(10.0)));
-    setProperty(ctx, QLatin1String("PI"), Value::number(ctx, qt_PI));
-    setProperty(ctx, QLatin1String("SQRT1_2"), Value::number(ctx, ::sqrt(0.5)));
-    setProperty(ctx, QLatin1String("SQRT2"), Value::number(ctx, ::sqrt(2.0)));
+    setProperty(ctx, QLatin1String("E"), Value::fromNumber(::exp(1.0)));
+    setProperty(ctx, QLatin1String("LN2"), Value::fromNumber(::log(2.0)));
+    setProperty(ctx, QLatin1String("LN10"), Value::fromNumber(::log(10.0)));
+    setProperty(ctx, QLatin1String("LOG2E"), Value::fromNumber(1.0/::log(2.0)));
+    setProperty(ctx, QLatin1String("LOG10E"), Value::fromNumber(1.0/::log(10.0)));
+    setProperty(ctx, QLatin1String("PI"), Value::fromNumber(qt_PI));
+    setProperty(ctx, QLatin1String("SQRT1_2"), Value::fromNumber(::sqrt(0.5)));
+    setProperty(ctx, QLatin1String("SQRT2"), Value::fromNumber(::sqrt(2.0)));
 
     setProperty(ctx, QLatin1String("abs"), method_abs, 1);
     setProperty(ctx, QLatin1String("acos"), method_acos, 1);
@@ -617,36 +617,36 @@ void MathObject::method_abs(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v == 0) // 0 | -0
-        ctx->result = Value::number(ctx, 0);
+        ctx->result = Value::fromNumber(0);
     else
-        ctx->result = Value::number(ctx, v < 0 ? -v : v);
+        ctx->result = Value::fromNumber(v < 0 ? -v : v);
 }
 
 void MathObject::method_acos(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v > 1)
-        ctx->result = Value::number(ctx, qSNaN());
+        ctx->result = Value::fromNumber(qSNaN());
     else
-        ctx->result = Value::number(ctx, ::acos(v));
+        ctx->result = Value::fromNumber(::acos(v));
 }
 
 void MathObject::method_asin(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v > 1)
-        ctx->result = Value::number(ctx, qSNaN());
+        ctx->result = Value::fromNumber(qSNaN());
     else
-        ctx->result = Value::number(ctx, ::asin(v));
+        ctx->result = Value::fromNumber(::asin(v));
 }
 
 void MathObject::method_atan(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v == 0.0)
-        ctx->result = Value::number(ctx, v);
+        ctx->result = Value::fromNumber(v);
     else
-        ctx->result = Value::number(ctx, ::atan(v));
+        ctx->result = Value::fromNumber(::atan(v));
 }
 
 void MathObject::method_atan2(Context *ctx)
@@ -654,34 +654,34 @@ void MathObject::method_atan2(Context *ctx)
     double v1 = ctx->argument(0).toNumber(ctx);
     double v2 = ctx->argument(1).toNumber(ctx);
     if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0)) {
-        ctx->result = Value::number(ctx, copySign(0, -1.0));
+        ctx->result = Value::fromNumber(copySign(0, -1.0));
         return;
     }
     if ((v1 == 0.0) && (v2 == 0.0)) {
         if ((copySign(1.0, v1) == 1.0) && (copySign(1.0, v2) == -1.0)) {
-            ctx->result = Value::number(ctx, qt_PI);
+            ctx->result = Value::fromNumber(qt_PI);
             return;
         } else if ((copySign(1.0, v1) == -1.0) && (copySign(1.0, v2) == -1.0)) {
-            ctx->result = Value::number(ctx, -qt_PI);
+            ctx->result = Value::fromNumber(-qt_PI);
             return;
         }
     }
-    ctx->result = Value::number(ctx, ::atan2(v1, v2));
+    ctx->result = Value::fromNumber(::atan2(v1, v2));
 }
 
 void MathObject::method_ceil(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v < 0.0 && v > -1.0)
-        ctx->result = Value::number(ctx, copySign(0, -1.0));
+        ctx->result = Value::fromNumber(copySign(0, -1.0));
     else
-        ctx->result = Value::number(ctx, ::ceil(v));
+        ctx->result = Value::fromNumber(::ceil(v));
 }
 
 void MathObject::method_cos(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
-    ctx->result = Value::number(ctx, ::cos(v));
+    ctx->result = Value::fromNumber(::cos(v));
 }
 
 void MathObject::method_exp(Context *ctx)
@@ -689,27 +689,27 @@ void MathObject::method_exp(Context *ctx)
     double v = ctx->argument(0).toNumber(ctx);
     if (qIsInf(v)) {
         if (copySign(1.0, v) == -1.0)
-            ctx->result = Value::number(ctx, 0);
+            ctx->result = Value::fromNumber(0);
         else
-            ctx->result = Value::number(ctx, qInf());
+            ctx->result = Value::fromNumber(qInf());
     } else {
-        ctx->result = Value::number(ctx, ::exp(v));
+        ctx->result = Value::fromNumber(::exp(v));
     }
 }
 
 void MathObject::method_floor(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
-    ctx->result = Value::number(ctx, ::floor(v));
+    ctx->result = Value::fromNumber(::floor(v));
 }
 
 void MathObject::method_log(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v < 0)
-        ctx->result = Value::number(ctx, qSNaN());
+        ctx->result = Value::fromNumber(qSNaN());
     else
-        ctx->result = Value::number(ctx, ::log(v));
+        ctx->result = Value::fromNumber(::log(v));
 }
 
 void MathObject::method_max(Context *ctx)
@@ -720,7 +720,7 @@ void MathObject::method_max(Context *ctx)
         if (x > mx || qIsNaN(x))
             mx = x;
     }
-    ctx->result = Value::number(ctx, mx);
+    ctx->result = Value::fromNumber(mx);
 }
 
 void MathObject::method_min(Context *ctx)
@@ -733,7 +733,7 @@ void MathObject::method_min(Context *ctx)
             mx = x;
         }
     }
-    ctx->result = Value::number(ctx, mx);
+    ctx->result = Value::fromNumber(mx);
 }
 
 void MathObject::method_pow(Context *ctx)
@@ -742,27 +742,27 @@ void MathObject::method_pow(Context *ctx)
     double y = ctx->argument(1).toNumber(ctx);
 
     if (qIsNaN(y)) {
-        ctx->result = Value::number(ctx, qSNaN());
+        ctx->result = Value::fromNumber(qSNaN());
         return;
     }
 
     if (y == 0) {
-        ctx->result = Value::number(ctx, 1);
+        ctx->result = Value::fromNumber(1);
     } else if (((x == 1) || (x == -1)) && qIsInf(y)) {
-        ctx->result = Value::number(ctx, qSNaN());
+        ctx->result = Value::fromNumber(qSNaN());
     } else if (((x == 0) && copySign(1.0, x) == 1.0) && (y < 0)) {
-        ctx->result = Value::number(ctx, qInf());
+        ctx->result = Value::fromNumber(qInf());
     } else if ((x == 0) && copySign(1.0, x) == -1.0) {
         if (y < 0) {
             if (::fmod(-y, 2.0) == 1.0)
-                ctx->result = Value::number(ctx, -qInf());
+                ctx->result = Value::fromNumber(-qInf());
             else
-                ctx->result = Value::number(ctx, qInf());
+                ctx->result = Value::fromNumber(qInf());
         } else if (y > 0) {
             if (::fmod(y, 2.0) == 1.0)
-                ctx->result = Value::number(ctx, copySign(0, -1.0));
+                ctx->result = Value::fromNumber(copySign(0, -1.0));
             else
-                ctx->result = Value::number(ctx, 0);
+                ctx->result = Value::fromNumber(0);
         }
     }
 
@@ -782,39 +782,39 @@ void MathObject::method_pow(Context *ctx)
     }
 #endif
     else {
-        ctx->result = Value::number(ctx, ::pow(x, y));
+        ctx->result = Value::fromNumber(::pow(x, y));
     }
 }
 
 void MathObject::method_random(Context *ctx)
 {
-    ctx->result = Value::number(ctx, qrand() / (double) RAND_MAX);
+    ctx->result = Value::fromNumber(qrand() / (double) RAND_MAX);
 }
 
 void MathObject::method_round(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     v = copySign(::floor(v + 0.5), v);
-    ctx->result = Value::number(ctx, v);
+    ctx->result = Value::fromNumber(v);
 }
 
 void MathObject::method_sin(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
-    ctx->result = Value::number(ctx, ::sin(v));
+    ctx->result = Value::fromNumber(::sin(v));
 }
 
 void MathObject::method_sqrt(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
-    ctx->result = Value::number(ctx, ::sqrt(v));
+    ctx->result = Value::fromNumber(::sqrt(v));
 }
 
 void MathObject::method_tan(Context *ctx)
 {
     double v = ctx->argument(0).toNumber(ctx);
     if (v == 0.0)
-        ctx->result = Value::number(ctx, v);
+        ctx->result = Value::fromNumber(v);
     else
-        ctx->result = Value::number(ctx, ::tan(v));
+        ctx->result = Value::fromNumber(::tan(v));
 }
index 573c3d5..d99bfc2 100644 (file)
@@ -472,9 +472,8 @@ void InstructionSelection::visitMove(IR::Move *s)
                 amd64_mov_membase_reg(_codePtr, AMD64_RDI, offsetof(Value, numberValue), AMD64_RAX, 8);
                 return;
             } else if (IR::String *str = s->source->asString()) {
-                amd64_mov_reg_reg(_codePtr, AMD64_RDI, AMD64_R14, 8);
-                loadTempAddress(AMD64_RSI, t);
-                amd64_mov_reg_imm(_codePtr, AMD64_RDX, _engine->newString(*str->value));
+                loadTempAddress(AMD64_RDI, t);
+                amd64_mov_reg_imm(_codePtr, AMD64_RSI, _engine->newString(*str->value));
                 amd64_call_code(_codePtr, __qmljs_init_string);
                 return;
             } else if (IR::Closure *clos = s->source->asClosure()) {