diff options
Diffstat (limited to 'deps/v8/src/ia32/ic-ia32.cc')
-rw-r--r-- | deps/v8/src/ia32/ic-ia32.cc | 118 |
1 files changed, 9 insertions, 109 deletions
diff --git a/deps/v8/src/ia32/ic-ia32.cc b/deps/v8/src/ia32/ic-ia32.cc index be5910a12..5f143b104 100644 --- a/deps/v8/src/ia32/ic-ia32.cc +++ b/deps/v8/src/ia32/ic-ia32.cc @@ -216,105 +216,6 @@ static void GenerateDictionaryStore(MacroAssembler* masm, } -static void GenerateNumberDictionaryLoad(MacroAssembler* masm, - Label* miss, - Register elements, - Register key, - Register r0, - Register r1, - Register r2, - Register result) { - // Register use: - // - // elements - holds the slow-case elements of the receiver and is unchanged. - // - // key - holds the smi key on entry and is unchanged. - // - // Scratch registers: - // - // r0 - holds the untagged key on entry and holds the hash once computed. - // - // r1 - used to hold the capacity mask of the dictionary - // - // r2 - used for the index into the dictionary. - // - // result - holds the result on exit if the load succeeds and we fall through. - - Label done; - - // Compute the hash code from the untagged key. This must be kept in sync - // with ComputeIntegerHash in utils.h. - // - // hash = ~hash + (hash << 15); - __ mov(r1, r0); - __ not_(r0); - __ shl(r1, 15); - __ add(r0, Operand(r1)); - // hash = hash ^ (hash >> 12); - __ mov(r1, r0); - __ shr(r1, 12); - __ xor_(r0, Operand(r1)); - // hash = hash + (hash << 2); - __ lea(r0, Operand(r0, r0, times_4, 0)); - // hash = hash ^ (hash >> 4); - __ mov(r1, r0); - __ shr(r1, 4); - __ xor_(r0, Operand(r1)); - // hash = hash * 2057; - __ imul(r0, r0, 2057); - // hash = hash ^ (hash >> 16); - __ mov(r1, r0); - __ shr(r1, 16); - __ xor_(r0, Operand(r1)); - - // Compute capacity mask. - __ mov(r1, FieldOperand(elements, NumberDictionary::kCapacityOffset)); - __ shr(r1, kSmiTagSize); // convert smi to int - __ dec(r1); - - // Generate an unrolled loop that performs a few probes before giving up. - const int kProbes = 4; - for (int i = 0; i < kProbes; i++) { - // Use r2 for index calculations and keep the hash intact in r0. - __ mov(r2, r0); - // Compute the masked index: (hash + i + i * i) & mask. - if (i > 0) { - __ add(Operand(r2), Immediate(NumberDictionary::GetProbeOffset(i))); - } - __ and_(r2, Operand(r1)); - - // Scale the index by multiplying by the entry size. - ASSERT(NumberDictionary::kEntrySize == 3); - __ lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 - - // Check if the key matches. - __ cmp(key, FieldOperand(elements, - r2, - times_pointer_size, - NumberDictionary::kElementsStartOffset)); - if (i != (kProbes - 1)) { - __ j(equal, &done); - } else { - __ j(not_equal, miss); - } - } - - __ bind(&done); - // Check that the value is a normal propety. - const int kDetailsOffset = - NumberDictionary::kElementsStartOffset + 2 * kPointerSize; - ASSERT_EQ(NORMAL, 0); - __ test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), - Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); - __ j(not_zero, miss); - - // Get the value at the masked, scaled index. - const int kValueOffset = - NumberDictionary::kElementsStartOffset + kPointerSize; - __ mov(result, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); -} - - void LoadIC::GenerateArrayLength(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- eax : receiver @@ -591,14 +492,13 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { // Push receiver on the stack to free up a register for the dictionary // probing. __ push(edx); - GenerateNumberDictionaryLoad(masm, - &slow_pop_receiver, - ecx, - eax, - ebx, - edx, - edi, - eax); + __ LoadFromNumberDictionary(&slow_pop_receiver, + ecx, + eax, + ebx, + edx, + edi, + eax); // Pop receiver before returning. __ pop(edx); __ ret(0); @@ -1200,8 +1100,8 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { __ SmiUntag(ebx); // ebx: untagged index // Receiver in edx will be clobbered, need to reload it on miss. - GenerateNumberDictionaryLoad( - masm, &slow_reload_receiver, eax, ecx, ebx, edx, edi, edi); + __ LoadFromNumberDictionary( + &slow_reload_receiver, eax, ecx, ebx, edx, edi, edi); __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); __ jmp(&do_call); |