Chromium Code Reviews| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 void DropAndRet(int drop = 0, | 200 void DropAndRet(int drop = 0, |
| 201 Condition cond = cc_always, | 201 Condition cond = cc_always, |
| 202 Register reg = no_reg, | 202 Register reg = no_reg, |
| 203 const Operand& op = Operand(no_reg)); | 203 const Operand& op = Operand(no_reg)); |
| 204 | 204 |
| 205 // 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 |
| 206 // less efficient form using xor instead of mov is emitted. | 206 // less efficient form using xor instead of mov is emitted. |
| 207 void Swap(Register reg1, Register reg2, Register scratch = no_reg); | 207 void Swap(Register reg1, Register reg2, Register scratch = no_reg); |
| 208 | 208 |
| 209 void Call(Label* target); | 209 void Call(Label* target); |
| 210 // May do nothing if the registers are identical. | |
| 211 void Move(Register dst, Register src); | |
| 212 | 210 |
| 211 inline void Move(Register dst, Register src) { | |
| 212 if (!dst.is(src)) { | |
|
Søren Thygesen Gjesse
2011/05/24 07:21:00
Indentation.
| |
| 213 mov(dst, src); | |
| 214 } | |
| 215 } | |
| 216 | |
| 217 inline void Move(FPURegister dst, FPURegister src) { | |
| 218 if (!dst.is(src)) { | |
| 219 mov_d(dst, src); | |
| 220 } | |
| 221 } | |
| 222 | |
| 223 inline void Move(Register dst_low, Register dst_high, FPURegister src) { | |
| 224 mfc1(dst_low, src); | |
| 225 mfc1(dst_high, FPURegister::from_code(src.code() + 1)); | |
| 226 } | |
| 227 | |
| 228 inline void Move(FPURegister dst, Register src_low, Register src_high) { | |
| 229 mtc1(src_low, dst); | |
| 230 mtc1(src_high, FPURegister::from_code(dst.code() + 1)); | |
| 231 } | |
| 213 | 232 |
| 214 // Jump unconditionally to given label. | 233 // Jump unconditionally to given label. |
| 215 // We NEED a nop in the branch delay slot, as it used by v8, for example in | 234 // We NEED a nop in the branch delay slot, as it used by v8, for example in |
| 216 // CodeGenerator::ProcessDeferred(). | 235 // CodeGenerator::ProcessDeferred(). |
| 217 // Currently the branch delay slot is filled by the MacroAssembler. | 236 // Currently the branch delay slot is filled by the MacroAssembler. |
| 218 // Use rather b(Label) for code generation. | 237 // Use rather b(Label) for code generation. |
| 219 void jmp(Label* L) { | 238 void jmp(Label* L) { |
| 220 Branch(L); | 239 Branch(L); |
| 221 } | 240 } |
| 222 | 241 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 ASSERT(!src1.is(src2)); | 521 ASSERT(!src1.is(src2)); |
| 503 lw(src2, MemOperand(sp, 0 * kPointerSize)); | 522 lw(src2, MemOperand(sp, 0 * kPointerSize)); |
| 504 lw(src1, MemOperand(sp, 1 * kPointerSize)); | 523 lw(src1, MemOperand(sp, 1 * kPointerSize)); |
| 505 Addu(sp, sp, 2 * kPointerSize); | 524 Addu(sp, sp, 2 * kPointerSize); |
| 506 } | 525 } |
| 507 | 526 |
| 508 void Pop(uint32_t count = 1) { | 527 void Pop(uint32_t count = 1) { |
| 509 Addu(sp, sp, Operand(count * kPointerSize)); | 528 Addu(sp, sp, Operand(count * kPointerSize)); |
| 510 } | 529 } |
| 511 | 530 |
| 512 // --------------------------------------------------------------------------- | |
| 513 // These functions are only used by crankshaft, so they are currently | |
| 514 // unimplemented. | |
| 515 | |
| 516 // Push and pop the registers that can hold pointers, as defined by the | 531 // Push and pop the registers that can hold pointers, as defined by the |
| 517 // RegList constant kSafepointSavedRegisters. | 532 // RegList constant kSafepointSavedRegisters. |
| 518 void PushSafepointRegisters() { | 533 void PushSafepointRegisters(); |
| 519 UNIMPLEMENTED_MIPS(); | 534 void PopSafepointRegisters(); |
| 520 } | 535 void PushSafepointRegistersAndDoubles(); |
| 521 | 536 void PopSafepointRegistersAndDoubles(); |
| 522 void PopSafepointRegisters() { | 537 // Store value in register src in the safepoint stack slot for |
| 523 UNIMPLEMENTED_MIPS(); | 538 // register dst. |
| 524 } | 539 void StoreToSafepointRegisterSlot(Register src, Register dst); |
| 525 | 540 void StoreToSafepointRegistersAndDoublesSlot(Register src, Register dst); |
| 526 void PushSafepointRegistersAndDoubles() { | 541 // Load the value of the src register from its safepoint stack slot |
| 527 UNIMPLEMENTED_MIPS(); | 542 // into register dst. |
| 528 } | 543 void LoadFromSafepointRegisterSlot(Register dst, Register src); |
| 529 | |
| 530 void PopSafepointRegistersAndDoubles() { | |
| 531 UNIMPLEMENTED_MIPS(); | |
| 532 } | |
| 533 | |
| 534 static int SafepointRegisterStackIndex(int reg_code) { | |
| 535 UNIMPLEMENTED_MIPS(); | |
| 536 return 0; | |
| 537 } | |
| 538 | |
| 539 // --------------------------------------------------------------------------- | |
| 540 | 544 |
| 541 // MIPS32 R2 instruction macro. | 545 // MIPS32 R2 instruction macro. |
| 542 void Ins(Register rt, Register rs, uint16_t pos, uint16_t size); | 546 void Ins(Register rt, Register rs, uint16_t pos, uint16_t size); |
| 543 void Ext(Register rt, Register rs, uint16_t pos, uint16_t size); | 547 void Ext(Register rt, Register rs, uint16_t pos, uint16_t size); |
| 544 | 548 |
| 545 // Convert unsigned word to double. | 549 // Convert unsigned word to double. |
| 546 void Cvt_d_uw(FPURegister fd, FPURegister fs); | 550 void Cvt_d_uw(FPURegister fd, FPURegister fs); |
| 547 void Cvt_d_uw(FPURegister fd, Register rs); | 551 void Cvt_d_uw(FPURegister fd, Register rs); |
| 548 | 552 |
| 549 // Convert double to unsigned word. | 553 // Convert double to unsigned word. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 | 878 |
| 875 // Calls a C function and cleans up the space for arguments allocated | 879 // Calls a C function and cleans up the space for arguments allocated |
| 876 // by PrepareCallCFunction. The called function is not allowed to trigger a | 880 // by PrepareCallCFunction. The called function is not allowed to trigger a |
| 877 // garbage collection, since that might move the code and invalidate the | 881 // garbage collection, since that might move the code and invalidate the |
| 878 // return address (unless this is somehow accounted for by the called | 882 // return address (unless this is somehow accounted for by the called |
| 879 // function). | 883 // function). |
| 880 void CallCFunction(ExternalReference function, int num_arguments); | 884 void CallCFunction(ExternalReference function, int num_arguments); |
| 881 void CallCFunction(Register function, Register scratch, int num_arguments); | 885 void CallCFunction(Register function, Register scratch, int num_arguments); |
| 882 void GetCFunctionDoubleResult(const DoubleRegister dst); | 886 void GetCFunctionDoubleResult(const DoubleRegister dst); |
| 883 | 887 |
| 888 // There are two ways of passing double arguments on MIPS, depending on | |
| 889 // whether soft or hard floating point ABI is used. These functions | |
| 890 // abstract parameter passing for the three different ways we call | |
| 891 // C functions from generated code. | |
| 892 void SetCallCDoubleArguments(DoubleRegister dreg); | |
| 893 void SetCallCDoubleArguments(DoubleRegister dreg1, DoubleRegister dreg2); | |
| 894 void SetCallCDoubleArguments(DoubleRegister dreg, Register reg); | |
| 895 | |
| 884 // Calls an API function. Allocates HandleScope, extracts returned value | 896 // Calls an API function. Allocates HandleScope, extracts returned value |
| 885 // from handle and propagates exceptions. Restores context. | 897 // from handle and propagates exceptions. Restores context. |
| 886 MaybeObject* TryCallApiFunctionAndReturn(ExternalReference function, | 898 MaybeObject* TryCallApiFunctionAndReturn(ExternalReference function, |
| 887 int stack_space); | 899 int stack_space); |
| 888 | 900 |
| 889 // Jump to the builtin routine. | 901 // Jump to the builtin routine. |
| 890 void JumpToExternalReference(const ExternalReference& builtin); | 902 void JumpToExternalReference(const ExternalReference& builtin); |
| 891 | 903 |
| 892 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); | 904 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 893 | 905 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1053 Label* failure); | 1065 Label* failure); |
| 1054 | 1066 |
| 1055 // Test that both first and second are sequential ASCII strings. | 1067 // Test that both first and second are sequential ASCII strings. |
| 1056 // Check that they are non-smis. | 1068 // Check that they are non-smis. |
| 1057 void JumpIfNotBothSequentialAsciiStrings(Register first, | 1069 void JumpIfNotBothSequentialAsciiStrings(Register first, |
| 1058 Register second, | 1070 Register second, |
| 1059 Register scratch1, | 1071 Register scratch1, |
| 1060 Register scratch2, | 1072 Register scratch2, |
| 1061 Label* failure); | 1073 Label* failure); |
| 1062 | 1074 |
| 1075 void LoadInstanceDescriptors(Register map, Register descriptors); | |
| 1076 | |
| 1063 private: | 1077 private: |
| 1064 void CallCFunctionHelper(Register function, | 1078 void CallCFunctionHelper(Register function, |
| 1065 ExternalReference function_reference, | 1079 ExternalReference function_reference, |
| 1066 Register scratch, | 1080 Register scratch, |
| 1067 int num_arguments); | 1081 int num_arguments); |
| 1068 | 1082 |
| 1069 void Jump(intptr_t target, RelocInfo::Mode rmode, | 1083 void Jump(intptr_t target, RelocInfo::Mode rmode, |
| 1070 BranchDelaySlot bd = PROTECT); | 1084 BranchDelaySlot bd = PROTECT); |
| 1071 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = cc_always, | 1085 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = cc_always, |
| 1072 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg), | 1086 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg), |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1093 // Activation support. | 1107 // Activation support. |
| 1094 void EnterFrame(StackFrame::Type type); | 1108 void EnterFrame(StackFrame::Type type); |
| 1095 void LeaveFrame(StackFrame::Type type); | 1109 void LeaveFrame(StackFrame::Type type); |
| 1096 | 1110 |
| 1097 void InitializeNewString(Register string, | 1111 void InitializeNewString(Register string, |
| 1098 Register length, | 1112 Register length, |
| 1099 Heap::RootListIndex map_index, | 1113 Heap::RootListIndex map_index, |
| 1100 Register scratch1, | 1114 Register scratch1, |
| 1101 Register scratch2); | 1115 Register scratch2); |
| 1102 | 1116 |
| 1117 // Compute memory operands for safepoint stack slots. | |
| 1118 static int SafepointRegisterStackIndex(int reg_code); | |
| 1119 MemOperand SafepointRegisterSlot(Register reg); | |
| 1120 MemOperand SafepointRegistersAndDoublesSlot(Register reg); | |
| 1103 | 1121 |
| 1104 bool generating_stub_; | 1122 bool generating_stub_; |
| 1105 bool allow_stub_calls_; | 1123 bool allow_stub_calls_; |
| 1106 // This handle will be patched with the code object on installation. | 1124 // This handle will be patched with the code object on installation. |
| 1107 Handle<Object> code_object_; | 1125 Handle<Object> code_object_; |
| 1126 | |
| 1127 // Needs access to SafepointRegisterStackIndex for optimized frame | |
| 1128 // traversal. | |
| 1129 friend class OptimizedFrame; | |
| 1108 }; | 1130 }; |
| 1109 | 1131 |
| 1110 | 1132 |
| 1111 // The code patcher is used to patch (typically) small parts of code e.g. for | 1133 // The code patcher is used to patch (typically) small parts of code e.g. for |
| 1112 // debugging and other types of instrumentation. When using the code patcher | 1134 // debugging and other types of instrumentation. When using the code patcher |
| 1113 // the exact number of bytes specified must be emitted. It is not legal to emit | 1135 // the exact number of bytes specified must be emitted. It is not legal to emit |
| 1114 // relocation information. If any of these constraints are violated it causes | 1136 // relocation information. If any of these constraints are violated it causes |
| 1115 // an assertion to fail. | 1137 // an assertion to fail. |
| 1116 class CodePatcher { | 1138 class CodePatcher { |
| 1117 public: | 1139 public: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1175 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1197 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1176 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1198 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1177 #else | 1199 #else |
| 1178 #define ACCESS_MASM(masm) masm-> | 1200 #define ACCESS_MASM(masm) masm-> |
| 1179 #endif | 1201 #endif |
| 1180 | 1202 |
| 1181 } } // namespace v8::internal | 1203 } } // namespace v8::internal |
| 1182 | 1204 |
| 1183 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1205 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
| 1184 | 1206 |
| OLD | NEW |