void __qmljs_llvm_typeof(ExecutionContext *ctx, Value *result, const Value *value)
{
- *result = __qmljs_builtin_typeof(*value, ctx);
+ __qmljs_builtin_typeof(ctx, result, *value);
}
void __qmljs_llvm_throw(ExecutionContext *context, Value *value)
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinTypeofSubscript)
- VALUE(instr.result) = __qmljs_builtin_typeof_element(VALUE(instr.base), VALUE(instr.index), context);
+ __qmljs_builtin_typeof_element(context, VALUEPTR(instr.result), VALUE(instr.base), VALUE(instr.index));
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinTypeofName)
- VALUE(instr.result) = __qmljs_builtin_typeof_name(instr.name, context);
+ __qmljs_builtin_typeof_name(context, VALUEPTR(instr.result), instr.name);
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofValue)
- VALUE(instr.result) = __qmljs_builtin_typeof(VALUE(instr.value), context);
+ __qmljs_builtin_typeof(context, VALUEPTR(instr.result), VALUE(instr.value));
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinPostIncMember)
return context->engine->exception;
}
-Value __qmljs_builtin_typeof(Value value, ExecutionContext *ctx)
+void __qmljs_builtin_typeof(ExecutionContext *ctx, Value *result, const Value &value)
{
+ if (!result)
+ return;
switch (value.type()) {
case Value::Undefined_Type:
- return __qmljs_string_literal_undefined(ctx);
+ *result =__qmljs_string_literal_undefined(ctx);
break;
case Value::Null_Type:
- return __qmljs_string_literal_object(ctx);
+ *result = __qmljs_string_literal_object(ctx);
break;
case Value::Boolean_Type:
- return __qmljs_string_literal_boolean(ctx);
+ *result =__qmljs_string_literal_boolean(ctx);
break;
case Value::String_Type:
- return __qmljs_string_literal_string(ctx);
+ *result = __qmljs_string_literal_string(ctx);
break;
case Value::Object_Type:
if (__qmljs_is_callable(value, ctx))
- return __qmljs_string_literal_function(ctx);
+ *result =__qmljs_string_literal_function(ctx);
else
- return __qmljs_string_literal_object(ctx); // ### implementation-defined
+ *result = __qmljs_string_literal_object(ctx); // ### implementation-defined
break;
default:
- return __qmljs_string_literal_number(ctx);
+ *result =__qmljs_string_literal_number(ctx);
break;
}
}
-Value __qmljs_builtin_typeof_name(String *name, ExecutionContext *context)
+void __qmljs_builtin_typeof_name(ExecutionContext *context, Value *result, String *name)
{
- return __qmljs_builtin_typeof(context->getPropertyNoThrow(name), context);
+ if (result)
+ __qmljs_builtin_typeof(context, result, context->getPropertyNoThrow(name));
}
void __qmljs_builtin_typeof_member(ExecutionContext *context, Value *result, const Value &base, String *name)
{
Value obj = base.toObject(context);
if (result)
- *result = __qmljs_builtin_typeof(obj.objectValue()->__get__(context, name), context);
+ __qmljs_builtin_typeof(context, result, obj.objectValue()->__get__(context, name));
}
-Value __qmljs_builtin_typeof_element(Value base, Value index, ExecutionContext *context)
+void __qmljs_builtin_typeof_element(ExecutionContext *context, Value *result, const Value &base, const Value &index)
{
String *name = index.toString(context);
Value obj = base.toObject(context);
- return __qmljs_builtin_typeof(obj.objectValue()->__get__(context, name), context);
+ if (result)
+ __qmljs_builtin_typeof(context, result, obj.objectValue()->__get__(context, name));
}
void __qmljs_builtin_post_increment(ExecutionContext *ctx, Value *result, Value *val)
Value __qmljs_construct_property(ExecutionContext *context, Value base, String *name, Value *args, int argc);
Value __qmljs_construct_value(ExecutionContext *context, Value func, Value *args, int argc);
-Value __qmljs_builtin_typeof(Value val, ExecutionContext *ctx);
-Value __qmljs_builtin_typeof_name(String *name, ExecutionContext *context);
+void __qmljs_builtin_typeof(ExecutionContext *ctx, Value *result, const Value &val);
+void __qmljs_builtin_typeof_name(ExecutionContext *context, Value* result, String *name);
void __qmljs_builtin_typeof_member(ExecutionContext* context, Value* result, const Value &base, String *name);
-Value __qmljs_builtin_typeof_element(Value base, Value index, ExecutionContext *context);
+void __qmljs_builtin_typeof_element(ExecutionContext* context, Value *result, const Value &base, const Value &index);
void __qmljs_builtin_post_increment(ExecutionContext *ctx, Value *result, Value *val);
void __qmljs_builtin_post_increment_name(ExecutionContext *context, Value *result, String *name);
void InstructionSelection::callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof_element, base, index, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_element, Assembler::ContextRegister, Assembler::PointerToValue(result), Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof_name, identifier(name), Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_name, Assembler::ContextRegister, Assembler::PointerToValue(result), identifier(name));
}
void InstructionSelection::callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof, value, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof, Assembler::ContextRegister, Assembler::PointerToValue(result), Assembler::PointerToValue(value));
}
void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result)