mips: Add the qml mode to the lithium code generation as well
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>
Tue, 8 May 2012 20:55:37 +0000 (22:55 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 9 May 2012 13:31:45 +0000 (15:31 +0200)
When adding qml mode to the MIPS backend, the MIPS JIT didn't have
support for lithium yet. On the upgrade to 3.10.1 MIPS gained this
support but the qml mode was not patched into the lithium code. Add
the qml mode to lithium based on the patch for the ARM jit.

Change-Id: Ia0aba2fd8b7533f38e864b54aa1d4df1e02f26c7
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
src/3rdparty/v8/src/mips/lithium-codegen-mips.cc
src/3rdparty/v8/src/mips/lithium-mips.cc
src/3rdparty/v8/src/mips/lithium-mips.h

index e4de40f..2270d8b 100644 (file)
@@ -172,12 +172,13 @@ bool LCodeGen::GeneratePrologue() {
 
   // Possibly allocate a local context.
   int heap_slots = 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(";;; 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);
@@ -2825,7 +2826,7 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
 void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
   Register context = ToRegister(instr->context());
   Register result = ToRegister(instr->result());
-  __ lw(result, ContextOperand(cp, Context::GLOBAL_INDEX));
+  __ lw(result, ContextOperand(cp, instr->qml_global()?Context::QML_GLOBAL_INDEX:Context::GLOBAL_INDEX));
 }
 
 
index e0dd801..6bc6d7f 100644 (file)
@@ -1150,7 +1150,7 @@ LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
 
 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
   LOperand* context = UseRegisterAtStart(instr->value());
-  return DefineAsRegister(new(zone()) LGlobalObject(context));
+  return DefineAsRegister(new(zone()) LGlobalObject(context, instr->qml_global()));
 }
 
 
@@ -1225,7 +1225,7 @@ LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
 
 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
   argument_count_ -= instr->argument_count();
-  return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, v0), instr);
+  return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(instr->qml_global()), v0), instr);
 }
 
 
index 952df99..e1fec8b 100644 (file)
@@ -1392,13 +1392,17 @@ class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
 
 class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
  public:
-  explicit LGlobalObject(LOperand* context) {
+  explicit LGlobalObject(LOperand* context, bool qml_global) {
     inputs_[0] = context;
+    qml_global_ = qml_global;
   }
 
   DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
 
   LOperand* context() { return InputAt(0); }
+  bool qml_global() { return qml_global_; }
+ private:
+  bool qml_global_;
 };
 
 
@@ -1490,10 +1494,16 @@ class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
   DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
   DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
 
+  explicit LCallGlobal(bool qml_global) : qml_global_(qml_global) {}
+
   virtual void PrintDataTo(StringStream* stream);
 
   Handle<String> name() const {return hydrogen()->name(); }
   int arity() const { return hydrogen()->argument_count() - 1; }
+
+  bool qml_global() { return qml_global_; }
+ private:
+  bool qml_global_;
 };