OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 15 matching lines...) Expand all Loading... |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 28 #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
29 #define V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 29 #define V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
30 | 30 |
31 #include "assembler.h" | 31 #include "assembler.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 // Forward declaration. | |
37 class CallWrapper; | |
38 | |
39 // ---------------------------------------------------------------------------- | 36 // ---------------------------------------------------------------------------- |
40 // Static helper functions | 37 // Static helper functions |
41 | 38 |
42 // Generate a MemOperand for loading a field from an object. | 39 // Generate a MemOperand for loading a field from an object. |
43 static inline MemOperand FieldMemOperand(Register object, int offset) { | 40 static inline MemOperand FieldMemOperand(Register object, int offset) { |
44 return MemOperand(object, offset - kHeapObjectTag); | 41 return MemOperand(object, offset - kHeapObjectTag); |
45 } | 42 } |
46 | 43 |
47 | 44 |
48 static inline Operand SmiUntagOperand(Register object) { | 45 static inline Operand SmiUntagOperand(Register object) { |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1056 |
1060 private: | 1057 private: |
1061 byte* address_; // The address of the code being patched. | 1058 byte* address_; // The address of the code being patched. |
1062 int instructions_; // Number of instructions of the expected patch size. | 1059 int instructions_; // Number of instructions of the expected patch size. |
1063 int size_; // Number of bytes of the expected patch size. | 1060 int size_; // Number of bytes of the expected patch size. |
1064 MacroAssembler masm_; // Macro assembler used to generate the code. | 1061 MacroAssembler masm_; // Macro assembler used to generate the code. |
1065 }; | 1062 }; |
1066 #endif // ENABLE_DEBUGGER_SUPPORT | 1063 #endif // ENABLE_DEBUGGER_SUPPORT |
1067 | 1064 |
1068 | 1065 |
1069 // Helper class for generating code or data associated with the code | |
1070 // right after a call instruction. As an example this can be used to | |
1071 // generate safepoint data after calls for crankshaft. | |
1072 class CallWrapper { | |
1073 public: | |
1074 CallWrapper() { } | |
1075 virtual ~CallWrapper() { } | |
1076 // Called just before emitting a call. Argument is the size of the generated | |
1077 // call code. | |
1078 virtual void BeforeCall(int call_size) = 0; | |
1079 // Called just after emitting a call, i.e., at the return site for the call. | |
1080 virtual void AfterCall() = 0; | |
1081 }; | |
1082 | |
1083 | |
1084 // ----------------------------------------------------------------------------- | 1066 // ----------------------------------------------------------------------------- |
1085 // Static helper functions. | 1067 // Static helper functions. |
1086 | 1068 |
1087 static MemOperand ContextOperand(Register context, int index) { | 1069 static MemOperand ContextOperand(Register context, int index) { |
1088 return MemOperand(context, Context::SlotOffset(index)); | 1070 return MemOperand(context, Context::SlotOffset(index)); |
1089 } | 1071 } |
1090 | 1072 |
1091 | 1073 |
1092 static inline MemOperand GlobalObjectOperand() { | 1074 static inline MemOperand GlobalObjectOperand() { |
1093 return ContextOperand(cp, Context::GLOBAL_INDEX); | 1075 return ContextOperand(cp, Context::GLOBAL_INDEX); |
1094 } | 1076 } |
1095 | 1077 |
1096 | 1078 |
1097 #ifdef GENERATED_CODE_COVERAGE | 1079 #ifdef GENERATED_CODE_COVERAGE |
1098 #define CODE_COVERAGE_STRINGIFY(x) #x | 1080 #define CODE_COVERAGE_STRINGIFY(x) #x |
1099 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1081 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1100 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1082 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1101 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1083 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1102 #else | 1084 #else |
1103 #define ACCESS_MASM(masm) masm-> | 1085 #define ACCESS_MASM(masm) masm-> |
1104 #endif | 1086 #endif |
1105 | 1087 |
1106 | 1088 |
1107 } } // namespace v8::internal | 1089 } } // namespace v8::internal |
1108 | 1090 |
1109 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1091 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |