Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 masm.GetCode(&desc); | 340 masm.GetCode(&desc); |
| 341 | 341 |
| 342 CPU::FlushICache(buffer, actual_size); | 342 CPU::FlushICache(buffer, actual_size); |
| 343 OS::ProtectCode(buffer, actual_size); | 343 OS::ProtectCode(buffer, actual_size); |
| 344 | 344 |
| 345 return FUNCTION_CAST<OS::MemCopyUint16Uint8Function>(buffer); | 345 return FUNCTION_CAST<OS::MemCopyUint16Uint8Function>(buffer); |
| 346 #endif | 346 #endif |
| 347 } | 347 } |
| 348 #endif | 348 #endif |
| 349 | 349 |
| 350 UnaryMathFunction CreateSqrtFunction() { | |
| 351 #if defined(USE_SIMULATOR) | |
| 352 return &std::sqrt; | |
| 353 #else | |
| 354 if (!CpuFeatures::IsSupported(VFP3)) return &std::sqrt; | |
|
Benedikt Meurer
2014/01/07 08:12:33
This test is unnecessary.
| |
| 355 | |
| 356 size_t actual_size; | |
| 357 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | |
| 358 if (buffer == NULL) return &std::sqrt; | |
| 359 | |
| 360 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | |
| 361 | |
| 362 if (!masm.use_eabi_hardfloat()) { | |
| 363 __ vmov(d0, r0, r1); | |
|
Sven Panne
2014/01/07 08:27:56
GetCFunctionDoubleResult(d0) without the if
| |
| 364 } | |
| 365 __ vsqrt(d0, d0); | |
| 366 if (!masm.use_eabi_hardfloat()) { | |
| 367 __ vmov(r0, r1, d0); | |
|
Sven Panne
2014/01/07 08:27:56
SetCallCDoubleArguments(d0) without the if
| |
| 368 } | |
| 369 __ Ret(); | |
| 370 | |
| 371 CodeDesc desc; | |
| 372 masm.GetCode(&desc); | |
| 373 ASSERT(!RelocInfo::RequiresRelocation(desc)); | |
| 374 | |
| 375 CPU::FlushICache(buffer, actual_size); | |
| 376 OS::ProtectCode(buffer, actual_size); | |
| 377 return FUNCTION_CAST<UnaryMathFunction>(buffer); | |
| 378 #endif | |
| 379 } | |
| 380 | |
| 350 #undef __ | 381 #undef __ |
| 351 | 382 |
| 352 | 383 |
| 353 UnaryMathFunction CreateSqrtFunction() { | |
| 354 return &sqrt; | |
| 355 } | |
| 356 | |
| 357 | |
| 358 // ------------------------------------------------------------------------- | 384 // ------------------------------------------------------------------------- |
| 359 // Platform-specific RuntimeCallHelper functions. | 385 // Platform-specific RuntimeCallHelper functions. |
| 360 | 386 |
| 361 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { | 387 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { |
| 362 masm->EnterFrame(StackFrame::INTERNAL); | 388 masm->EnterFrame(StackFrame::INTERNAL); |
| 363 ASSERT(!masm->has_frame()); | 389 ASSERT(!masm->has_frame()); |
| 364 masm->set_has_frame(true); | 390 masm->set_has_frame(true); |
| 365 } | 391 } |
| 366 | 392 |
| 367 | 393 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 patcher.masm()->add(r0, pc, Operand(-8)); | 914 patcher.masm()->add(r0, pc, Operand(-8)); |
| 889 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 915 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 890 patcher.masm()->emit_code_stub_address(stub); | 916 patcher.masm()->emit_code_stub_address(stub); |
| 891 } | 917 } |
| 892 } | 918 } |
| 893 | 919 |
| 894 | 920 |
| 895 } } // namespace v8::internal | 921 } } // namespace v8::internal |
| 896 | 922 |
| 897 #endif // V8_TARGET_ARCH_ARM | 923 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |