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

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

Issue 6298019: Revert "Add custom typed ICs for pixel array loads. " (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 __ CompareRoot(scratch, Heap::kTheHoleValueRootIndex); 508 __ CompareRoot(scratch, Heap::kTheHoleValueRootIndex);
509 // In case the loaded value is the_hole we have to consult GetProperty 509 // In case the loaded value is the_hole we have to consult GetProperty
510 // to ensure the prototype chain is searched. 510 // to ensure the prototype chain is searched.
511 __ j(equal, out_of_range); 511 __ j(equal, out_of_range);
512 if (!result.is(scratch)) { 512 if (!result.is(scratch)) {
513 __ movq(result, scratch); 513 __ movq(result, scratch);
514 } 514 }
515 } 515 }
516 516
517 517
518 // Loads a indexed element from a pixel array.
519 static void GenerateFastPixelArrayLoad(MacroAssembler* masm,
520 Register receiver,
521 Register key,
522 Register elements,
523 Register untagged_key,
524 Register result,
525 Label* not_pixel_array,
526 Label* key_not_smi,
527 Label* out_of_range) {
528 // Register use:
529 // receiver - holds the receiver and is unchanged.
530 // key - holds the key and is unchanged (must be a smi).
531 // elements - is set to the the receiver's element if
532 // the receiver doesn't have a pixel array or the
533 // key is not a smi, otherwise it's the elements'
534 // external pointer.
535 // untagged_key - is set to the untagged key
536
537 // Check that the key is a smi.
538 if (key_not_smi != NULL) {
539 __ JumpIfNotSmi(key, key_not_smi);
540 }
541 __ SmiToInteger32(untagged_key, key);
542
543 // Verify that the receiver has pixel array elements.
544 __ movq(elements, FieldOperand(receiver, JSObject::kElementsOffset));
545 __ CompareRoot(FieldOperand(elements, HeapObject::kMapOffset),
546 Heap::kPixelArrayMapRootIndex);
547 __ j(not_equal, not_pixel_array);
548
549 // Check that the smi is in range.
550 __ cmpl(untagged_key, FieldOperand(elements, PixelArray::kLengthOffset));
551 __ j(above_equal, out_of_range);
552
553 // Load and tag the element as a smi.
554 __ movq(elements, FieldOperand(elements, PixelArray::kExternalPointerOffset));
555 __ movzxbq(result, Operand(elements, untagged_key, times_1, 0));
556 __ Integer32ToSmi(result, result);
557 __ ret(0);
558 }
559
560
561 // Checks whether a key is an array index string or a symbol string. 518 // Checks whether a key is an array index string or a symbol string.
562 // Falls through if the key is a symbol. 519 // Falls through if the key is a symbol.
563 static void GenerateKeyStringCheck(MacroAssembler* masm, 520 static void GenerateKeyStringCheck(MacroAssembler* masm,
564 Register key, 521 Register key,
565 Register map, 522 Register map,
566 Register hash, 523 Register hash,
567 Label* index_string, 524 Label* index_string,
568 Label* not_symbol) { 525 Label* not_symbol) {
569 // Register use: 526 // Register use:
570 // key - holds the key and is unchanged. Assumed to be non-smi. 527 // key - holds the key and is unchanged. Assumed to be non-smi.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 rax, 573 rax,
617 rcx, 574 rcx,
618 rbx, 575 rbx,
619 rax, 576 rax,
620 NULL, 577 NULL,
621 &slow); 578 &slow);
622 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); 579 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1);
623 __ ret(0); 580 __ ret(0);
624 581
625 __ bind(&check_pixel_array); 582 __ bind(&check_pixel_array);
626 GenerateFastPixelArrayLoad(masm, 583 // Check whether the elements object is a pixel array.
627 rdx, 584 // rdx: receiver
628 rax, 585 // rax: key
629 rcx, 586 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset));
630 rbx, 587 __ SmiToInteger32(rbx, rax); // Used on both directions of next branch.
631 rax, 588 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset),
632 &check_number_dictionary, 589 Heap::kPixelArrayMapRootIndex);
633 NULL, 590 __ j(not_equal, &check_number_dictionary);
634 &slow); 591 __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset));
592 __ j(above_equal, &slow);
593 __ movq(rax, FieldOperand(rcx, PixelArray::kExternalPointerOffset));
594 __ movzxbq(rax, Operand(rax, rbx, times_1, 0));
595 __ Integer32ToSmi(rax, rax);
596 __ ret(0);
635 597
636 __ bind(&check_number_dictionary); 598 __ bind(&check_number_dictionary);
637 // Check whether the elements is a number dictionary. 599 // Check whether the elements is a number dictionary.
638 // rdx: receiver 600 // rdx: receiver
639 // rax: key 601 // rax: key
640 // rbx: key as untagged int32 602 // rbx: key as untagged int32
641 // rcx: elements 603 // rcx: elements
642 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), 604 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset),
643 Heap::kHashTableMapRootIndex); 605 Heap::kHashTableMapRootIndex);
644 __ j(not_equal, &slow); 606 __ j(not_equal, &slow);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 __ push(rcx); // return address 760 __ push(rcx); // return address
799 761
800 // Perform tail call to the entry. 762 // Perform tail call to the entry.
801 __ TailCallExternalReference(ExternalReference( 763 __ TailCallExternalReference(ExternalReference(
802 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1); 764 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1);
803 765
804 __ bind(&slow); 766 __ bind(&slow);
805 GenerateMiss(masm); 767 GenerateMiss(masm);
806 } 768 }
807 769
808 void KeyedLoadIC::GeneratePixelArray(MacroAssembler* masm) {
809 // ----------- S t a t e -------------
810 // -- rax : key
811 // -- rdx : receiver
812 // -- rsp[0] : return address
813 // -----------------------------------
814 Label slow;
815
816 // Verify that it's safe to access the receiver's elements.
817 GenerateKeyedLoadReceiverCheck(
818 masm, rdx, rcx, Map::kHasNamedInterceptor, &slow);
819
820 // Generate the indexed load from the pixel array.
821 GenerateFastPixelArrayLoad(masm,
822 rdx,
823 rax,
824 rcx,
825 rbx,
826 rax,
827 &slow,
828 &slow,
829 &slow);
830
831 __ bind(&slow);
832 GenerateMiss(masm);
833 }
834
835 770
836 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 771 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
837 // ----------- S t a t e ------------- 772 // ----------- S t a t e -------------
838 // -- rax : value 773 // -- rax : value
839 // -- rcx : key 774 // -- rcx : key
840 // -- rdx : receiver 775 // -- rdx : receiver
841 // -- rsp[0] : return address 776 // -- rsp[0] : return address
842 // ----------------------------------- 777 // -----------------------------------
843 Label slow, slow_with_tagged_index, fast, array, extra, check_pixel_array; 778 Label slow, slow_with_tagged_index, fast, array, extra, check_pixel_array;
844 779
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 } 1703 }
1769 1704
1770 void PatchInlinedSmiCode(Address address) { 1705 void PatchInlinedSmiCode(Address address) {
1771 UNIMPLEMENTED(); 1706 UNIMPLEMENTED();
1772 } 1707 }
1773 1708
1774 1709
1775 } } // namespace v8::internal 1710 } } // namespace v8::internal
1776 1711
1777 #endif // V8_TARGET_ARCH_X64 1712 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698