Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/arm/codegen-arm.cc

Issue 98363010: ARM: Implement sqrt in inline assembly. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Address the 2nd round of review comments. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 size_t actual_size;
355 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
356 if (buffer == NULL) return &std::sqrt;
357
358 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
359
360 __ GetCFunctionDoubleResult(d0);
361 __ vsqrt(d0, d0);
362 __ SetCallCDoubleArguments(d0);
363 __ Ret();
364
365 CodeDesc desc;
366 masm.GetCode(&desc);
367 ASSERT(!RelocInfo::RequiresRelocation(desc));
368
369 CPU::FlushICache(buffer, actual_size);
370 OS::ProtectCode(buffer, actual_size);
371 return FUNCTION_CAST<UnaryMathFunction>(buffer);
372 #endif
373 }
374
350 #undef __ 375 #undef __
351 376
352 377
353 UnaryMathFunction CreateSqrtFunction() {
354 return &sqrt;
355 }
356
357
358 // ------------------------------------------------------------------------- 378 // -------------------------------------------------------------------------
359 // Platform-specific RuntimeCallHelper functions. 379 // Platform-specific RuntimeCallHelper functions.
360 380
361 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const { 381 void StubRuntimeCallHelper::BeforeCall(MacroAssembler* masm) const {
362 masm->EnterFrame(StackFrame::INTERNAL); 382 masm->EnterFrame(StackFrame::INTERNAL);
363 ASSERT(!masm->has_frame()); 383 ASSERT(!masm->has_frame());
364 masm->set_has_frame(true); 384 masm->set_has_frame(true);
365 } 385 }
366 386
367 387
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 patcher.masm()->add(r0, pc, Operand(-8)); 908 patcher.masm()->add(r0, pc, Operand(-8));
889 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 909 patcher.masm()->ldr(pc, MemOperand(pc, -4));
890 patcher.masm()->emit_code_stub_address(stub); 910 patcher.masm()->emit_code_stub_address(stub);
891 } 911 }
892 } 912 }
893 913
894 914
895 } } // namespace v8::internal 915 } } // namespace v8::internal
896 916
897 #endif // V8_TARGET_ARCH_ARM 917 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698