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

Side by Side Diff: src/a64/stub-cache-a64.cc

Issue 153953005: A64: Synchronize with r16993. (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/a64/lithium-a64.cc ('k') | src/accessors.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 static void FreeSpaceForFastApiCall(MacroAssembler* masm) { 832 static void FreeSpaceForFastApiCall(MacroAssembler* masm) {
833 __ Drop(kFastApiCallArguments); 833 __ Drop(kFastApiCallArguments);
834 } 834 }
835 835
836 836
837 static void GenerateFastApiDirectCall(MacroAssembler* masm, 837 static void GenerateFastApiDirectCall(MacroAssembler* masm,
838 const CallOptimization& optimization, 838 const CallOptimization& optimization,
839 int argc, 839 int argc,
840 bool restore_context) { 840 bool restore_context) {
841 // ----------- S t a t e ------------- 841 // ----------- S t a t e -------------
842 // -- sp[0] : context 842 // -- sp[0] - sp[48] : FunctionCallbackInfo, including
843 // -- sp[8] : holder (set by CheckPrototypes) 843 // holder (set by CheckPrototypes)
844 // -- sp[16] : callee JS function
845 // -- sp[24] : call data
846 // -- sp[32] : isolate
847 // -- sp[40] : ReturnValue default value
848 // -- sp[48] : ReturnValue
849 // -- sp[56] : last JS argument 844 // -- sp[56] : last JS argument
850 // -- ... 845 // -- ...
851 // -- sp[(argc + 6) * 8] : first JS argument 846 // -- sp[(argc + 6) * 8] : first JS argument
852 // -- sp[(argc + 7) * 8] : receiver 847 // -- sp[(argc + 7) * 8] : receiver
853 // ----------------------------------- 848 // -----------------------------------
849 typedef FunctionCallbackArguments FCA;
850 const int kArgs = kFastApiCallArguments;
854 // Save calling context. 851 // Save calling context.
855 __ Poke(cp, 0); 852 __ Poke(cp, (kArgs - 1 + FCA::kContextSaveIndex) * kPointerSize);
856 // Get the function and setup the context. 853 // Get the function and setup the context.
857 Handle<JSFunction> function = optimization.constant_function(); 854 Handle<JSFunction> function = optimization.constant_function();
858 Register function_reg = x5; 855 Register function_reg = x5;
859 __ LoadHeapObject(function_reg, function); 856 __ LoadHeapObject(function_reg, function);
860 __ Ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset)); 857 __ Ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
861 __ Poke(function_reg, 2 * kPointerSize); 858 __ Poke(function_reg, (kArgs - 1 + FCA::kCalleeIndex) * kPointerSize);
862 859
863 // Pass the additional arguments. 860 // Construct the FunctionCallbackInfo.
864 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 861 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
865 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 862 Handle<Object> call_data(api_call_info->data(), masm->isolate());
866 Register call_data_reg = x6; 863 Register call_data_reg = x6;
867 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 864 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
868 __ Mov(x0, Operand(api_call_info)); 865 __ Mov(x0, Operand(api_call_info));
869 __ Ldr(call_data_reg, FieldMemOperand(x0, CallHandlerInfo::kDataOffset)); 866 __ Ldr(call_data_reg, FieldMemOperand(x0, CallHandlerInfo::kDataOffset));
870 } else { 867 } else {
871 __ Mov(call_data_reg, Operand(call_data)); 868 __ Mov(call_data_reg, Operand(call_data));
872 } 869 }
873 // Store call data. 870 // Store call data.
874 __ Poke(call_data_reg, 3 * kPointerSize); 871 __ Poke(call_data_reg, (kArgs - 1 + FCA::kDataIndex) * kPointerSize);
875 // Store isolate. 872 // Store isolate.
876 Register isolate_reg = x7; 873 Register isolate_reg = x7;
877 __ Mov(isolate_reg, 874 __ Mov(isolate_reg,
878 Operand(ExternalReference::isolate_address(masm->isolate()))); 875 Operand(ExternalReference::isolate_address(masm->isolate())));
879 __ Poke(isolate_reg, 4 * kPointerSize); 876 __ Poke(isolate_reg, (kArgs - 1 + FCA::kIsolateIndex) * kPointerSize);
880 // Store ReturnValue default and ReturnValue. 877 // Store ReturnValue default and ReturnValue.
881 Register undefined_reg = x8; 878 Register undefined_reg = x8;
882 __ LoadRoot(undefined_reg, Heap::kUndefinedValueRootIndex); 879 __ LoadRoot(undefined_reg, Heap::kUndefinedValueRootIndex);
883 __ PokePair(undefined_reg, undefined_reg, 5 * kXRegSizeInBytes); 880 __ Poke(undefined_reg, (kArgs - 1 + FCA::kReturnValueOffset) * kPointerSize);
881 __ Poke(undefined_reg,
882 (kArgs - 1 + FCA::kReturnValueDefaultValueIndex) * kPointerSize);
884 883
885 Register implicit_args = x2; 884 Register implicit_args = x2;
886 __ Add(implicit_args, masm->StackPointer(), 885 __ Add(implicit_args, masm->StackPointer(), (kArgs - 1) * kPointerSize);
887 (kFastApiCallArguments - 1) * kXRegSizeInBytes);
888 886
889 FrameScope frame_scope(masm, StackFrame::MANUAL); 887 FrameScope frame_scope(masm, StackFrame::MANUAL);
890 // Allocate the v8::Arguments structure inside the ExitFrame since it's not 888 // Allocate the v8::Arguments structure inside the ExitFrame since it's not
891 // controlled by GC. 889 // controlled by GC.
892 const int kApiArgsStackSpace = 4; 890 const int kApiArgsStackSpace = 4;
893 __ EnterExitFrame( 891 __ EnterExitFrame(
894 false, 892 false,
895 x3, 893 x3,
896 kApiArgsStackSpace + MacroAssembler::kCallApiFunctionSpillSpace); 894 kApiArgsStackSpace + MacroAssembler::kCallApiFunctionSpillSpace);
897 895
(...skipping 13 matching lines...) Expand all
911 __ Mov(x3, 0); 909 __ Mov(x3, 0);
912 __ Str(x3, MemOperand(args, 3 * kPointerSize)); 910 __ Str(x3, MemOperand(args, 3 * kPointerSize));
913 911
914 // After the call to the API function we need to free memory used for: 912 // After the call to the API function we need to free memory used for:
915 // - JS arguments 913 // - JS arguments
916 // - the receiver 914 // - the receiver
917 // - the space allocated by ReserveSpaceForFastApiCall. 915 // - the space allocated by ReserveSpaceForFastApiCall.
918 // 916 //
919 // The memory allocated for v8::Arguments structure will be freed when we'll 917 // The memory allocated for v8::Arguments structure will be freed when we'll
920 // leave the ExitFrame. 918 // leave the ExitFrame.
921 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 919 const int kStackUnwindSpace = argc + kArgs + 1;
922 920
923 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 921 Address function_address = v8::ToCData<Address>(api_call_info->callback());
924 ApiFunction fun(function_address); 922 ApiFunction fun(function_address);
925 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; 923 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
926 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); 924 ExternalReference ref = ExternalReference(&fun, type, masm->isolate());
927 925
928 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); 926 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
929 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL; 927 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL;
930 ApiFunction thunk_fun(thunk_address); 928 ApiFunction thunk_fun(thunk_address);
931 ExternalReference thunk_ref = 929 ExternalReference thunk_ref =
932 ExternalReference(&thunk_fun, thunk_type, masm->isolate()); 930 ExternalReference(&thunk_fun, thunk_type, masm->isolate());
933 931
934 AllowExternalCallThatCantCauseGC scope(masm); 932 AllowExternalCallThatCantCauseGC scope(masm);
935 MemOperand context_restore_operand(fp, 2 * kPointerSize); 933 MemOperand context_restore_operand(
934 fp, (kArgs + 1 + FCA::kContextSaveIndex) * kPointerSize);
936 MemOperand return_value_operand( 935 MemOperand return_value_operand(
937 fp, (kFastApiCallArguments + 1) * kPointerSize); 936 fp, (kArgs + 1 + FCA::kReturnValueOffset) * kPointerSize);
938 // CallApiFunctionAndReturn can spill registers inside the exit frame, 937 // CallApiFunctionAndReturn can spill registers inside the exit frame,
939 // after the return address and the v8::Arguments structure. 938 // after the return address and the v8::Arguments structure.
940 const int spill_offset = 1 + kApiArgsStackSpace; 939 const int spill_offset = 1 + kApiArgsStackSpace;
941 __ CallApiFunctionAndReturn(ref, 940 __ CallApiFunctionAndReturn(ref,
942 function_address, 941 function_address,
943 thunk_ref, 942 thunk_ref,
944 x1, 943 x1,
945 kStackUnwindSpace, 944 kStackUnwindSpace,
946 spill_offset, 945 spill_offset,
947 return_value_operand, 946 return_value_operand,
(...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3266 3265
3267 // Miss case, call the runtime. 3266 // Miss case, call the runtime.
3268 __ Bind(&miss_force_generic); 3267 __ Bind(&miss_force_generic);
3269 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3268 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3270 } 3269 }
3271 3270
3272 3271
3273 } } // namespace v8::internal 3272 } } // namespace v8::internal
3274 3273
3275 #endif // V8_TARGET_ARCH_A64 3274 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | src/accessors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698