| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // MacroAssembler implements a collection of frequently used macros. | 93 // MacroAssembler implements a collection of frequently used macros. |
| 94 class MacroAssembler: public Assembler { | 94 class MacroAssembler: public Assembler { |
| 95 public: | 95 public: |
| 96 // The isolate parameter can be NULL if the macro assembler should | 96 // The isolate parameter can be NULL if the macro assembler should |
| 97 // not use isolate-dependent functionality. In this case, it's the | 97 // not use isolate-dependent functionality. In this case, it's the |
| 98 // responsibility of the caller to never invoke such function on the | 98 // responsibility of the caller to never invoke such function on the |
| 99 // macro assembler. | 99 // macro assembler. |
| 100 MacroAssembler(Isolate* isolate, void* buffer, int size); | 100 MacroAssembler(Isolate* isolate, void* buffer, int size); |
| 101 | 101 |
| 102 // Arguments macros. | 102 // Arguments macros. |
| 103 #define COND_TYPED_ARGS Condition cond, Register r1, const Operand& r2 | 103 #define COND_TYPED_ARGS Condition cond, Register r1, const Operand& r2 |
| 104 #define COND_ARGS cond, r1, r2 | 104 #define COND_ARGS cond, r1, r2 |
| 105 | 105 |
| 106 // Prototypes. | 106 // Cases when relocation is not needed. |
| 107 | |
| 108 // Prototypes for functions with no target (eg Ret()). | |
| 109 #define DECLARE_NOTARGET_PROTOTYPE(Name) \ | |
| 110 void Name(BranchDelaySlot bd = PROTECT); \ | |
| 111 void Name(COND_TYPED_ARGS, BranchDelaySlot bd = PROTECT); \ | |
| 112 inline void Name(BranchDelaySlot bd, COND_TYPED_ARGS) { \ | |
| 113 Name(COND_ARGS, bd); \ | |
| 114 } | |
| 115 | |
| 116 // Prototypes for functions with a target. | |
| 117 | |
| 118 // Cases when relocation may be needed. | |
| 119 #define DECLARE_RELOC_PROTOTYPE(Name, target_type) \ | |
| 120 void Name(target_type target, \ | |
| 121 RelocInfo::Mode rmode, \ | |
| 122 BranchDelaySlot bd = PROTECT); \ | |
| 123 inline void Name(BranchDelaySlot bd, \ | |
| 124 target_type target, \ | |
| 125 RelocInfo::Mode rmode) { \ | |
| 126 Name(target, rmode, bd); \ | |
| 127 } \ | |
| 128 void Name(target_type target, \ | |
| 129 RelocInfo::Mode rmode, \ | |
| 130 COND_TYPED_ARGS, \ | |
| 131 BranchDelaySlot bd = PROTECT); \ | |
| 132 inline void Name(BranchDelaySlot bd, \ | |
| 133 target_type target, \ | |
| 134 RelocInfo::Mode rmode, \ | |
| 135 COND_TYPED_ARGS) { \ | |
| 136 Name(target, rmode, COND_ARGS, bd); \ | |
| 137 } | |
| 138 | |
| 139 // Cases when relocation is not needed. | |
| 140 #define DECLARE_NORELOC_PROTOTYPE(Name, target_type) \ | 107 #define DECLARE_NORELOC_PROTOTYPE(Name, target_type) \ |
| 141 void Name(target_type target, BranchDelaySlot bd = PROTECT); \ | 108 void Name(target_type target, BranchDelaySlot bd = PROTECT); \ |
| 142 inline void Name(BranchDelaySlot bd, target_type target) { \ | 109 inline void Name(BranchDelaySlot bd, target_type target) { \ |
| 143 Name(target, bd); \ | 110 Name(target, bd); \ |
| 144 } \ | 111 } \ |
| 145 void Name(target_type target, \ | 112 void Name(target_type target, \ |
| 146 COND_TYPED_ARGS, \ | 113 COND_TYPED_ARGS, \ |
| 147 BranchDelaySlot bd = PROTECT); \ | 114 BranchDelaySlot bd = PROTECT); \ |
| 148 inline void Name(BranchDelaySlot bd, \ | 115 inline void Name(BranchDelaySlot bd, \ |
| 149 target_type target, \ | 116 target_type target, \ |
| 150 COND_TYPED_ARGS) { \ | 117 COND_TYPED_ARGS) { \ |
| 151 Name(target, COND_ARGS, bd); \ | 118 Name(target, COND_ARGS, bd); \ |
| 152 } | 119 } |
| 153 | 120 |
| 154 // Target prototypes. | |
| 155 | |
| 156 #define DECLARE_JUMP_CALL_PROTOTYPES(Name) \ | |
| 157 DECLARE_NORELOC_PROTOTYPE(Name, Register) \ | |
| 158 DECLARE_NORELOC_PROTOTYPE(Name, const Operand&) \ | |
| 159 DECLARE_RELOC_PROTOTYPE(Name, byte*) \ | |
| 160 DECLARE_RELOC_PROTOTYPE(Name, Handle<Code>) | |
| 161 | |
| 162 #define DECLARE_BRANCH_PROTOTYPES(Name) \ | 121 #define DECLARE_BRANCH_PROTOTYPES(Name) \ |
| 163 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ | 122 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ |
| 164 DECLARE_NORELOC_PROTOTYPE(Name, int16_t) | 123 DECLARE_NORELOC_PROTOTYPE(Name, int16_t) |
| 165 | 124 |
| 125 DECLARE_BRANCH_PROTOTYPES(Branch) |
| 126 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) |
| 166 | 127 |
| 167 DECLARE_JUMP_CALL_PROTOTYPES(Jump) | 128 #undef DECLARE_BRANCH_PROTOTYPES |
| 168 DECLARE_JUMP_CALL_PROTOTYPES(Call) | |
| 169 | |
| 170 DECLARE_BRANCH_PROTOTYPES(Branch) | |
| 171 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) | |
| 172 | |
| 173 DECLARE_NOTARGET_PROTOTYPE(Ret) | |
| 174 | |
| 175 #undef COND_TYPED_ARGS | 129 #undef COND_TYPED_ARGS |
| 176 #undef COND_ARGS | 130 #undef COND_ARGS |
| 177 #undef DECLARE_NOTARGET_PROTOTYPE | |
| 178 #undef DECLARE_NORELOC_PROTOTYPE | |
| 179 #undef DECLARE_RELOC_PROTOTYPE | |
| 180 #undef DECLARE_JUMP_CALL_PROTOTYPES | |
| 181 #undef DECLARE_BRANCH_PROTOTYPES | |
| 182 | 131 |
| 183 void CallWithAstId(Handle<Code> code, | |
| 184 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, | |
| 185 unsigned ast_id = kNoASTId, | |
| 186 Condition cond = al, | |
| 187 Register r1 = zero_reg, | |
| 188 const Operand& r2 = Operand(zero_reg)); | |
| 189 | 132 |
| 190 int CallSize(Register reg); | 133 // Jump, Call, and Ret pseudo instructions implementing inter-working. |
| 191 int CallSize(Handle<Code> code, RelocInfo::Mode rmode); | 134 #define COND_ARGS Condition cond = al, Register rs = zero_reg, \ |
| 135 const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT |
| 136 |
| 137 void Jump(Register target, COND_ARGS); |
| 138 void Jump(intptr_t target, RelocInfo::Mode rmode, COND_ARGS); |
| 139 void Jump(Address target, RelocInfo::Mode rmode, COND_ARGS); |
| 140 void Jump(Handle<Code> code, RelocInfo::Mode rmode, COND_ARGS); |
| 141 int CallSize(Register target, COND_ARGS); |
| 142 void Call(Register target, COND_ARGS); |
| 143 int CallSize(Address target, RelocInfo::Mode rmode, COND_ARGS); |
| 144 void Call(Address target, RelocInfo::Mode rmode, COND_ARGS); |
| 145 int CallSize(Handle<Code> code, |
| 146 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
| 147 unsigned ast_id = kNoASTId, |
| 148 COND_ARGS); |
| 149 void Call(Handle<Code> code, |
| 150 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
| 151 unsigned ast_id = kNoASTId, |
| 152 COND_ARGS); |
| 153 void Ret(COND_ARGS); |
| 154 inline void Ret(BranchDelaySlot bd) { |
| 155 Ret(al, zero_reg, Operand(zero_reg), bd); |
| 156 } |
| 157 |
| 158 #undef COND_ARGS |
| 192 | 159 |
| 193 // Emit code to discard a non-negative number of pointer-sized elements | 160 // Emit code to discard a non-negative number of pointer-sized elements |
| 194 // from the stack, clobbering only the sp register. | 161 // from the stack, clobbering only the sp register. |
| 195 void Drop(int count, | 162 void Drop(int count, |
| 196 Condition cond = cc_always, | 163 Condition cond = cc_always, |
| 197 Register reg = no_reg, | 164 Register reg = no_reg, |
| 198 const Operand& op = Operand(no_reg)); | 165 const Operand& op = Operand(no_reg)); |
| 199 | 166 |
| 200 void DropAndRet(int drop = 0, | 167 void DropAndRet(int drop = 0, |
| 201 Condition cond = cc_always, | 168 Condition cond = cc_always, |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 const Operand& rt, | 1085 const Operand& rt, |
| 1119 BranchDelaySlot bdslot = PROTECT); | 1086 BranchDelaySlot bdslot = PROTECT); |
| 1120 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); | 1087 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); |
| 1121 void BranchAndLinkShort(Label* L, Condition cond, Register rs, | 1088 void BranchAndLinkShort(Label* L, Condition cond, Register rs, |
| 1122 const Operand& rt, | 1089 const Operand& rt, |
| 1123 BranchDelaySlot bdslot = PROTECT); | 1090 BranchDelaySlot bdslot = PROTECT); |
| 1124 void J(Label* L, BranchDelaySlot bdslot); | 1091 void J(Label* L, BranchDelaySlot bdslot); |
| 1125 void Jr(Label* L, BranchDelaySlot bdslot); | 1092 void Jr(Label* L, BranchDelaySlot bdslot); |
| 1126 void Jalr(Label* L, BranchDelaySlot bdslot); | 1093 void Jalr(Label* L, BranchDelaySlot bdslot); |
| 1127 | 1094 |
| 1128 void Jump(intptr_t target, RelocInfo::Mode rmode, | |
| 1129 BranchDelaySlot bd = PROTECT); | |
| 1130 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = cc_always, | |
| 1131 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg), | |
| 1132 BranchDelaySlot bd = PROTECT); | |
| 1133 void Call(intptr_t target, RelocInfo::Mode rmode, | |
| 1134 BranchDelaySlot bd = PROTECT); | |
| 1135 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = cc_always, | |
| 1136 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg), | |
| 1137 BranchDelaySlot bd = PROTECT); | |
| 1138 | |
| 1139 // Helper functions for generating invokes. | 1095 // Helper functions for generating invokes. |
| 1140 void InvokePrologue(const ParameterCount& expected, | 1096 void InvokePrologue(const ParameterCount& expected, |
| 1141 const ParameterCount& actual, | 1097 const ParameterCount& actual, |
| 1142 Handle<Code> code_constant, | 1098 Handle<Code> code_constant, |
| 1143 Register code_reg, | 1099 Register code_reg, |
| 1144 Label* done, | 1100 Label* done, |
| 1145 InvokeFlag flag, | 1101 InvokeFlag flag, |
| 1146 const CallWrapper& call_wrapper, | 1102 const CallWrapper& call_wrapper, |
| 1147 CallKind call_kind); | 1103 CallKind call_kind); |
| 1148 | 1104 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1200 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 1245 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1201 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1246 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1202 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1247 #else | 1203 #else |
| 1248 #define ACCESS_MASM(masm) masm-> | 1204 #define ACCESS_MASM(masm) masm-> |
| 1249 #endif | 1205 #endif |
| 1250 | 1206 |
| 1251 } } // namespace v8::internal | 1207 } } // namespace v8::internal |
| 1252 | 1208 |
| 1253 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1209 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
| OLD | NEW |