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

Issue 1774010: Port inline version of Math.sqrt and Math.pow from ia32 to x64. (Closed)

Created:
10 years, 8 months ago by Mads Ager (chromium)
Modified:
9 years, 7 months ago
Reviewers:
William Hesse
CC:
v8-dev
Visibility:
Public.

Description

Port inline version of Math.sqrt and Math.pow from ia32 to x64. Committed: http://code.google.com/p/v8/source/detail?r=4541

Patch Set 1 #

Total comments: 10

Patch Set 2 : '' #

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+235 lines, -15 lines) Patch
M src/ia32/codegen-ia32.cc View 1 2 3 chunks +4 lines, -7 lines 0 comments Download
M src/x64/assembler-x64.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/x64/assembler-x64.cc View 1 2 1 chunk +12 lines, -1 line 0 comments Download
M src/x64/codegen-x64.cc View 1 2 1 chunk +215 lines, -6 lines 0 comments Download
M src/x64/disasm-x64.cc View 2 chunks +3 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
Mads Ager (chromium)
10 years, 8 months ago (2010-04-28 13:13:14 UTC) #1
William Hesse
LGTM if cvtsi2sd is removed. http://codereview.chromium.org/1774010/diff/1/3 File src/x64/assembler-x64.cc (right): http://codereview.chromium.org/1774010/diff/1/3#newcode2489 src/x64/assembler-x64.cc:2489: void Assembler::cvtsi2sd(XMMRegister dst, Register ...
10 years, 8 months ago (2010-04-28 13:46:01 UTC) #2
Mads Ager (chromium)
10 years, 8 months ago (2010-04-28 14:42:53 UTC) #3
http://codereview.chromium.org/1774010/diff/1/3
File src/x64/assembler-x64.cc (right):

http://codereview.chromium.org/1774010/diff/1/3#newcode2489
src/x64/assembler-x64.cc:2489: void Assembler::cvtsi2sd(XMMRegister dst,
Register src) {
On 2010/04/28 13:46:02, William Hesse wrote:
> This is the same as cvtlsi2sd() 22 lines above this.  The l or q prefix says
> whether we are using a 32- or 64- bit general purpose register as the source.

Whoops, yes of course. Thanks!

http://codereview.chromium.org/1774010/diff/1/5
File src/x64/codegen-x64.cc (right):

http://codereview.chromium.org/1774010/diff/1/5#newcode4042
src/x64/codegen-x64.cc:4042: 
On 2010/04/28 13:46:02, William Hesse wrote:
> I wonder if there is any case where we can get a smi and HeapNumber version of
> the same integer, that are obviously equal, but so that Pow(x, y_smi) is
> different than Pow(x, y_float).  Is that a problem?

Apparently it hasn't been so far. It is a bit weird though.

http://codereview.chromium.org/1774010/diff/1/5#newcode4046
src/x64/codegen-x64.cc:4046: // on both arguments and that the arguments are not
the same
On 2010/04/28 13:46:02, William Hesse wrote:
> The assumption is really that the two arguments are not copies of each other,
so
> that an x = y before the use of %Math.pow(x, y) would also be a problem.  But
we
> don't actually use the assumption!  The spill of exponent.reg() means that
base
> will be loaded in a different register, even if it is a copy.  There is no
> assumption.  Even the remaining two copies, on the frame, may be copies,
because
> they are only used to call runtime.

You are right, I just copied the comments from the ia32 version. I'll remove
that comment from both before submitting. Thanks.

http://codereview.chromium.org/1774010/diff/1/5#newcode4073
src/x64/codegen-x64.cc:4073: __ cvtsi2sd(xmm3, answer.reg());
On 2010/04/28 13:46:02, William Hesse wrote:
> These should all be cvtlsi2sd, I think.

Done.

http://codereview.chromium.org/1774010/diff/1/5#newcode4256
src/x64/codegen-x64.cc:4256: __ AllocateHeapNumber(result.reg(), scratch.reg(),
&runtime);
On 2010/04/28 13:46:02, William Hesse wrote:
> If you allocate the heap number before doing the calculation, you can go to
> runtime if allocation fails, to definitely allocate one, and then do the
> calculation knowing that you have a heap number to store the result in.

Good point, we can do that on both ia32 and x64 as a separate change and see if
it matters.

Powered by Google App Engine
This is Rietveld 408576698