aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_masm_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-05 14:49:55 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-11 13:01:54 +0200
commita23158a41291055aa0f546869e4c9f8efb19c2dc (patch)
tree747b5daced2a361724953ff7d45d6c4e87870a6f /src/qml/compiler/qv4isel_masm_p.h
parent6e8e5d16e16d6ee683a5c06a24f8f202ed5239ff (diff)
Generate CallData structures directly in the instruction selection
Like this we can hand the CallData through the runtime methods without any need to modify them. This simplifies the code in there, and should also speed them up to some degree. Change-Id: Ibd92ff4a8f279a5c4a054c5678646f658cfed5ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_masm_p.h')
-rw-r--r--src/qml/compiler/qv4isel_masm_p.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h
index 58d37208b9..1119c433a3 100644
--- a/src/qml/compiler/qv4isel_masm_p.h
+++ b/src/qml/compiler/qv4isel_masm_p.h
@@ -269,7 +269,7 @@ public:
public:
StackLayout(V4IR::Function *function, int maxArgCountForBuiltins)
: calleeSavedRegCount(Assembler::calleeSavedRegisterCount + 1)
- , maxOutgoingArgumentCount(qMax(function->maxNumberOfArguments, maxArgCountForBuiltins))
+ , maxOutgoingArgumentCount(function->maxNumberOfArguments)
, localCount(function->tempCount)
, savedConstCount(maxArgCountForBuiltins)
{
@@ -295,7 +295,7 @@ public:
+ RegisterSize; // saved StackFrameRegister
// space for the callee saved registers
- int frameSize = RegisterSize * calleeSavedRegisterCount;
+ int frameSize = RegisterSize * (calleeSavedRegisterCount + savedConstCount);
frameSize = WTF::roundUpToMultipleOf(StackAlignment, frameSize + stackSpaceAllocatedOtherwise);
frameSize -= stackSpaceAllocatedOtherwise;
@@ -305,7 +305,7 @@ public:
int calculateJSStackFrameSize() const
{
- const int locals = (maxOutgoingArgumentCount + localCount + savedConstCount) + 1;
+ const int locals = (localCount + sizeof(QV4::CallData)/sizeof(QV4::Value) - 1 + maxOutgoingArgumentCount) + 1;
int frameSize = locals * sizeof(QV4::Value);
return frameSize;
}
@@ -315,7 +315,7 @@ public:
Q_ASSERT(idx >= 0);
Q_ASSERT(idx < localCount);
- Pointer addr = argumentAddressForCall(0);
+ Pointer addr = callDataAddress(0);
addr.offset -= sizeof(QV4::Value) * (idx + 1);
return addr;
}
@@ -328,8 +328,11 @@ public:
Q_ASSERT(argument < maxOutgoingArgumentCount);
const int index = maxOutgoingArgumentCount - argument;
- return Pointer(Assembler::LocalsRegister,
- sizeof(QV4::Value) * (-index) - calleeSavedRegisterSpace());
+ return Pointer(Assembler::LocalsRegister, sizeof(QV4::Value) * (-index));
+ }
+
+ Pointer callDataAddress(int offset = 0) const {
+ return Pointer(Assembler::LocalsRegister, -(sizeof(QV4::CallData) + sizeof(QV4::Value) * (maxOutgoingArgumentCount - 1)) + offset);
}
Address savedRegPointer(int offset) const
@@ -1255,6 +1258,11 @@ protected:
return _as->stackLayout().argumentAddressForCall(0);
}
+ Pointer baseAddressForCallData()
+ {
+ return _as->stackLayout().callDataAddress();
+ }
+
virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
@@ -1329,6 +1337,7 @@ private:
_as->generateFunctionCallImp(t, isel_stringIfy(function), function, __VA_ARGS__)
int prepareVariableArguments(V4IR::ExprList* args);
+ int prepareCallData(V4IR::ExprList* args, V4IR::Expr *thisObject);
typedef void (*ActivationMethod)(QV4::ExecutionContext *, QV4::Value *result, QV4::String *name, QV4::Value *args, int argc);
void callRuntimeMethodImp(V4IR::Temp *result, const char* name, ActivationMethod method, V4IR::Expr *base, V4IR::ExprList *args);