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

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

Issue 24857002: MIPS: Refactoring PropertyCallbackInfo & FunctionCallbackInfo, step 2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | no next file » | 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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 static void FreeSpaceForFastApiCall(MacroAssembler* masm) { 825 static void FreeSpaceForFastApiCall(MacroAssembler* masm) {
826 __ Drop(kFastApiCallArguments); 826 __ Drop(kFastApiCallArguments);
827 } 827 }
828 828
829 829
830 static void GenerateFastApiDirectCall(MacroAssembler* masm, 830 static void GenerateFastApiDirectCall(MacroAssembler* masm,
831 const CallOptimization& optimization, 831 const CallOptimization& optimization,
832 int argc, 832 int argc,
833 bool restore_context) { 833 bool restore_context) {
834 // ----------- S t a t e ------------- 834 // ----------- S t a t e -------------
835 // -- sp[0] : context 835 // -- sp[0] - sp[24] : FunctionCallbackInfo, incl.
836 // -- sp[4] : holder (set by CheckPrototypes) 836 // : holder (set by CheckPrototypes)
837 // -- sp[8] : callee JS function
838 // -- sp[12] : call data
839 // -- sp[16] : isolate
840 // -- sp[20] : ReturnValue default value
841 // -- sp[24] : ReturnValue
842 // -- sp[28] : last JS argument 837 // -- sp[28] : last JS argument
843 // -- ... 838 // -- ...
844 // -- sp[(argc + 6) * 4] : first JS argument 839 // -- sp[(argc + 6) * 4] : first JS argument
845 // -- sp[(argc + 7) * 4] : receiver 840 // -- sp[(argc + 7) * 4] : receiver
846 // ----------------------------------- 841 // -----------------------------------
842 typedef FunctionCallbackArguments FCA;
843 const int kArgs = kFastApiCallArguments;
847 // Save calling context. 844 // Save calling context.
848 __ sw(cp, MemOperand(sp)); 845 __ sw(cp,
846 MemOperand(sp, (kArgs - 1 + FCA::kContextSaveIndex) * kPointerSize));
849 // Get the function and setup the context. 847 // Get the function and setup the context.
850 Handle<JSFunction> function = optimization.constant_function(); 848 Handle<JSFunction> function = optimization.constant_function();
851 __ LoadHeapObject(t1, function); 849 __ LoadHeapObject(t1, function);
852 __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset)); 850 __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset));
853 __ sw(t1, MemOperand(sp, 2 * kPointerSize)); 851 __ sw(t1, MemOperand(sp, (kArgs - 1 + FCA::kCalleeIndex) * kPointerSize));
854 852
855 // Pass the additional arguments. 853 // Construct the FunctionCallbackInfo.
856 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 854 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
857 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 855 Handle<Object> call_data(api_call_info->data(), masm->isolate());
858 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 856 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
859 __ li(a0, api_call_info); 857 __ li(a0, api_call_info);
860 __ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset)); 858 __ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset));
861 } else { 859 } else {
862 __ li(t2, call_data); 860 __ li(t2, call_data);
863 } 861 }
864 // Store call data. 862 // Store call data.
865 __ sw(t2, MemOperand(sp, 3 * kPointerSize)); 863 __ sw(t2, MemOperand(sp, (kArgs - 1 + FCA::kDataIndex) * kPointerSize));
866 // Store isolate. 864 // Store isolate.
867 __ li(t3, Operand(ExternalReference::isolate_address(masm->isolate()))); 865 __ li(t3, Operand(ExternalReference::isolate_address(masm->isolate())));
868 __ sw(t3, MemOperand(sp, 4 * kPointerSize)); 866 __ sw(t3, MemOperand(sp, (kArgs - 1 + FCA::kIsolateIndex) * kPointerSize));
869 // Store ReturnValue default and ReturnValue. 867 // Store ReturnValue default and ReturnValue.
870 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); 868 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex);
871 __ sw(t1, MemOperand(sp, 5 * kPointerSize)); 869 __ sw(t1,
872 __ sw(t1, MemOperand(sp, 6 * kPointerSize)); 870 MemOperand(sp, (kArgs - 1 + FCA::kReturnValueOffset) * kPointerSize));
871 __ sw(t1,
872 MemOperand(sp,
873 (kArgs - 1 + FCA::kReturnValueDefaultValueIndex) * kPointerSize));
873 874
874 // Prepare arguments. 875 // Prepare arguments.
875 __ Addu(a2, sp, Operand((kFastApiCallArguments - 1) * kPointerSize)); 876 __ Addu(a2, sp, Operand((kArgs - 1) * kPointerSize));
876 877
877 // Allocate the v8::Arguments structure in the arguments' space since 878 // Allocate the v8::Arguments structure in the arguments' space since
878 // it's not controlled by GC. 879 // it's not controlled by GC.
879 const int kApiStackSpace = 4; 880 const int kApiStackSpace = 4;
880 881
881 FrameScope frame_scope(masm, StackFrame::MANUAL); 882 FrameScope frame_scope(masm, StackFrame::MANUAL);
882 __ EnterExitFrame(false, kApiStackSpace); 883 __ EnterExitFrame(false, kApiStackSpace);
883 884
884 // a0 = v8::Arguments& 885 // a0 = v8::Arguments&
885 // Arguments is built at sp + 1 (sp is a reserved spot for ra). 886 // Arguments is built at sp + 1 (sp is a reserved spot for ra).
886 __ Addu(a0, sp, kPointerSize); 887 __ Addu(a0, sp, kPointerSize);
887 888
888 // v8::Arguments::implicit_args_ 889 // v8::Arguments::implicit_args_
889 __ sw(a2, MemOperand(a0, 0 * kPointerSize)); 890 __ sw(a2, MemOperand(a0, 0 * kPointerSize));
890 // v8::Arguments::values_ 891 // v8::Arguments::values_
891 __ Addu(t0, a2, Operand(argc * kPointerSize)); 892 __ Addu(t0, a2, Operand(argc * kPointerSize));
892 __ sw(t0, MemOperand(a0, 1 * kPointerSize)); 893 __ sw(t0, MemOperand(a0, 1 * kPointerSize));
893 // v8::Arguments::length_ = argc 894 // v8::Arguments::length_ = argc
894 __ li(t0, Operand(argc)); 895 __ li(t0, Operand(argc));
895 __ sw(t0, MemOperand(a0, 2 * kPointerSize)); 896 __ sw(t0, MemOperand(a0, 2 * kPointerSize));
896 // v8::Arguments::is_construct_call = 0 897 // v8::Arguments::is_construct_call = 0
897 __ sw(zero_reg, MemOperand(a0, 3 * kPointerSize)); 898 __ sw(zero_reg, MemOperand(a0, 3 * kPointerSize));
898 899
899 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 900 const int kStackUnwindSpace = argc + kArgs + 1;
900 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 901 Address function_address = v8::ToCData<Address>(api_call_info->callback());
901 ApiFunction fun(function_address); 902 ApiFunction fun(function_address);
902 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; 903 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
903 ExternalReference ref = 904 ExternalReference ref =
904 ExternalReference(&fun, 905 ExternalReference(&fun,
905 type, 906 type,
906 masm->isolate()); 907 masm->isolate());
907 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); 908 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
908 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL; 909 ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL;
909 ApiFunction thunk_fun(thunk_address); 910 ApiFunction thunk_fun(thunk_address);
910 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 911 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
911 masm->isolate()); 912 masm->isolate());
912 913
913 AllowExternalCallThatCantCauseGC scope(masm); 914 AllowExternalCallThatCantCauseGC scope(masm);
914 MemOperand context_restore_operand( 915 MemOperand context_restore_operand(
915 fp, 2 * kPointerSize); 916 fp, (kArgs + 1 + FCA::kContextSaveIndex) * kPointerSize);
916 MemOperand return_value_operand( 917 MemOperand return_value_operand(
917 fp, (kFastApiCallArguments + 1) * kPointerSize); 918 fp, (kArgs + 1 + FCA::kReturnValueOffset) * kPointerSize);
918 __ CallApiFunctionAndReturn(ref, 919 __ CallApiFunctionAndReturn(ref,
919 function_address, 920 function_address,
920 thunk_ref, 921 thunk_ref,
921 a1, 922 a1,
922 kStackUnwindSpace, 923 kStackUnwindSpace,
923 return_value_operand, 924 return_value_operand,
924 restore_context ? 925 restore_context ?
925 &context_restore_operand : NULL); 926 &context_restore_operand : NULL);
926 } 927 }
927 928
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 // ----------------------------------- 3208 // -----------------------------------
3208 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3209 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3209 } 3210 }
3210 3211
3211 3212
3212 #undef __ 3213 #undef __
3213 3214
3214 } } // namespace v8::internal 3215 } } // namespace v8::internal
3215 3216
3216 #endif // V8_TARGET_ARCH_MIPS 3217 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698