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

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

Issue 6368050: Fix Math.pow(-0, 0.5) and Math.pow(-0, -0.5). These are not equal to sqrt(-0... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/assembler.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 4680 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 // Compare exponent with -0.5. 4691 // Compare exponent with -0.5.
4692 __ cmp(scratch1, Operand(0xbfe00000)); 4692 __ cmp(scratch1, Operand(0xbfe00000));
4693 __ b(ne, &not_minus_half); 4693 __ b(ne, &not_minus_half);
4694 4694
4695 // Get the double value from the base into vfp register d0. 4695 // Get the double value from the base into vfp register d0.
4696 __ ObjectToDoubleVFPRegister(base, d0, 4696 __ ObjectToDoubleVFPRegister(base, d0,
4697 scratch1, scratch2, heap_number_map, s0, 4697 scratch1, scratch2, heap_number_map, s0,
4698 runtime.entry_label(), 4698 runtime.entry_label(),
4699 AVOID_NANS_AND_INFINITIES); 4699 AVOID_NANS_AND_INFINITIES);
4700 4700
4701 // Convert -0 into +0 by adding +0.
4702 __ vmov(d2, 0.0);
4703 __ vadd(d0, d2, d0);
4701 // Load 1.0 into d2. 4704 // Load 1.0 into d2.
4702 __ vmov(d2, 1.0); 4705 __ vmov(d2, 1.0);
4703 4706
4704 // Calculate the reciprocal of the square root. 1/sqrt(x) = sqrt(1/x). 4707 // Calculate the reciprocal of the square root.
4708 __ vsqrt(d0, d0);
4705 __ vdiv(d0, d2, d0); 4709 __ vdiv(d0, d2, d0);
4706 __ vsqrt(d0, d0);
4707 4710
4708 __ b(&allocate_return); 4711 __ b(&allocate_return);
4709 4712
4710 __ bind(&not_minus_half); 4713 __ bind(&not_minus_half);
4711 // Compare exponent with 0.5. 4714 // Compare exponent with 0.5.
4712 __ cmp(scratch1, Operand(0x3fe00000)); 4715 __ cmp(scratch1, Operand(0x3fe00000));
4713 runtime.Branch(ne); 4716 runtime.Branch(ne);
4714 4717
4715 // Get the double value from the base into vfp register d0. 4718 // Get the double value from the base into vfp register d0.
4716 __ ObjectToDoubleVFPRegister(base, d0, 4719 __ ObjectToDoubleVFPRegister(base, d0,
4717 scratch1, scratch2, heap_number_map, s0, 4720 scratch1, scratch2, heap_number_map, s0,
4718 runtime.entry_label(), 4721 runtime.entry_label(),
4719 AVOID_NANS_AND_INFINITIES); 4722 AVOID_NANS_AND_INFINITIES);
4723 // Convert -0 into +0 by adding +0.
4724 __ vmov(d2, 0.0);
4725 __ vadd(d0, d2, d0);
4720 __ vsqrt(d0, d0); 4726 __ vsqrt(d0, d0);
4721 4727
4722 __ bind(&allocate_return); 4728 __ bind(&allocate_return);
4723 Register scratch3 = r5; 4729 Register scratch3 = r5;
4724 __ AllocateHeapNumberWithValue(scratch3, d0, scratch1, scratch2, 4730 __ AllocateHeapNumberWithValue(scratch3, d0, scratch1, scratch2,
4725 heap_number_map, runtime.entry_label()); 4731 heap_number_map, runtime.entry_label());
4726 __ mov(base, scratch3); 4732 __ mov(base, scratch3);
4727 done.Jump(); 4733 done.Jump();
4728 4734
4729 runtime.Bind(); 4735 runtime.Bind();
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after
7363 BinaryOpIC::GetName(runtime_operands_type_)); 7369 BinaryOpIC::GetName(runtime_operands_type_));
7364 return name_; 7370 return name_;
7365 } 7371 }
7366 7372
7367 7373
7368 #undef __ 7374 #undef __
7369 7375
7370 } } // namespace v8::internal 7376 } } // namespace v8::internal
7371 7377
7372 #endif // V8_TARGET_ARCH_ARM 7378 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698