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

Issue 1641083003: [builtins] Make Math.max and Math.min fast by default. (Closed)

Created:
4 years, 10 months ago by Benedikt Meurer
Modified:
4 years, 10 months ago
Reviewers:
Jarin, jbramley
CC:
v8-reviews_googlegroups.com, v8-mips-ports_googlegroups.com, v8-x87-ports_googlegroups.com, v8-ppc-ports_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[builtins] Make Math.max and Math.min fast by default. The previous versions of Math.max and Math.min made it difficult to optimize those (that's why we already have custom code in Crankshaft), and due to lack of ideas what to do about the variable number of arguments, we will probably need to stick in special code in TurboFan as well; so inlining those builtins is off the table, hence there's no real advantage in having them around as "not quite JS" with extra work necessary in the optimizing compilers to still make those builtins somewhat fast in cases where we cannot inline them (also there's a tricky deopt loop in Crankshaft related to Math.min and Math.max, but that will be dealt with later). So to sum up: Instead of trying to make Math.max and Math.min semi-fast in the optimizing compilers with weird work-arounds support %_Arguments %_ArgumentsLength, we do provide the optimal code as native builtins instead and call it a day (which gives a nice performance boost on some benchmarks). R=jarin@chromium.org Committed: https://crrev.com/cb9b801069c432e745f0651cf00d65ef88cd7f06 Cr-Commit-Position: refs/heads/master@{#33582}

Patch Set 1 #

Patch Set 2 : SKIP unrelated ignition failures. #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+678 lines, -71 lines) Patch
M src/arm/builtins-arm.cc View 1 chunk +102 lines, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.cc View 1 chunk +3 lines, -0 lines 0 comments Download
M src/arm64/builtins-arm64.cc View 1 chunk +104 lines, -0 lines 5 comments Download
M src/bootstrapper.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M src/builtins.h View 2 chunks +14 lines, -0 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 1 chunk +116 lines, -0 lines 0 comments Download
M src/js/math.js View 3 chunks +0 lines, -58 lines 0 comments Download
M src/js/prologue.js View 1 chunk +0 lines, -2 lines 0 comments Download
M src/js/string.js View 4 chunks +6 lines, -6 lines 0 comments Download
M src/mips/builtins-mips.cc View 1 chunk +103 lines, -0 lines 0 comments Download
M src/mips64/builtins-mips64.cc View 1 chunk +103 lines, -0 lines 0 comments Download
M src/x64/builtins-x64.cc View 1 chunk +112 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.h View 1 chunk +6 lines, -0 lines 0 comments Download
M test/cctest/cctest.status View 1 2 chunks +3 lines, -0 lines 0 comments Download
M test/mjsunit/compiler/regress-1085.js View 1 chunk +0 lines, -1 line 0 comments Download
M test/mjsunit/compiler/regress-max.js View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 14 (4 generated)
Benedikt Meurer
4 years, 10 months ago (2016-01-28 12:22:25 UTC) #1
Benedikt Meurer
Hey Jaro, Here's the Math.max and Math.min CL I was cursing about today. :-) Please ...
4 years, 10 months ago (2016-01-28 12:23:14 UTC) #2
Jarin
lgtm. (Although I am not too thrilled about introducing another pile of platform-specific code.) Could ...
4 years, 10 months ago (2016-01-28 12:39:51 UTC) #3
Benedikt Meurer
On 2016/01/28 12:39:51, Jarin wrote: > lgtm. (Although I am not too thrilled about introducing ...
4 years, 10 months ago (2016-01-28 12:44:51 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1641083003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1641083003/20001
4 years, 10 months ago (2016-01-28 12:45:05 UTC) #7
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 10 months ago (2016-01-28 13:06:49 UTC) #8
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/cb9b801069c432e745f0651cf00d65ef88cd7f06 Cr-Commit-Position: refs/heads/master@{#33582}
4 years, 10 months ago (2016-01-28 13:07:20 UTC) #10
jbramley
ARM64 only. (I'll look at ARM too.) https://codereview.chromium.org/1641083003/diff/20001/src/arm64/builtins-arm64.cc File src/arm64/builtins-arm64.cc (right): https://codereview.chromium.org/1641083003/diff/20001/src/arm64/builtins-arm64.cc#newcode161 src/arm64/builtins-arm64.cc:161: __ Mov(x4, ...
4 years, 10 months ago (2016-01-28 18:15:35 UTC) #12
jbramley
Sorry, I didn't reload and didn't realise it had been submitted. Should I submit a ...
4 years, 10 months ago (2016-01-28 18:16:48 UTC) #13
Benedikt Meurer (Google)
4 years, 10 months ago (2016-01-28 19:50:45 UTC) #14
Message was sent while issue was closed.
On 2016/01/28 18:16:48, jbramley wrote:
> Sorry, I didn't reload and didn't realise it had been submitted. Should I
submit
> a patch to implement the things above?

Yes please. I just did a baseline implementation.

Powered by Google App Engine
This is Rietveld 408576698