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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 24695003: Fix optimized Math.pow on x64 with NaN exponents. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 27949)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -4228,19 +4228,18 @@
Register temp = locs()->temp(0).reg();
XmmRegister zero_temp = locs()->temp(1).fpu_reg();
- Label check_base_is_one;
// Check if exponent is 0.0 -> return 1.0;
__ LoadObject(temp, Double::ZoneHandle(Double::NewCanonical(0)), PP);
__ movsd(zero_temp, FieldAddress(temp, Double::value_offset()));
__ LoadObject(temp, Double::ZoneHandle(Double::NewCanonical(1)), PP);
__ movsd(result, FieldAddress(temp, Double::value_offset()));
// 'result' contains 1.0.
+ Label exp_is_nan;
__ comisd(exp, zero_temp);
- __ j(PARITY_EVEN, &check_base_is_one, Assembler::kNearJump); // NaN.
+ __ j(PARITY_EVEN, &exp_is_nan, Assembler::kNearJump); // NaN.
__ j(EQUAL, &skip_call, Assembler::kNearJump); // exp is 0, result is 1.0.
Label base_is_nan;
- __ Bind(&check_base_is_one);
// Checks if base == 1.0.
__ comisd(base, result);
__ j(PARITY_EVEN, &base_is_nan, Assembler::kNearJump);
@@ -4251,7 +4250,14 @@
// Returns NaN.
__ movsd(result, base);
__ jmp(&skip_call, Assembler::kNearJump);
- // exp is Nan case is handled correctly in the C-library.
+
+ __ Bind(&exp_is_nan);
+ // Checks if base == 1.0.
+ __ comisd(base, result);
+ __ j(PARITY_EVEN, &base_is_nan, Assembler::kNearJump);
+ __ j(EQUAL, &skip_call, Assembler::kNearJump); // base and result are 1.0
+ __ movsd(result, exp); // result is NaN
+ __ jmp(&skip_call, Assembler::kNearJump);
}
__ Bind(&do_call);
__ CallRuntime(TargetFunction(), InputCount());
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698