| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 72 | 72 |
| 73 #if defined(V8_HOST_ARCH_MIPS) | 73 #if defined(V8_HOST_ARCH_MIPS) |
| 74 MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) { | 74 MemCopyUint8Function CreateMemCopyUint8Function(Isolate* isolate, |
| 75 MemCopyUint8Function stub) { |
| 75 #if defined(USE_SIMULATOR) || defined(_MIPS_ARCH_MIPS32R6) || \ | 76 #if defined(USE_SIMULATOR) || defined(_MIPS_ARCH_MIPS32R6) || \ |
| 76 defined(_MIPS_ARCH_MIPS32RX) | 77 defined(_MIPS_ARCH_MIPS32RX) |
| 77 return stub; | 78 return stub; |
| 78 #else | 79 #else |
| 79 size_t actual_size; | 80 size_t actual_size; |
| 80 byte* buffer = | 81 byte* buffer = |
| 81 static_cast<byte*>(base::OS::Allocate(3 * KB, &actual_size, true)); | 82 static_cast<byte*>(base::OS::Allocate(3 * KB, &actual_size, true)); |
| 82 if (buffer == NULL) return stub; | 83 if (buffer == nullptr) return stub; |
| 83 | 84 |
| 84 // This code assumes that cache lines are 32 bytes and if the cache line is | 85 // This code assumes that cache lines are 32 bytes and if the cache line is |
| 85 // larger it will not work correctly. | 86 // larger it will not work correctly. |
| 86 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), | 87 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
| 87 CodeObjectRequired::kNo); | 88 CodeObjectRequired::kNo); |
| 88 | 89 |
| 89 { | 90 { |
| 90 Label lastb, unaligned, aligned, chkw, | 91 Label lastb, unaligned, aligned, chkw, |
| 91 loop16w, chk1w, wordCopy_loop, skip_pref, lastbloop, | 92 loop16w, chk1w, wordCopy_loop, skip_pref, lastbloop, |
| 92 leave, ua_chk16w, ua_loop16w, ua_skip_pref, ua_chkw, | 93 leave, ua_chk16w, ua_loop16w, ua_skip_pref, ua_chkw, |
| 93 ua_chk1w, ua_wordCopy_loop, ua_smallCopy, ua_smallCopy_loop; | 94 ua_chk1w, ua_wordCopy_loop, ua_smallCopy, ua_smallCopy_loop; |
| 94 | 95 |
| 95 // The size of each prefetch. | 96 // The size of each prefetch. |
| 96 uint32_t pref_chunk = 32; | 97 uint32_t pref_chunk = 32; |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 __ bne(a0, a3, &ua_smallCopy_loop); | 591 __ bne(a0, a3, &ua_smallCopy_loop); |
| 591 __ sb(v1, MemOperand(a0, -1)); // In delay slot. | 592 __ sb(v1, MemOperand(a0, -1)); // In delay slot. |
| 592 | 593 |
| 593 __ jr(ra); | 594 __ jr(ra); |
| 594 __ nop(); | 595 __ nop(); |
| 595 } | 596 } |
| 596 CodeDesc desc; | 597 CodeDesc desc; |
| 597 masm.GetCode(&desc); | 598 masm.GetCode(&desc); |
| 598 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 599 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 599 | 600 |
| 600 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 601 Assembler::FlushICache(isolate, buffer, actual_size); |
| 601 base::OS::ProtectCode(buffer, actual_size); | 602 base::OS::ProtectCode(buffer, actual_size); |
| 602 return FUNCTION_CAST<MemCopyUint8Function>(buffer); | 603 return FUNCTION_CAST<MemCopyUint8Function>(buffer); |
| 603 #endif | 604 #endif |
| 604 } | 605 } |
| 605 #endif | 606 #endif |
| 606 | 607 |
| 607 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { | 608 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { |
| 608 #if defined(USE_SIMULATOR) | 609 #if defined(USE_SIMULATOR) |
| 609 return nullptr; | 610 return nullptr; |
| 610 #else | 611 #else |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } | 1261 } |
| 1261 } | 1262 } |
| 1262 | 1263 |
| 1263 | 1264 |
| 1264 #undef __ | 1265 #undef __ |
| 1265 | 1266 |
| 1266 } // namespace internal | 1267 } // namespace internal |
| 1267 } // namespace v8 | 1268 } // namespace v8 |
| 1268 | 1269 |
| 1269 #endif // V8_TARGET_ARCH_MIPS | 1270 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |