| Index: src/ia32/code-stubs-ia32.cc
|
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
|
| index 7b6eb8faf95cebdc0b61452cdef150359e050390..d7d1d9c3cc0c244ae4d35c770414ed5e3c0ad42f 100644
|
| --- a/src/ia32/code-stubs-ia32.cc
|
| +++ b/src/ia32/code-stubs-ia32.cc
|
| @@ -6541,7 +6541,67 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
|
| // must always call a backup property check that is complete.
|
| // This function is safe to call if the receiver has fast properties.
|
| // Name must be a symbol and receiver must be a heap object.
|
| -MaybeObject* StringDictionaryLookupStub::GenerateNegativeLookup(
|
| +void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
|
| + Label* miss,
|
| + Label* done,
|
| + Register properties,
|
| + Handle<String> name,
|
| + Register r0) {
|
| + ASSERT(name->IsSymbol());
|
| +
|
| + // If names of slots in range from 1 to kProbes - 1 for the hash value are
|
| + // not equal to the name and kProbes-th slot is not used (its name is the
|
| + // undefined value), it guarantees the hash table doesn't contain the
|
| + // property. It's true even if some slots represent deleted properties
|
| + // (their names are the null value).
|
| + for (int i = 0; i < kInlinedProbes; i++) {
|
| + // Compute the masked index: (hash + i + i * i) & mask.
|
| + Register index = r0;
|
| + // Capacity is smi 2^n.
|
| + __ mov(index, FieldOperand(properties, kCapacityOffset));
|
| + __ dec(index);
|
| + __ and_(index,
|
| + Immediate(Smi::FromInt(name->Hash() +
|
| + StringDictionary::GetProbeOffset(i))));
|
| +
|
| + // Scale the index by multiplying by the entry size.
|
| + ASSERT(StringDictionary::kEntrySize == 3);
|
| + __ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
|
| + Register entity_name = r0;
|
| + // Having undefined at this place means the name is not contained.
|
| + ASSERT_EQ(kSmiTagSize, 1);
|
| + __ mov(entity_name, Operand(properties, index, times_half_pointer_size,
|
| + kElementsStartOffset - kHeapObjectTag));
|
| + __ cmp(entity_name, masm->isolate()->factory()->undefined_value());
|
| + __ j(equal, done);
|
| +
|
| + // Stop if found the property.
|
| + __ cmp(entity_name, Handle<String>(name));
|
| + __ j(equal, miss);
|
| +
|
| + // Check if the entry name is not a symbol.
|
| + __ mov(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset));
|
| + __ test_b(FieldOperand(entity_name, Map::kInstanceTypeOffset),
|
| + kIsSymbolMask);
|
| + __ j(zero, miss);
|
| + }
|
| +
|
| + StringDictionaryLookupStub stub(properties,
|
| + r0,
|
| + r0,
|
| + StringDictionaryLookupStub::NEGATIVE_LOOKUP);
|
| + __ push(Immediate(Handle<Object>(name)));
|
| + __ push(Immediate(name->Hash()));
|
| + __ CallStub(&stub);
|
| + __ test(r0, r0);
|
| + __ j(not_zero, miss);
|
| + __ jmp(done);
|
| +}
|
| +
|
| +
|
| +// TODO(kmillikin): Eliminate this function when the stub cache is fully
|
| +// handlified.
|
| +MaybeObject* StringDictionaryLookupStub::TryGenerateNegativeLookup(
|
| MacroAssembler* masm,
|
| Label* miss,
|
| Label* done,
|
|
|