| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } else { | 60 } else { |
| 61 __ vmov(r0, r1, result); | 61 __ vmov(r0, r1, result); |
| 62 } | 62 } |
| 63 __ Ret(); | 63 __ Ret(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 CodeDesc desc; | 66 CodeDesc desc; |
| 67 masm.GetCode(&desc); | 67 masm.GetCode(&desc); |
| 68 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 68 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 69 | 69 |
| 70 CpuFeatures::FlushICache(buffer, actual_size); | 70 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); |
| 71 base::OS::ProtectCode(buffer, actual_size); | 71 base::OS::ProtectCode(buffer, actual_size); |
| 72 | 72 |
| 73 #if !defined(USE_SIMULATOR) | 73 #if !defined(USE_SIMULATOR) |
| 74 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 74 return FUNCTION_CAST<UnaryMathFunction>(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 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs); | 220 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs); |
| 221 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs); | 221 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs); |
| 222 __ ldrb(temp1, MemOperand(src), ne); | 222 __ ldrb(temp1, MemOperand(src), ne); |
| 223 __ strb(temp1, MemOperand(dest), ne); | 223 __ strb(temp1, MemOperand(dest), ne); |
| 224 __ Ret(); | 224 __ Ret(); |
| 225 | 225 |
| 226 CodeDesc desc; | 226 CodeDesc desc; |
| 227 masm.GetCode(&desc); | 227 masm.GetCode(&desc); |
| 228 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 228 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 229 | 229 |
| 230 CpuFeatures::FlushICache(buffer, actual_size); | 230 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); |
| 231 base::OS::ProtectCode(buffer, actual_size); | 231 base::OS::ProtectCode(buffer, actual_size); |
| 232 return FUNCTION_CAST<MemCopyUint8Function>(buffer); | 232 return FUNCTION_CAST<MemCopyUint8Function>(buffer); |
| 233 #endif | 233 #endif |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 // Convert 8 to 16. The number of character to copy must be at least 8. | 237 // Convert 8 to 16. The number of character to copy must be at least 8. |
| 238 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( | 238 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( |
| 239 MemCopyUint16Uint8Function stub) { | 239 MemCopyUint16Uint8Function stub) { |
| 240 #if defined(USE_SIMULATOR) | 240 #if defined(USE_SIMULATOR) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 __ str(temp3, MemOperand(dest, 4, PostIndex)); | 307 __ str(temp3, MemOperand(dest, 4, PostIndex)); |
| 308 __ bind(¬_two); | 308 __ bind(¬_two); |
| 309 __ ldrb(temp1, MemOperand(src), ne); | 309 __ ldrb(temp1, MemOperand(src), ne); |
| 310 __ strh(temp1, MemOperand(dest), ne); | 310 __ strh(temp1, MemOperand(dest), ne); |
| 311 __ Pop(pc, r4); | 311 __ Pop(pc, r4); |
| 312 } | 312 } |
| 313 | 313 |
| 314 CodeDesc desc; | 314 CodeDesc desc; |
| 315 masm.GetCode(&desc); | 315 masm.GetCode(&desc); |
| 316 | 316 |
| 317 CpuFeatures::FlushICache(buffer, actual_size); | 317 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); |
| 318 base::OS::ProtectCode(buffer, actual_size); | 318 base::OS::ProtectCode(buffer, actual_size); |
| 319 | 319 |
| 320 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer); | 320 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer); |
| 321 #endif | 321 #endif |
| 322 } | 322 } |
| 323 #endif | 323 #endif |
| 324 | 324 |
| 325 UnaryMathFunction CreateSqrtFunction() { | 325 UnaryMathFunction CreateSqrtFunction() { |
| 326 #if defined(USE_SIMULATOR) | 326 #if defined(USE_SIMULATOR) |
| 327 return &std::sqrt; | 327 return &std::sqrt; |
| 328 #else | 328 #else |
| 329 size_t actual_size; | 329 size_t actual_size; |
| 330 byte* buffer = | 330 byte* buffer = |
| 331 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 331 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 332 if (buffer == NULL) return &std::sqrt; | 332 if (buffer == NULL) return &std::sqrt; |
| 333 | 333 |
| 334 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 334 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 335 | 335 |
| 336 __ MovFromFloatParameter(d0); | 336 __ MovFromFloatParameter(d0); |
| 337 __ vsqrt(d0, d0); | 337 __ vsqrt(d0, d0); |
| 338 __ MovToFloatResult(d0); | 338 __ MovToFloatResult(d0); |
| 339 __ Ret(); | 339 __ Ret(); |
| 340 | 340 |
| 341 CodeDesc desc; | 341 CodeDesc desc; |
| 342 masm.GetCode(&desc); | 342 masm.GetCode(&desc); |
| 343 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 343 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 344 | 344 |
| 345 CpuFeatures::FlushICache(buffer, actual_size); | 345 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); |
| 346 base::OS::ProtectCode(buffer, actual_size); | 346 base::OS::ProtectCode(buffer, actual_size); |
| 347 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 347 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
| 348 #endif | 348 #endif |
| 349 } | 349 } |
| 350 | 350 |
| 351 #undef __ | 351 #undef __ |
| 352 | 352 |
| 353 | 353 |
| 354 // ------------------------------------------------------------------------- | 354 // ------------------------------------------------------------------------- |
| 355 // Platform-specific RuntimeCallHelper functions. | 355 // Platform-specific RuntimeCallHelper functions. |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } | 927 } |
| 928 | 928 |
| 929 | 929 |
| 930 void Code::PatchPlatformCodeAge(Isolate* isolate, | 930 void Code::PatchPlatformCodeAge(Isolate* isolate, |
| 931 byte* sequence, | 931 byte* sequence, |
| 932 Code::Age age, | 932 Code::Age age, |
| 933 MarkingParity parity) { | 933 MarkingParity parity) { |
| 934 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 934 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 935 if (age == kNoAgeCodeAge) { | 935 if (age == kNoAgeCodeAge) { |
| 936 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 936 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 937 CpuFeatures::FlushICache(sequence, young_length); | 937 Assembler::FlushICache(isolate, sequence, young_length); |
| 938 } else { | 938 } else { |
| 939 Code* stub = GetCodeAgeStub(isolate, age, parity); | 939 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 940 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 940 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
| 941 patcher.masm()->add(r0, pc, Operand(-8)); | 941 patcher.masm()->add(r0, pc, Operand(-8)); |
| 942 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 942 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 943 patcher.masm()->emit_code_stub_address(stub); | 943 patcher.masm()->emit_code_stub_address(stub); |
| 944 } | 944 } |
| 945 } | 945 } |
| 946 | 946 |
| 947 | 947 |
| 948 } // namespace internal | 948 } // namespace internal |
| 949 } // namespace v8 | 949 } // namespace v8 |
| 950 | 950 |
| 951 #endif // V8_TARGET_ARCH_ARM | 951 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |