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

Issue 3327022: Custom call IC for Math.floor. (Closed)

Created:
10 years, 3 months ago by Vitaly Repeshko
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Custom call IC for Math.floor. Committed: http://code.google.com/p/v8/source/detail?r=5499

Patch Set 1 #

Patch Set 2 : Oops, forgot to upload the test #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+359 lines, -44 lines) Patch
M src/bootstrapper.cc View 1 chunk +26 lines, -19 lines 0 comments Download
M src/ia32/assembler-ia32.h View 2 chunks +8 lines, -0 lines 0 comments Download
M src/ia32/assembler-ia32.cc View 3 chunks +46 lines, -1 line 0 comments Download
M src/ia32/disasm-ia32.cc View 1 chunk +9 lines, -0 lines 2 comments Download
M src/ia32/macro-assembler-ia32.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M src/ia32/stub-cache-ia32.cc View 1 chunk +125 lines, -0 lines 2 comments Download
M src/stub-cache.h View 2 chunks +19 lines, -23 lines 0 comments Download
M src/stub-cache.cc View 1 chunk +1 line, -1 line 0 comments Download
A test/mjsunit/math-floor.js View 1 chunk +112 lines, -0 lines 6 comments Download

Messages

Total messages: 3 (0 generated)
Vitaly Repeshko
10 years, 3 months ago (2010-09-13 15:32:38 UTC) #1
Erik Corry
LGTM http://codereview.chromium.org/3327022/diff/3001/4004 File src/ia32/disasm-ia32.cc (right): http://codereview.chromium.org/3327022/diff/3001/4004#newcode1163 src/ia32/disasm-ia32.cc:1163: int8_t imm8 = *reinterpret_cast<int8_t*>(data + 1); Why not ...
10 years, 3 months ago (2010-09-20 11:56:50 UTC) #2
Vitaly Repeshko
10 years, 3 months ago (2010-09-21 12:54:49 UTC) #3
Thanks! The patch is now submitted.


-- Vitaly

http://codereview.chromium.org/3327022/diff/3001/4004
File src/ia32/disasm-ia32.cc (right):

http://codereview.chromium.org/3327022/diff/3001/4004#newcode1163
src/ia32/disasm-ia32.cc:1163: int8_t imm8 = *reinterpret_cast<int8_t*>(data +
1);
On 2010/09/20 11:56:50, Erik Corry wrote:
> Why not just:
> int imm8 = data[1];
> ?

Almost done. I left static_cast there to avoid unsigned to signed warnings.

http://codereview.chromium.org/3327022/diff/3001/4007
File src/ia32/stub-cache-ia32.cc (right):

http://codereview.chromium.org/3327022/diff/3001/4007#newcode1871
src/ia32/stub-cache-ia32.cc:1871: // discards NaN.
On 2010/09/20 11:56:50, Erik Corry wrote:
> It might be nice to detect +- zero and pass it through unchanged.  Zero is
> probably reasonably common.  Once you have done that then negative numbers are
> perhaps not so hard?  It seems like it's the same except you want to subtract
> then add instead of adding then subtracting below and then you need to reverse
> the rest too.  You can save this for another change or not do it at all :-)

I filed a bug to consider extending it.

http://codereview.chromium.org/3327022/diff/3001/4010
File test/mjsunit/math-floor.js (right):

http://codereview.chromium.org/3327022/diff/3001/4010#newcode31
test/mjsunit/math-floor.js:31: assertEquals(0, Math.floor(0));
On 2010/09/20 11:56:50, Erik Corry wrote:
> This tests the Smi 0 but not the heap number 0.  Normally + will not check for
a
> Smi result so this should work:
> 
> x = 0.5
> y = 0.5
> assertEquals(x - y, Math.floor(x - y)))

Done. I left the smi test case for completeness.

http://codereview.chromium.org/3327022/diff/3001/4010#newcode32
test/mjsunit/math-floor.js:32: assertEquals(-0, Math.floor(-0));
On 2010/09/20 11:56:50, Erik Corry wrote:
> 0 == -0 so this test doesn't really work.  You need to do
> 
> 1/-0, 1/Math.floor(-0)
> 

Good catch! Fixed.

http://codereview.chromium.org/3327022/diff/3001/4010#newcode60
test/mjsunit/math-floor.js:60: var two_30 = 1 << 30;
On 2010/09/20 11:56:50, Erik Corry wrote:
> It would be nice to pass this in as an argument so you could easily do two_53
as
> well.

There are actually some differences. But even if there were none, I still think
having verbose test code would be better: it's much easier to spot an error.

Powered by Google App Engine
This is Rietveld 408576698