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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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/x64/assembler-x64-inl.h ('k') | src/x64/full-codegen-x64.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 2012 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
(...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) { 3720 static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) {
3721 // Cache the called function in a global property cell. Cache states 3721 // Cache the called function in a global property cell. Cache states
3722 // are uninitialized, monomorphic (indicated by a JSFunction), and 3722 // are uninitialized, monomorphic (indicated by a JSFunction), and
3723 // megamorphic. 3723 // megamorphic.
3724 // rbx : cache cell for call target 3724 // rbx : cache cell for call target
3725 // rdi : the function to call 3725 // rdi : the function to call
3726 Isolate* isolate = masm->isolate(); 3726 Isolate* isolate = masm->isolate();
3727 Label initialize, done; 3727 Label initialize, done;
3728 3728
3729 // Load the cache state into rcx. 3729 // Load the cache state into rcx.
3730 __ movq(rcx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset)); 3730 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset));
3731 3731
3732 // A monomorphic cache hit or an already megamorphic state: invoke the 3732 // A monomorphic cache hit or an already megamorphic state: invoke the
3733 // function without changing the state. 3733 // function without changing the state.
3734 __ cmpq(rcx, rdi); 3734 __ cmpq(rcx, rdi);
3735 __ j(equal, &done, Label::kNear); 3735 __ j(equal, &done, Label::kNear);
3736 __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate)); 3736 __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate));
3737 __ j(equal, &done, Label::kNear); 3737 __ j(equal, &done, Label::kNear);
3738 3738
3739 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 3739 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
3740 // megamorphic. 3740 // megamorphic.
3741 __ Cmp(rcx, TypeFeedbackCells::UninitializedSentinel(isolate)); 3741 __ Cmp(rcx, TypeFeedbackCells::UninitializedSentinel(isolate));
3742 __ j(equal, &initialize, Label::kNear); 3742 __ j(equal, &initialize, Label::kNear);
3743 // MegamorphicSentinel is an immortal immovable object (undefined) so no 3743 // MegamorphicSentinel is an immortal immovable object (undefined) so no
3744 // write-barrier is needed. 3744 // write-barrier is needed.
3745 __ Move(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), 3745 __ Move(FieldOperand(rbx, Cell::kValueOffset),
3746 TypeFeedbackCells::MegamorphicSentinel(isolate)); 3746 TypeFeedbackCells::MegamorphicSentinel(isolate));
3747 __ jmp(&done, Label::kNear); 3747 __ jmp(&done, Label::kNear);
3748 3748
3749 // An uninitialized cache is patched with the function. 3749 // An uninitialized cache is patched with the function.
3750 __ bind(&initialize); 3750 __ bind(&initialize);
3751 __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rdi); 3751 __ movq(FieldOperand(rbx, Cell::kValueOffset), rdi);
3752 // No need for a write barrier here - cells are rescanned. 3752 // No need for a write barrier here - cells are rescanned.
3753 3753
3754 __ bind(&done); 3754 __ bind(&done);
3755 } 3755 }
3756 3756
3757 3757
3758 static void GenerateRecordCallTarget(MacroAssembler* masm) { 3758 static void GenerateRecordCallTarget(MacroAssembler* masm) {
3759 // Cache the called function in a global property cell. Cache states 3759 // Cache the called function in a global property cell. Cache states
3760 // are uninitialized, monomorphic (indicated by a JSFunction), and 3760 // are uninitialized, monomorphic (indicated by a JSFunction), and
3761 // megamorphic. 3761 // megamorphic.
3762 // rbx : cache cell for call target 3762 // rbx : cache cell for call target
3763 // rdi : the function to call 3763 // rdi : the function to call
3764 ASSERT(FLAG_optimize_constructed_arrays); 3764 ASSERT(FLAG_optimize_constructed_arrays);
3765 Isolate* isolate = masm->isolate(); 3765 Isolate* isolate = masm->isolate();
3766 Label initialize, done, miss, megamorphic, not_array_function; 3766 Label initialize, done, miss, megamorphic, not_array_function;
3767 3767
3768 // Load the cache state into rcx. 3768 // Load the cache state into rcx.
3769 __ movq(rcx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset)); 3769 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset));
3770 3770
3771 // A monomorphic cache hit or an already megamorphic state: invoke the 3771 // A monomorphic cache hit or an already megamorphic state: invoke the
3772 // function without changing the state. 3772 // function without changing the state.
3773 __ cmpq(rcx, rdi); 3773 __ cmpq(rcx, rdi);
3774 __ j(equal, &done); 3774 __ j(equal, &done);
3775 __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate)); 3775 __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate));
3776 __ j(equal, &done); 3776 __ j(equal, &done);
3777 3777
3778 // Special handling of the Array() function, which caches not only the 3778 // Special handling of the Array() function, which caches not only the
3779 // monomorphic Array function but the initial ElementsKind with special 3779 // monomorphic Array function but the initial ElementsKind with special
(...skipping 12 matching lines...) Expand all
3792 3792
3793 __ bind(&miss); 3793 __ bind(&miss);
3794 3794
3795 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 3795 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
3796 // megamorphic. 3796 // megamorphic.
3797 __ Cmp(rcx, TypeFeedbackCells::UninitializedSentinel(isolate)); 3797 __ Cmp(rcx, TypeFeedbackCells::UninitializedSentinel(isolate));
3798 __ j(equal, &initialize); 3798 __ j(equal, &initialize);
3799 // MegamorphicSentinel is an immortal immovable object (undefined) so no 3799 // MegamorphicSentinel is an immortal immovable object (undefined) so no
3800 // write-barrier is needed. 3800 // write-barrier is needed.
3801 __ bind(&megamorphic); 3801 __ bind(&megamorphic);
3802 __ Move(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), 3802 __ Move(FieldOperand(rbx, Cell::kValueOffset),
3803 TypeFeedbackCells::MegamorphicSentinel(isolate)); 3803 TypeFeedbackCells::MegamorphicSentinel(isolate));
3804 __ jmp(&done, Label::kNear); 3804 __ jmp(&done, Label::kNear);
3805 3805
3806 // An uninitialized cache is patched with the function or sentinel to 3806 // An uninitialized cache is patched with the function or sentinel to
3807 // indicate the ElementsKind if function is the Array constructor. 3807 // indicate the ElementsKind if function is the Array constructor.
3808 __ bind(&initialize); 3808 __ bind(&initialize);
3809 // Make sure the function is the Array() function 3809 // Make sure the function is the Array() function
3810 __ LoadArrayFunction(rcx); 3810 __ LoadArrayFunction(rcx);
3811 __ cmpq(rdi, rcx); 3811 __ cmpq(rdi, rcx);
3812 __ j(not_equal, &not_array_function); 3812 __ j(not_equal, &not_array_function);
3813 3813
3814 // The target function is the Array constructor, install a sentinel value in 3814 // The target function is the Array constructor, install a sentinel value in
3815 // the constructor's type info cell that will track the initial ElementsKind 3815 // the constructor's type info cell that will track the initial ElementsKind
3816 // that should be used for the array when its constructed. 3816 // that should be used for the array when its constructed.
3817 Handle<Object> initial_kind_sentinel = 3817 Handle<Object> initial_kind_sentinel =
3818 TypeFeedbackCells::MonomorphicArraySentinel(isolate, 3818 TypeFeedbackCells::MonomorphicArraySentinel(isolate,
3819 GetInitialFastElementsKind()); 3819 GetInitialFastElementsKind());
3820 __ Move(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), 3820 __ Move(FieldOperand(rbx, Cell::kValueOffset),
3821 initial_kind_sentinel); 3821 initial_kind_sentinel);
3822 __ jmp(&done); 3822 __ jmp(&done);
3823 3823
3824 __ bind(&not_array_function); 3824 __ bind(&not_array_function);
3825 __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rdi); 3825 __ movq(FieldOperand(rbx, Cell::kValueOffset), rdi);
3826 // No need for a write barrier here - cells are rescanned. 3826 // No need for a write barrier here - cells are rescanned.
3827 3827
3828 __ bind(&done); 3828 __ bind(&done);
3829 } 3829 }
3830 3830
3831 3831
3832 void CallFunctionStub::Generate(MacroAssembler* masm) { 3832 void CallFunctionStub::Generate(MacroAssembler* masm) {
3833 // rbx : cache cell for call target 3833 // rbx : cache cell for call target
3834 // rdi : the function to call 3834 // rdi : the function to call
3835 Isolate* isolate = masm->isolate(); 3835 Isolate* isolate = masm->isolate();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 JUMP_FUNCTION, 3886 JUMP_FUNCTION,
3887 NullCallWrapper(), 3887 NullCallWrapper(),
3888 CALL_AS_FUNCTION); 3888 CALL_AS_FUNCTION);
3889 3889
3890 // Slow-case: Non-function called. 3890 // Slow-case: Non-function called.
3891 __ bind(&slow); 3891 __ bind(&slow);
3892 if (RecordCallTarget()) { 3892 if (RecordCallTarget()) {
3893 // If there is a call target cache, mark it megamorphic in the 3893 // If there is a call target cache, mark it megamorphic in the
3894 // non-function case. MegamorphicSentinel is an immortal immovable 3894 // non-function case. MegamorphicSentinel is an immortal immovable
3895 // object (undefined) so no write barrier is needed. 3895 // object (undefined) so no write barrier is needed.
3896 __ Move(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), 3896 __ Move(FieldOperand(rbx, Cell::kValueOffset),
3897 TypeFeedbackCells::MegamorphicSentinel(isolate)); 3897 TypeFeedbackCells::MegamorphicSentinel(isolate));
3898 } 3898 }
3899 // Check for function proxy. 3899 // Check for function proxy.
3900 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); 3900 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
3901 __ j(not_equal, &non_function); 3901 __ j(not_equal, &non_function);
3902 __ pop(rcx); 3902 __ pop(rcx);
3903 __ push(rdi); // put proxy as additional argument under return address 3903 __ push(rdi); // put proxy as additional argument under return address
3904 __ push(rcx); 3904 __ push(rcx);
3905 __ Set(rax, argc_ + 1); 3905 __ Set(rax, argc_ + 1);
3906 __ Set(rbx, 0); 3906 __ Set(rbx, 0);
(...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after
6629 6629
6630 __ bind(&need_incremental); 6630 __ bind(&need_incremental);
6631 6631
6632 // Fall through when we need to inform the incremental marker. 6632 // Fall through when we need to inform the incremental marker.
6633 } 6633 }
6634 6634
6635 6635
6636 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { 6636 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
6637 // ----------- S t a t e ------------- 6637 // ----------- S t a t e -------------
6638 // -- rax : element value to store 6638 // -- rax : element value to store
6639 // -- rbx : array literal
6640 // -- rdi : map of array literal
6641 // -- rcx : element index as smi 6639 // -- rcx : element index as smi
6642 // -- rdx : array literal index in function
6643 // -- rsp[0] : return address 6640 // -- rsp[0] : return address
6641 // -- rsp[8] : array literal index in function
6642 // -- rsp[16]: array literal
6643 // clobbers rbx, rdx, rdi
6644 // ----------------------------------- 6644 // -----------------------------------
6645 6645
6646 Label element_done; 6646 Label element_done;
6647 Label double_elements; 6647 Label double_elements;
6648 Label smi_element; 6648 Label smi_element;
6649 Label slow_elements; 6649 Label slow_elements;
6650 Label fast_elements; 6650 Label fast_elements;
6651 6651
6652 // Get array literal index, array literal and its map.
6653 __ movq(rdx, Operand(rsp, 1 * kPointerSize));
6654 __ movq(rbx, Operand(rsp, 2 * kPointerSize));
6655 __ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset));
6656
6652 __ CheckFastElements(rdi, &double_elements); 6657 __ CheckFastElements(rdi, &double_elements);
6653 6658
6654 // FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS 6659 // FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS
6655 __ JumpIfSmi(rax, &smi_element); 6660 __ JumpIfSmi(rax, &smi_element);
6656 __ CheckFastSmiElements(rdi, &fast_elements); 6661 __ CheckFastSmiElements(rdi, &fast_elements);
6657 6662
6658 // Store into the array literal requires a elements transition. Call into 6663 // Store into the array literal requires a elements transition. Call into
6659 // the runtime. 6664 // the runtime.
6660 6665
6661 __ bind(&slow_elements); 6666 __ bind(&slow_elements);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
6927 6932
6928 // Initial map for the builtin Array function should be a map. 6933 // Initial map for the builtin Array function should be a map.
6929 __ movq(rcx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); 6934 __ movq(rcx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
6930 // Will both indicate a NULL and a Smi. 6935 // Will both indicate a NULL and a Smi.
6931 STATIC_ASSERT(kSmiTag == 0); 6936 STATIC_ASSERT(kSmiTag == 0);
6932 Condition not_smi = NegateCondition(masm->CheckSmi(rcx)); 6937 Condition not_smi = NegateCondition(masm->CheckSmi(rcx));
6933 __ Check(not_smi, "Unexpected initial map for Array function"); 6938 __ Check(not_smi, "Unexpected initial map for Array function");
6934 __ CmpObjectType(rcx, MAP_TYPE, rcx); 6939 __ CmpObjectType(rcx, MAP_TYPE, rcx);
6935 __ Check(equal, "Unexpected initial map for Array function"); 6940 __ Check(equal, "Unexpected initial map for Array function");
6936 6941
6937 // We should either have undefined in ebx or a valid jsglobalpropertycell 6942 // We should either have undefined in ebx or a valid cell
6938 Label okay_here; 6943 Label okay_here;
6939 Handle<Map> global_property_cell_map( 6944 Handle<Map> cell_map = masm->isolate()->factory()->cell_map();
6940 masm->isolate()->heap()->global_property_cell_map());
6941 __ Cmp(rbx, undefined_sentinel); 6945 __ Cmp(rbx, undefined_sentinel);
6942 __ j(equal, &okay_here); 6946 __ j(equal, &okay_here);
6943 __ Cmp(FieldOperand(rbx, 0), global_property_cell_map); 6947 __ Cmp(FieldOperand(rbx, 0), cell_map);
6944 __ Assert(equal, "Expected property cell in register rbx"); 6948 __ Assert(equal, "Expected property cell in register rbx");
6945 __ bind(&okay_here); 6949 __ bind(&okay_here);
6946 } 6950 }
6947 6951
6948 if (FLAG_optimize_constructed_arrays) { 6952 if (FLAG_optimize_constructed_arrays) {
6949 Label no_info, switch_ready; 6953 Label no_info, switch_ready;
6950 // Get the elements kind and case on that. 6954 // Get the elements kind and case on that.
6951 __ Cmp(rbx, undefined_sentinel); 6955 __ Cmp(rbx, undefined_sentinel);
6952 __ j(equal, &no_info); 6956 __ j(equal, &no_info);
6953 __ movq(rdx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset)); 6957 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset));
6954 __ JumpIfNotSmi(rdx, &no_info); 6958 __ JumpIfNotSmi(rdx, &no_info);
6955 __ SmiToInteger32(rdx, rdx); 6959 __ SmiToInteger32(rdx, rdx);
6956 __ jmp(&switch_ready); 6960 __ jmp(&switch_ready);
6957 __ bind(&no_info); 6961 __ bind(&no_info);
6958 __ movq(rdx, Immediate(GetInitialFastElementsKind())); 6962 __ movq(rdx, Immediate(GetInitialFastElementsKind()));
6959 __ bind(&switch_ready); 6963 __ bind(&switch_ready);
6960 6964
6961 if (argument_count_ == ANY) { 6965 if (argument_count_ == ANY) {
6962 Label not_zero_case, not_one_case; 6966 Label not_zero_case, not_one_case;
6963 __ testq(rax, rax); 6967 __ testq(rax, rax);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
7095 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); 7099 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
7096 } 7100 }
7097 } 7101 }
7098 7102
7099 7103
7100 #undef __ 7104 #undef __
7101 7105
7102 } } // namespace v8::internal 7106 } } // namespace v8::internal
7103 7107
7104 #endif // V8_TARGET_ARCH_X64 7108 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698