| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 #undef COND_ARGS | 187 #undef COND_ARGS |
| 188 | 188 |
| 189 // Emit code to discard a non-negative number of pointer-sized elements | 189 // Emit code to discard a non-negative number of pointer-sized elements |
| 190 // from the stack, clobbering only the sp register. | 190 // from the stack, clobbering only the sp register. |
| 191 void Drop(int count, | 191 void Drop(int count, |
| 192 Condition cond = cc_always, | 192 Condition cond = cc_always, |
| 193 Register reg = no_reg, | 193 Register reg = no_reg, |
| 194 const Operand& op = Operand(no_reg)); | 194 const Operand& op = Operand(no_reg)); |
| 195 | 195 |
| 196 void DropAndRet(int drop = 0, | 196 // Trivial case of DropAndRet that utilizes the delay slot and only emits |
| 197 Condition cond = cc_always, | 197 // 2 instructions. |
| 198 Register reg = no_reg, | 198 void DropAndRet(int drop); |
| 199 const Operand& op = Operand(no_reg)); | 199 |
| 200 void DropAndRet(int drop, |
| 201 Condition cond, |
| 202 Register reg, |
| 203 const Operand& op); |
| 200 | 204 |
| 201 // Swap two registers. If the scratch register is omitted then a slightly | 205 // Swap two registers. If the scratch register is omitted then a slightly |
| 202 // less efficient form using xor instead of mov is emitted. | 206 // less efficient form using xor instead of mov is emitted. |
| 203 void Swap(Register reg1, Register reg2, Register scratch = no_reg); | 207 void Swap(Register reg1, Register reg2, Register scratch = no_reg); |
| 204 | 208 |
| 205 void Call(Label* target); | 209 void Call(Label* target); |
| 206 | 210 |
| 207 inline void Move(Register dst, Register src) { | 211 inline void Move(Register dst, Register src) { |
| 208 if (!dst.is(src)) { | 212 if (!dst.is(src)) { |
| 209 mov(dst, src); | 213 mov(dst, src); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 Register scratch3); | 770 Register scratch3); |
| 767 | 771 |
| 768 // Enter exit frame. | 772 // Enter exit frame. |
| 769 // argc - argument count to be dropped by LeaveExitFrame. | 773 // argc - argument count to be dropped by LeaveExitFrame. |
| 770 // save_doubles - saves FPU registers on stack, currently disabled. | 774 // save_doubles - saves FPU registers on stack, currently disabled. |
| 771 // stack_space - extra stack space. | 775 // stack_space - extra stack space. |
| 772 void EnterExitFrame(bool save_doubles, | 776 void EnterExitFrame(bool save_doubles, |
| 773 int stack_space = 0); | 777 int stack_space = 0); |
| 774 | 778 |
| 775 // Leave the current exit frame. | 779 // Leave the current exit frame. |
| 776 void LeaveExitFrame(bool save_doubles, Register arg_count); | 780 void LeaveExitFrame(bool save_doubles, |
| 781 Register arg_count, |
| 782 bool do_return = false); |
| 777 | 783 |
| 778 // Get the actual activation frame alignment for target environment. | 784 // Get the actual activation frame alignment for target environment. |
| 779 static int ActivationFrameAlignment(); | 785 static int ActivationFrameAlignment(); |
| 780 | 786 |
| 781 // Make sure the stack is aligned. Only emits code in debug mode. | 787 // Make sure the stack is aligned. Only emits code in debug mode. |
| 782 void AssertStackIsAligned(); | 788 void AssertStackIsAligned(); |
| 783 | 789 |
| 784 void LoadContext(Register dst, int context_chain_length); | 790 void LoadContext(Register dst, int context_chain_length); |
| 785 | 791 |
| 786 // Conditionally load the cached Array transitioned map of type | 792 // Conditionally load the cached Array transitioned map of type |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 Ret(lt, overflow_check, Operand(zero_reg), bd); | 1082 Ret(lt, overflow_check, Operand(zero_reg), bd); |
| 1077 } | 1083 } |
| 1078 | 1084 |
| 1079 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1085 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { |
| 1080 Ret(ge, overflow_check, Operand(zero_reg), bd); | 1086 Ret(ge, overflow_check, Operand(zero_reg), bd); |
| 1081 } | 1087 } |
| 1082 | 1088 |
| 1083 // ------------------------------------------------------------------------- | 1089 // ------------------------------------------------------------------------- |
| 1084 // Runtime calls. | 1090 // Runtime calls. |
| 1085 | 1091 |
| 1092 // See comments at the beginning of CEntryStub::Generate. |
| 1093 inline void PrepareCEntryArgs(int num_args) { |
| 1094 li(s0, num_args); |
| 1095 li(s1, (num_args - 1) * kPointerSize); |
| 1096 } |
| 1097 |
| 1098 inline void PrepareCEntryFunction(const ExternalReference& ref) { |
| 1099 li(s2, Operand(ref)); |
| 1100 } |
| 1101 |
| 1086 // Call a code stub. | 1102 // Call a code stub. |
| 1087 void CallStub(CodeStub* stub, Condition cond = cc_always, | 1103 void CallStub(CodeStub* stub, |
| 1088 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg)); | 1104 Condition cond = cc_always, |
| 1105 Register r1 = zero_reg, |
| 1106 const Operand& r2 = Operand(zero_reg), |
| 1107 BranchDelaySlot bd = PROTECT); |
| 1089 | 1108 |
| 1090 // Tail call a code stub (jump). | 1109 // Tail call a code stub (jump). |
| 1091 void TailCallStub(CodeStub* stub); | 1110 void TailCallStub(CodeStub* stub); |
| 1092 | 1111 |
| 1093 void CallJSExitStub(CodeStub* stub); | 1112 void CallJSExitStub(CodeStub* stub); |
| 1094 | 1113 |
| 1095 // Call a runtime routine. | 1114 // Call a runtime routine. |
| 1096 void CallRuntime(const Runtime::Function* f, int num_arguments); | 1115 void CallRuntime(const Runtime::Function* f, int num_arguments); |
| 1097 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 1116 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
| 1098 | 1117 |
| 1099 // Convenience function: Same as above, but takes the fid instead. | 1118 // Convenience function: Same as above, but takes the fid instead. |
| 1100 void CallRuntime(Runtime::FunctionId fid, int num_arguments); | 1119 void CallRuntime(Runtime::FunctionId fid, int num_arguments); |
| 1101 | 1120 |
| 1102 // Convenience function: call an external reference. | 1121 // Convenience function: call an external reference. |
| 1103 void CallExternalReference(const ExternalReference& ext, | 1122 void CallExternalReference(const ExternalReference& ext, |
| 1104 int num_arguments); | 1123 int num_arguments, |
| 1124 BranchDelaySlot bd = PROTECT); |
| 1105 | 1125 |
| 1106 // Tail call of a runtime routine (jump). | 1126 // Tail call of a runtime routine (jump). |
| 1107 // Like JumpToExternalReference, but also takes care of passing the number | 1127 // Like JumpToExternalReference, but also takes care of passing the number |
| 1108 // of parameters. | 1128 // of parameters. |
| 1109 void TailCallExternalReference(const ExternalReference& ext, | 1129 void TailCallExternalReference(const ExternalReference& ext, |
| 1110 int num_arguments, | 1130 int num_arguments, |
| 1111 int result_size); | 1131 int result_size); |
| 1112 | 1132 |
| 1113 // Convenience function: tail call a runtime routine (jump). | 1133 // Convenience function: tail call a runtime routine (jump). |
| 1114 void TailCallRuntime(Runtime::FunctionId fid, | 1134 void TailCallRuntime(Runtime::FunctionId fid, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 void SetCallCDoubleArguments(DoubleRegister dreg1, DoubleRegister dreg2); | 1180 void SetCallCDoubleArguments(DoubleRegister dreg1, DoubleRegister dreg2); |
| 1161 void SetCallCDoubleArguments(DoubleRegister dreg, Register reg); | 1181 void SetCallCDoubleArguments(DoubleRegister dreg, Register reg); |
| 1162 | 1182 |
| 1163 // Calls an API function. Allocates HandleScope, extracts returned value | 1183 // Calls an API function. Allocates HandleScope, extracts returned value |
| 1164 // from handle and propagates exceptions. Restores context. stack_space | 1184 // from handle and propagates exceptions. Restores context. stack_space |
| 1165 // - space to be unwound on exit (includes the call JS arguments space and | 1185 // - space to be unwound on exit (includes the call JS arguments space and |
| 1166 // the additional space allocated for the fast call). | 1186 // the additional space allocated for the fast call). |
| 1167 void CallApiFunctionAndReturn(ExternalReference function, int stack_space); | 1187 void CallApiFunctionAndReturn(ExternalReference function, int stack_space); |
| 1168 | 1188 |
| 1169 // Jump to the builtin routine. | 1189 // Jump to the builtin routine. |
| 1170 void JumpToExternalReference(const ExternalReference& builtin); | 1190 void JumpToExternalReference(const ExternalReference& builtin, |
| 1191 BranchDelaySlot bd = PROTECT); |
| 1171 | 1192 |
| 1172 // Invoke specified builtin JavaScript function. Adds an entry to | 1193 // Invoke specified builtin JavaScript function. Adds an entry to |
| 1173 // the unresolved list if the name does not resolve. | 1194 // the unresolved list if the name does not resolve. |
| 1174 void InvokeBuiltin(Builtins::JavaScript id, | 1195 void InvokeBuiltin(Builtins::JavaScript id, |
| 1175 InvokeFlag flag, | 1196 InvokeFlag flag, |
| 1176 const CallWrapper& call_wrapper = NullCallWrapper()); | 1197 const CallWrapper& call_wrapper = NullCallWrapper()); |
| 1177 | 1198 |
| 1178 // Store the code object for the given builtin in the target register and | 1199 // Store the code object for the given builtin in the target register and |
| 1179 // setup the function in a1. | 1200 // setup the function in a1. |
| 1180 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 1201 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1506 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 1486 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1507 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1487 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1508 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1488 #else | 1509 #else |
| 1489 #define ACCESS_MASM(masm) masm-> | 1510 #define ACCESS_MASM(masm) masm-> |
| 1490 #endif | 1511 #endif |
| 1491 | 1512 |
| 1492 } } // namespace v8::internal | 1513 } } // namespace v8::internal |
| 1493 | 1514 |
| 1494 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1515 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
| OLD | NEW |