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

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

Issue 9235007: Handle single element array growth + transition in generic KeyedStoreIC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version Created 8 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
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 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
11 // with the distribution. 11 // with the distribution.
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 StrictModeFlag strict_mode) { 628 StrictModeFlag strict_mode) {
629 // ----------- S t a t e ------------- 629 // ----------- S t a t e -------------
630 // -- rax : value 630 // -- rax : value
631 // -- rcx : key 631 // -- rcx : key
632 // -- rdx : receiver 632 // -- rdx : receiver
633 // -- rsp[0] : return address 633 // -- rsp[0] : return address
634 // ----------------------------------- 634 // -----------------------------------
635 Label slow, slow_with_tagged_index, fast, array, extra, check_extra_double; 635 Label slow, slow_with_tagged_index, fast, array, extra, check_extra_double;
636 Label fast_object_with_map_check, fast_object_without_map_check; 636 Label fast_object_with_map_check, fast_object_without_map_check;
637 Label fast_double_with_map_check, fast_double_without_map_check; 637 Label fast_double_with_map_check, fast_double_without_map_check;
638 Label transition_smi_elements, finish_object_store, non_double_value;
639 Label transition_double_elements;
638 640
639 // Check that the object isn't a smi. 641 // Check that the object isn't a smi.
640 __ JumpIfSmi(rdx, &slow_with_tagged_index); 642 __ JumpIfSmi(rdx, &slow_with_tagged_index);
641 // Get the map from the receiver. 643 // Get the map from the receiver.
642 __ movq(r9, FieldOperand(rdx, HeapObject::kMapOffset)); 644 __ movq(r9, FieldOperand(rdx, HeapObject::kMapOffset));
643 // Check that the receiver does not require access checks. We need 645 // Check that the receiver does not require access checks. We need
644 // to do this because this generic stub does not perform map checks. 646 // to do this because this generic stub does not perform map checks.
645 __ testb(FieldOperand(r9, Map::kBitFieldOffset), 647 __ testb(FieldOperand(r9, Map::kBitFieldOffset),
646 Immediate(1 << Map::kIsAccessCheckNeeded)); 648 Immediate(1 << Map::kIsAccessCheckNeeded));
647 __ j(not_zero, &slow_with_tagged_index); 649 __ j(not_zero, &slow_with_tagged_index);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 Label non_smi_value; 732 Label non_smi_value;
731 __ JumpIfNotSmi(rax, &non_smi_value); 733 __ JumpIfNotSmi(rax, &non_smi_value);
732 // It's irrelevant whether array is smi-only or not when writing a smi. 734 // It's irrelevant whether array is smi-only or not when writing a smi.
733 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), 735 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize),
734 rax); 736 rax);
735 __ ret(0); 737 __ ret(0);
736 738
737 __ bind(&non_smi_value); 739 __ bind(&non_smi_value);
738 // Writing a non-smi, check whether array allows non-smi elements. 740 // Writing a non-smi, check whether array allows non-smi elements.
739 // r9: receiver's map 741 // r9: receiver's map
740 __ CheckFastObjectElements(r9, &slow, Label::kNear); 742 __ CheckFastObjectElements(r9, &transition_smi_elements);
743 __ bind(&finish_object_store);
741 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), 744 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize),
742 rax); 745 rax);
743 __ movq(rdx, rax); // Preserve the value which is returned. 746 __ movq(rdx, rax); // Preserve the value which is returned.
744 __ RecordWriteArray( 747 __ RecordWriteArray(
745 rbx, rdx, rcx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 748 rbx, rdx, rcx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
746 __ ret(0); 749 __ ret(0);
747 750
748 __ bind(&fast_double_with_map_check); 751 __ bind(&fast_double_with_map_check);
749 // Check for fast double array case. If this fails, call through to the 752 // Check for fast double array case. If this fails, call through to the
750 // runtime. 753 // runtime.
751 // rdi: elements array's map 754 // rdi: elements array's map
752 __ CompareRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); 755 __ CompareRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex);
753 __ j(not_equal, &slow); 756 __ j(not_equal, &slow);
754 __ bind(&fast_double_without_map_check); 757 __ bind(&fast_double_without_map_check);
755 // If the value is a number, store it as a double in the FastDoubleElements 758 // If the value is a number, store it as a double in the FastDoubleElements
756 // array. 759 // array.
757 __ StoreNumberToDoubleElements(rax, rbx, rcx, xmm0, &slow); 760 __ StoreNumberToDoubleElements(rax, rbx, rcx, xmm0,
761 &transition_double_elements);
758 __ ret(0); 762 __ ret(0);
763
764 __ bind(&transition_smi_elements);
765 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset));
766
767 // Transition the array appropriately depending on the value type.
768 __ CompareRoot(r9, Heap::kHeapNumberMapRootIndex);
769 __ j(not_equal, &non_double_value);
770
771 // Value is a double. Transition FAST_SMI_ONLY_ELEMENTS ->
772 // FAST_DOUBLE_ELEMENTS and complete the store.
773 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
774 FAST_DOUBLE_ELEMENTS,
775 rbx,
776 rdi,
777 &slow);
778 ElementsTransitionGenerator::GenerateSmiOnlyToDouble(masm, &slow);
779 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
780 __ jmp(&fast_double_without_map_check);
781
782 __ bind(&non_double_value);
783 // Value is not a double, FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
784 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
785 FAST_ELEMENTS,
786 rbx,
787 rdi,
788 &slow);
789 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm);
790 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
791 __ jmp(&finish_object_store);
792
793 __ bind(&transition_double_elements);
794 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a
795 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and
796 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS
797 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset));
798 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS,
799 FAST_ELEMENTS,
800 rbx,
801 rdi,
802 &slow);
803 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &slow);
804 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
805 __ jmp(&finish_object_store);
759 } 806 }
760 807
761 808
762 // The generated code does not accept smi keys. 809 // The generated code does not accept smi keys.
763 // The generated code falls through if both probes miss. 810 // The generated code falls through if both probes miss.
764 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, 811 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm,
765 int argc, 812 int argc,
766 Code::Kind kind, 813 Code::Kind kind,
767 Code::ExtraICState extra_state) { 814 Code::ExtraICState extra_state) {
768 // ----------- S t a t e ------------- 815 // ----------- S t a t e -------------
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1773 Condition cc = *jmp_address == Assembler::kJncShortOpcode
1727 ? not_zero 1774 ? not_zero
1728 : zero; 1775 : zero;
1729 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1776 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1730 } 1777 }
1731 1778
1732 1779
1733 } } // namespace v8::internal 1780 } } // namespace v8::internal
1734 1781
1735 #endif // V8_TARGET_ARCH_X64 1782 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698