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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 11418149: Faster implementation of Math.exp() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Win build Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/codegen-ia32.h » ('j') | 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 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 // B ^ E = (2^(E * log2(B)) - 1) + 1 = (2^X - 1) + 1 for X = E * log2(B) 3108 // B ^ E = (2^(E * log2(B)) - 1) + 1 = (2^X - 1) + 1 for X = E * log2(B)
3109 // FYL2X calculates st(1) * log2(st(0)) 3109 // FYL2X calculates st(1) * log2(st(0))
3110 __ fyl2x(); // X 3110 __ fyl2x(); // X
3111 __ fld(0); // X, X 3111 __ fld(0); // X, X
3112 __ frndint(); // rnd(X), X 3112 __ frndint(); // rnd(X), X
3113 __ fsub(1); // rnd(X), X-rnd(X) 3113 __ fsub(1); // rnd(X), X-rnd(X)
3114 __ fxch(1); // X - rnd(X), rnd(X) 3114 __ fxch(1); // X - rnd(X), rnd(X)
3115 // F2XM1 calculates 2^st(0) - 1 for -1 < st(0) < 1 3115 // F2XM1 calculates 2^st(0) - 1 for -1 < st(0) < 1
3116 __ f2xm1(); // 2^(X-rnd(X)) - 1, rnd(X) 3116 __ f2xm1(); // 2^(X-rnd(X)) - 1, rnd(X)
3117 __ fld1(); // 1, 2^(X-rnd(X)) - 1, rnd(X) 3117 __ fld1(); // 1, 2^(X-rnd(X)) - 1, rnd(X)
3118 __ faddp(1); // 1, 2^(X-rnd(X)), rnd(X) 3118 __ faddp(1); // 2^(X-rnd(X)), rnd(X)
3119 // FSCALE calculates st(0) * 2^st(1) 3119 // FSCALE calculates st(0) * 2^st(1)
3120 __ fscale(); // 2^X, rnd(X) 3120 __ fscale(); // 2^X, rnd(X)
3121 __ fstp(1); 3121 __ fstp(1); // 2^X
3122 // Bail out to runtime in case of exceptions in the status word. 3122 // Bail out to runtime in case of exceptions in the status word.
3123 __ fnstsw_ax(); 3123 __ fnstsw_ax();
3124 __ test_b(eax, 0x5F); // We check for all but precision exception. 3124 __ test_b(eax, 0x5F); // We check for all but precision exception.
3125 __ j(not_zero, &fast_power_failed, Label::kNear); 3125 __ j(not_zero, &fast_power_failed, Label::kNear);
3126 __ fstp_d(Operand(esp, 0)); 3126 __ fstp_d(Operand(esp, 0));
3127 __ movdbl(double_result, Operand(esp, 0)); 3127 __ movdbl(double_result, Operand(esp, 0));
3128 __ add(esp, Immediate(kDoubleSize)); 3128 __ add(esp, Immediate(kDoubleSize));
3129 __ jmp(&done); 3129 __ jmp(&done);
3130 3130
3131 __ bind(&fast_power_failed); 3131 __ bind(&fast_power_failed);
(...skipping 4317 matching lines...) Expand 10 before | Expand all | Expand 10 after
7449 // Restore ecx. 7449 // Restore ecx.
7450 __ pop(ecx); 7450 __ pop(ecx);
7451 __ ret(0); 7451 __ ret(0);
7452 } 7452 }
7453 7453
7454 #undef __ 7454 #undef __
7455 7455
7456 } } // namespace v8::internal 7456 } } // namespace v8::internal
7457 7457
7458 #endif // V8_TARGET_ARCH_IA32 7458 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698