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

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

Issue 6546036: Combine typed and pixel arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix wrong external element call Created 9 years, 10 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
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 547
548 548
549 549
550 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 550 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
551 // ----------- S t a t e ------------- 551 // ----------- S t a t e -------------
552 // -- rax : key 552 // -- rax : key
553 // -- rdx : receiver 553 // -- rdx : receiver
554 // -- rsp[0] : return address 554 // -- rsp[0] : return address
555 // ----------------------------------- 555 // -----------------------------------
556 Label slow, check_string, index_smi, index_string, property_array_property; 556 Label slow, check_string, index_smi, index_string, property_array_property;
557 Label check_pixel_array, probe_dictionary, check_number_dictionary; 557 Label probe_dictionary, check_number_dictionary;
558 558
559 // Check that the key is a smi. 559 // Check that the key is a smi.
560 __ JumpIfNotSmi(rax, &check_string); 560 __ JumpIfNotSmi(rax, &check_string);
561 __ bind(&index_smi); 561 __ bind(&index_smi);
562 // Now the key is known to be a smi. This place is also jumped to from below 562 // Now the key is known to be a smi. This place is also jumped to from below
563 // where a numeric string is converted to a smi. 563 // where a numeric string is converted to a smi.
564 564
565 GenerateKeyedLoadReceiverCheck( 565 GenerateKeyedLoadReceiverCheck(
566 masm, rdx, rcx, Map::kHasIndexedInterceptor, &slow); 566 masm, rdx, rcx, Map::kHasIndexedInterceptor, &slow);
567 567
568 // Check the "has fast elements" bit in the receiver's map which is 568 // Check the "has fast elements" bit in the receiver's map which is
569 // now in rcx. 569 // now in rcx.
570 __ testb(FieldOperand(rcx, Map::kBitField2Offset), 570 __ testb(FieldOperand(rcx, Map::kBitField2Offset),
571 Immediate(1 << Map::kHasFastElements)); 571 Immediate(1 << Map::kHasFastElements));
572 __ j(zero, &check_pixel_array); 572 __ j(zero, &check_number_dictionary);
573 573
574 GenerateFastArrayLoad(masm, 574 GenerateFastArrayLoad(masm,
575 rdx, 575 rdx,
576 rax, 576 rax,
577 rcx, 577 rcx,
578 rbx, 578 rbx,
579 rax, 579 rax,
580 NULL, 580 NULL,
581 &slow); 581 &slow);
582 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); 582 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1);
583 __ ret(0); 583 __ ret(0);
584 584
585 __ bind(&check_pixel_array); 585 __ bind(&check_number_dictionary);
586 GenerateFastPixelArrayLoad(masm, 586 __ SmiToInteger32(rbx, rax);
587 rdx, 587 __ movq(rcx, FieldOperand(receiver, JSObject::kElementsOffset));
588 rax,
589 rcx,
590 rbx,
591 rax,
592 &check_number_dictionary,
593 NULL,
594 &slow);
595 588
596 __ bind(&check_number_dictionary);
597 // Check whether the elements is a number dictionary. 589 // Check whether the elements is a number dictionary.
598 // rdx: receiver 590 // rdx: receiver
599 // rax: key 591 // rax: key
600 // rbx: key as untagged int32 592 // rbx: key as untagged int32
601 // rcx: elements 593 // rcx: elements
602 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), 594 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset),
603 Heap::kHashTableMapRootIndex); 595 Heap::kHashTableMapRootIndex);
604 __ j(not_equal, &slow); 596 __ j(not_equal, &slow);
605 GenerateNumberDictionaryLoad(masm, &slow, rcx, rax, rbx, r9, rdi, rax); 597 GenerateNumberDictionaryLoad(masm, &slow, rcx, rax, rbx, r9, rdi, rax);
606 __ ret(0); 598 __ ret(0);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 758 }
767 759
768 760
769 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 761 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
770 // ----------- S t a t e ------------- 762 // ----------- S t a t e -------------
771 // -- rax : value 763 // -- rax : value
772 // -- rcx : key 764 // -- rcx : key
773 // -- rdx : receiver 765 // -- rdx : receiver
774 // -- rsp[0] : return address 766 // -- rsp[0] : return address
775 // ----------------------------------- 767 // -----------------------------------
776 Label slow, slow_with_tagged_index, fast, array, extra, check_pixel_array; 768 Label slow, slow_with_tagged_index, fast, array, extra;
777 769
778 // Check that the object isn't a smi. 770 // Check that the object isn't a smi.
779 __ JumpIfSmi(rdx, &slow_with_tagged_index); 771 __ JumpIfSmi(rdx, &slow_with_tagged_index);
780 // Get the map from the receiver. 772 // Get the map from the receiver.
781 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); 773 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset));
782 // Check that the receiver does not require access checks. We need 774 // Check that the receiver does not require access checks. We need
783 // to do this because this generic stub does not perform map checks. 775 // to do this because this generic stub does not perform map checks.
784 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), 776 __ testb(FieldOperand(rbx, Map::kBitFieldOffset),
785 Immediate(1 << Map::kIsAccessCheckNeeded)); 777 Immediate(1 << Map::kIsAccessCheckNeeded));
786 __ j(not_zero, &slow_with_tagged_index); 778 __ j(not_zero, &slow_with_tagged_index);
787 // Check that the key is a smi. 779 // Check that the key is a smi.
788 __ JumpIfNotSmi(rcx, &slow_with_tagged_index); 780 __ JumpIfNotSmi(rcx, &slow_with_tagged_index);
789 __ SmiToInteger32(rcx, rcx); 781 __ SmiToInteger32(rcx, rcx);
790 782
791 __ CmpInstanceType(rbx, JS_ARRAY_TYPE); 783 __ CmpInstanceType(rbx, JS_ARRAY_TYPE);
792 __ j(equal, &array); 784 __ j(equal, &array);
793 // Check that the object is some kind of JS object. 785 // Check that the object is some kind of JS object.
794 __ CmpInstanceType(rbx, FIRST_JS_OBJECT_TYPE); 786 __ CmpInstanceType(rbx, FIRST_JS_OBJECT_TYPE);
795 __ j(below, &slow); 787 __ j(below, &slow);
796 788
797 // Object case: Check key against length in the elements array. 789 // Object case: Check key against length in the elements array.
798 // rax: value 790 // rax: value
799 // rdx: JSObject 791 // rdx: JSObject
800 // rcx: index 792 // rcx: index
801 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); 793 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
802 // Check that the object is in fast mode and writable. 794 // Check that the object is in fast mode and writable.
803 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), 795 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset),
804 Heap::kFixedArrayMapRootIndex); 796 Heap::kFixedArrayMapRootIndex);
805 __ j(not_equal, &check_pixel_array); 797 __ j(not_equal, &slow);
806 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), rcx); 798 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), rcx);
807 // rax: value 799 // rax: value
808 // rbx: FixedArray 800 // rbx: FixedArray
809 // rcx: index 801 // rcx: index
810 __ j(above, &fast); 802 __ j(above, &fast);
811 803
812 // Slow case: call runtime. 804 // Slow case: call runtime.
813 __ bind(&slow); 805 __ bind(&slow);
814 __ Integer32ToSmi(rcx, rcx); 806 __ Integer32ToSmi(rcx, rcx);
815 __ bind(&slow_with_tagged_index); 807 __ bind(&slow_with_tagged_index);
816 GenerateRuntimeSetProperty(masm); 808 GenerateRuntimeSetProperty(masm);
817 // Never returns to here. 809 // Never returns to here.
818 810
819 // Check whether the elements is a pixel array.
820 // rax: value
821 // rdx: receiver
822 // rbx: receiver's elements array
823 // rcx: index, zero-extended.
824 __ bind(&check_pixel_array);
825 GenerateFastPixelArrayStore(masm,
826 rdx,
827 rcx,
828 rax,
829 rbx,
830 rdi,
831 false,
832 true,
833 NULL,
834 &slow,
835 &slow,
836 &slow);
837
838 // Extra capacity case: Check if there is extra capacity to 811 // Extra capacity case: Check if there is extra capacity to
839 // perform the store and update the length. Used for adding one 812 // perform the store and update the length. Used for adding one
840 // element to the array by writing to array[array.length]. 813 // element to the array by writing to array[array.length].
841 __ bind(&extra); 814 __ bind(&extra);
842 // rax: value 815 // rax: value
843 // rdx: receiver (a JSArray) 816 // rdx: receiver (a JSArray)
844 // rbx: receiver's elements array (a FixedArray) 817 // rbx: receiver's elements array (a FixedArray)
845 // rcx: index 818 // rcx: index
846 // flags: smicompare (rdx.length(), rbx) 819 // flags: smicompare (rdx.length(), rbx)
847 __ j(not_equal, &slow); // do not leave holes in the array 820 __ j(not_equal, &slow); // do not leave holes in the array
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1718 Condition cc = *jmp_address == Assembler::kJncShortOpcode
1746 ? not_zero 1719 ? not_zero
1747 : zero; 1720 : zero;
1748 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1721 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1749 } 1722 }
1750 1723
1751 1724
1752 } } // namespace v8::internal 1725 } } // namespace v8::internal
1753 1726
1754 #endif // V8_TARGET_ARCH_X64 1727 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/objects.cc ('K') | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698