| 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/arm/codegen-arm.h" | 5 #include "src/arm/codegen-arm.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "src/arm/simulator-arm.h" | 9 #include "src/arm/simulator-arm.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 #if !defined(USE_SIMULATOR) | 73 #if !defined(USE_SIMULATOR) |
| 74 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); | 74 return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer); |
| 75 #else | 75 #else |
| 76 fast_exp_arm_machine_code = buffer; | 76 fast_exp_arm_machine_code = buffer; |
| 77 return &fast_exp_simulator; | 77 return &fast_exp_simulator; |
| 78 #endif | 78 #endif |
| 79 } | 79 } |
| 80 | 80 |
| 81 #if defined(V8_HOST_ARCH_ARM) | 81 #if defined(V8_HOST_ARCH_ARM) |
| 82 MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) { | 82 MemCopyUint8Function CreateMemCopyUint8Function(Isolate* isolate, |
| 83 MemCopyUint8Function stub) { |
| 83 #if defined(USE_SIMULATOR) | 84 #if defined(USE_SIMULATOR) |
| 84 return stub; | 85 return stub; |
| 85 #else | 86 #else |
| 86 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; | 87 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; |
| 87 size_t actual_size; | 88 size_t actual_size; |
| 88 byte* buffer = | 89 byte* buffer = |
| 89 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 90 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 90 if (buffer == NULL) return stub; | 91 if (buffer == nullptr) return stub; |
| 91 | 92 |
| 92 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), | 93 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
| 93 CodeObjectRequired::kNo); | 94 CodeObjectRequired::kNo); |
| 94 | 95 |
| 95 Register dest = r0; | 96 Register dest = r0; |
| 96 Register src = r1; | 97 Register src = r1; |
| 97 Register chars = r2; | 98 Register chars = r2; |
| 98 Register temp1 = r3; | 99 Register temp1 = r3; |
| 99 Label less_4; | 100 Label less_4; |
| 100 | 101 |
| 101 if (CpuFeatures::IsSupported(NEON)) { | 102 if (CpuFeatures::IsSupported(NEON)) { |
| 102 Label loop, less_256, less_128, less_64, less_32, _16_or_less, _8_or_less; | 103 Label loop, less_256, less_128, less_64, less_32, _16_or_less, _8_or_less; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs); | 222 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs); |
| 222 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs); | 223 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs); |
| 223 __ ldrb(temp1, MemOperand(src), ne); | 224 __ ldrb(temp1, MemOperand(src), ne); |
| 224 __ strb(temp1, MemOperand(dest), ne); | 225 __ strb(temp1, MemOperand(dest), ne); |
| 225 __ Ret(); | 226 __ Ret(); |
| 226 | 227 |
| 227 CodeDesc desc; | 228 CodeDesc desc; |
| 228 masm.GetCode(&desc); | 229 masm.GetCode(&desc); |
| 229 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 230 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 230 | 231 |
| 231 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 232 Assembler::FlushICache(isolate, buffer, actual_size); |
| 232 base::OS::ProtectCode(buffer, actual_size); | 233 base::OS::ProtectCode(buffer, actual_size); |
| 233 return FUNCTION_CAST<MemCopyUint8Function>(buffer); | 234 return FUNCTION_CAST<MemCopyUint8Function>(buffer); |
| 234 #endif | 235 #endif |
| 235 } | 236 } |
| 236 | 237 |
| 237 | 238 |
| 238 // Convert 8 to 16. The number of character to copy must be at least 8. | 239 // Convert 8 to 16. The number of character to copy must be at least 8. |
| 239 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( | 240 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( |
| 240 MemCopyUint16Uint8Function stub) { | 241 Isolate* isolate, MemCopyUint16Uint8Function stub) { |
| 241 #if defined(USE_SIMULATOR) | 242 #if defined(USE_SIMULATOR) |
| 242 return stub; | 243 return stub; |
| 243 #else | 244 #else |
| 244 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; | 245 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; |
| 245 size_t actual_size; | 246 size_t actual_size; |
| 246 byte* buffer = | 247 byte* buffer = |
| 247 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 248 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 248 if (buffer == NULL) return stub; | 249 if (buffer == nullptr) return stub; |
| 249 | 250 |
| 250 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), | 251 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
| 251 CodeObjectRequired::kNo); | 252 CodeObjectRequired::kNo); |
| 252 | 253 |
| 253 Register dest = r0; | 254 Register dest = r0; |
| 254 Register src = r1; | 255 Register src = r1; |
| 255 Register chars = r2; | 256 Register chars = r2; |
| 256 if (CpuFeatures::IsSupported(NEON)) { | 257 if (CpuFeatures::IsSupported(NEON)) { |
| 257 Register temp = r3; | 258 Register temp = r3; |
| 258 Label loop; | 259 Label loop; |
| 259 | 260 |
| 260 __ bic(temp, chars, Operand(0x7)); | 261 __ bic(temp, chars, Operand(0x7)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 __ str(temp3, MemOperand(dest, 4, PostIndex)); | 310 __ str(temp3, MemOperand(dest, 4, PostIndex)); |
| 310 __ bind(¬_two); | 311 __ bind(¬_two); |
| 311 __ ldrb(temp1, MemOperand(src), ne); | 312 __ ldrb(temp1, MemOperand(src), ne); |
| 312 __ strh(temp1, MemOperand(dest), ne); | 313 __ strh(temp1, MemOperand(dest), ne); |
| 313 __ Pop(pc, r4); | 314 __ Pop(pc, r4); |
| 314 } | 315 } |
| 315 | 316 |
| 316 CodeDesc desc; | 317 CodeDesc desc; |
| 317 masm.GetCode(&desc); | 318 masm.GetCode(&desc); |
| 318 | 319 |
| 319 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 320 Assembler::FlushICache(isolate, buffer, actual_size); |
| 320 base::OS::ProtectCode(buffer, actual_size); | 321 base::OS::ProtectCode(buffer, actual_size); |
| 321 | 322 |
| 322 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer); | 323 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer); |
| 323 #endif | 324 #endif |
| 324 } | 325 } |
| 325 #endif | 326 #endif |
| 326 | 327 |
| 327 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { | 328 UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { |
| 328 #if defined(USE_SIMULATOR) | 329 #if defined(USE_SIMULATOR) |
| 329 return nullptr; | 330 return nullptr; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 947 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 947 patcher.masm()->emit_code_stub_address(stub); | 948 patcher.masm()->emit_code_stub_address(stub); |
| 948 } | 949 } |
| 949 } | 950 } |
| 950 | 951 |
| 951 | 952 |
| 952 } // namespace internal | 953 } // namespace internal |
| 953 } // namespace v8 | 954 } // namespace v8 |
| 954 | 955 |
| 955 #endif // V8_TARGET_ARCH_ARM | 956 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |