Reviewers: danno, Benedikt Meurer, Paul Lind, kisg, palfia, dusmil,
Description:
MIPS: Improve Array.shift() performance for small arrays.
Port r21203 (eaa92e4)
TEST=mjsunit/array-shift,mjsunit/array-shift2,mjsunit/array-shift3
BUG=
Please review this at https://codereview.chromium.org/275883002/
SVN Base: https://github.com/v8/v8.git@gbl
Affected files (+43, -0 lines):
M src/mips/code-stubs-mips.cc
M src/mips/lithium-codegen-mips.cc
M src/mips/lithium-mips.h
M src/mips/lithium-mips.cc
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index
486e4c244052fb7b023ac0679b127bf7addab260..a746d76f95b9d84da5ba647dbf01be84587c57b5
100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -306,6 +306,16 @@ void
ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
}
+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(
CodeStubInterfaceDescriptor* descriptor) {
static Register registers[] = { a1, a0 };
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
95ee3a6c12dd2c2b1ced217c8b2193372775a5ee..b731baa321a790cd5ef8436b34a7dd90153ef38e
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -4442,6 +4442,15 @@ void
LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
}
+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) {
Register object = ToRegister(instr->object());
Register temp = ToRegister(instr->temp());
Index: src/mips/lithium-mips.cc
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index
e882655d21501d6cf94718cdff670f5a457ed6b2..97b91fac3995476829ce2f3d7347820ff4aa7a4b
100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -2209,6 +2209,14 @@ LInstruction*
LChunkBuilder::DoTransitionElementsKind(
}
+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(
HTrapAllocationMemento* instr) {
LOperand* object = UseRegister(instr->object());
Index: src/mips/lithium-mips.h
diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h
index
14ac0a48232468a8a0ddf1f0779ee15573af1533..8133c31a0a5df75b5cce44a264fde6d67f113456
100644
--- a/src/mips/lithium-mips.h
+++ b/src/mips/lithium-mips.h
@@ -26,6 +26,7 @@ class LCodeGen;
V(ArgumentsLength) \
V(ArithmeticD) \
V(ArithmeticT) \
+ V(ArrayShift) \
V(BitI) \
V(BoundsCheck) \
V(Branch) \
@@ -2236,6 +2237,21 @@ class LTransitionElementsKind V8_FINAL : public
LTemplateInstruction<0, 2, 1> {
};
+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.