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 #include "src/mips/codegen-mips.h" | 5 #include "src/mips/codegen-mips.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 temp1, temp2, temp3); | 51 temp1, temp2, temp3); |
52 __ Pop(temp3, temp2, temp1); | 52 __ Pop(temp3, temp2, temp1); |
53 __ MovToFloatResult(result); | 53 __ MovToFloatResult(result); |
54 __ Ret(); | 54 __ Ret(); |
55 } | 55 } |
56 | 56 |
57 CodeDesc desc; | 57 CodeDesc desc; |
58 masm.GetCode(&desc); | 58 masm.GetCode(&desc); |
59 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 59 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
60 | 60 |
61 CpuFeatures::FlushICache(buffer, actual_size); | 61 Assembler::FlushICache(isolate, buffer, actual_size); |
62 base::OS::ProtectCode(buffer, actual_size); | 62 base::OS::ProtectCode(buffer, actual_size); |
63 | 63 |
64 #if !defined(USE_SIMULATOR) | 64 #if !defined(USE_SIMULATOR) |
65 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); | 65 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
66 #else | 66 #else |
67 fast_exp_mips_machine_code = buffer; | 67 fast_exp_mips_machine_code = buffer; |
68 return &fast_exp_simulator; | 68 return &fast_exp_simulator; |
69 #endif | 69 #endif |
70 } | 70 } |
71 | 71 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 __ bne(a0, a3, &ua_smallCopy_loop); | 590 __ bne(a0, a3, &ua_smallCopy_loop); |
591 __ sb(v1, MemOperand(a0, -1)); // In delay slot. | 591 __ sb(v1, MemOperand(a0, -1)); // In delay slot. |
592 | 592 |
593 __ jr(ra); | 593 __ jr(ra); |
594 __ nop(); | 594 __ nop(); |
595 } | 595 } |
596 CodeDesc desc; | 596 CodeDesc desc; |
597 masm.GetCode(&desc); | 597 masm.GetCode(&desc); |
598 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 598 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
599 | 599 |
600 CpuFeatures::FlushICache(buffer, actual_size); | 600 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); |
601 base::OS::ProtectCode(buffer, actual_size); | 601 base::OS::ProtectCode(buffer, actual_size); |
602 return FUNCTION_CAST<MemCopyUint8Function>(buffer); | 602 return FUNCTION_CAST<MemCopyUint8Function>(buffer); |
603 #endif | 603 #endif |
604 } | 604 } |
605 #endif | 605 #endif |
606 | 606 |
607 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { | 607 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { |
608 #if defined(USE_SIMULATOR) | 608 #if defined(USE_SIMULATOR) |
609 return nullptr; | 609 return nullptr; |
610 #else | 610 #else |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 } | 1234 } |
1235 | 1235 |
1236 | 1236 |
1237 void Code::PatchPlatformCodeAge(Isolate* isolate, | 1237 void Code::PatchPlatformCodeAge(Isolate* isolate, |
1238 byte* sequence, | 1238 byte* sequence, |
1239 Code::Age age, | 1239 Code::Age age, |
1240 MarkingParity parity) { | 1240 MarkingParity parity) { |
1241 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 1241 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
1242 if (age == kNoAgeCodeAge) { | 1242 if (age == kNoAgeCodeAge) { |
1243 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 1243 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
1244 CpuFeatures::FlushICache(sequence, young_length); | 1244 Assembler::FlushICache(isolate, sequence, young_length); |
1245 } else { | 1245 } else { |
1246 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1246 Code* stub = GetCodeAgeStub(isolate, age, parity); |
1247 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 1247 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
1248 // Mark this code sequence for FindPlatformCodeAgeSequence(). | 1248 // Mark this code sequence for FindPlatformCodeAgeSequence(). |
1249 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); | 1249 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); |
1250 // Load the stub address to t9 and call it, | 1250 // Load the stub address to t9 and call it, |
1251 // GetCodeAgeAndParity() extracts the stub address from this instruction. | 1251 // GetCodeAgeAndParity() extracts the stub address from this instruction. |
1252 patcher.masm()->li( | 1252 patcher.masm()->li( |
1253 t9, | 1253 t9, |
1254 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())), | 1254 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())), |
1255 CONSTANT_SIZE); | 1255 CONSTANT_SIZE); |
1256 patcher.masm()->nop(); // Prevent jalr to jal optimization. | 1256 patcher.masm()->nop(); // Prevent jalr to jal optimization. |
1257 patcher.masm()->jalr(t9, a0); | 1257 patcher.masm()->jalr(t9, a0); |
1258 patcher.masm()->nop(); // Branch delay slot nop. | 1258 patcher.masm()->nop(); // Branch delay slot nop. |
1259 patcher.masm()->nop(); // Pad the empty space. | 1259 patcher.masm()->nop(); // Pad the empty space. |
1260 } | 1260 } |
1261 } | 1261 } |
1262 | 1262 |
1263 | 1263 |
1264 #undef __ | 1264 #undef __ |
1265 | 1265 |
1266 } // namespace internal | 1266 } // namespace internal |
1267 } // namespace v8 | 1267 } // namespace v8 |
1268 | 1268 |
1269 #endif // V8_TARGET_ARCH_MIPS | 1269 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |