Revision: 21549
Author:   [email protected]
Date:     Wed May 28 08:18:39 2014 UTC
Log:      X87: Convert String array index/length hash to BitField.

Port r21533 (736c779)

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/x87/macro-assembler-x87.cc
 /branches/bleeding_edge/src/x87/macro-assembler-x87.h

=======================================
--- /branches/bleeding_edge/src/x87/macro-assembler-x87.cc Wed May 28 08:16:11 2014 UTC +++ /branches/bleeding_edge/src/x87/macro-assembler-x87.cc Wed May 28 08:18:39 2014 UTC
@@ -1940,16 +1940,10 @@
   // reserved for it does not conflict.
   ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) <
          (1 << String::kArrayIndexValueBits));
- // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in
-  // the low kHashShift bits.
-  and_(hash, String::kArrayIndexValueMask);
-  STATIC_ASSERT(String::kHashShift >= kSmiTagSize && kSmiTag == 0);
-  if (String::kHashShift > kSmiTagSize) {
-    shr(hash, String::kHashShift - kSmiTagSize);
-  }
   if (!index.is(hash)) {
     mov(index, hash);
   }
+  DecodeFieldToSmi<String::ArrayIndexValueBits>(index);
 }


=======================================
--- /branches/bleeding_edge/src/x87/macro-assembler-x87.h Mon May 26 11:28:08 2014 UTC +++ /branches/bleeding_edge/src/x87/macro-assembler-x87.h Wed May 28 08:18:39 2014 UTC
@@ -478,7 +478,23 @@
   void DecodeField(Register reg) {
     static const int shift = Field::kShift;
     static const int mask = Field::kMask >> Field::kShift;
-    sar(reg, shift);
+    if (shift != 0) {
+      sar(reg, shift);
+    }
+    and_(reg, Immediate(mask));
+  }
+
+  template<typename Field>
+  void DecodeFieldToSmi(Register reg) {
+    static const int shift = Field::kShift;
+    static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize;
+    STATIC_ASSERT((mask & (0x80000000u >> (kSmiTagSize - 1))) == 0);
+    STATIC_ASSERT(kSmiTag == 0);
+    if (shift < kSmiTagSize) {
+      shl(reg, kSmiTagSize - shift);
+    } else if (shift > kSmiTagSize) {
+      sar(reg, shift - kSmiTagSize);
+    }
     and_(reg, Immediate(mask));
   }

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