Revision: 21229
Author:   [email protected]
Date:     Fri May  9 15:49:42 2014 UTC
Log:      MIPS: Improve Array.shift() performance for small arrays.

Port r21203 (eaa92e4)

TEST=mjsunit/array-shift,mjsunit/array-shift2,mjsunit/array-shift3
BUG=
[email protected]

Review URL: https://codereview.chromium.org/275883002

Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21229

Modified:
 /branches/bleeding_edge/src/mips/code-stubs-mips.cc
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.h

=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Fri May 9 13:01:50 2014 UTC +++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Fri May 9 15:49:42 2014 UTC
@@ -304,6 +304,16 @@
   descriptor->deoptimization_handler_ =
       FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss);
 }
+
+
+void ArrayShiftStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  static Register registers[] = { a0 };
+  descriptor->register_param_count_ = 1;
+  descriptor->register_params_ = registers;
+  descriptor->deoptimization_handler_ =
+      Builtins::c_function_address(Builtins::c_ArrayShift);
+}


 void BinaryOpICStub::InitializeInterfaceDescriptor(
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed May 7 08:42:20 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Fri May 9 15:49:42 2014 UTC
@@ -4440,6 +4440,15 @@
   }
   __ bind(&not_applicable);
 }
+
+
+void LCodeGen::DoArrayShift(LArrayShift* instr) {
+  ASSERT(ToRegister(instr->context()).is(cp));
+  ASSERT(ToRegister(instr->object()).is(a0));
+  ASSERT(ToRegister(instr->result()).is(v0));
+  ArrayShiftStub stub(isolate(), instr->hydrogen()->kind());
+  CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
+}


 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Thu May 8 08:51:51 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-mips.cc Fri May 9 15:49:42 2014 UTC
@@ -2207,6 +2207,14 @@
     return MarkAsCall(result, instr);
   }
 }
+
+
+LInstruction* LChunkBuilder::DoArrayShift(HArrayShift* instr) {
+  LOperand* object = UseFixed(instr->object(), a0);
+  LOperand* context = UseFixed(instr->context(), cp);
+  LArrayShift* result = new(zone()) LArrayShift(context, object);
+ return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
+}


 LInstruction* LChunkBuilder::DoTrapAllocationMemento(
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h Mon May 5 11:03:14 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-mips.h Fri May 9 15:49:42 2014 UTC
@@ -26,6 +26,7 @@
   V(ArgumentsLength)                            \
   V(ArithmeticD)                                \
   V(ArithmeticT)                                \
+  V(ArrayShift)                                 \
   V(BitI)                                       \
   V(BoundsCheck)                                \
   V(Branch)                                     \
@@ -2236,6 +2237,21 @@
 };


+class LArrayShift V8_FINAL : public LTemplateInstruction<1, 2, 0> {
+ public:
+  LArrayShift(LOperand* context, LOperand* object) {
+    inputs_[0] = context;
+    inputs_[1] = object;
+  }
+
+  LOperand* context() const { return inputs_[0]; }
+  LOperand* object() const { return inputs_[1]; }
+
+  DECLARE_CONCRETE_INSTRUCTION(ArrayShift, "array-shift")
+  DECLARE_HYDROGEN_ACCESSOR(ArrayShift)
+};
+
+
class LTrapAllocationMemento V8_FINAL : public LTemplateInstruction<0, 1, 1> {
  public:
   LTrapAllocationMemento(LOperand* object,

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to