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