From 018af32fc2d902ff47482d0501195f7e0739cdcf Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 11 Dec 2012 14:43:50 +0100 Subject: [PATCH] Cleanup: Added a storeValue() overload that operates on an IR::Temp* Change-Id: Iab23eaa41f4ef4d3f99dccd6d2075fa4ba8e918e Reviewed-by: Lars Knoll --- qv4isel_masm.cpp | 19 ++++++++++--------- qv4isel_masm_p.h | 2 ++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/qv4isel_masm.cpp b/qv4isel_masm.cpp index b3d7b78..09147e4 100644 --- a/qv4isel_masm.cpp +++ b/qv4isel_masm.cpp @@ -117,6 +117,12 @@ void Assembler::copyValue(Result result, Source source) #endif } +void Assembler::storeValue(VM::Value value, IR::Temp* destination) +{ + Address addr = loadTempAddress(ScratchRegister, destination); + storeValue(value, addr); +} + void Assembler::enterStandardStackFrame(int locals) { #if CPU(ARM) @@ -471,9 +477,7 @@ void InstructionSelection::callActivationProperty(IR::Call *call, IR::Temp *resu return; } else if (call->args->expr->asTemp()){ // ### should throw in strict mode - Address dest = _asm->loadTempAddress(Assembler::ScratchRegister, result); - Value v = Value::fromBoolean(false); - _asm->storeValue(v, dest); + _asm->storeValue(Value::fromBoolean(false), result); return; } break; @@ -633,22 +637,19 @@ void InstructionSelection::visitMove(IR::Move *s) } return; } else if (IR::Const *c = s->source->asConst()) { - Address dest = _asm->loadTempAddress(Assembler::ScratchRegister, t); Value v = convertToValue(c); - _asm->storeValue(v, dest); + _asm->storeValue(t, dest); return; } else if (IR::Temp *t2 = s->source->asTemp()) { _asm->copyValue(t, t2); return; } else if (IR::String *str = s->source->asString()) { - Address dest = _asm->loadTempAddress(Assembler::ScratchRegister, t); Value v = Value::fromString(engine()->newString(*str->value)); - _asm->storeValue(v, dest); + _asm->storeValue(v, t); return; } else if (IR::RegExp *re = s->source->asRegExp()) { - Address dest = _asm->loadTempAddress(Assembler::ScratchRegister, t); Value v = Value::fromObject(engine()->newRegExpObject(*re->value, re->flags)); - _asm->storeValue(v, dest); + _asm->storeValue(v, t); return; } else if (IR::Closure *clos = s->source->asClosure()) { VM::Function *vmFunc = vmFunction(clos->value); diff --git a/qv4isel_masm_p.h b/qv4isel_masm_p.h index 243b066..ca32511 100644 --- a/qv4isel_masm_p.h +++ b/qv4isel_masm_p.h @@ -370,6 +370,8 @@ public: #endif } + void storeValue(VM::Value value, IR::Temp* temp); + void enterStandardStackFrame(int locals); void leaveStandardStackFrame(int locals); -- 2.7.4