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

Unified Diff: src/mips/codegen-mips.cc

Issue 2077533002: [builtins] Introduce proper Float64Exp operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Import tests from Raymond. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/mips/codegen-mips.cc
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
index 63bbda3168b3dd826e75f99a4621788627384ba9..07cab806995b760def12b462717188fc0a7cbf93 100644
--- a/src/mips/codegen-mips.cc
+++ b/src/mips/codegen-mips.cc
@@ -16,60 +16,6 @@ namespace internal {
#define __ masm.
-
-#if defined(USE_SIMULATOR)
-byte* fast_exp_mips_machine_code = nullptr;
-double fast_exp_simulator(double x, Isolate* isolate) {
- return Simulator::current(isolate)->CallFP(fast_exp_mips_machine_code, x, 0);
-}
-#endif
-
-
-UnaryMathFunctionWithIsolate CreateExpFunction(Isolate* isolate) {
- size_t actual_size;
- byte* buffer =
- static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
- if (buffer == nullptr) return nullptr;
- ExternalReference::InitializeMathExpData();
-
- MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size),
- CodeObjectRequired::kNo);
-
- {
- DoubleRegister input = f12;
- DoubleRegister result = f0;
- DoubleRegister double_scratch1 = f4;
- DoubleRegister double_scratch2 = f6;
- Register temp1 = t0;
- Register temp2 = t1;
- Register temp3 = t2;
-
- __ MovFromFloatParameter(input);
- __ Push(temp3, temp2, temp1);
- MathExpGenerator::EmitMathExp(
- &masm, input, result, double_scratch1, double_scratch2,
- temp1, temp2, temp3);
- __ Pop(temp3, temp2, temp1);
- __ MovToFloatResult(result);
- __ Ret();
- }
-
- CodeDesc desc;
- masm.GetCode(&desc);
- DCHECK(!RelocInfo::RequiresRelocation(desc));
-
- Assembler::FlushICache(isolate, buffer, actual_size);
- base::OS::ProtectCode(buffer, actual_size);
-
-#if !defined(USE_SIMULATOR)
- return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer);
-#else
- fast_exp_mips_machine_code = buffer;
- return &fast_exp_simulator;
-#endif
-}
-
-
#if defined(V8_HOST_ARCH_MIPS)
MemCopyUint8Function CreateMemCopyUint8Function(Isolate* isolate,
MemCopyUint8Function stub) {
@@ -1092,95 +1038,6 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
__ bind(&done);
}
-
-static MemOperand ExpConstant(int index, Register base) {
- return MemOperand(base, index * kDoubleSize);
-}
-
-
-void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
- DoubleRegister input,
- DoubleRegister result,
- DoubleRegister double_scratch1,
- DoubleRegister double_scratch2,
- Register temp1,
- Register temp2,
- Register temp3) {
- DCHECK(!input.is(result));
- DCHECK(!input.is(double_scratch1));
- DCHECK(!input.is(double_scratch2));
- DCHECK(!result.is(double_scratch1));
- DCHECK(!result.is(double_scratch2));
- DCHECK(!double_scratch1.is(double_scratch2));
- DCHECK(!temp1.is(temp2));
- DCHECK(!temp1.is(temp3));
- DCHECK(!temp2.is(temp3));
- DCHECK(ExternalReference::math_exp_constants(0).address() != NULL);
- DCHECK(!masm->serializer_enabled()); // External references not serializable.
-
- Label zero, infinity, done;
-
- __ li(temp3, Operand(ExternalReference::math_exp_constants(0)));
-
- __ ldc1(double_scratch1, ExpConstant(0, temp3));
- __ BranchF(&zero, NULL, ge, double_scratch1, input);
-
- __ ldc1(double_scratch2, ExpConstant(1, temp3));
- __ BranchF(&infinity, NULL, ge, input, double_scratch2);
-
- __ ldc1(double_scratch1, ExpConstant(3, temp3));
- __ ldc1(result, ExpConstant(4, temp3));
- __ mul_d(double_scratch1, double_scratch1, input);
- __ add_d(double_scratch1, double_scratch1, result);
- __ FmoveLow(temp2, double_scratch1);
- __ sub_d(double_scratch1, double_scratch1, result);
- __ ldc1(result, ExpConstant(6, temp3));
- __ ldc1(double_scratch2, ExpConstant(5, temp3));
- __ mul_d(double_scratch1, double_scratch1, double_scratch2);
- __ sub_d(double_scratch1, double_scratch1, input);
- __ sub_d(result, result, double_scratch1);
- __ mul_d(double_scratch2, double_scratch1, double_scratch1);
- __ mul_d(result, result, double_scratch2);
- __ ldc1(double_scratch2, ExpConstant(7, temp3));
- __ mul_d(result, result, double_scratch2);
- __ sub_d(result, result, double_scratch1);
- // Mov 1 in double_scratch2 as math_exp_constants_array[8] == 1.
- DCHECK(*reinterpret_cast<double*>
- (ExternalReference::math_exp_constants(8).address()) == 1);
- __ Move(double_scratch2, 1.);
- __ add_d(result, result, double_scratch2);
- __ srl(temp1, temp2, 11);
- __ Ext(temp2, temp2, 0, 11);
- __ Addu(temp1, temp1, Operand(0x3ff));
-
- // Must not call ExpConstant() after overwriting temp3!
- __ li(temp3, Operand(ExternalReference::math_exp_log_table()));
- __ Lsa(temp3, temp3, temp2, 3);
- __ lw(temp2, MemOperand(temp3, Register::kMantissaOffset));
- __ lw(temp3, MemOperand(temp3, Register::kExponentOffset));
- // The first word is loaded is the lower number register.
- if (temp2.code() < temp3.code()) {
- __ sll(at, temp1, 20);
- __ Or(temp1, temp3, at);
- __ Move(double_scratch1, temp2, temp1);
- } else {
- __ sll(at, temp1, 20);
- __ Or(temp1, temp2, at);
- __ Move(double_scratch1, temp3, temp1);
- }
- __ mul_d(result, result, double_scratch1);
- __ BranchShort(&done);
-
- __ bind(&zero);
- __ Move(result, kDoubleRegZero);
- __ BranchShort(&done);
-
- __ bind(&infinity);
- __ ldc1(result, ExpConstant(2, temp3));
-
- __ bind(&done);
-}
-
#ifdef DEBUG
// nop(CODE_AGE_MARKER_NOP)
static const uint32_t kCodeAgePatchFirstInstruction = 0x00010180;

Powered by Google App Engine
This is Rietveld 408576698