| OLD | NEW | 
|---|
| 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_X87_MACRO_ASSEMBLER_X87_H_ | 5 #ifndef V8_X87_MACRO_ASSEMBLER_X87_H_ | 
| 6 #define V8_X87_MACRO_ASSEMBLER_X87_H_ | 6 #define V8_X87_MACRO_ASSEMBLER_X87_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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 748   void PrepareCallCFunction(int num_arguments, Register scratch); | 748   void PrepareCallCFunction(int num_arguments, Register scratch); | 
| 749 | 749 | 
| 750   // Calls a C function and cleans up the space for arguments allocated | 750   // Calls a C function and cleans up the space for arguments allocated | 
| 751   // by PrepareCallCFunction. The called function is not allowed to trigger a | 751   // by PrepareCallCFunction. The called function is not allowed to trigger a | 
| 752   // garbage collection, since that might move the code and invalidate the | 752   // garbage collection, since that might move the code and invalidate the | 
| 753   // return address (unless this is somehow accounted for by the called | 753   // return address (unless this is somehow accounted for by the called | 
| 754   // function). | 754   // function). | 
| 755   void CallCFunction(ExternalReference function, int num_arguments); | 755   void CallCFunction(ExternalReference function, int num_arguments); | 
| 756   void CallCFunction(Register function, int num_arguments); | 756   void CallCFunction(Register function, int num_arguments); | 
| 757 | 757 | 
| 758   // Prepares stack to put arguments (aligns and so on). Reserves |  | 
| 759   // space for return value if needed (assumes the return value is a handle). |  | 
| 760   // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) |  | 
| 761   // etc. Saves context (esi). If space was reserved for return value then |  | 
| 762   // stores the pointer to the reserved slot into esi. |  | 
| 763   void PrepareCallApiFunction(int argc); |  | 
| 764 |  | 
| 765   // Calls an API function.  Allocates HandleScope, extracts returned value |  | 
| 766   // from handle and propagates exceptions.  Clobbers ebx, edi and |  | 
| 767   // caller-save registers.  Restores context.  On return removes |  | 
| 768   // stack_space * kPointerSize (GCed). |  | 
| 769   void CallApiFunctionAndReturn(Register function_address, |  | 
| 770                                 ExternalReference thunk_ref, |  | 
| 771                                 Operand thunk_last_arg, int stack_space, |  | 
| 772                                 Operand* stack_space_operand, |  | 
| 773                                 Operand return_value_operand, |  | 
| 774                                 Operand* context_restore_operand); |  | 
| 775 |  | 
| 776   // Jump to a runtime routine. | 758   // Jump to a runtime routine. | 
| 777   void JumpToExternalReference(const ExternalReference& ext); | 759   void JumpToExternalReference(const ExternalReference& ext); | 
| 778 | 760 | 
| 779   // --------------------------------------------------------------------------- | 761   // --------------------------------------------------------------------------- | 
| 780   // Utilities | 762   // Utilities | 
| 781 | 763 | 
| 782   void Ret(); | 764   void Ret(); | 
| 783 | 765 | 
| 784   // Return and drop arguments from stack, where the number of arguments | 766   // Return and drop arguments from stack, where the number of arguments | 
| 785   // may be bigger than 2^16 - 1.  Requires a scratch register. | 767   // may be bigger than 2^16 - 1.  Requires a scratch register. | 
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1044 inline Operand ContextOperand(Register context, int index) { | 1026 inline Operand ContextOperand(Register context, int index) { | 
| 1045   return Operand(context, Context::SlotOffset(index)); | 1027   return Operand(context, Context::SlotOffset(index)); | 
| 1046 } | 1028 } | 
| 1047 | 1029 | 
| 1048 | 1030 | 
| 1049 inline Operand GlobalObjectOperand() { | 1031 inline Operand GlobalObjectOperand() { | 
| 1050   return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); | 1032   return ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX); | 
| 1051 } | 1033 } | 
| 1052 | 1034 | 
| 1053 | 1035 | 
| 1054 // Generates an Operand for saving parameters after PrepareCallApiFunction. |  | 
| 1055 Operand ApiParameterOperand(int index); |  | 
| 1056 |  | 
| 1057 |  | 
| 1058 #ifdef GENERATED_CODE_COVERAGE | 1036 #ifdef GENERATED_CODE_COVERAGE | 
| 1059 extern void LogGeneratedCodeCoverage(const char* file_line); | 1037 extern void LogGeneratedCodeCoverage(const char* file_line); | 
| 1060 #define CODE_COVERAGE_STRINGIFY(x) #x | 1038 #define CODE_COVERAGE_STRINGIFY(x) #x | 
| 1061 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1039 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 
| 1062 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1040 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 
| 1063 #define ACCESS_MASM(masm) {                                               \ | 1041 #define ACCESS_MASM(masm) {                                               \ | 
| 1064     byte* ia32_coverage_function =                                        \ | 1042     byte* ia32_coverage_function =                                        \ | 
| 1065         reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ | 1043         reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ | 
| 1066     masm->pushfd();                                                       \ | 1044     masm->pushfd();                                                       \ | 
| 1067     masm->pushad();                                                       \ | 1045     masm->pushad();                                                       \ | 
| 1068     masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__)));         \ | 1046     masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__)));         \ | 
| 1069     masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY);         \ | 1047     masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY);         \ | 
| 1070     masm->pop(eax);                                                       \ | 1048     masm->pop(eax);                                                       \ | 
| 1071     masm->popad();                                                        \ | 1049     masm->popad();                                                        \ | 
| 1072     masm->popfd();                                                        \ | 1050     masm->popfd();                                                        \ | 
| 1073   }                                                                       \ | 1051   }                                                                       \ | 
| 1074   masm-> | 1052   masm-> | 
| 1075 #else | 1053 #else | 
| 1076 #define ACCESS_MASM(masm) masm-> | 1054 #define ACCESS_MASM(masm) masm-> | 
| 1077 #endif | 1055 #endif | 
| 1078 | 1056 | 
| 1079 | 1057 | 
| 1080 } }  // namespace v8::internal | 1058 } }  // namespace v8::internal | 
| 1081 | 1059 | 
| 1082 #endif  // V8_X87_MACRO_ASSEMBLER_X87_H_ | 1060 #endif  // V8_X87_MACRO_ASSEMBLER_X87_H_ | 
| OLD | NEW | 
|---|