Remove KeyedStoreIC::GenerateRuntimeSetProperty and move Store::GenerateRuntimeSetPro...
authorverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 22 Aug 2014 12:48:15 +0000 (12:48 +0000)
committerverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 22 Aug 2014 12:48:15 +0000 (12:48 +0000)
BUG=
R=yangguo@chromium.org

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

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

src/ic/arm/ic-arm.cc
src/ic/arm/ic-compiler-arm.cc
src/ic/arm64/ic-arm64.cc
src/ic/arm64/ic-compiler-arm64.cc
src/ic/ia32/ic-compiler-ia32.cc
src/ic/ia32/ic-ia32.cc
src/ic/ic-compiler.cc
src/ic/ic-compiler.h
src/ic/ic.h
src/ic/x64/ic-compiler-x64.cc
src/ic/x64/ic-x64.cc

index 68b49c7fdb71d54e98f2d35dbe1a401afc2ba6dd..9c6b894e1bb9c27f911a5979c92cccb2fb86b122 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/codegen.h"
 #include "src/ic/ic.h"
+#include "src/ic/ic-compiler.h"
 #include "src/ic/stub-cache.h"
 
 namespace v8 {
@@ -756,18 +757,6 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
 }
 
 
-void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                              StrictMode strict_mode) {
-  // Push receiver, key and value for runtime call.
-  __ Push(ReceiverRegister(), NameRegister(), ValueRegister());
-
-  __ mov(r0, Operand(Smi::FromInt(strict_mode)));  // Strict mode.
-  __ Push(r0);
-
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
 static void KeyedStoreGenerateGenericHelper(
     MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
     KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
@@ -965,7 +954,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
   // r0: value.
   // r1: key.
   // r2: receiver.
-  GenerateRuntimeSetProperty(masm, strict_mode);
+  PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
 
   // Extra capacity case: Check if there is extra capacity to
   // perform the store and update the length. Used for adding one
@@ -1062,18 +1051,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
 }
 
 
-void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                         StrictMode strict_mode) {
-  __ Push(ReceiverRegister(), NameRegister(), ValueRegister());
-
-  __ mov(r0, Operand(Smi::FromInt(strict_mode)));
-  __ Push(r0);
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
 #undef __
 
 
index 2c6df44ba82fe68e4db32ff3aa79d1a38372a7b9..ac0da716ee67bfe9b85b9be57991bcfde48747d2 100644 (file)
@@ -964,6 +964,19 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
 }
 
 
+void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                                    StrictMode strict_mode) {
+  __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
+          StoreIC::ValueRegister());
+
+  __ mov(r0, Operand(Smi::FromInt(strict_mode)));
+  __ Push(r0);
+
+  // Do tail-call to runtime routine.
+  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
+}
+
+
 #undef __
 }
 }  // namespace v8::internal
index 3f80465de85798a05fa34c98829bf443f440de79..bffa603cb74c7b06dbb4c2504c52a3a900fb9ed4 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/codegen.h"
 #include "src/ic/ic.h"
+#include "src/ic/ic-compiler.h"
 #include "src/ic/stub-cache.h"
 
 namespace v8 {
@@ -788,21 +789,6 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
 }
 
 
