Reviewers: Weiliang, ulan,

Message:
WL.
PTAL.
thanks

Description:
X87: CheckPrototypes uses weak cells to embed maps.

port 062a032f50291ce181462226ff41b4ef9b11deba

original commit message:

  CheckPrototypes uses weak cells to embed maps.

BUG=

Please review this at https://codereview.chromium.org/761093004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+13, -8 lines):
  M src/ic/x87/handler-compiler-x87.cc


Index: src/ic/x87/handler-compiler-x87.cc
diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index aa3c619b0aef12a9a75f1e69a5a2b0209940b12e..909f97ec671eeb9af281b80a1d4c04fdd4544f3d 100644
--- a/src/ic/x87/handler-compiler-x87.cc
+++ b/src/ic/x87/handler-compiler-x87.cc
@@ -415,8 +415,12 @@ Register PropertyHandlerCompiler::CheckPrototypes(
       reg = holder_reg;  // From now on the object will be in holder_reg.
       __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
     } else {
+      Register map_reg = scratch1;
+      __ mov(map_reg, FieldOperand(reg, HeapObject::kMapOffset));
       if (depth != 1 || check == CHECK_ALL_MAPS) {
-        __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
+        Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
+        __ CmpWeakValue(map_reg, cell, scratch2);
+        __ j(not_equal, miss);
       }

// Check access rights to the global object. This has to happen after
@@ -426,17 +430,15 @@ Register PropertyHandlerCompiler::CheckPrototypes(
// global proxy (as opposed to using slow ICs). See corresponding code
       // in LookupForRead().
       if (current_map->IsJSGlobalProxyMap()) {
-        __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss);
+        __ CheckAccessGlobalProxy(reg, map_reg, scratch2, miss);
+        // Restore map_reg.
+        __ mov(map_reg, FieldOperand(reg, HeapObject::kMapOffset));
       } else if (current_map->IsJSGlobalObjectMap()) {
GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
                                   name, scratch2, miss);
       }
-
-      __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
-
       reg = holder_reg;  // From now on the object will be in holder_reg.
-
-      __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
+      __ mov(reg, FieldOperand(map_reg, Map::kPrototypeOffset));
     }

     // Go to the next object in the prototype chain.
@@ -449,7 +451,10 @@ Register PropertyHandlerCompiler::CheckPrototypes(

   if (depth != 0 || check == CHECK_ALL_MAPS) {
     // Check the holder map.
-    __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
+    __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
+    Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
+    __ CmpWeakValue(scratch1, cell, scratch2);
+    __ j(not_equal, miss);
   }

   // Perform security check for access to the global object.


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