Revision: 15145
Author:   [email protected]
Date:     Fri Jun 14 04:21:34 2013
Log:      Install a generic handler whenever we fail to update the IC.
Ignore select cases in StoreIC since we don't have premonomorphic.

[email protected]

Review URL: https://chromiumcodereview.appspot.com/17027007
http://code.google.com/p/v8/source/detail?r=15145

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   Mon Jun 10 02:12:57 2013
+++ /branches/bleeding_edge/src/arm/ic-arm.cc   Fri Jun 14 04:21:34 2013
@@ -1581,8 +1581,8 @@
 }


-void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
-                                  StrictModeFlag strict_mode) {
+void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                         StrictModeFlag strict_mode) {
   // ----------- S t a t e -------------
   //  -- r0    : value
   //  -- r1    : receiver
=======================================
--- /branches/bleeding_edge/src/builtins.cc     Thu Jun  6 06:22:42 2013
+++ /branches/bleeding_edge/src/builtins.cc     Fri Jun 14 04:21:34 2013
@@ -1496,18 +1496,28 @@


 static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) {
-  StoreIC::GenerateGlobalProxy(masm, kNonStrictMode);
+  StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode);
 }


 static void Generate_StoreIC_GlobalProxy_Strict(MacroAssembler* masm) {
-  StoreIC::GenerateGlobalProxy(masm, kStrictMode);
+  StoreIC::GenerateRuntimeSetProperty(masm, kStrictMode);
 }


 static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
   StoreStubCompiler::GenerateStoreViaSetter(masm, Handle<JSFunction>());
 }
+
+
+static void Generate_StoreIC_Generic(MacroAssembler* masm) {
+  StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode);
+}
+
+
+static void Generate_StoreIC_Generic_Strict(MacroAssembler* masm) {
+  StoreIC::GenerateRuntimeSetProperty(masm, kStrictMode);
+}


 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/builtins.h      Wed Jun  5 04:12:49 2013
+++ /branches/bleeding_edge/src/builtins.h      Fri Jun 14 04:21:34 2013
@@ -166,6 +166,10 @@
                                     Code::kNoExtraICState)              \
   V(StoreIC_Megamorphic,            STORE_IC, MEGAMORPHIC,              \
                                     Code::kNoExtraICState)              \
+  V(StoreIC_Generic,                STORE_IC, GENERIC,                  \
+                                    Code::kNoExtraICState)              \
+  V(StoreIC_Generic_Strict,         STORE_IC, GENERIC,                  \
+                                    kStrictMode)                        \
   V(StoreIC_GlobalProxy,            STORE_IC, GENERIC,                  \
                                     Code::kNoExtraICState)              \
   V(StoreIC_Initialize_Strict,      STORE_IC, UNINITIALIZED,            \
=======================================
--- /branches/bleeding_edge/src/ia32/ic-ia32.cc Wed Jun  5 04:12:49 2013
+++ /branches/bleeding_edge/src/ia32/ic-ia32.cc Fri Jun 14 04:21:34 2013
@@ -1482,8 +1482,8 @@
 }


-void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
-                                  StrictModeFlag strict_mode) {
+void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                         StrictModeFlag strict_mode) {
   // ----------- S t a t e -------------
   //  -- eax    : value
   //  -- ecx    : name
=======================================
--- /branches/bleeding_edge/src/ic.cc   Thu Jun 13 08:01:25 2013
+++ /branches/bleeding_edge/src/ic.cc   Fri Jun 14 04:21:34 2013
@@ -936,15 +936,7 @@
   }

   // Update inline cache and stub cache.
