Revision: 14950
Author:   [email protected]
Date:     Wed Jun  5 04:12:49 2013
Log: Add LoadIC_Slow builtin and use it for loading properties from primitive values.

This fixes recent performance regressions on Dromaeo.

BUG=chromium:242512
[email protected]

Review URL: https://codereview.chromium.org/16226024
http://code.google.com/p/v8/source/detail?r=14950

Modified:
 /branches/bleeding_edge/src/arm/ic-arm.cc
 /branches/bleeding_edge/src/builtins.cc
 /branches/bleeding_edge/src/builtins.h
 /branches/bleeding_edge/src/ia32/ic-ia32.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/ic.h
 /branches/bleeding_edge/src/x64/ic-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/ic-arm.cc   Fri May 17 08:38:14 2013
+++ /branches/bleeding_edge/src/arm/ic-arm.cc   Wed Jun  5 04:12:49 2013
@@ -646,9 +646,6 @@
 }


-// Defined in ic.cc.
-Object* LoadIC_Miss(Arguments args);
-
 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
   // ----------- S t a t e -------------
   //  -- r2    : name
@@ -709,6 +706,21 @@
       ExternalReference(IC_Utility(kLoadIC_Miss), isolate);
   __ TailCallExternalReference(ref, 2, 1);
 }
+
+
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+  // ---------- S t a t e --------------
+  //  -- r2    : name
+  //  -- lr    : return address
+  //  -- r0    : receiver
+  //  -- sp[0] : receiver
+  // -----------------------------------
+
+  __ mov(r3, r0);
+  __ Push(r3, r2);
+
+  __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
+}


 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm,
@@ -876,9 +888,6 @@
   __ bind(&slow);
   GenerateMiss(masm, argc);
 }
-
-
-Object* KeyedLoadIC_Miss(Arguments args);


void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
=======================================
--- /branches/bleeding_edge/src/builtins.cc     Wed Jun  5 03:43:18 2013
+++ /branches/bleeding_edge/src/builtins.cc     Wed Jun  5 04:12:49 2013
@@ -1493,6 +1493,11 @@
 static void Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
   LoadStubCompiler::GenerateLoadViaGetter(masm, Handle<JSFunction>());
 }
+
+
+static void Generate_LoadIC_Slow(MacroAssembler* masm) {
+  LoadIC::GenerateRuntimeGetProperty(masm);
+}


 static void Generate_KeyedLoadIC_Initialize(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/builtins.h      Tue May 14 04:45:33 2013
+++ /branches/bleeding_edge/src/builtins.h      Wed Jun  5 04:12:49 2013
@@ -144,6 +144,8 @@
                                     Code::kNoExtraICState)              \
   V(LoadIC_Getter_ForDeopt,         LOAD_IC, MONOMORPHIC,               \
                                     Code::kNoExtraICState)              \
+  V(LoadIC_Slow,                    LOAD_IC, GENERIC,                   \
+                                    Code::kNoExtraICState)              \
                                                                         \
   V(KeyedLoadIC_Initialize,         KEYED_LOAD_IC, UNINITIALIZED,       \
                                     Code::kNoExtraICState)              \
=======================================
--- /branches/bleeding_edge/src/ia32/ic-ia32.cc Tue Jun  4 03:30:05 2013
+++ /branches/bleeding_edge/src/ia32/ic-ia32.cc Wed Jun  5 04:12:49 2013
@@ -1352,6 +1352,23 @@
       ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
   __ TailCallExternalReference(ref, 2, 1);
 }
+
+
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+  // ----------- S t a t e -------------
+  //  -- ecx    : key
+  //  -- edx    : receiver
+  //  -- esp[0] : return address
+  // -----------------------------------
+
+  __ pop(ebx);
+  __ push(edx);  // receiver
+  __ push(ecx);  // name
+  __ push(ebx);  // return address
+
+  // Perform tail call to the entry.
+  __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
+}


void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
=======================================
--- /branches/bleeding_edge/src/ic.cc   Tue Jun  4 00:49:45 2013
+++ /branches/bleeding_edge/src/ic.cc   Wed Jun  5 04:12:49 2013
@@ -937,7 +937,13 @@

   // Update inline cache and stub cache.
   if (FLAG_use_ic) {
-    UpdateCaches(&lookup, state, object, name);
+    if (!object->IsJSObject()) {
+      // TODO(jkummerow): It would be nice to support non-JSObjects in
+      // UpdateCaches, then we wouldn't need to go generic here.
+      set_target(*generic_stub());
+    } else {
+      UpdateCaches(&lookup, state, object, name);
+    }
   }

   PropertyAttributes attr;
=======================================
--- /branches/bleeding_edge/src/ic.h    Wed May 29 07:49:28 2013
+++ /branches/bleeding_edge/src/ic.h    Wed Jun  5 04:12:49 2013
@@ -369,6 +369,7 @@
   static void GenerateMiss(MacroAssembler* masm);
   static void GenerateMegamorphic(MacroAssembler* masm);
   static void GenerateNormal(MacroAssembler* masm);
+  static void GenerateRuntimeGetProperty(MacroAssembler* masm);

   MUST_USE_RESULT MaybeObject* Load(State state,
                                     Handle<Object> object,
@@ -378,8 +379,7 @@
   virtual Code::Kind kind() const { return Code::LOAD_IC; }

   virtual Handle<Code> generic_stub() const {
-    UNREACHABLE();
-    return Handle<Code>::null();
+    return isolate()->builtins()->LoadIC_Slow();
   }

   virtual Handle<Code> megamorphic_stub() {
=======================================
--- /branches/bleeding_edge/src/x64/ic-x64.cc   Fri May 10 02:12:30 2013
+++ /branches/bleeding_edge/src/x64/ic-x64.cc   Wed Jun  5 04:12:49 2013
@@ -1378,6 +1378,23 @@
       ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
   __ TailCallExternalReference(ref, 2, 1);
 }
+
+
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+  // ----------- S t a t e -------------
+  //  -- rax    : receiver
+  //  -- rcx    : name
+  //  -- rsp[0]  : return address
+  // -----------------------------------
+
+  __ pop(rbx);
+  __ push(rax);  // receiver
+  __ push(rcx);  // name
+  __ push(rbx);  // return address
+
+  // Perform tail call to the entry.
+  __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
+}


void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {

--
--
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/groups/opt_out.


Reply via email to