Revision: 22808
Author:   [email protected]
Date:     Mon Aug  4 10:47:10 2014 UTC
Log:      Reuse the nonexistent handler frontend for transition handlers

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/arm/stub-cache-arm.cc
 /branches/bleeding_edge/src/arm64/stub-cache-arm64.cc
 /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/mips/stub-cache-mips.cc
 /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc
 /branches/bleeding_edge/src/stub-cache.cc
 /branches/bleeding_edge/src/stub-cache.h
 /branches/bleeding_edge/src/x64/stub-cache-x64.cc
 /branches/bleeding_edge/src/x87/stub-cache-x87.cc

=======================================
--- /branches/bleeding_edge/src/arm/stub-cache-arm.cc Mon Aug 4 09:09:21 2014 UTC +++ /branches/bleeding_edge/src/arm/stub-cache-arm.cc Mon Aug 4 10:47:10 2014 UTC
@@ -409,18 +409,6 @@
     __ mov(this->name(), Operand(name));
   }
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    Register holder_reg, Handle<Name> name, Label* miss) {
-  if (holder()->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(holder()),
-                              name, scratch1(), miss);
-  } else if (!holder()->HasFastProperties()) {
- GenerateDictionaryNegativeLookup(masm(), miss, holder_reg, name, scratch1(),
-                                     scratch2());
-  }
-}


 // Generate StoreTransition code, value is passed in r0 register.
@@ -1125,20 +1113,6 @@
   // Return the generated code.
   return GetCode(kind(), Code::FAST, name);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
-  // Return undefined if maps of the full prototype chain are still the
-  // same and no global property with this name contains a value.
-  __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
-  __ Ret();
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


 Register* PropertyAccessCompiler::load_calling_convention() {
=======================================
--- /branches/bleeding_edge/src/arm64/stub-cache-arm64.cc Mon Aug 4 09:09:21 2014 UTC +++ /branches/bleeding_edge/src/arm64/stub-cache-arm64.cc Mon Aug 4 10:47:10 2014 UTC
@@ -366,18 +366,6 @@
     __ Mov(this->name(), Operand(name));
   }
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    Register holder_reg, Handle<Name> name, Label* miss) {
-  if (holder()->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(holder()),
-                              name, scratch1(), miss);
-  } else if (!holder()->HasFastProperties()) {
- GenerateDictionaryNegativeLookup(masm(), miss, holder_reg, name, scratch1(),
-                                     scratch2());
-  }
-}


 // Generate StoreTransition code, value is passed in x0 register.
@@ -1100,20 +1088,6 @@
   // Return the generated code.
   return GetCode(kind(), Code::FAST, name);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
-  // Return undefined if maps of the full prototype chain are still the
-  // same and no global property with this name contains a value.
-  __ LoadRoot(x0, Heap::kUndefinedValueRootIndex);
-  __ Ret();
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


// TODO(all): The so-called scratch registers are significant in some cases. For
=======================================
--- /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Mon Aug 4 09:09:21 2014 UTC +++ /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Mon Aug 4 10:47:10 2014 UTC
@@ -408,18 +408,6 @@
     __ mov(this->name(), Immediate(name));
   }
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    Register holder_reg, Handle<Name> name, Label* miss) {
-  if (holder()->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(holder()),
-                              name, scratch1(), miss);
-  } else if (!holder()->HasFastProperties()) {
- GenerateDictionaryNegativeLookup(masm(), miss, holder_reg, name, scratch1(),
-                                     scratch2());
-  }
-}


// Receiver_reg is preserved on jumps to miss_label, but may be destroyed if
@@ -1149,20 +1137,6 @@
   // Return the generated code.
