Reviewers: danno, ulan, paul.l..., gergely.kis.imgtec, akos.palfi.imgtec,

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

Port 062a032f50291ce181462226ff41b4ef9b11deba

BUG=v8:3629
LOG=N

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

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

Affected files (+16, -10 lines):
  M src/ic/mips/handler-compiler-mips.cc
  M src/ic/mips64/handler-compiler-mips64.cc


Index: src/ic/mips/handler-compiler-mips.cc
diff --git a/src/ic/mips/handler-compiler-mips.cc b/src/ic/mips/handler-compiler-mips.cc index 8a7b6aa8229ae38bdd851ee828d8b02ba2ce10bf..2a8d3b86f18adea2de25370046e7c91cd8a40b22 100644
--- a/src/ic/mips/handler-compiler-mips.cc
+++ b/src/ic/mips/handler-compiler-mips.cc
@@ -412,11 +412,11 @@ Register PropertyHandlerCompiler::CheckPrototypes(
       __ lw(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
     } else {
       Register map_reg = scratch1;
+      __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
       if (depth != 1 || check == CHECK_ALL_MAPS) {
-        // CheckMap implicitly loads the map of |reg| into |map_reg|.
-        __ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK);
-      } else {
-        __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
+        Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
+        __ CmpWeakValue(scratch2, map_reg, cell);
+        __ Branch(miss, ne, scratch2, Operand(zero_reg));
       }

// Check access rights to the global object. This has to happen after
@@ -447,7 +447,10 @@ Register PropertyHandlerCompiler::CheckPrototypes(

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

   // Perform security check for access to the global object.
Index: src/ic/mips64/handler-compiler-mips64.cc
diff --git a/src/ic/mips64/handler-compiler-mips64.cc b/src/ic/mips64/handler-compiler-mips64.cc index d659db2498b2fd46035d9798dfe686bc440f48cb..5e626c3a3f80f117de73d53584694351c2aba4d0 100644
--- a/src/ic/mips64/handler-compiler-mips64.cc
+++ b/src/ic/mips64/handler-compiler-mips64.cc
@@ -412,11 +412,11 @@ Register PropertyHandlerCompiler::CheckPrototypes(
       __ ld(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
     } else {
       Register map_reg = scratch1;
+      __ ld(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
       if (depth != 1 || check == CHECK_ALL_MAPS) {
-        // CheckMap implicitly loads the map of |reg| into |map_reg|.
-        __ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK);
-      } else {
-        __ ld(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
+        Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
+        __ CmpWeakValue(scratch2, map_reg, cell);
+        __ Branch(miss, ne, scratch2, Operand(zero_reg));
       }

// Check access rights to the global object. This has to happen after
@@ -447,7 +447,10 @@ Register PropertyHandlerCompiler::CheckPrototypes(

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

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