Reviewers: Yang,

Message:
Hi Yang, here is the additional fix needed for the recent internalized string
change. Thanks!
--Michael

Description:
In MacroAssembler::JumpIfNotBothSequentialAsciiStrings a custom mask
helps us decide if we have two ascii strings. We don't care if they
are internalized or not. A few days ago we flipped the meaning of the
internalized bit in INSTANCE_TYPE, and that broke this custom mask.
This CL effects a repair.

BUG=

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/macro-assembler-arm.cc
  M src/ia32/macro-assembler-ia32.cc
  M src/mips/macro-assembler-mips.cc
  M src/x64/macro-assembler-x64.cc


Index: src/arm/macro-assembler-arm.cc
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
index 8416926b46adaccce279e32ab64dd7ad85f2677c..ee4b7fa73aab0d651c31f0aa1caf5f2b1d477265 100644
--- a/src/arm/macro-assembler-arm.cc
+++ b/src/arm/macro-assembler-arm.cc
@@ -3262,7 +3262,11 @@ void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii(
     Label* failure) {
   int kFlatAsciiStringMask =
       kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask;
-  int kFlatAsciiStringTag = ASCII_STRING_TYPE;
+ // Use ASCII_INTERNALIZED_STRING_TYPE because it's internalized bit is zero.
+  // Since we don't include that bit in the mask above, the test below will
+  // succeed for ASCII_STRING_TYPE and ASCII_INTERNALIZED_STRING_TYPE.
+  STATIC_ASSERT(kInternalizedTag == 0);
+  const int kFlatAsciiStringTag = ASCII_INTERNALIZED_STRING_TYPE;
   and_(scratch1, first, Operand(kFlatAsciiStringMask));
   and_(scratch2, second, Operand(kFlatAsciiStringMask));
   cmp(scratch1, Operand(kFlatAsciiStringTag));
Index: src/ia32/macro-assembler-ia32.cc
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index ef90c10df0d1a2b414d630c724f8e14646a4ed00..5165e1fc6c4c1ddbc32039d4ac8d6d41f1984954 100644
--- a/src/ia32/macro-assembler-ia32.cc
+++ b/src/ia32/macro-assembler-ia32.cc
@@ -2798,7 +2798,11 @@ void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register object1,
   // Check that both are flat ASCII strings.
   const int kFlatAsciiStringMask =
       kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
-  const int kFlatAsciiStringTag = ASCII_STRING_TYPE;
+ // Use ASCII_INTERNALIZED_STRING_TYPE because it's internalized bit is zero.
+  // Since we don't include that bit in the mask above, the test below will
+  // succeed for ASCII_STRING_TYPE and ASCII_INTERNALIZED_STRING_TYPE.
+  STATIC_ASSERT(kInternalizedTag == 0);
+  const int kFlatAsciiStringTag = ASCII_INTERNALIZED_STRING_TYPE;
// Interleave bits from both instance types and compare them in one check.
   ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
   and_(scratch1, kFlatAsciiStringMask);
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 8a44185ed70a5e48b682c2816b60821da3343c44..1eaa98639f58433102102e4e455d9bab2e29bcc7 100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -4970,7 +4970,11 @@ void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii(
     Label* failure) {
   int kFlatAsciiStringMask =
       kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask;
-  int kFlatAsciiStringTag = ASCII_STRING_TYPE;
+ // Use ASCII_INTERNALIZED_STRING_TYPE because it's internalized bit is zero.
+  // Since we don't include that bit in the mask above, the test below will
+  // succeed for ASCII_STRING_TYPE and ASCII_INTERNALIZED_STRING_TYPE.
+  STATIC_ASSERT(kInternalizedTag == 0);
+  const int kFlatAsciiStringTag = ASCII_INTERNALIZED_STRING_TYPE;
   ASSERT(kFlatAsciiStringTag <= 0xffff);  // Ensure this fits 16-bit immed.
   andi(scratch1, first, kFlatAsciiStringMask);
   Branch(failure, ne, scratch1, Operand(kFlatAsciiStringTag));
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index b3e15905aad4654d41ed8041bac60424694959fb..ddd0f978c05d7fd6fa6a6f0f7507de1ce21655fa 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -2253,7 +2253,11 @@ void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(
   ASSERT(kNotStringTag != 0);
   const int kFlatAsciiStringMask =
       kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
-  const int kFlatAsciiStringTag = ASCII_STRING_TYPE;
+ // Use ASCII_INTERNALIZED_STRING_TYPE because it's internalized bit is zero.
+  // Since we don't include that bit in the mask above, the test below will
+  // succeed for ASCII_STRING_TYPE and ASCII_INTERNALIZED_STRING_TYPE.
+  STATIC_ASSERT(kInternalizedTag == 0);
+  const int kFlatAsciiStringTag = ASCII_INTERNALIZED_STRING_TYPE;

   andl(scratch1, Immediate(kFlatAsciiStringMask));
   andl(scratch2, Immediate(kFlatAsciiStringMask));


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