return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
-  // Return undefined if maps of the full prototype chain are still the
-  // same and no global property with this name contains a value.
-  __ mov(eax, isolate()->factory()->undefined_value());
-  __ ret(0);
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


 Register* PropertyAccessCompiler::load_calling_convention() {
=======================================
--- /branches/bleeding_edge/src/ic.cc   Mon Aug  4 09:09:21 2014 UTC
+++ /branches/bleeding_edge/src/ic.cc   Mon Aug  4 10:47:10 2014 UTC
@@ -1434,7 +1434,8 @@
     Handle<Map> transition(lookup->GetTransitionTarget());
     PropertyDetails details = lookup->GetPropertyDetails();

-    if (details.type() != CALLBACKS && details.attributes() == NONE) {
+    if (details.type() != CALLBACKS && details.attributes() == NONE &&
+        holder->HasFastProperties()) {
       return compiler.CompileStoreTransition(transition, name);
     }
   } else {
=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Mon Aug 4 08:34:56 2014 UTC +++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Mon Aug 4 10:47:10 2014 UTC
@@ -278,19 +278,6 @@
   __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
   __ Branch(miss, ne, scratch, Operand(at));
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    MacroAssembler* masm, Handle<JSObject> holder, Register holder_reg,
-    Handle<Name> name, Label* miss) {
-  if (holder->IsJSGlobalObject()) {
-    GenerateCheckPropertyCell(
- masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
-  } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
-    GenerateDictionaryNegativeLookup(
-        masm, miss, holder_reg, name, scratch1(), scratch2());
-  }
-}


 // Generate StoreTransition code, value is passed in a0 register.
@@ -1128,19 +1115,6 @@
   // Return the generated code.
   return GetCode(kind(), Code::FAST, name);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
- // Return undefined if maps of the full prototype chain is still the same.
-  __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
-  __ Ret();
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


 Register* PropertyAccessCompiler::load_calling_convention() {
=======================================
--- /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc Mon Aug 4 08:34:56 2014 UTC +++ /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc Mon Aug 4 10:47:10 2014 UTC
@@ -279,19 +279,6 @@
   __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
   __ Branch(miss, ne, scratch, Operand(at));
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    MacroAssembler* masm, Handle<JSObject> holder, Register holder_reg,
-    Handle<Name> name, Label* miss) {
-  if (holder->IsJSGlobalObject()) {
-    GenerateCheckPropertyCell(
- masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
-  } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
-    GenerateDictionaryNegativeLookup(
-        masm, miss, holder_reg, name, scratch1(), scratch2());
-  }
-}


 // Generate StoreTransition code, value is passed in a0 register.
@@ -1129,19 +1116,6 @@
   // Return the generated code.
   return GetCode(kind(), Code::FAST, name);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
- // Return undefined if maps of the full prototype chain is still the same.
-  __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
-  __ Ret();
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


 Register* PropertyAccessCompiler::load_calling_convention() {
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc   Mon Aug  4 09:09:21 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc   Mon Aug  4 10:47:10 2014 UTC
@@ -803,9 +803,10 @@
 }


-void NamedLoadHandlerCompiler::NonexistentFrontend(Handle<Name> name) {
-  Label miss;
-
+void PropertyHandlerCompiler::NonexistentFrontendHeader(Handle<Name> name,
+                                                        Label* miss,
+                                                        Register scratch1,
+ Register scratch2) {
   Register holder_reg;
   Handle<Map> last_map;
   if (holder().is_null()) {
@@ -815,33 +816,29 @@
     // Handle<JSObject>::null().
     ASSERT(last_map->prototype() == isolate()->heap()->null_value());
   } else {
-    holder_reg = FrontendHeader(receiver(), name, &miss);
+    holder_reg = FrontendHeader(receiver(), name, miss);
     last_map = handle(holder()->map());
   }

-  if (last_map->is_dictionary_map() && !last_map->IsJSGlobalObjectMap()) {
-    if (!name->IsUniqueName()) {
-      ASSERT(name->IsString());
-      name = factory()->InternalizeString(Handle<String>::cast(name));
+  if (last_map->is_dictionary_map()) {
+    if (last_map->IsJSGlobalObjectMap()) {
+      Handle<JSGlobalObject> global =
+          holder().is_null()
+              ? Handle<JSGlobalObject>::cast(type()->AsConstant()->Value())
+              : Handle<JSGlobalObject>::cast(holder());
+      GenerateCheckPropertyCell(masm(), global, name, scratch1, miss);
+    } else {
+      if (!name->IsUniqueName()) {
+        ASSERT(name->IsString());
+        name = factory()->InternalizeString(Handle<String>::cast(name));
+      }
+      ASSERT(holder().is_null() ||
+             holder()->property_dictionary()->FindEntry(name) ==
+                 NameDictionary::kNotFound);
+ GenerateDictionaryNegativeLookup(masm(), miss, holder_reg, name, scratch1,
+                                       scratch2);
     }
-    ASSERT(holder().is_null() ||
-           holder()->property_dictionary()->FindEntry(name) ==
-               NameDictionary::kNotFound);
-    GenerateDictionaryNegativeLookup(masm(), &miss, holder_reg, name,
-                                     scratch2(), scratch3());
   }
-
-  // If the last object in the prototype chain is a global object,
-  // check that the global property cell is empty.
-  if (last_map->IsJSGlobalObjectMap()) {
-    Handle<JSGlobalObject> global =
-        holder().is_null()
-            ? Handle<JSGlobalObject>::cast(type()->AsConstant()->Value())
-            : Handle<JSGlobalObject>::cast(holder());
-    GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
-  }
-
-  FrontendFooter(name, &miss);
 }


@@ -859,6 +856,16 @@
   GenerateLoadConstant(value);
   return GetCode(kind(), Code::FAST, name);
 }
+
+
+Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
+    Handle<Name> name) {
+  Label miss;
+  NonexistentFrontendHeader(name, &miss, scratch2(), scratch3());
+  GenerateLoadConstant(isolate()->factory()->undefined_value());
+  FrontendFooter(name, &miss);
+  return GetCode(kind(), Code::FAST, name);
+}


 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback(
@@ -970,21 +977,15 @@
       iter.Advance();
     }
     if (!last.is_null()) set_holder(last);
-  }
-
-  Register holder_reg = FrontendHeader(receiver(), name, &miss);
-
-  // If no property was found, and the holder (the last object in the
- // prototype chain) is in slow mode, we need to do a negative lookup on the
-  // holder.
-  if (is_nonexistent) {
-    GenerateNegativeHolderLookup(holder_reg, name, &miss);
+    NonexistentFrontendHeader(name, &miss, scratch1(), scratch2());
+  } else {
+    FrontendHeader(receiver(), name, &miss);
+    ASSERT(holder()->HasFastProperties());
   }

GenerateStoreTransition(transition, name, receiver(), this->name(), value(), scratch1(), scratch2(), scratch3(), &miss, &slow);

-  // Handle store cache miss.
   GenerateRestoreName(&miss, name);
   TailCallBuiltin(masm(), MissBuiltin(kind()));

=======================================
--- /branches/bleeding_edge/src/stub-cache.h    Mon Aug  4 09:09:21 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.h    Mon Aug  4 10:47:10 2014 UTC
@@ -391,6 +391,8 @@
virtual void FrontendFooter(Handle<Name> name, Label* miss) { UNREACHABLE(); }

   Register Frontend(Register object_reg, Handle<Name> name);
+  void NonexistentFrontendHeader(Handle<Name> name, Label* miss,
+                                 Register scratch1, Register scratch2);

   // TODO(verwaest): Make non-static.
   static void GenerateFastApiCall(MacroAssembler* masm,
@@ -519,8 +521,6 @@
   Register CallbackFrontend(Register object_reg, Handle<Name> name,
                             Handle<Object> callback);
   Handle<Code> CompileLoadNonexistent(Handle<Name> name);
-  void NonexistentFrontend(Handle<Name> name);
-
   void GenerateLoadField(Register reg,
                          FieldIndex field,
                          Representation representation);
@@ -589,9 +589,6 @@
   void GenerateRestoreName(Label* label, Handle<Name> name);

  private:
-  void GenerateNegativeHolderLookup(Register holder_reg, Handle<Name> name,
-                                    Label* miss);
-
   void GenerateStoreTransition(Handle<Map> transition, Handle<Name> name,
                                Register receiver_reg, Register name_reg,
                                Register value_reg, Register scratch1,
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Mon Aug 4 09:09:21 2014 UTC +++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Mon Aug 4 10:47:10 2014 UTC
@@ -365,18 +365,6 @@
     __ Move(this->name(), name);
   }
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    Register holder_reg, Handle<Name> name, Label* miss) {
-  if (holder()->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(holder()),
-                              name, scratch1(), miss);
-  } else if (!holder()->HasFastProperties()) {
- GenerateDictionaryNegativeLookup(masm(), miss, holder_reg, name, scratch1(),
-                                     scratch2());
-  }
-}


