Commit a9c074b8 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: With >= 64 non-string instance types, I removed an optimization that...

MIPS: With >= 64 non-string instance types, I removed an optimization that allowed us to detect internalized strings with a single bit test.

Port r15773 (60aa9f0)

Original commit message:
With >= 64 non-string instance types, I removed an optimization that allowed us to detect internalized strings with a single bit test. (https://code.google.com/p/v8/source/detail?r=15358) But that change caused a regression, so here is an improvement:

Put the internalized string types in the lower 64 entries of
INSTANCE_TYPE, and non-internalized string types in the next 64 entries.
This way we can restore the single bit check.

BUG=

Review URL: https://codereview.chromium.org/19723008
Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15783 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4c3269a4
......@@ -1225,17 +1225,10 @@ static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
// Now that we have the types we might as well check for
// internalized-internalized.
Label not_internalized;
STATIC_ASSERT(kInternalizedTag != 0);
__ And(t2, a2, Operand(kIsNotStringMask | kIsInternalizedMask));
__ Branch(&not_internalized, ne, t2,
Operand(kInternalizedTag | kStringTag));
__ And(a3, a3, Operand(kIsNotStringMask | kIsInternalizedMask));
__ Branch(&return_not_equal, eq, a3,
Operand(kInternalizedTag | kStringTag));
__ bind(&not_internalized);
STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0);
__ Or(a2, a2, Operand(a3));
__ And(at, a2, Operand(kIsNotStringMask | kIsNotInternalizedMask));
__ Branch(&return_not_equal, eq, at, Operand(zero_reg));
}
......@@ -1271,15 +1264,15 @@ static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm,
// a2 is object type of rhs.
Label object_test;
STATIC_ASSERT(kInternalizedTag != 0);
STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0);
__ And(at, a2, Operand(kIsNotStringMask));
__ Branch(&object_test, ne, at, Operand(zero_reg));
__ And(at, a2, Operand(kIsInternalizedMask));
__ Branch(possible_strings, eq, at, Operand(zero_reg));
__ And(at, a2, Operand(kIsNotInternalizedMask));
__ Branch(possible_strings, ne, at, Operand(zero_reg));
__ GetObjectType(rhs, a3, a3);
__ Branch(not_both_strings, ge, a3, Operand(FIRST_NONSTRING_TYPE));
__ And(at, a3, Operand(kIsInternalizedMask));
__ Branch(possible_strings, eq, at, Operand(zero_reg));
__ And(at, a3, Operand(kIsNotInternalizedMask));
__ Branch(possible_strings, ne, at, Operand(zero_reg));
// Both are internalized strings. We already checked they weren't the same
// pointer so they are not equal.
......@@ -6383,13 +6376,10 @@ void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) {
__ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset));
__ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset));
__ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset));
STATIC_ASSERT(kInternalizedTag != 0);
__ 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));
STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0);
__ Or(tmp1, tmp1, Operand(tmp2));
__ And(at, tmp1, Operand(kIsNotStringMask | kIsNotInternalizedMask));
__ Branch(&miss, ne, at, Operand(zero_reg));
// Make sure a0 is non-zero. At this point input operands are
// guaranteed to be non-zero.
......@@ -6424,7 +6414,6 @@ void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) {
// Check that both operands are unique names. This leaves the instance
// types loaded in tmp1 and tmp2.
STATIC_ASSERT(kInternalizedTag != 0);
__ lw(tmp1, FieldMemOperand(left, HeapObject::kMapOffset));
__ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset));
__ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset));
......@@ -6498,11 +6487,11 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
// strings.
if (equality) {
ASSERT(GetCondition() == eq);
STATIC_ASSERT(kInternalizedTag != 0);
__ And(tmp3, tmp1, Operand(tmp2));
__ And(tmp5, tmp3, Operand(kIsInternalizedMask));
STATIC_ASSERT(kInternalizedTag == 0);
__ Or(tmp3, tmp1, Operand(tmp2));
__ And(tmp5, tmp3, Operand(kIsNotInternalizedMask));
Label is_symbol;
__ Branch(&is_symbol, eq, tmp5, Operand(zero_reg));
__ Branch(&is_symbol, ne, tmp5, Operand(zero_reg));
// Make sure a0 is non-zero. At this point input operands are
// guaranteed to be non-zero.
ASSERT(right.is(a0));
......
......@@ -330,9 +330,9 @@ static void GenerateKeyNameCheck(MacroAssembler* masm,
// bit test is enough.
// map: key map
__ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
STATIC_ASSERT(kInternalizedTag != 0);
__ And(at, hash, Operand(kIsInternalizedMask));
__ Branch(not_unique, eq, at, Operand(zero_reg));
STATIC_ASSERT(kInternalizedTag == 0);
__ And(at, hash, Operand(kIsNotInternalizedMask));
__ Branch(not_unique, ne, at, Operand(zero_reg));
__ bind(&unique);
}
......
......@@ -3209,9 +3209,13 @@ 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));
STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0);
Label succeed;
And(at, reg, Operand(kIsNotStringMask | kIsNotInternalizedMask));
Branch(&succeed, eq, at, Operand(zero_reg));
Branch(not_unique_name, ne, reg, Operand(SYMBOL_TYPE));
bind(&succeed);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment