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

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 1633024: Revert r4444 "Inline fast cases in string keyed load IC." (Closed)
Patch Set: Created 10 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 (1 << String::kArrayIndexValueBits)); 484 (1 << String::kArrayIndexValueBits));
485 __ bind(&index_string); 485 __ bind(&index_string);
486 __ and_(ebx, String::kArrayIndexHashMask); 486 __ and_(ebx, String::kArrayIndexHashMask);
487 __ shr(ebx, String::kHashShift); 487 __ shr(ebx, String::kHashShift);
488 __ jmp(&index_int); 488 __ jmp(&index_int);
489 } 489 }
490 490
491 491
492 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { 492 void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
493 // ----------- S t a t e ------------- 493 // ----------- S t a t e -------------
494 // -- eax : key (index) 494 // -- eax : key
495 // -- edx : receiver 495 // -- edx : receiver
496 // -- esp[0] : return address 496 // -- esp[0] : return address
497 // ----------------------------------- 497 // -----------------------------------
498 Label miss; 498 Label miss, index_ok;
499 Label not_positive_smi;
500 Label slow_char_code;
501 Label got_char_code;
502 499
503 Register receiver = edx; 500 // Pop return address.
504 Register index = eax; 501 // Performing the load early is better in the common case.
505 Register code = ebx; 502 __ pop(ebx);
506 Register scratch = ecx;
507 503
508 StringHelper::GenerateFastCharCodeAt(masm, 504 __ test(edx, Immediate(kSmiTagMask));
509 receiver, 505 __ j(zero, &miss);
510 index, 506 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
511 scratch, 507 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
512 code, 508 __ test(ecx, Immediate(kIsNotStringMask));
513 &miss, // When not a string. 509 __ j(not_zero, &miss);
514 &not_positive_smi,
515 &slow_char_code);
516 // If we didn't bail out, code register contains smi tagged char
517 // code.
518 __ bind(&got_char_code);
519 StringHelper::GenerateCharFromCode(masm, code, eax, JUMP_FUNCTION);
520 #ifdef DEBUG
521 __ Abort("Unexpected fall-through from char from code tail call");
522 #endif
523 510
524 // Check if key is a smi or a heap number. 511 // Check if key is a smi or a heap number.
525 __ bind(&not_positive_smi); 512 __ test(eax, Immediate(kSmiTagMask));
526 ASSERT(kSmiTag == 0); 513 __ j(zero, &index_ok);
527 __ test(index, Immediate(kSmiTagMask));
528 __ j(zero, &slow_char_code);
529 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); 514 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
530 __ cmp(ecx, Factory::heap_number_map()); 515 __ cmp(ecx, Factory::heap_number_map());
531 __ j(not_equal, &miss); 516 __ j(not_equal, &miss);
532 517
533 // Push receiver and key on the stack (now that we know they are a 518 __ bind(&index_ok);
534 // string and a number), and call runtime. 519 // Push receiver and key on the stack, and make a tail call.
535 __ bind(&slow_char_code); 520 __ push(edx); // receiver
536 __ EnterInternalFrame(); 521 __ push(eax); // key
537 __ push(receiver); 522 __ push(ebx); // return address
538 __ push(index); 523 __ InvokeBuiltin(Builtins::STRING_CHAR_AT, JUMP_FUNCTION);
539 __ CallRuntime(Runtime::kStringCharCodeAt, 1);
540 ASSERT(!code.is(eax));
541 __ mov(code, eax);
542 __ LeaveInternalFrame();
543 __ jmp(&got_char_code);
544 524
545 __ bind(&miss); 525 __ bind(&miss);
526 __ push(ebx);
546 GenerateMiss(masm); 527 GenerateMiss(masm);
547 } 528 }
548 529
549 530
550 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, 531 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
551 ExternalArrayType array_type) { 532 ExternalArrayType array_type) {
552 // ----------- S t a t e ------------- 533 // ----------- S t a t e -------------
553 // -- eax : key 534 // -- eax : key
554 // -- edx : receiver 535 // -- edx : receiver
555 // -- esp[0] : return address 536 // -- esp[0] : return address
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 1605
1625 // Do tail-call to runtime routine. 1606 // Do tail-call to runtime routine.
1626 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); 1607 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss));
1627 __ TailCallExternalReference(ref, 3, 1); 1608 __ TailCallExternalReference(ref, 3, 1);
1628 } 1609 }
1629 1610
1630 #undef __ 1611 #undef __
1631 1612
1632 1613
1633 } } // namespace v8::internal 1614 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698