On 11/22/2011 06:49 PM, Holger Hans Peter Freyther wrote:
> Hi all,
>
> I want to run QtDeclarative on MIPS and I will need to apply the QML changes
> for this backend. I wonder about the pro/cons of having implementation and
> tests separated in two different repositories.
Hi Aaron,
I think there is no Gerrit for V8 changes itself. I have patched the MIPS
FullCodeGenerator like it is patched in ARM for the QmlGlobalObjectOperand.
The test case in QtV8 are passing now. It would be great if the initial commit
message would go into some more details when and when not to use
QmlGlobalObjectOperand() and when and when not to use RelocInfo::CODE_TARGET.
E.g. why does this not use CODE_TARGET?
FullCodeGenerator::EmitVariableAssignment
__ ldr(r1,
var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->StoreIC_Initialize_Strict()
: isolate()->builtins()->StoreIC_Initialize();
__ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
thanks
holger
PS: Will work on the global compare tomorrow.
>From fd8c8d1f07eb31f3cd3acb65b438cd80bdcbf272 Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <[email protected]>
Date: Tue, 22 Nov 2011 22:37:05 +0100
Subject: [PATCH] mips: Patch in QmlGlobalObjectOperand into the MIPS code.
There is no Lithium support for MIPS, only full code generation is
patched with ARM as the role model. The QmlMode patches pass now.
If this get's squashed into the QmlMode patch... then 'resolve' -> 'resolved'
[Thread debugging using libthread_db enabled]
********* Start testing of tst_v8 *********
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_v8::initTestCase()
PASS : tst_v8::eval()
PASS : tst_v8::evalwithinwith()
FAIL: /data/qt/mips/Qt/qtbase/tests/auto/v8/v8test.cpp:275 userObjectComparisonCalled == 1
FAIL! : tst_v8::userobjectcompare() 'v8test_userobjectcompare()' returned FALSE. ()
Loc: [/data/qt/mips/Qt/qtbase/tests/auto/v8/tst_v8.cpp(76)]
PASS : tst_v8::externalteardown()
PASS : tst_v8::globalcall()
PASS : tst_v8::cleanupTestCase()
Totals: 6 passed, 1 failed, 0 skipped
********* Finished testing of tst_v8 *********
[Inferior 1 (process 714) exited with code 01]
---
src/mips/code-stubs-mips.cc | 5 +++++
src/mips/full-codegen-mips.cc | 30 ++++++++++++++++++------------
src/mips/macro-assembler-mips.h | 5 +++++
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 85e929d..a534b78 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -173,6 +173,11 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
__ lw(a1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ sw(a1, MemOperand(v0, Context::SlotOffset(Context::GLOBAL_INDEX)));
+ // Copy the qml global object from the surrounding context.
+ __ lw(a1, MemOperand(cp, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
+ __ sw(a1, MemOperand(v0, Context::SlotOffset(Context::QML_GLOBAL_INDEX)));
+
+
// Initialize the rest of the slots to undefined.
__ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 2f989bc..b6bd407 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -191,12 +191,13 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
// Possibly allocate a local context.
int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
- if (heap_slots > 0) {
+ if (heap_slots > 0 ||
+ (scope()->is_qml_mode() && scope()->is_global_scope())) {
Comment cmnt(masm_, "[ Allocate local context");
// Argument to NewContext is the function, which is in a1.
__ push(a1);
if (heap_slots <= FastNewContextStub::kMaximumSlots) {
- FastNewContextStub stub(heap_slots);
+ FastNewContextStub stub((heap_slots < 0)?0:heap_slots);
__ CallStub(&stub);
} else {
__ CallRuntime(Runtime::kNewFunctionContext, 1);
@@ -1199,9 +1200,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
__ bind(&fast);
}
- __ lw(a0, GlobalObjectOperand());
+ __ lw(a0, var->is_qml_global() ? QmlGlobalObjectOperand():GlobalObjectOperand());
__ li(a2, Operand(var->name()));
- RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
+ RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF || var->is_qml_global())
? RelocInfo::CODE_TARGET
: RelocInfo::CODE_TARGET_CONTEXT;
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
@@ -1286,10 +1287,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
Comment cmnt(masm_, "Global variable");
// Use inline caching. Variable name is passed in a2 and the global
// object (receiver) in a0.
- __ lw(a0, GlobalObjectOperand());
+ __ lw(a0, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
__ li(a2, Operand(var->name()));
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
- __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
+ __ Call(ic, var->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
context()->Plug(v0);
break;
}
@@ -1937,7 +1938,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
// Global var, const, or let.
__ mov(a0, result_register());
__ li(a2, Operand(var->name()));
- __ lw(a1, GlobalObjectOperand());
+ __ lw(a1, var->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
Handle<Code> ic = is_strict_mode()
? isolate()->builtins()->StoreIC_Initialize_Strict()
: isolate()->builtins()->StoreIC_Initialize();
@@ -2246,9 +2247,14 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
__ li(a1, Operand(Smi::FromInt(strict_mode)));
__ push(a1);
+
+ // Push the qml mode flag.
+ __ li(a1, Operand(Smi::FromInt(is_qml_mode())));
+ __ push(a1);
+
__ CallRuntime(flag == SKIP_CONTEXT_LOOKUP
? Runtime::kResolvePossiblyDirectEvalNoLookup
- : Runtime::kResolvePossiblyDirectEval, 4);
+ : Runtime::kResolvePossiblyDirectEval, 5);
}
@@ -2320,9 +2326,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
context()->DropAndPlug(1, v0);
} else if (proxy != NULL && proxy->var()->IsUnallocated()) {
// Push global object as receiver for the call IC.
- __ lw(a0, GlobalObjectOperand());
+ __ lw(a0, proxy->var()->is_qml_global()?QmlGlobalObjectOperand():GlobalObjectOperand());
__ push(a0);
- EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
+ EmitCallWithIC(expr, proxy->name(), proxy->var()->is_qml_global()?RelocInfo::CODE_TARGET:RelocInfo::CODE_TARGET_CONTEXT);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
// Call to a lookup slot (dynamically introduced variable).
Label slow, done;
@@ -3743,7 +3749,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
// but "delete this" is allowed.
ASSERT(strict_mode_flag() == kNonStrictMode || var->is_this());
if (var->IsUnallocated()) {
- __ lw(a2, GlobalObjectOperand());
+ __ lw(a2, var->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
__ li(a1, Operand(var->name()));
__ li(a0, Operand(Smi::FromInt(kNonStrictMode)));
__ Push(a2, a1, a0);
@@ -4032,7 +4038,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
VariableProxy* proxy = expr->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "Global variable");
- __ lw(a0, GlobalObjectOperand());
+ __ lw(a0, proxy->var()->is_qml_global() ? QmlGlobalObjectOperand() : GlobalObjectOperand());
__ li(a2, Operand(proxy->name()));
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
// Use a regular load, not a contextual load, to avoid a reference
diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h
index 84c55f7..5224db9 100644
--- a/src/mips/macro-assembler-mips.h
+++ b/src/mips/macro-assembler-mips.h
@@ -112,6 +112,11 @@ static inline MemOperand GlobalObjectOperand() {
}
+static inline MemOperand QmlGlobalObjectOperand() {
+ return ContextOperand(cp, Context::QML_GLOBAL_INDEX);
+}
+
+
// Generate a MemOperand for loading a field from an object.
static inline MemOperand FieldMemOperand(Register object, int offset) {
return MemOperand(object, offset - kHeapObjectTag);
--
1.7.7.3
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development