MIPS: Convert String array index/length hash to BitField.
Port r21533 (736c779) BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/297233007 Patch from Balazs Kilvady <kilvadyb@homejinni.com>. git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21539 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
5192a0d0d9
commit
47664dc108
@ -3999,19 +3999,14 @@ bool MacroAssembler::AllowThisStubCall(CodeStub* stub) {
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::IndexFromHash(Register hash,
|
||||
Register index) {
|
||||
void MacroAssembler::IndexFromHash(Register hash, Register index) {
|
||||
// If the hash field contains an array index pick it out. The assert checks
|
||||
// that the constants for the maximum number of digits for an array index
|
||||
// cached in the hash field and the number of bits 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.
|
||||
STATIC_ASSERT(kSmiTag == 0);
|
||||
Ext(hash, hash, String::kHashShift, String::kArrayIndexValueBits);
|
||||
sll(index, hash, kSmiTagSize);
|
||||
DecodeFieldToSmi<String::ArrayIndexValueBits>(index, hash);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1485,13 +1485,7 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
|
||||
|
||||
template<typename Field>
|
||||
void DecodeField(Register dst, Register src) {
|
||||
static const int shift = Field::kShift;
|
||||
static const int mask = Field::kMask >> shift;
|
||||
static const int size = Field::kSize;
|
||||
srl(dst, src, shift);
|
||||
if (shift + size != 32) {
|
||||
And(dst, dst, Operand(mask));
|
||||
}
|
||||
Ext(dst, src, Field::kShift, Field::kSize);
|
||||
}
|
||||
|
||||
template<typename Field>
|
||||
@ -1499,6 +1493,28 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
|
||||
DecodeField<Field>(reg, reg);
|
||||
}
|
||||
|
||||
template<typename Field>
|
||||
void DecodeFieldToSmi(Register dst, Register src) {
|
||||
static const int shift = Field::kShift;
|
||||
static const int mask = Field::kMask >> shift << kSmiTagSize;
|
||||
STATIC_ASSERT((mask & (0x80000000u >> (kSmiTagSize - 1))) == 0);
|
||||
STATIC_ASSERT(kSmiTag == 0);
|
||||
if (shift < kSmiTagSize) {
|
||||
sll(dst, src, kSmiTagSize - shift);
|
||||
And(dst, dst, Operand(mask));
|
||||
} else if (shift > kSmiTagSize) {
|
||||
srl(dst, src, shift - kSmiTagSize);
|
||||
And(dst, dst, Operand(mask));
|
||||
} else {
|
||||
And(dst, src, Operand(mask));
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Field>
|
||||
void DecodeFieldToSmi(Register reg) {
|
||||
DecodeField<Field>(reg, reg);
|
||||
}
|
||||
|
||||
// Generates function and stub prologue code.
|
||||
void StubPrologue();
|
||||
void Prologue(bool code_pre_aging);
|
||||
|
Loading…
Reference in New Issue
Block a user