| Index: src/ia32/ic-ia32.cc
|
| ===================================================================
|
| --- src/ia32/ic-ia32.cc (revision 3546)
|
| +++ src/ia32/ic-ia32.cc (working copy)
|
| @@ -391,6 +391,48 @@
|
| }
|
|
|
|
|
| +void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- esp[0] : return address
|
| + // -- esp[4] : key
|
| + // -- esp[8] : receiver
|
| + // -----------------------------------
|
| + Label miss, index_ok;
|
| +
|
| + // Pop return address.
|
| + // Performing the load early is better in the common case.
|
| + __ pop(eax);
|
| +
|
| + __ mov(ebx, Operand(esp, 1 * kPointerSize));
|
| + __ test(ebx, Immediate(kSmiTagMask));
|
| + __ j(zero, &miss);
|
| + __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset));
|
| + __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
|
| + __ test(ecx, Immediate(kIsNotStringMask));
|
| + __ j(not_zero, &miss);
|
| +
|
| + // Check if key is a smi or a heap number.
|
| + __ mov(edx, Operand(esp, 0));
|
| + __ test(edx, Immediate(kSmiTagMask));
|
| + __ j(zero, &index_ok);
|
| + __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset));
|
| + __ cmp(ecx, Factory::heap_number_map());
|
| + __ j(not_equal, &miss);
|
| +
|
| + __ bind(&index_ok);
|
| + // Duplicate receiver and key since they are expected on the stack after
|
| + // the KeyedLoadIC call.
|
| + __ push(ebx); // receiver
|
| + __ push(edx); // key
|
| + __ push(eax); // return address
|
| + __ InvokeBuiltin(Builtins::STRING_CHAR_AT, JUMP_FUNCTION);
|
| +
|
| + __ bind(&miss);
|
| + __ push(eax);
|
| + GenerateMiss(masm);
|
| +}
|
| +
|
| +
|
| void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
|
| ExternalArrayType array_type) {
|
| // ----------- S t a t e -------------
|
|
|