-  if (FLAG_use_ic) {
-    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);
-    }
-  }
+  if (FLAG_use_ic) UpdateCaches(&lookup, state, object, name);

   PropertyAttributes attr;
   if (lookup.IsInterceptor() || lookup.IsHandler()) {
@@ -1204,11 +1196,17 @@
                           Handle<Object> object,
                           Handle<String> name) {
   // Bail out if the result is not cacheable.
-  if (!lookup->IsCacheable()) return;
+  if (!lookup->IsCacheable()) {
+    set_target(*generic_stub());
+    return;
+  }

-  // Loading properties from values is not common, so don't try to
-  // deal with non-JS objects here.
-  if (!object->IsJSObject()) return;
+  // TODO(jkummerow): It would be nice to support non-JSObjects in
+  // UpdateCaches, then we wouldn't need to go generic here.
+  if (!object->IsJSObject()) {
+    set_target(*generic_stub());
+    return;
+  }

   Handle<JSObject> receiver = Handle<JSObject>::cast(object);
   Handle<Code> code;
@@ -1219,7 +1217,10 @@
     code = pre_monomorphic_stub();
   } else {
     code = ComputeLoadHandler(lookup, receiver, name);
-    if (code.is_null()) return;
+    if (code.is_null()) {
+      set_target(*generic_stub());
+      return;
+    }
   }

   PatchCache(state, kNonStrictMode, receiver, name, code);
@@ -1640,6 +1641,12 @@
              IsUndeclaredGlobal(object)) {
     // Strict mode doesn't allow setting non-existent global property.
     return ReferenceError("not_defined", name);
+  } else if (FLAG_use_ic &&
+             (lookup.IsNormal() ||
+              (lookup.IsField() && lookup.CanHoldValue(value)))) {
+    Handle<Code> stub = strict_mode == kStrictMode
+        ? generic_stub_strict() : generic_stub();
+    set_target(*stub);
   }

   // Set the property.
@@ -1660,9 +1667,14 @@
   // These are not cacheable, so we never see such LookupResults here.
   ASSERT(!lookup->IsHandler());

-  Handle<Code> code =
-      ComputeStoreMonomorphic(lookup, strict_mode, receiver, name);
-  if (code.is_null()) return;
+  Handle<Code> code = ComputeStoreMonomorphic(
+      lookup, strict_mode, receiver, name);
+  if (code.is_null()) {
+    Handle<Code> stub = strict_mode == kStrictMode
+        ? generic_stub_strict() : generic_stub();
+    set_target(*stub);
+    return;
+  }

   PatchCache(state, strict_mode, receiver, name, code);
   TRACE_IC("StoreIC", name, state, target());
=======================================
--- /branches/bleeding_edge/src/ic.h    Wed Jun 12 10:20:37 2013
+++ /branches/bleeding_edge/src/ic.h    Fri Jun 14 04:21:34 2013
@@ -511,8 +511,8 @@
   static void GenerateMegamorphic(MacroAssembler* masm,
                                   StrictModeFlag strict_mode);
   static void GenerateNormal(MacroAssembler* masm);
-  static void GenerateGlobalProxy(MacroAssembler* masm,
-                                  StrictModeFlag strict_mode);
+  static void GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                         StrictModeFlag strict_mode);

   MUST_USE_RESULT MaybeObject* Store(
       State state,
@@ -532,6 +532,12 @@
   virtual Handle<Code> megamorphic_stub_strict() {
     return isolate()->builtins()->StoreIC_Megamorphic_Strict();
   }
+  virtual Handle<Code> generic_stub() const {
+    return isolate()->builtins()->StoreIC_Generic();
+  }
+  virtual Handle<Code> generic_stub_strict() const {
+    return isolate()->builtins()->StoreIC_Generic_Strict();
+  }
   virtual Handle<Code> global_proxy_stub() {
     return isolate()->builtins()->StoreIC_GlobalProxy();
   }
=======================================
--- /branches/bleeding_edge/src/x64/ic-x64.cc   Wed Jun  5 04:12:49 2013
+++ /branches/bleeding_edge/src/x64/ic-x64.cc   Fri Jun 14 04:21:34 2013
@@ -1502,8 +1502,8 @@
 }


-void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
-                                  StrictModeFlag strict_mode) {
+void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
+                                         StrictModeFlag strict_mode) {
   // ----------- S t a t e -------------
   //  -- rax    : value
   //  -- rcx    : name

--
--
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