Revert "Use the same registers for StoreIC and KeyedStoreIC."
authormvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 11 Jul 2014 14:50:59 +0000 (14:50 +0000)
committermvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 11 Jul 2014 14:50:59 +0000 (14:50 +0000)
This reverts commit r22358 due to release mode arm64 test failures.

TBR=mstarzinger@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22359 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

16 files changed:
src/arm/code-stubs-arm.cc
src/arm/ic-arm.cc
src/arm/stub-cache-arm.cc
src/arm64/code-stubs-arm64.cc
src/arm64/ic-arm64.cc
src/arm64/stub-cache-arm64.cc
src/code-stubs-hydrogen.cc
src/code-stubs.cc
src/code-stubs.h
src/ia32/code-stubs-ia32.cc
src/ia32/ic-ia32.cc
src/ia32/stub-cache-ia32.cc
src/ic.h
src/x64/code-stubs-x64.cc
src/x64/ic-x64.cc
src/x64/stub-cache-x64.cc

index 77eaf22..5e0e69e 100644 (file)
@@ -221,6 +221,14 @@ void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
 }
 
 
+void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  Register registers[] = { r0, r3, r1, r2 };
+  descriptor->Initialize(ARRAY_SIZE(registers), registers,
+                         FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
+}
+
+
 void BinaryOpICStub::InitializeInterfaceDescriptor(
     CodeStubInterfaceDescriptor* descriptor) {
   Register registers[] = { r1, r0 };
index 7b85f43..c49b161 100644 (file)
@@ -500,8 +500,8 @@ void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
   Register receiver = ReceiverRegister();
   Register key = NameRegister();
   Register value = ValueRegister();
-  ASSERT(receiver.is(r1));
-  ASSERT(key.is(r2));
+  ASSERT(receiver.is(r2));
+  ASSERT(key.is(r1));
   ASSERT(value.is(r0));
 
   Label slow, notin;
@@ -552,24 +552,9 @@ const Register StoreIC::NameRegister() { return r2; }
 const Register StoreIC::ValueRegister() { return r0; }
 
 
-const Register KeyedStoreIC::ReceiverRegister() {
-  return StoreIC::ReceiverRegister();
-}
-
-
-const Register KeyedStoreIC::NameRegister() {
-  return StoreIC::NameRegister();
-}
-
-
-const Register KeyedStoreIC::ValueRegister() {
-  return StoreIC::ValueRegister();
-}
-
-
-const Register KeyedStoreIC::MapRegister() {
-  return r3;
-}
+const Register KeyedStoreIC::ReceiverRegister() { return r2; }
+const Register KeyedStoreIC::NameRegister() { return r1; }
+const Register KeyedStoreIC::ValueRegister() { return r0; }
 
 
 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
@@ -1043,8 +1028,8 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
   Register value = ValueRegister();
   Register key = NameRegister();
   Register receiver = ReceiverRegister();
-  ASSERT(receiver.is(r1));
-  ASSERT(key.is(r2));
+  ASSERT(receiver.is(r2));
+  ASSERT(key.is(r1));
   ASSERT(value.is(r0));
   Register receiver_map = r3;
   Register elements_map = r6;
index 1898dbc..98002dc 100644 (file)
@@ -1294,11 +1294,10 @@ Register* StoreStubCompiler::registers() {
 
 
 Register* KeyedStoreStubCompiler::registers() {
-  // receiver, name, scratch1/map, scratch2, scratch3.
+  // receiver, name, scratch1, scratch2, scratch3.
   Register receiver = KeyedStoreIC::ReceiverRegister();
   Register name = KeyedStoreIC::NameRegister();
-  Register map = KeyedStoreIC::MapRegister();
-  static Register registers[] = { receiver, name, map, r4, r5 };
+  static Register registers[] = { receiver, name, r3, r4, r5 };
   return registers;
 }
 
@@ -1398,10 +1397,7 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
   Label* smi_target = IncludesNumberType(types) ? &number_case : &miss;
   __ JumpIfSmi(receiver(), smi_target);
 
-  // Polymorphic keyed stores may use the map register
   Register map_reg = scratch1();
-  ASSERT(kind() != Code::KEYED_STORE_IC ||
-         map_reg.is(KeyedStoreIC::MapRegister()));
 
   int receiver_count = types->length();
   int number_of_handled_maps = 0;
index 7126628..5b76f1a 100644 (file)
@@ -238,6 +238,18 @@ void ToBooleanStub::InitializeInterfaceDescriptor(
 }
 
 
+void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  // x0: value
+  // x3: target map
+  // x1: key
+  // x2: receiver
+  Register registers[] = { x0, x3, x1, x2 };
+  descriptor->Initialize(ARRAY_SIZE(registers), registers,
+                         FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
+}
+
+
 void BinaryOpICStub::InitializeInterfaceDescriptor(
     CodeStubInterfaceDescriptor* descriptor) {
   // x1: left operand
index 9040061..5a2dde5 100644 (file)
@@ -506,8 +506,8 @@ void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
   Register value = ValueRegister();
   Register key = NameRegister();
   Register receiver = ReceiverRegister();
-  ASSERT(receiver.is(x1));
-  ASSERT(key.is(x2));
+  ASSERT(receiver.is(x2));
+  ASSERT(key.is(x1));
   ASSERT(value.is(x0));
 
   Register map = x3;
@@ -574,24 +574,9 @@ const Register StoreIC::NameRegister() { return x2; }
 const Register StoreIC::ValueRegister() { return x0; }
 
 
-const Register KeyedStoreIC::ReceiverRegister() {
-  return StoreIC::ReceiverRegister();
-}
-
-
-const Register KeyedStoreIC::NameRegister() {
-  return StoreIC::NameRegister();
-}
-
-
-const Register KeyedStoreIC::ValueRegister() {
-  return StoreIC::ValueRegister();
-}
-
-
-const Register KeyedStoreIC::MapRegister() {
-  return x3;
-}
+const Register KeyedStoreIC::ReceiverRegister() { return x2; }
+const Register KeyedStoreIC::NameRegister() { return x1; }
+const Register KeyedStoreIC::ValueRegister() { return x0; }
 
 
 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
@@ -1082,8 +1067,8 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
   Register value = ValueRegister();
   Register key = NameRegister();
   Register receiver = ReceiverRegister();
-  ASSERT(receiver.is(x1));
-  ASSERT(key.is(x2));
+  ASSERT(receiver.is(x2));
+  ASSERT(key.is(x1));
   ASSERT(value.is(x0));
 
   Register receiver_map = x3;
index c3b48a5..d52493e 100644 (file)
@@ -1276,11 +1276,10 @@ Register* StoreStubCompiler::registers() {
 
 
 Register* KeyedStoreStubCompiler::registers() {
-  // receiver, name, scratch1/map, scratch2, scratch3.
+  // receiver, name, scratch1, scratch2, scratch3.
   Register receiver = KeyedStoreIC::ReceiverRegister();
   Register name = KeyedStoreIC::NameRegister();
-  Register map = KeyedStoreIC::MapRegister();
-  static Register registers[] = { receiver, name, map, x4, x5 };
+  static Register registers[] = { receiver, name, x3, x4, x5 };
   return registers;
 }
 
@@ -1371,10 +1370,7 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
   Label* smi_target = IncludesNumberType(types) ? &number_case : &miss;
   __ JumpIfSmi(receiver(), smi_target);
 
-  // Polymorphic keyed stores may use the map register
   Register map_reg = scratch1();
-  ASSERT(kind() != Code::KEYED_STORE_IC ||
-         map_reg.is(KeyedStoreIC::MapRegister()));
   __ Ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset));
   int receiver_count = types->length();
   int number_of_handled_maps = 0;
index 547820c..bdd168b 100644 (file)
@@ -1077,10 +1077,10 @@ Handle<Code> StoreGlobalStub::GenerateCode() {
 
 template<>
 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
-  HValue* value = GetParameter(ElementsTransitionAndStoreStub::kValueIndex);
-  HValue* map = GetParameter(ElementsTransitionAndStoreStub::kMapIndex);
-  HValue* key = GetParameter(ElementsTransitionAndStoreStub::kKeyIndex);
-  HValue* object = GetParameter(ElementsTransitionAndStoreStub::kObjectIndex);
+  HValue* value = GetParameter(0);
+  HValue* map = GetParameter(1);
+  HValue* key = GetParameter(2);
+  HValue* object = GetParameter(3);
 
   if (FLAG_trace_elements_transitions) {
     // Tracing elements transitions is the job of the runtime.
index c36568c..5a3f4e4 100644 (file)
@@ -644,17 +644,6 @@ void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
 }
 
 
-void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
-    CodeStubInterfaceDescriptor* descriptor) {
-  Register registers[] = { ValueRegister(),
-                           MapRegister(),
-                           KeyRegister(),
-                           ObjectRegister() };
-  descriptor->Initialize(ARRAY_SIZE(registers), registers,
-                         FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
-}
-
-
 void StoreGlobalStub::InitializeInterfaceDescriptor(
     CodeStubInterfaceDescriptor* descriptor) {
   Register registers[] = { StoreIC::ReceiverRegister(),
index 7f62b9e..c0ab7e9 100644 (file)
@@ -2455,24 +2455,6 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
   virtual void InitializeInterfaceDescriptor(
       CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
 
-  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
-  enum RegisterInfo {
-    kValueIndex,
-    kMapIndex,
-    kKeyIndex,
-    kObjectIndex,
-    kRegisterArgumentCount
-  };
-
-  static const Register ValueRegister() {
-    return KeyedStoreIC::ValueRegister();
-  }
-  static const Register MapRegister() { return KeyedStoreIC::MapRegister(); }
-  static const Register KeyRegister() { return KeyedStoreIC::NameRegister(); }
-  static const Register ObjectRegister() {
-    return KeyedStoreIC::ReceiverRegister();
-  }
-
  private:
   class FromBits:      public BitField<ElementsKind,          0, 8> {};
   class ToBits:        public BitField<ElementsKind,          8, 8> {};
index 0f01934..1dfd62f 100644 (file)
@@ -225,6 +225,14 @@ void ToBooleanStub::InitializeInterfaceDescriptor(
 }
 
 
+void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  Register registers[] = { eax, ebx, ecx, edx };
+  descriptor->Initialize(ARRAY_SIZE(registers), registers,
+                         FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
+}
+
+
 void BinaryOpICStub::InitializeInterfaceDescriptor(
     CodeStubInterfaceDescriptor* descriptor) {
   Register registers[] = { edx, eax };
index a1a3995..379ed0f 100644 (file)
@@ -1039,11 +1039,6 @@ const Register KeyedStoreIC::ValueRegister() {
 }
 
 
-const Register KeyedStoreIC::MapRegister() {
-  return ebx;
-}
-
-
 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
   // Return address is on the stack.
   LoadIC_PushArgs(masm);
index a35be80..7350319 100644 (file)
@@ -1314,11 +1314,10 @@ Register* StoreStubCompiler::registers() {
 
 
 Register* KeyedStoreStubCompiler::registers() {
-  // receiver, name, scratch1/map, scratch2, scratch3.
+  // receiver, name, scratch1, scratch2, scratch3.
   Register receiver = KeyedStoreIC::ReceiverRegister();
   Register name = KeyedStoreIC::NameRegister();
-  Register map = KeyedStoreIC::MapRegister();
-  static Register registers[] = { receiver, name, map, edi, no_reg };
+  static Register registers[] = { receiver, name, ebx, edi, no_reg };
   return registers;
 }
 
@@ -1419,10 +1418,7 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
   Label* smi_target = IncludesNumberType(types) ? &number_case : &miss;
   __ JumpIfSmi(receiver(), smi_target);
 
-  // Polymorphic keyed stores may use the map register
   Register map_reg = scratch1();
-  ASSERT(kind() != Code::KEYED_STORE_IC ||
-         map_reg.is(KeyedStoreIC::MapRegister()));
   __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
   int receiver_count = types->length();
   int number_of_handled_maps = 0;
index 262893f..47ffd6e 100644 (file)
--- a/src/ic.h
+++ b/src/ic.h
@@ -705,11 +705,6 @@ class KeyedStoreIC: public StoreIC {
   static const Register NameRegister();
   static const Register ValueRegister();
 
-  // The map register isn't part of the normal call specification, but
-  // ElementsTransitionAndStoreStub, used in polymorphic keyed store
-  // stub implementations requires it to be initialized.
-  static const Register MapRegister();
-
   KeyedStoreIC(FrameDepth depth, Isolate* isolate)
       : StoreIC(depth, isolate) {
     ASSERT(target()->is_keyed_store_stub());
index 48668d3..486917f 100644 (file)
@@ -222,6 +222,14 @@ void ToBooleanStub::InitializeInterfaceDescriptor(
 }
 
 
+void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  Register registers[] = { rax, rbx, rcx, rdx };
+  descriptor->Initialize(ARRAY_SIZE(registers), registers,
+                         FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
+}
+
+
 void BinaryOpICStub::InitializeInterfaceDescriptor(
     CodeStubInterfaceDescriptor* descriptor) {
   Register registers[] = { rdx, rax };
index 40d5646..caa8d4c 100644 (file)
@@ -1065,11 +1065,6 @@ const Register KeyedStoreIC::ValueRegister() {
 }
 
 
-const Register KeyedStoreIC::MapRegister() {
-  return rbx;
-}
-
-
 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
   // The return address is on the stack.
 
index 508b1b3..886d9ad 100644 (file)
@@ -1253,11 +1253,10 @@ Register* StoreStubCompiler::registers() {
 
 
 Register* KeyedStoreStubCompiler::registers() {
-  // receiver, name, scratch1/map, scratch2, scratch3.
+  // receiver, name, scratch1, scratch2, scratch3.
   Register receiver = KeyedStoreIC::ReceiverRegister();
   Register name = KeyedStoreIC::NameRegister();
-  Register map = KeyedStoreIC::MapRegister();
-  static Register registers[] = { receiver, name, map, rdi, r8 };
+  static Register registers[] = { receiver, name, rbx, rdi, r8 };
   return registers;
 }
 
@@ -1362,10 +1361,7 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
   Label* smi_target = IncludesNumberType(types) ? &number_case : &miss;
   __ JumpIfSmi(receiver(), smi_target);
 
-  // Polymorphic keyed stores may use the map register
   Register map_reg = scratch1();
-  ASSERT(kind() != Code::KEYED_STORE_IC ||
-         map_reg.is(KeyedStoreIC::MapRegister()));
   __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
   int receiver_count = types->length();
   int number_of_handled_maps = 0;