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

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

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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/i18n.cc ('k') | src/ia32/code-stubs-ia32.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 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #if V8_TARGET_ARCH_IA32 30 #if V8_TARGET_ARCH_IA32
31 31
32 #include "codegen.h" 32 #include "codegen.h"
33 #include "deoptimizer.h" 33 #include "deoptimizer.h"
34 #include "full-codegen.h" 34 #include "full-codegen.h"
35 #include "stub-cache.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 40
40 #define __ ACCESS_MASM(masm) 41 #define __ ACCESS_MASM(masm)
41 42
42 43
43 void Builtins::Generate_Adaptor(MacroAssembler* masm, 44 void Builtins::Generate_Adaptor(MacroAssembler* masm,
44 CFunctionId id, 45 CFunctionId id,
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 __ Set(edx, Immediate(0)); // restore 774 __ Set(edx, Immediate(0)); // restore
774 775
775 __ pop(eax); 776 __ pop(eax);
776 __ SmiUntag(eax); 777 __ SmiUntag(eax);
777 } 778 }
778 779
779 // Restore the function to edi. 780 // Restore the function to edi.
780 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize)); 781 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize));
781 __ jmp(&patch_receiver); 782 __ jmp(&patch_receiver);
782 783
783 // Use the global receiver object from the called function as the
784 // receiver.
785 __ bind(&use_global_receiver); 784 __ bind(&use_global_receiver);
786 const int kGlobalIndex = 785 __ mov(ebx,
787 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; 786 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
788 __ mov(ebx, FieldOperand(esi, kGlobalIndex));
789 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
790 __ mov(ebx, FieldOperand(ebx, kGlobalIndex));
791 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); 787 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
792 788
793 __ bind(&patch_receiver); 789 __ bind(&patch_receiver);
794 __ mov(Operand(esp, eax, times_4, 0), ebx); 790 __ mov(Operand(esp, eax, times_4, 0), ebx);
795 791
796 __ jmp(&shift_arguments); 792 __ jmp(&shift_arguments);
797 } 793 }
798 794
799 // 3b. Check for function proxy. 795 // 3b. Check for function proxy.
800 __ bind(&slow); 796 __ bind(&slow);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 848 }
853 849
854 // 5b. Get the code to call from the function and check that the number of 850 // 5b. Get the code to call from the function and check that the number of
855 // expected arguments matches what we're providing. If so, jump 851 // expected arguments matches what we're providing. If so, jump
856 // (tail-call) to the code in register edx without checking arguments. 852 // (tail-call) to the code in register edx without checking arguments.
857 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 853 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
858 __ mov(ebx, 854 __ mov(ebx,
859 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); 855 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset));
860 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); 856 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset));
861 __ SmiUntag(ebx); 857 __ SmiUntag(ebx);
862 __ SetCallKind(ecx, CALL_AS_METHOD); 858 __ SetCallKind(ecx, CALL_AS_FUNCTION);
863 __ cmp(eax, ebx); 859 __ cmp(eax, ebx);
864 __ j(not_equal, 860 __ j(not_equal,
865 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); 861 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline());
866 862
867 ParameterCount expected(0); 863 ParameterCount expected(0);
868 __ InvokeCode(edx, expected, expected, JUMP_FUNCTION, NullCallWrapper(), 864 __ InvokeCode(edx, expected, expected, JUMP_FUNCTION, NullCallWrapper(),
869 CALL_AS_METHOD); 865 CALL_AS_FUNCTION);
870 } 866 }
871 867
872 868
873 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 869 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
874 static const int kArgumentsOffset = 2 * kPointerSize; 870 static const int kArgumentsOffset = 2 * kPointerSize;
875 static const int kReceiverOffset = 3 * kPointerSize; 871 static const int kReceiverOffset = 3 * kPointerSize;
876 static const int kFunctionOffset = 4 * kPointerSize; 872 static const int kFunctionOffset = 4 * kPointerSize;
877 { 873 {
878 FrameScope frame_scope(masm, StackFrame::INTERNAL); 874 FrameScope frame_scope(masm, StackFrame::INTERNAL);
879 875
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 const int kLimitOffset = 907 const int kLimitOffset =
912 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; 908 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize;
913 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; 909 const int kIndexOffset = kLimitOffset - 1 * kPointerSize;
914 __ push(eax); // limit 910 __ push(eax); // limit
915 __ push(Immediate(0)); // index 911 __ push(Immediate(0)); // index
916 912
917 // Get the receiver. 913 // Get the receiver.
918 __ mov(ebx, Operand(ebp, kReceiverOffset)); 914 __ mov(ebx, Operand(ebp, kReceiverOffset));
919 915
920 // Check that the function is a JS function (otherwise it must be a proxy). 916 // Check that the function is a JS function (otherwise it must be a proxy).
921 Label push_receiver; 917 Label push_receiver, use_global_receiver;
922 __ mov(edi, Operand(ebp, kFunctionOffset)); 918 __ mov(edi, Operand(ebp, kFunctionOffset));
923 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 919 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
924 __ j(not_equal, &push_receiver); 920 __ j(not_equal, &push_receiver);
925 921
926 // Change context eagerly to get the right global object if necessary. 922 // Change context eagerly to get the right global object if necessary.
927 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 923 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
928 924
929 // Compute the receiver. 925 // Compute the receiver.
930 // Do not transform the receiver for strict mode functions. 926 // Do not transform the receiver for strict mode functions.
931 Label call_to_object, use_global_receiver; 927 Label call_to_object;
932 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 928 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
933 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset), 929 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset),
934 1 << SharedFunctionInfo::kStrictModeBitWithinByte); 930 1 << SharedFunctionInfo::kStrictModeBitWithinByte);
935 __ j(not_equal, &push_receiver); 931 __ j(not_equal, &push_receiver);
936 932
937 Factory* factory = masm->isolate()->factory(); 933 Factory* factory = masm->isolate()->factory();
938 934
939 // Do not transform the receiver for natives (shared already in ecx). 935 // Do not transform the receiver for natives (shared already in ecx).
940 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kNativeByteOffset), 936 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kNativeByteOffset),
941 1 << SharedFunctionInfo::kNativeBitWithinByte); 937 1 << SharedFunctionInfo::kNativeBitWithinByte);
(...skipping 10 matching lines...) Expand all
952 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); 948 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
953 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); 949 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx);
954 __ j(above_equal, &push_receiver); 950 __ j(above_equal, &push_receiver);
955 951
956 __ bind(&call_to_object); 952 __ bind(&call_to_object);
957 __ push(ebx); 953 __ push(ebx);
958 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 954 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
959 __ mov(ebx, eax); 955 __ mov(ebx, eax);
960 __ jmp(&push_receiver); 956 __ jmp(&push_receiver);
961 957
962 // Use the current global receiver object as the receiver.
963 __ bind(&use_global_receiver); 958 __ bind(&use_global_receiver);
964 const int kGlobalOffset = 959 __ mov(ebx,
965 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; 960 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
966 __ mov(ebx, FieldOperand(esi, kGlobalOffset));
967 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
968 __ mov(ebx, FieldOperand(ebx, kGlobalOffset));
969 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); 961 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
970 962
971 // Push the receiver. 963 // Push the receiver.
972 __ bind(&push_receiver); 964 __ bind(&push_receiver);
973 __ push(ebx); 965 __ push(ebx);
974 966
975 // Copy all arguments from the array to the stack. 967 // Copy all arguments from the array to the stack.
976 Label entry, loop; 968 Label entry, loop;
977 __ mov(ecx, Operand(ebp, kIndexOffset)); 969 __ mov(ecx, Operand(ebp, kIndexOffset));
978 __ jmp(&entry); 970 __ jmp(&entry);
(...skipping 13 matching lines...) Expand all
992 984
993 // Update the index on the stack and in register eax. 985 // Update the index on the stack and in register eax.
994 __ mov(ecx, Operand(ebp, kIndexOffset)); 986 __ mov(ecx, Operand(ebp, kIndexOffset));
995 __ add(ecx, Immediate(1 << kSmiTagSize)); 987 __ add(ecx, Immediate(1 << kSmiTagSize));
996 __ mov(Operand(ebp, kIndexOffset), ecx); 988 __ mov(Operand(ebp, kIndexOffset), ecx);
997 989
998 __ bind(&entry); 990 __ bind(&entry);
999 __ cmp(ecx, Operand(ebp, kLimitOffset)); 991 __ cmp(ecx, Operand(ebp, kLimitOffset));
1000 __ j(not_equal, &loop); 992 __ j(not_equal, &loop);
1001 993
1002 // Invoke the function. 994 // Call the function.
1003 Label call_proxy; 995 Label call_proxy;
1004 __ mov(eax, ecx); 996 __ mov(eax, ecx);
1005 ParameterCount actual(eax); 997 ParameterCount actual(eax);
1006 __ SmiUntag(eax); 998 __ SmiUntag(eax);
1007 __ mov(edi, Operand(ebp, kFunctionOffset)); 999 __ mov(edi, Operand(ebp, kFunctionOffset));
1008 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 1000 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
1009 __ j(not_equal, &call_proxy); 1001 __ j(not_equal, &call_proxy);
1010 __ InvokeFunction(edi, actual, CALL_FUNCTION, 1002 __ InvokeFunction(edi, actual, CALL_FUNCTION,
1011 NullCallWrapper(), CALL_AS_METHOD); 1003 NullCallWrapper(), CALL_AS_FUNCTION);
1012 1004
1013 frame_scope.GenerateLeaveFrame(); 1005 frame_scope.GenerateLeaveFrame();
1014 __ ret(3 * kPointerSize); // remove this, receiver, and arguments 1006 __ ret(3 * kPointerSize); // remove this, receiver, and arguments
1015 1007
1016 // Invoke the function proxy. 1008 // Call the function proxy.
1017 __ bind(&call_proxy); 1009 __ bind(&call_proxy);
1018 __ push(edi); // add function proxy as last argument 1010 __ push(edi); // add function proxy as last argument
1019 __ inc(eax); 1011 __ inc(eax);
1020 __ Set(ebx, Immediate(0)); 1012 __ Set(ebx, Immediate(0));
1021 __ SetCallKind(ecx, CALL_AS_METHOD); 1013 __ SetCallKind(ecx, CALL_AS_FUNCTION);
1022 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); 1014 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY);
1023 __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1015 __ call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1024 RelocInfo::CODE_TARGET); 1016 RelocInfo::CODE_TARGET);
1025 1017
1026 // Leave internal frame. 1018 // Leave internal frame.
1027 } 1019 }
1028 __ ret(3 * kPointerSize); // remove this, receiver, and arguments 1020 __ ret(3 * kPointerSize); // remove this, receiver, and arguments
1029 } 1021 }
1030 1022
1031 1023
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 1381
1390 __ bind(&ok); 1382 __ bind(&ok);
1391 __ ret(0); 1383 __ ret(0);
1392 } 1384 }
1393 1385
1394 #undef __ 1386 #undef __
1395 } 1387 }
1396 } // namespace v8::internal 1388 } // namespace v8::internal
1397 1389
1398 #endif // V8_TARGET_ARCH_IA32 1390 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/i18n.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698