Revision: 8403 Author: [email protected] Date: Fri Jun 24 01:20:24 2011 Log: Merge revision 7629 and 8402 to the 3.2 branch.
This fixes an issue with the optimized version of Math.abs on 64 bit. Review URL: http://codereview.chromium.org/7236028 http://code.google.com/p/v8/source/detail?r=8403 Modified: /branches/3.2/src/version.cc /branches/3.2/src/x64/lithium-codegen-x64.cc /branches/3.2/test/mjsunit/math-abs.js ======================================= --- /branches/3.2/src/version.cc Wed Jun 22 08:46:29 2011 +++ /branches/3.2/src/version.cc Fri Jun 24 01:20:24 2011 @@ -35,7 +35,7 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 2 #define BUILD_NUMBER 10 -#define PATCH_LEVEL 21 +#define PATCH_LEVEL 22 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) #define IS_CANDIDATE_VERSION 0 ======================================= --- /branches/3.2/src/x64/lithium-codegen-x64.cc Wed Jun 15 13:59:20 2011 +++ /branches/3.2/src/x64/lithium-codegen-x64.cc Fri Jun 24 01:20:24 2011 @@ -2690,7 +2690,9 @@ Register input_reg = ToRegister(instr->InputAt(0)); // Smi check. __ JumpIfNotSmi(input_reg, deferred->entry()); + __ SmiToInteger32(input_reg, input_reg); EmitIntegerMathAbs(instr); + __ Integer32ToSmi(input_reg, input_reg); __ bind(deferred->exit()); } } ======================================= --- /branches/3.2/test/mjsunit/math-abs.js Thu Sep 30 03:07:24 2010 +++ /branches/3.2/test/mjsunit/math-abs.js Fri Jun 24 01:20:24 2011 @@ -25,7 +25,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --max-new-space-size=256 +// Flags: --max-new-space-size=256 --allow-natives-syntax function zero() { var x = 0.5; @@ -96,3 +96,16 @@ for (var i = 0; i < 500; i++) { test(); } + +// Regression test for optimized version of Math.abs, see: +// http://codereview.chromium.org/6875002. +function foo(x) { + return Math.abs(x); +} +// Get some smi type feedback. +for(var i = 0; i < 1000; i++) { + foo(-i); +} +assertEquals(42, foo(-42)); +%OptimizeFunctionOnNextCall(foo) +assertEquals(42, foo(-42)); -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