-void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                              StrictMode strict_mode) {
-  ASM_LOCATION("KeyedStoreIC::GenerateRuntimeSetProperty");
-
-  // Push receiver, key and value for runtime call.
-  __ Push(ReceiverRegister(), NameRegister(), ValueRegister());
-
-  // Push strict_mode for runtime call.
-  __ Mov(x10, Smi::FromInt(strict_mode));
-  __ Push(x10);
-
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
 static void KeyedStoreGenerateGenericHelper(
     MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
     KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
@@ -989,7 +975,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
   //  x0: value
   //  x1: key
   //  x2: receiver
-  GenerateRuntimeSetProperty(masm, strict_mode);
+  PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
 
 
   __ Bind(&extra);
@@ -1083,20 +1069,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
 }
 
 
-void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                         StrictMode strict_mode) {
-  ASM_LOCATION("StoreIC::GenerateRuntimeSetProperty");
-
-  __ Push(ReceiverRegister(), NameRegister(), ValueRegister());
-
-  __ Mov(x10, Smi::FromInt(strict_mode));
-  __ Push(x10);
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
 void StoreIC::GenerateSlow(MacroAssembler* masm) {
   // ---------- S t a t e --------------
   //  -- x0     : value
index d2ad8339b67c8fd32f2af74595bf1d41380473c9..d15a07d64b3e9c7804bad78281371a10c39363e4 100644 (file)
@@ -974,6 +974,22 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
   TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
 }
 
+
+void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                                    StrictMode strict_mode) {
+  ASM_LOCATION("PropertyICCompiler::GenerateRuntimeSetProperty");
+
+  __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
+          StoreIC::ValueRegister());
+
+  __ Mov(x10, Smi::FromInt(strict_mode));
+  __ Push(x10);
+
+  // Do tail-call to runtime routine.
+  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
+}
+
+
 #undef __
 }
 }  // namespace v8::internal
index 1a01a83349c2e0af86a1914ee4eed0cb4f9fa8e4..7ed1f8d07e11bf2cb6fa2bfefd1d95d88eafb43f 100644 (file)
@@ -979,6 +979,23 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
 }
 
 
+void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                                    StrictMode strict_mode) {
+  // Return address is on the stack.
+  DCHECK(!ebx.is(StoreIC::ReceiverRegister()) &&
+         !ebx.is(StoreIC::NameRegister()) && !ebx.is(StoreIC::ValueRegister()));
+  __ pop(ebx);
+  __ push(StoreIC::ReceiverRegister());
+  __ push(StoreIC::NameRegister());
+  __ push(StoreIC::ValueRegister());
+  __ push(Immediate(Smi::FromInt(strict_mode)));
+  __ push(ebx);  // return address
+
+  // Do tail-call to runtime routine.
+  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
+}
+
+
 #undef __
 }
 }  // namespace v8::internal
index c7dad0f25c1627c045ac30690a979bcf5cb9e039..4dd1a934cf425e4a6639d003a41a7c72ef623e6c 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/codegen.h"
 #include "src/ic/ic.h"
+#include "src/ic/ic-compiler.h"
 #include "src/ic/stub-cache.h"
 
 namespace v8 {
@@ -777,7 +778,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
 
   // Slow case: call runtime.
   __ bind(&slow);
-  GenerateRuntimeSetProperty(masm, strict_mode);
+  PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
 
   // Extra capacity case: Check if there is extra capacity to
   // perform the store and update the length. Used for adding one
@@ -1006,40 +1007,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
 }
 
 
-void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                         StrictMode strict_mode) {
-  // Return address is on the stack.
-  DCHECK(!ebx.is(ReceiverRegister()) && !ebx.is(NameRegister()) &&
-         !ebx.is(ValueRegister()));
-  __ pop(ebx);
-  __ push(ReceiverRegister());
-  __ push(NameRegister());
-  __ push(ValueRegister());
-  __ push(Immediate(Smi::FromInt(strict_mode)));
-  __ push(ebx);  // return address
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
-void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                              StrictMode strict_mode) {
-  // Return address is on the stack.
-  DCHECK(!ebx.is(ReceiverRegister()) && !ebx.is(NameRegister()) &&
-         !ebx.is(ValueRegister()));
-  __ pop(ebx);
-  __ push(ReceiverRegister());
-  __ push(NameRegister());
-  __ push(ValueRegister());
-  __ push(Immediate(Smi::FromInt(strict_mode)));
-  __ push(ebx);  // return address
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
   // Return address is on the stack.
   StoreIC_PushArgs(masm);
index 05a0a6ee95cdd688d21137342140653ea7b70595..f31a5c1ac3ebc9a0b46a85e46a7f6e96e752ca22 100644 (file)
@@ -387,7 +387,7 @@ Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) {
 Handle<Code> PropertyICCompiler::CompileStoreGeneric(Code::Flags flags) {
   ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
   StrictMode strict_mode = StoreIC::GetStrictMode(extra_state);
-  StoreIC::GenerateRuntimeSetProperty(masm(), strict_mode);
+  GenerateRuntimeSetProperty(masm(), strict_mode);
   Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
   PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
   return code;
index 8570ab17299f80a7de64a1246aec14fac7f6b098..303e732d14446da5747fd8de811900a605a6dfc0 100644 (file)
@@ -125,6 +125,12 @@ class PropertyICCompiler : public PropertyAccessCompiler {
   static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map,
                                         CompareNilICStub* stub);
 
+  // Helpers
+  // TODO(verwaest): Move all uses of these helpers to the PropertyICCompiler
+  // and make the helpers private.
+  static void GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                         StrictMode strict_mode);
+
 
  private:
   PropertyICCompiler(Isolate* isolate, Code::Kind kind,
index 7d4d23e9266656cb954eb7fecd13935cfe8e95bb..f41bb9ae51f6f8cf5a16034c16af29c0b5f329c8 100644 (file)
@@ -650,8 +650,6 @@ class KeyedStoreIC : public StoreIC {
   }
   static void GenerateMiss(MacroAssembler* masm);
   static void GenerateSlow(MacroAssembler* masm);
-  static void GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                         StrictMode strict_mode);
   static void GenerateGeneric(MacroAssembler* masm, StrictMode strict_mode);
   static void GenerateSloppyArguments(MacroAssembler* masm);
 
index 5e6f2254660504e5a776716b658ace24c98017bc..b9fe4788516f9ae1042c0387fd273f25e32f39c6 100644 (file)
@@ -968,6 +968,24 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
 }
 
 
