Fix nx representation of call expressions.
authorRoberto Raggi <roberto.raggi@nokia.com>
Tue, 8 May 2012 12:54:05 +0000 (14:54 +0200)
committerRoberto Raggi <roberto.raggi@nokia.com>
Tue, 8 May 2012 12:54:05 +0000 (14:54 +0200)
qmljs_runtime.cpp
qv4codegen.cpp
qv4isel.cpp

index ae6d505..29cb423 100644 (file)
@@ -358,7 +358,8 @@ void __qmljs_call_activation_property(Context *context, Value *result, String *n
             context->formals = f->formalParameterList;
             context->formalCount = f->formalParameterCount;
             f->call(context);
-            __qmljs_copy(result, &context->result);
+            if (result)
+                __qmljs_copy(result, &context->result);
         } else {
             Q_ASSERT(!"not a function");
         }
index d6685c3..f350dfb 100644 (file)
@@ -875,9 +875,7 @@ bool Codegen::visit(CallExpression *ast)
         (*args_it)->init(actual);
         args_it = &(*args_it)->next;
     }
-    const unsigned t = _block->newTemp();
-    _block->MOVE(_block->TEMP(t), _block->CALL(*base, args));
-    _expr.code = _block->TEMP(t);
+    _expr.code = _block->CALL(*base, args);
     return false;
 }
 
index 06a9715..fa99eac 100644 (file)
@@ -194,17 +194,24 @@ void InstructionSelection::callActivationProperty(IR::Call *call, IR::Temp *resu
 
     String *id = identifier(*call->base->asName()->id);
     amd64_mov_reg_reg(_codePtr, AMD64_RDI, AMD64_R15, 8);
-    loadTempAddress(AMD64_RSI, result);
+    if (result)
+        loadTempAddress(AMD64_RSI, result);
+    else
+        amd64_alu_reg_reg(_codePtr, X86_XOR, AMD64_RSI, AMD64_RSI);
     amd64_mov_reg_imm(_codePtr, AMD64_RDX, id);
     amd64_call_code(_codePtr, __qmljs_call_activation_property);
     amd64_mov_reg_reg(_codePtr, AMD64_RDI, AMD64_R15, 8);
     amd64_call_code(_codePtr, __qmljs_dispose_context);
 }
 
-void InstructionSelection::visitExp(IR::Exp *)
+void InstructionSelection::visitExp(IR::Exp *s)
 {
-//    Q_UNIMPLEMENTED();
-//    assert(!"TODO");
+    if (IR::Call *c = s->expr->asCall()) {
+        callActivationProperty(c, 0);
+        return;
+    }
+    Q_UNIMPLEMENTED();
+    assert(!"TODO");
 }
 
 void InstructionSelection::visitEnter(IR::Enter *)