// Receiver_reg is preserved on jumps to miss_label, but may be destroyed if
@@ -1079,20 +1067,6 @@
   // Return the generated code.
return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
-  // Return undefined if maps of the full prototype chain are still the
-  // same and no global property with this name contains a value.
-  __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
-  __ ret(0);
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


 Register* PropertyAccessCompiler::load_calling_convention() {
=======================================
--- /branches/bleeding_edge/src/x87/stub-cache-x87.cc Mon Aug 4 08:34:56 2014 UTC +++ /branches/bleeding_edge/src/x87/stub-cache-x87.cc Mon Aug 4 10:47:10 2014 UTC
@@ -399,19 +399,6 @@
   }
   __ j(not_equal, miss);
 }
-
-
-void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
-    MacroAssembler* masm, Handle<JSObject> holder, Register holder_reg,
-    Handle<Name> name, Label* miss) {
-  if (holder->IsJSGlobalObject()) {
-    GenerateCheckPropertyCell(
- masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
-  } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
-    GenerateDictionaryNegativeLookup(
-        masm, miss, holder_reg, name, scratch1(), scratch2());
-  }
-}


// Receiver_reg is preserved on jumps to miss_label, but may be destroyed if
@@ -1166,20 +1153,6 @@
   // Return the generated code.
return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }
-
-
-Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<Name> name) {
-  NonexistentFrontend(name);
-
-  // Return undefined if maps of the full prototype chain are still the
-  // same and no global property with this name contains a value.
-  __ mov(eax, isolate()->factory()->undefined_value());
-  __ ret(0);
-
-  // Return the generated code.
-  return GetCode(kind(), Code::FAST, name);
-}


 Register* PropertyAccessCompiler::load_calling_convention() {

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

Reply via email to