+void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                                    StrictMode strict_mode) {
+  // Return address is on the stack.
+  DCHECK(!rbx.is(StoreIC::ReceiverRegister()) &&
+         !rbx.is(StoreIC::NameRegister()) && !rbx.is(StoreIC::ValueRegister()));
+
+  __ PopReturnAddressTo(rbx);
+  __ Push(StoreIC::ReceiverRegister());
+  __ Push(StoreIC::NameRegister());
+  __ Push(StoreIC::ValueRegister());
+  __ Push(Smi::FromInt(strict_mode));
+  __ PushReturnAddressFrom(rbx);
+
+  // Do tail-call to runtime routine.
+  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
+}
+
+
 #undef __
 }
 }  // namespace v8::internal
index 24053df41e4e9853720cab45ba05a9b676c23401..1abb93193e096cbb68ad6b97e0558a924fd140d2 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/codegen.h"
 #include "src/ic/ic.h"
+#include "src/ic/ic-compiler.h"
 #include "src/ic/stub-cache.h"
 
 namespace v8 {
@@ -649,7 +650,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
   __ bind(&slow);
   __ Integer32ToSmi(key, key);
   __ bind(&slow_with_tagged_index);
-  GenerateRuntimeSetProperty(masm, strict_mode);
+  PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
   // Never returns to here.
 
   // Extra capacity case: Check if there is extra capacity to
@@ -1011,42 +1012,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
 }
 
 
-void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                         StrictMode strict_mode) {
-  // Return address is on the stack.
-  DCHECK(!rbx.is(ReceiverRegister()) && !rbx.is(NameRegister()) &&
-         !rbx.is(ValueRegister()));
-
-  __ PopReturnAddressTo(rbx);
-  __ Push(ReceiverRegister());
-  __ Push(NameRegister());
-  __ Push(ValueRegister());
-  __ Push(Smi::FromInt(strict_mode));
-  __ PushReturnAddressFrom(rbx);
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
-void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
-                                              StrictMode strict_mode) {
-  // Return address is on the stack.
-  DCHECK(!rbx.is(ReceiverRegister()) && !rbx.is(NameRegister()) &&
-         !rbx.is(ValueRegister()));
-
-  __ PopReturnAddressTo(rbx);
-  __ Push(ReceiverRegister());
-  __ Push(NameRegister());
-  __ Push(ValueRegister());
-  __ Push(Smi::FromInt(strict_mode));  // Strict mode.
-  __ PushReturnAddressFrom(rbx);
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
-}
-
-
 void StoreIC::GenerateSlow(MacroAssembler* masm) {
   // Return address is on the stack.
   StoreIC_PushArgs(masm);