Reviewers: danno, mvstanton, Paul Lind, palfia, kisg,
Description:
MIPS: The check for internalized strings relied on the fact that we had less
than 64 distinct InstanceTypes.
Port r15358 (3af77be)
Original commit message:
The check for internalized strings relied on the fact that we had less
than 64 distinct InstanceTypes. We are hitting that boundary, so this
check needs to be more comprehensive. In fact, two bits need to be
tested: verify that kNotStringTag isn't set, and that kInternalizedTag
is set.
BUG=
Please review this at https://codereview.chromium.org/18083004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/mips/code-stubs-mips.cc
M src/mips/ic-mips.cc
M src/mips/macro-assembler-mips.h
M src/mips/macro-assembler-mips.cc
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index
a05143534e3e3cc9009041881f2ffacebead7bad..2da8fc0ffeed283044d44f8a9331afaeb8b12096
100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -1181,12 +1181,17 @@ static void
EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
// Now that we have the types we might as well check for
// internalized-internalized.
- // Ensure that no non-strings have the internalized bit set.
- STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsInternalizedMask);
+ Label not_internalized;
STATIC_ASSERT(kInternalizedTag != 0);
- __ And(t2, a2, Operand(a3));
- __ And(t0, t2, Operand(kIsInternalizedMask));
- __ Branch(&return_not_equal, ne, t0, Operand(zero_reg));
+ __ And(t2, a2, Operand(kIsNotStringMask | kIsInternalizedMask));
+ __ Branch(¬_internalized, ne, t2,
+ Operand(kInternalizedTag | kStringTag));
+
+ __ And(a3, a3, Operand(kIsNotStringMask | kIsInternalizedMask));
+ __ Branch(&return_not_equal, eq, a3,
+ Operand(kInternalizedTag | kStringTag));
+
+ __ bind(¬_internalized);
}
@@ -1220,8 +1225,7 @@ static void
EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm,
ASSERT((lhs.is(a0) && rhs.is(a1)) ||
(lhs.is(a1) && rhs.is(a0)));
- // a2 is object type of lhs.
- // Ensure that no non-strings have the internalized bit set.
+ // a2 is object type of rhs.
Label object_test;
STATIC_ASSERT(kInternalizedTag != 0);
__ And(at, a2, Operand(kIsNotStringMask));
@@ -6612,9 +6616,13 @@ void
ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) {
__ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset));
__ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset));
STATIC_ASSERT(kInternalizedTag != 0);
- __ And(tmp1, tmp1, Operand(tmp2));
- __ And(tmp1, tmp1, kIsInternalizedMask);
- __ Branch(&miss, eq, tmp1, Operand(zero_reg));
+
+ __ And(tmp1, tmp1, Operand(kIsNotStringMask | kIsInternalizedMask));
+ __ Branch(&miss, ne, tmp1, Operand(kInternalizedTag | kStringTag));
+
+ __ And(tmp2, tmp2, Operand(kIsNotStringMask | kIsInternalizedMask));
+ __ Branch(&miss, ne, tmp2, Operand(kInternalizedTag | kStringTag));
+
// Make sure a0 is non-zero. At this point input operands are
// guaranteed to be non-zero.
ASSERT(right.is(a0));
@@ -6654,17 +6662,8 @@ void
ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) {
__ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset));
__ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset));
- Label succeed1;
- __ And(at, tmp1, Operand(kIsInternalizedMask));
- __ Branch(&succeed1, ne, at, Operand(zero_reg));
- __ Branch(&miss, ne, tmp1, Operand(SYMBOL_TYPE));
- __ bind(&succeed1);
-
- Label succeed2;
- __ And(at, tmp2, Operand(kIsInternalizedMask));
- __ Branch(&succeed2, ne, at, Operand(zero_reg));
- __ Branch(&miss, ne, tmp2, Operand(SYMBOL_TYPE));
- __ bind(&succeed2);
+ __ JumpIfNotUniqueName(tmp1, &miss);
+ __ JumpIfNotUniqueName(tmp2, &miss);
// Use a0 as result
__ mov(v0, a0);
@@ -6727,7 +6726,8 @@ void ICCompareStub::GenerateStrings(MacroAssembler*
masm) {
// Handle not identical strings.
// Check that both strings are internalized strings. If they are, we're
done
- // because we already know they are not identical.
+ // because we already know they are not identical. We know they are both
+ // strings.
if (equality) {
ASSERT(GetCondition() == eq);
STATIC_ASSERT(kInternalizedTag != 0);
@@ -6932,10 +6932,7 @@ void
NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
__ lw(entity_name, FieldMemOperand(entity_name,
HeapObject::kMapOffset));
__ lbu(entity_name,
FieldMemOperand(entity_name, Map::kInstanceTypeOffset));
- __ And(scratch0, entity_name, Operand(kIsInternalizedMask));
- __ Branch(&good, ne, scratch0, Operand(zero_reg));
- __ Branch(miss, ne, entity_name, Operand(SYMBOL_TYPE));
-
+ __ JumpIfNotUniqueName(entity_name, miss);
__ bind(&good);
// Restore the properties.
@@ -7109,14 +7106,10 @@ void
NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) {
// Check if the entry name is not a unique name.
- Label cont;
__ lw(entry_key, FieldMemOperand(entry_key, HeapObject::kMapOffset));
__ lbu(entry_key,
FieldMemOperand(entry_key, Map::kInstanceTypeOffset));
- __ And(result, entry_key, Operand(kIsInternalizedMask));
- __ Branch(&cont, ne, result, Operand(zero_reg));
- __ Branch(&maybe_in_dictionary, ne, entry_key, Operand(SYMBOL_TYPE));
- __ bind(&cont);
+ __ JumpIfNotUniqueName(entry_key, &maybe_in_dictionary);
}
}
Index: src/mips/ic-mips.cc
diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc
index
b30ee31ff62a9da24dc251e9bf1a83b7ac147a83..8a00f605639e2cf5270d850484435d9f1c45a700
100644
--- a/src/mips/ic-mips.cc
+++ b/src/mips/ic-mips.cc
@@ -326,7 +326,8 @@ static void GenerateKeyNameCheck(MacroAssembler* masm,
__ And(at, hash, Operand(Name::kContainsCachedArrayIndexMask));
__ Branch(index_string, eq, at, Operand(zero_reg));
- // Is the string internalized?
+ // Is the string internalized? We know it's a string, so a single
+ // bit test is enough.
// map: key map
__ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
STATIC_ASSERT(kInternalizedTag != 0);
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc
b/src/mips/macro-assembler-mips.cc
index
d41ddd2ccf0592d16cc76b38f65130ca55c3550a..3e3314a22f610467e383c9fdcc494ca2bc1daee4
100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -3202,6 +3202,14 @@ void
MacroAssembler::AllocateAsciiSlicedString(Register result,
}
+void MacroAssembler::JumpIfNotUniqueName(Register reg,
+ Label* not_unique_name) {
+ STATIC_ASSERT(((SYMBOL_TYPE - 1) & kIsInternalizedMask) ==
kInternalizedTag);
+ Branch(not_unique_name, lt, reg, Operand(kIsInternalizedMask));
+ Branch(not_unique_name, gt, reg, Operand(SYMBOL_TYPE));
+}
+
+
// Allocates a heap number or jumps to the label if the young space is
full and
// a scavenge is needed.
void MacroAssembler::AllocateHeapNumber(Register result,
Index: src/mips/macro-assembler-mips.h
diff --git a/src/mips/macro-assembler-mips.h
b/src/mips/macro-assembler-mips.h
index
c983b8ba5a3f58ec41b5dfaa863043c953095eea..ffae2fd69e06aa9665cc4bd2be84607bf3188652
100644
--- a/src/mips/macro-assembler-mips.h
+++ b/src/mips/macro-assembler-mips.h
@@ -1406,6 +1406,8 @@ class MacroAssembler: public Assembler {
Register scratch,
Label* failure);
+ void JumpIfNotUniqueName(Register reg, Label* not_unique_name);
+
// Test that both first and second are sequential ASCII strings.
// Assume that they are non-smis.
void JumpIfNonSmisNotBothSequentialAsciiStrings(Register first,
--
--
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.