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

Issue 21210002: Avoid redundant smi check for Math.abs (Closed)

Created:
7 years, 4 months ago by weiliang.lin2
Modified:
7 years, 4 months ago
Reviewers:
Jakob Kummerow
CC:
v8-dev
Visibility:
Public.

Description

Avoid redundant smi check for Math.abs Replaced by https://codereview.chromium.org/21180004/.

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M src/ia32/lithium-codegen-ia32.cc View 1 chunk +1 line, -1 line 1 comment Download
M src/x64/lithium-codegen-x64.cc View 1 chunk +1 line, -1 line 1 comment Download

Messages

Total messages: 2 (0 generated)
weiliang.lin2
7 years, 4 months ago (2013-07-30 05:39:20 UTC) #1
Jakob Kummerow
7 years, 4 months ago (2013-07-31 12:27:27 UTC) #2
This does not LGTM yet, see below.

Also, please port the patch to ARM. We don't want platforms to diverge if it can
be avoided.

https://codereview.chromium.org/21210002/diff/1/src/ia32/lithium-codegen-ia32.cc
File src/ia32/lithium-codegen-ia32.cc (right):

https://codereview.chromium.org/21210002/diff/1/src/ia32/lithium-codegen-ia32...
src/ia32/lithium-codegen-ia32.cc:3834: } else if (r.IsInteger32() || r.IsSmi())
{
You can use r.IsSmiOrInteger32() here.

https://codereview.chromium.org/21210002/diff/1/src/x64/lithium-codegen-x64.cc
File src/x64/lithium-codegen-x64.cc (right):

https://codereview.chromium.org/21210002/diff/1/src/x64/lithium-codegen-x64.c...
src/x64/lithium-codegen-x64.cc:3460: } else if (r.IsInteger32() || r.IsSmi()) {
This code is wrong. EmitIntegerMathAbs() uses testl/negl, which don't handle
Smis correctly. Repro case:

var a = [-1, -2];
function foo() {
  return Math.abs(a[0]);
}
print(foo());
print(foo());
%OptimizeFunctionOnNextCall(foo);
print(foo());

Powered by Google App Engine
This is Rietveld 408576698