OLD | NEW |
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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 // return address (unless this is somehow accounted for by the called | 775 // return address (unless this is somehow accounted for by the called |
776 // function). | 776 // function). |
777 void CallCFunction(ExternalReference function, int num_arguments); | 777 void CallCFunction(ExternalReference function, int num_arguments); |
778 void CallCFunction(Register function, int num_arguments); | 778 void CallCFunction(Register function, int num_arguments); |
779 | 779 |
780 // Prepares stack to put arguments (aligns and so on). Reserves | 780 // Prepares stack to put arguments (aligns and so on). Reserves |
781 // space for return value if needed (assumes the return value is a handle). | 781 // space for return value if needed (assumes the return value is a handle). |
782 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) | 782 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) |
783 // etc. Saves context (esi). If space was reserved for return value then | 783 // etc. Saves context (esi). If space was reserved for return value then |
784 // stores the pointer to the reserved slot into esi. | 784 // stores the pointer to the reserved slot into esi. |
785 void PrepareCallApiFunction(int argc, bool returns_handle); | 785 void PrepareCallApiFunction(int argc); |
786 | 786 |
787 // Calls an API function. Allocates HandleScope, extracts returned value | 787 // Calls an API function. Allocates HandleScope, extracts returned value |
788 // from handle and propagates exceptions. Clobbers ebx, edi and | 788 // from handle and propagates exceptions. Clobbers ebx, edi and |
789 // caller-save registers. Restores context. On return removes | 789 // caller-save registers. Restores context. On return removes |
790 // stack_space * kPointerSize (GCed). | 790 // stack_space * kPointerSize (GCed). |
791 void CallApiFunctionAndReturn(Address function_address, | 791 void CallApiFunctionAndReturn(Address function_address, |
792 Address thunk_address, | 792 Address thunk_address, |
793 Operand thunk_last_arg, | 793 Operand thunk_last_arg, |
794 int stack_space, | 794 int stack_space, |
795 bool returns_handle, | |
796 int return_value_offset_from_ebp); | 795 int return_value_offset_from_ebp); |
797 | 796 |
798 // Jump to a runtime routine. | 797 // Jump to a runtime routine. |
799 void JumpToExternalReference(const ExternalReference& ext); | 798 void JumpToExternalReference(const ExternalReference& ext); |
800 | 799 |
801 // --------------------------------------------------------------------------- | 800 // --------------------------------------------------------------------------- |
802 // Utilities | 801 // Utilities |
803 | 802 |
804 void Ret(); | 803 void Ret(); |
805 | 804 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 return Operand(context, Context::SlotOffset(index)); | 1031 return Operand(context, Context::SlotOffset(index)); |
1033 } | 1032 } |
1034 | 1033 |
1035 | 1034 |
1036 inline Operand GlobalObjectOperand() { | 1035 inline Operand GlobalObjectOperand() { |
1037 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); | 1036 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); |
1038 } | 1037 } |
1039 | 1038 |
1040 | 1039 |
1041 // Generates an Operand for saving parameters after PrepareCallApiFunction. | 1040 // Generates an Operand for saving parameters after PrepareCallApiFunction. |
1042 Operand ApiParameterOperand(int index, bool returns_handle); | 1041 Operand ApiParameterOperand(int index); |
1043 | 1042 |
1044 | 1043 |
1045 #ifdef GENERATED_CODE_COVERAGE | 1044 #ifdef GENERATED_CODE_COVERAGE |
1046 extern void LogGeneratedCodeCoverage(const char* file_line); | 1045 extern void LogGeneratedCodeCoverage(const char* file_line); |
1047 #define CODE_COVERAGE_STRINGIFY(x) #x | 1046 #define CODE_COVERAGE_STRINGIFY(x) #x |
1048 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1047 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1049 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1048 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1050 #define ACCESS_MASM(masm) { \ | 1049 #define ACCESS_MASM(masm) { \ |
1051 byte* ia32_coverage_function = \ | 1050 byte* ia32_coverage_function = \ |
1052 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ | 1051 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ |
1053 masm->pushfd(); \ | 1052 masm->pushfd(); \ |
1054 masm->pushad(); \ | 1053 masm->pushad(); \ |
1055 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ | 1054 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ |
1056 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ | 1055 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ |
1057 masm->pop(eax); \ | 1056 masm->pop(eax); \ |
1058 masm->popad(); \ | 1057 masm->popad(); \ |
1059 masm->popfd(); \ | 1058 masm->popfd(); \ |
1060 } \ | 1059 } \ |
1061 masm-> | 1060 masm-> |
1062 #else | 1061 #else |
1063 #define ACCESS_MASM(masm) masm-> | 1062 #define ACCESS_MASM(masm) masm-> |
1064 #endif | 1063 #endif |
1065 | 1064 |
1066 | 1065 |
1067 } } // namespace v8::internal | 1066 } } // namespace v8::internal |
1068 | 1067 |
1069 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 1068 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |