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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 // return address (unless this is somehow accounted for by the called | 762 // return address (unless this is somehow accounted for by the called |
763 // function). | 763 // function). |
764 void CallCFunction(ExternalReference function, int num_arguments); | 764 void CallCFunction(ExternalReference function, int num_arguments); |
765 void CallCFunction(Register function, int num_arguments); | 765 void CallCFunction(Register function, int num_arguments); |
766 | 766 |
767 // Prepares stack to put arguments (aligns and so on). Reserves | 767 // Prepares stack to put arguments (aligns and so on). Reserves |
768 // space for return value if needed (assumes the return value is a handle). | 768 // space for return value if needed (assumes the return value is a handle). |
769 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) | 769 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) |
770 // etc. Saves context (esi). If space was reserved for return value then | 770 // etc. Saves context (esi). If space was reserved for return value then |
771 // stores the pointer to the reserved slot into esi. | 771 // stores the pointer to the reserved slot into esi. |
772 void PrepareCallApiFunction(int argc); | 772 void PrepareCallApiFunction(int argc, bool returns_handle); |
773 | 773 |
774 // Calls an API function. Allocates HandleScope, extracts returned value | 774 // Calls an API function. Allocates HandleScope, extracts returned value |
775 // from handle and propagates exceptions. Clobbers ebx, edi and | 775 // from handle and propagates exceptions. Clobbers ebx, edi and |
776 // caller-save registers. Restores context. On return removes | 776 // caller-save registers. Restores context. On return removes |
777 // stack_space * kPointerSize (GCed). | 777 // stack_space * kPointerSize (GCed). |
778 void CallApiFunctionAndReturn(Address function_address, int stack_space); | 778 void CallApiFunctionAndReturn(Address function_address, |
| 779 int stack_space, |
| 780 bool returns_handle, |
| 781 int return_value_offset_from_ebp); |
779 | 782 |
780 // Jump to a runtime routine. | 783 // Jump to a runtime routine. |
781 void JumpToExternalReference(const ExternalReference& ext); | 784 void JumpToExternalReference(const ExternalReference& ext); |
782 | 785 |
783 // --------------------------------------------------------------------------- | 786 // --------------------------------------------------------------------------- |
784 // Utilities | 787 // Utilities |
785 | 788 |
786 void Ret(); | 789 void Ret(); |
787 | 790 |
788 // Return and drop arguments from stack, where the number of arguments | 791 // Return and drop arguments from stack, where the number of arguments |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 return Operand(context, Context::SlotOffset(index)); | 1006 return Operand(context, Context::SlotOffset(index)); |
1004 } | 1007 } |
1005 | 1008 |
1006 | 1009 |
1007 inline Operand GlobalObjectOperand() { | 1010 inline Operand GlobalObjectOperand() { |
1008 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); | 1011 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); |
1009 } | 1012 } |
1010 | 1013 |
1011 | 1014 |
1012 // Generates an Operand for saving parameters after PrepareCallApiFunction. | 1015 // Generates an Operand for saving parameters after PrepareCallApiFunction. |
1013 Operand ApiParameterOperand(int index); | 1016 Operand ApiParameterOperand(int index, bool returns_handle); |
1014 | 1017 |
1015 | 1018 |
1016 #ifdef GENERATED_CODE_COVERAGE | 1019 #ifdef GENERATED_CODE_COVERAGE |
1017 extern void LogGeneratedCodeCoverage(const char* file_line); | 1020 extern void LogGeneratedCodeCoverage(const char* file_line); |
1018 #define CODE_COVERAGE_STRINGIFY(x) #x | 1021 #define CODE_COVERAGE_STRINGIFY(x) #x |
1019 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1022 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1020 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1023 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1021 #define ACCESS_MASM(masm) { \ | 1024 #define ACCESS_MASM(masm) { \ |
1022 byte* ia32_coverage_function = \ | 1025 byte* ia32_coverage_function = \ |
1023 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ | 1026 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ |
1024 masm->pushfd(); \ | 1027 masm->pushfd(); \ |
1025 masm->pushad(); \ | 1028 masm->pushad(); \ |
1026 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ | 1029 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ |
1027 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ | 1030 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ |
1028 masm->pop(eax); \ | 1031 masm->pop(eax); \ |
1029 masm->popad(); \ | 1032 masm->popad(); \ |
1030 masm->popfd(); \ | 1033 masm->popfd(); \ |
1031 } \ | 1034 } \ |
1032 masm-> | 1035 masm-> |
1033 #else | 1036 #else |
1034 #define ACCESS_MASM(masm) masm-> | 1037 #define ACCESS_MASM(masm) masm-> |
1035 #endif | 1038 #endif |
1036 | 1039 |
1037 | 1040 |
1038 } } // namespace v8::internal | 1041 } } // namespace v8::internal |
1039 | 1042 |
1040 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 1043 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |