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

Side by Side Diff: src/ia32/macro-assembler-ia32.h

Issue 860013002: move CallApiFunctionAndReturn to code-stubs-* (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/macro-assembler-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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ 5 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_
6 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ 6 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/frames.h" 10 #include "src/frames.h"
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 void PrepareCallCFunction(int num_arguments, Register scratch); 784 void PrepareCallCFunction(int num_arguments, Register scratch);
785 785
786 // Calls a C function and cleans up the space for arguments allocated 786 // Calls a C function and cleans up the space for arguments allocated
787 // by PrepareCallCFunction. The called function is not allowed to trigger a 787 // by PrepareCallCFunction. The called function is not allowed to trigger a
788 // garbage collection, since that might move the code and invalidate the 788 // garbage collection, since that might move the code and invalidate the
789 // return address (unless this is somehow accounted for by the called 789 // return address (unless this is somehow accounted for by the called
790 // function). 790 // function).
791 void CallCFunction(ExternalReference function, int num_arguments); 791 void CallCFunction(ExternalReference function, int num_arguments);
792 void CallCFunction(Register function, int num_arguments); 792 void CallCFunction(Register function, int num_arguments);
793 793
794 // Prepares stack to put arguments (aligns and so on). Reserves
795 // space for return value if needed (assumes the return value is a handle).
796 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1)
797 // etc. Saves context (esi). If space was reserved for return value then
798 // stores the pointer to the reserved slot into esi.
799 void PrepareCallApiFunction(int argc);
800
801 // Calls an API function. Allocates HandleScope, extracts returned value
802 // from handle and propagates exceptions. Clobbers ebx, edi and
803 // caller-save registers. Restores context. On return removes
804 // stack_space * kPointerSize (GCed).
805 void CallApiFunctionAndReturn(Register function_address,
806 ExternalReference thunk_ref,
807 Operand thunk_last_arg, int stack_space,
808 Operand* stack_space_operand,
809 Operand return_value_operand,
810 Operand* context_restore_operand);
811
812 // Jump to a runtime routine. 794 // Jump to a runtime routine.
813 void JumpToExternalReference(const ExternalReference& ext); 795 void JumpToExternalReference(const ExternalReference& ext);
814 796
815 // --------------------------------------------------------------------------- 797 // ---------------------------------------------------------------------------
816 // Utilities 798 // Utilities
817 799
818 void Ret(); 800 void Ret();
819 801
820 // Return and drop arguments from stack, where the number of arguments 802 // Return and drop arguments from stack, where the number of arguments
821 // may be bigger than 2^16 - 1. Requires a scratch register. 803 // may be bigger than 2^16 - 1. Requires a scratch register.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 inline Operand ContextOperand(Register context, int index) { 1064 inline Operand ContextOperand(Register context, int index) {
1083 return Operand(context, Context::SlotOffset(index)); 1065 return Operand(context, Context::SlotOffset(index));
1084 } 1066 }
1085 1067
1086 1068
1087 inline Operand GlobalObjectOperand() { 1069 inline Operand GlobalObjectOperand() {
1088 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); 1070 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX);
1089 } 1071 }
1090 1072
1091 1073
1092 // Generates an Operand for saving parameters after PrepareCallApiFunction.
1093 Operand ApiParameterOperand(int index);
1094
1095
1096 #ifdef GENERATED_CODE_COVERAGE 1074 #ifdef GENERATED_CODE_COVERAGE
1097 extern void LogGeneratedCodeCoverage(const char* file_line); 1075 extern void LogGeneratedCodeCoverage(const char* file_line);
1098 #define CODE_COVERAGE_STRINGIFY(x) #x 1076 #define CODE_COVERAGE_STRINGIFY(x) #x
1099 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 1077 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1100 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1078 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1101 #define ACCESS_MASM(masm) { \ 1079 #define ACCESS_MASM(masm) { \
1102 byte* ia32_coverage_function = \ 1080 byte* ia32_coverage_function = \
1103 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ 1081 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \
1104 masm->pushfd(); \ 1082 masm->pushfd(); \
1105 masm->pushad(); \ 1083 masm->pushad(); \
1106 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ 1084 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \
1107 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ 1085 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \
1108 masm->pop(eax); \ 1086 masm->pop(eax); \
1109 masm->popad(); \ 1087 masm->popad(); \
1110 masm->popfd(); \ 1088 masm->popfd(); \
1111 } \ 1089 } \
1112 masm-> 1090 masm->
1113 #else 1091 #else
1114 #define ACCESS_MASM(masm) masm-> 1092 #define ACCESS_MASM(masm) masm->
1115 #endif 1093 #endif
1116 1094
1117 1095
1118 } } // namespace v8::internal 1096 } } // namespace v8::internal
1119 1097
1120 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ 1098 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698