| 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_operand, |
| 782 int return_value_offset); |
| 779 | 783 |
| 780 // Jump to a runtime routine. | 784 // Jump to a runtime routine. |
| 781 void JumpToExternalReference(const ExternalReference& ext); | 785 void JumpToExternalReference(const ExternalReference& ext); |
| 782 | 786 |
| 783 // --------------------------------------------------------------------------- | 787 // --------------------------------------------------------------------------- |
| 784 // Utilities | 788 // Utilities |
| 785 | 789 |
| 786 void Ret(); | 790 void Ret(); |
| 787 | 791 |
| 788 // Return and drop arguments from stack, where the number of arguments | 792 // 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)); | 1007 return Operand(context, Context::SlotOffset(index)); |
| 1004 } | 1008 } |
| 1005 | 1009 |
| 1006 | 1010 |
| 1007 inline Operand GlobalObjectOperand() { | 1011 inline Operand GlobalObjectOperand() { |
| 1008 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); | 1012 return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); |
| 1009 } | 1013 } |
| 1010 | 1014 |
| 1011 | 1015 |
| 1012 // Generates an Operand for saving parameters after PrepareCallApiFunction. | 1016 // Generates an Operand for saving parameters after PrepareCallApiFunction. |
| 1013 Operand ApiParameterOperand(int index); | 1017 Operand ApiParameterOperand(int index, bool returns_handle); |
| 1014 | 1018 |
| 1015 | 1019 |
| 1016 #ifdef GENERATED_CODE_COVERAGE | 1020 #ifdef GENERATED_CODE_COVERAGE |
| 1017 extern void LogGeneratedCodeCoverage(const char* file_line); | 1021 extern void LogGeneratedCodeCoverage(const char* file_line); |
| 1018 #define CODE_COVERAGE_STRINGIFY(x) #x | 1022 #define CODE_COVERAGE_STRINGIFY(x) #x |
| 1019 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1023 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 1020 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1024 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1021 #define ACCESS_MASM(masm) { \ | 1025 #define ACCESS_MASM(masm) { \ |
| 1022 byte* ia32_coverage_function = \ | 1026 byte* ia32_coverage_function = \ |
| 1023 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ | 1027 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ |
| 1024 masm->pushfd(); \ | 1028 masm->pushfd(); \ |
| 1025 masm->pushad(); \ | 1029 masm->pushad(); \ |
| 1026 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ | 1030 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ |
| 1027 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ | 1031 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ |
| 1028 masm->pop(eax); \ | 1032 masm->pop(eax); \ |
| 1029 masm->popad(); \ | 1033 masm->popad(); \ |
| 1030 masm->popfd(); \ | 1034 masm->popfd(); \ |
| 1031 } \ | 1035 } \ |
| 1032 masm-> | 1036 masm-> |
| 1033 #else | 1037 #else |
| 1034 #define ACCESS_MASM(masm) masm-> | 1038 #define ACCESS_MASM(masm) masm-> |
| 1035 #endif | 1039 #endif |
| 1036 | 1040 |
| 1037 | 1041 |
| 1038 } } // namespace v8::internal | 1042 } } // namespace v8::internal |
| 1039 | 1043 |
| 1040 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 1044 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |