| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "codegen.h" | 9 #include "codegen.h" |
| 10 #include "macro-assembler.h" | 10 #include "macro-assembler.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 #if !defined(USE_SIMULATOR) | 72 #if !defined(USE_SIMULATOR) |
| 73 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 73 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
| 74 #else | 74 #else |
| 75 fast_exp_arm_machine_code = buffer; | 75 fast_exp_arm_machine_code = buffer; |
| 76 return &fast_exp_simulator; | 76 return &fast_exp_simulator; |
| 77 #endif | 77 #endif |
| 78 } | 78 } |
| 79 | 79 |
| 80 #if defined(V8_HOST_ARCH_ARM) | 80 #if defined(V8_HOST_ARCH_ARM) |
| 81 MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) { | 81 OS::MemCopyUint8Function CreateMemCopyUint8Function( |
| 82 OS::MemCopyUint8Function stub) { |
| 82 #if defined(USE_SIMULATOR) | 83 #if defined(USE_SIMULATOR) |
| 83 return stub; | 84 return stub; |
| 84 #else | 85 #else |
| 85 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; | 86 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; |
| 86 size_t actual_size; | 87 size_t actual_size; |
| 87 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 88 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
| 88 if (buffer == NULL) return stub; | 89 if (buffer == NULL) return stub; |
| 89 | 90 |
| 90 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 91 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 91 | 92 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 __ ldrb(temp1, MemOperand(src), ne); | 221 __ ldrb(temp1, MemOperand(src), ne); |
| 221 __ strb(temp1, MemOperand(dest), ne); | 222 __ strb(temp1, MemOperand(dest), ne); |
| 222 __ Ret(); | 223 __ Ret(); |
| 223 | 224 |
| 224 CodeDesc desc; | 225 CodeDesc desc; |
| 225 masm.GetCode(&desc); | 226 masm.GetCode(&desc); |
| 226 ASSERT(!RelocInfo::RequiresRelocation(desc)); | 227 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
| 227 | 228 |
| 228 CPU::FlushICache(buffer, actual_size); | 229 CPU::FlushICache(buffer, actual_size); |
| 229 OS::ProtectCode(buffer, actual_size); | 230 OS::ProtectCode(buffer, actual_size); |
| 230 return FUNCTION_CAST<MemCopyUint8Function>(buffer); | 231 return FUNCTION_CAST<OS::MemCopyUint8Function>(buffer); |
| 231 #endif | 232 #endif |
| 232 } | 233 } |
| 233 | 234 |
| 234 | 235 |
| 235 // Convert 8 to 16. The number of character to copy must be at least 8. | 236 // Convert 8 to 16. The number of character to copy must be at least 8. |
| 236 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( | 237 OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( |
| 237 MemCopyUint16Uint8Function stub) { | 238 OS::MemCopyUint16Uint8Function stub) { |
| 238 #if defined(USE_SIMULATOR) | 239 #if defined(USE_SIMULATOR) |
| 239 return stub; | 240 return stub; |
| 240 #else | 241 #else |
| 241 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; | 242 if (!CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) return stub; |
| 242 size_t actual_size; | 243 size_t actual_size; |
| 243 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 244 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
| 244 if (buffer == NULL) return stub; | 245 if (buffer == NULL) return stub; |
| 245 | 246 |
| 246 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 247 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 247 | 248 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 __ strh(temp1, MemOperand(dest), ne); | 308 __ strh(temp1, MemOperand(dest), ne); |
| 308 __ Pop(pc, r4); | 309 __ Pop(pc, r4); |
| 309 } | 310 } |
| 310 | 311 |
| 311 CodeDesc desc; | 312 CodeDesc desc; |
| 312 masm.GetCode(&desc); | 313 masm.GetCode(&desc); |
| 313 | 314 |
| 314 CPU::FlushICache(buffer, actual_size); | 315 CPU::FlushICache(buffer, actual_size); |
| 315 OS::ProtectCode(buffer, actual_size); | 316 OS::ProtectCode(buffer, actual_size); |
| 316 | 317 |
| 317 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer); | 318 return FUNCTION_CAST<OS::MemCopyUint16Uint8Function>(buffer); |
| 318 #endif | 319 #endif |
| 319 } | 320 } |
| 320 #endif | 321 #endif |
| 321 | 322 |
| 322 UnaryMathFunction CreateSqrtFunction() { | 323 UnaryMathFunction CreateSqrtFunction() { |
| 323 #if defined(USE_SIMULATOR) | 324 #if defined(USE_SIMULATOR) |
| 324 return &std::sqrt; | 325 return &std::sqrt; |
| 325 #else | 326 #else |
| 326 size_t actual_size; | 327 size_t actual_size; |
| 327 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 328 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 patcher.masm()->add(r0, pc, Operand(-8)); | 882 patcher.masm()->add(r0, pc, Operand(-8)); |
| 882 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 883 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 883 patcher.masm()->emit_code_stub_address(stub); | 884 patcher.masm()->emit_code_stub_address(stub); |
| 884 } | 885 } |
| 885 } | 886 } |
| 886 | 887 |
| 887 | 888 |
| 888 } } // namespace v8::internal | 889 } } // namespace v8::internal |
| 889 | 890 |
| 890 #endif // V8_TARGET_ARCH_ARM | 891 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |