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

Issue 8749002: Implement Math.pow using FPU instructions and inline it in crankshaft (ia32). (Closed)

Created:
9 years ago by Yang
Modified:
9 years ago
Reviewers:
Bill Hesse, ulan
CC:
v8-dev
Visibility:
Public.

Description

Implement Math.pow using FPU instructions and inline it in crankshaft (ia32). Committed: http://code.google.com/p/v8/source/detail?r=10133

Patch Set 1 #

Patch Set 2 : Short jumps, comments, extractps #

Patch Set 3 : added new instructions to disassembler. #

Total comments: 1

Patch Set 4 : remove unnecessary heap number check in crankshaft code #

Total comments: 11

Patch Set 5 : clear exception flags #

Patch Set 6 : Also do NaN/infinity check on base for TAGGED case. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+434 lines, -293 lines) Patch
M src/arm/full-codegen-arm.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/assembler.cc View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M src/code-stubs.h View 1 chunk +7 lines, -2 lines 0 comments Download
M src/ia32/assembler-ia32.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M src/ia32/assembler-ia32.cc View 1 2 2 chunks +34 lines, -0 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 2 3 4 5 1 chunk +223 lines, -122 lines 1 comment Download
M src/ia32/disasm-ia32.cc View 1 2 3 chunks +15 lines, -0 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 chunk +22 lines, -51 lines 0 comments Download
M src/mips/full-codegen-mips.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M src/x64/assembler-x64.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/x64/full-codegen-x64.cc View 1 chunk +1 line, -1 line 0 comments Download
M test/mjsunit/math-pow.js View 1 chunk +119 lines, -113 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Yang
Please take a look.
9 years ago (2011-11-30 15:53:03 UTC) #1
Bill Hesse
This is great! I worked on the previous code for this, and didn't think that ...
9 years ago (2011-12-01 13:54:24 UTC) #2
ulan
9 years ago (2011-12-01 18:11:26 UTC) #3
LGTM with comments.

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc
File src/ia32/code-stubs-ia32.cc (right):

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:2965: __ j(greater_equal, &generic_runtime);
j(equal) seems to be sufficient as ecx cannot be greater than kExponentMask.

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:2968: __ jmp(&unpack_exponent, Label::kNear);
Move the jump before the empty line?

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:2981: if (exponent_type_ == ON_STACK) {
I wonder if copy-pasting and keeping the ON_STACK and TAGGED cases disjoint
would be better.

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:2998: __ extractps(ecx, xmm1, 4 * kBitsPerByte);
Since we already use HeapNumber::kExponentMask below, maybe replace 4 by
(HeapNumber::kExponentOffset - HeapNumber::kMantissaOffset)?

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:3029: // xmm3 now has -0.5.
xmm4 now has -0.5.

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:3040: __ extractps(ecx, xmm1, 4 * kBitsPerByte);
Redundant instruction.

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:3098: // xmm0: base as double that is not +/-
Infinity or NaN
xmm0 -> xmm1

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:3100: // Save exponent in base as we need to check
if exponent is negative later.
base -> ecx in the comment

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:3121: // base has the original value of the exponent
- if the exponent  is
base -> ecx in the comment

http://codereview.chromium.org/8749002/diff/5005/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:3138: // xmm1: result
xmm1 -> xmm3 in the comment.

http://codereview.chromium.org/8749002/diff/5005/test/mjsunit/math-pow.js
File test/mjsunit/math-pow.js (right):

http://codereview.chromium.org/8749002/diff/5005/test/mjsunit/math-pow.js#new...
test/mjsunit/math-pow.js:140:
assertTrue((1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) ===
4.4501477170144023e-308);
Lines are too long.

http://codereview.chromium.org/8749002/diff/9030/src/ia32/code-stubs-ia32.cc
File src/ia32/code-stubs-ia32.cc (right):

http://codereview.chromium.org/8749002/diff/9030/src/ia32/code-stubs-ia32.cc#...
src/ia32/code-stubs-ia32.cc:2998: UNREACHABLE();
Since you listed all the cases above, the default case can be removed. This will
enable static checks by compiler instead of run-time checks by UNREACHABLE().

Powered by Google App Engine
This is Rietveld 408576698