Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: src/ia32/ic-ia32.cc

Issue 521041: Improve keyed loads on strings by using a new stub (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins.cc ('k') | src/ic.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 -------------
« no previous file with comments | « src/builtins.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698