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

Issue 68723002: Implement Math.random() purely in JavaScript. (Closed)

Created:
7 years, 1 month ago by Sven Panne
Modified:
7 years, 1 month ago
Reviewers:
Michael Starzinger
CC:
v8-dev
Visibility:
Public.

Description

Implement Math.random() purely in JavaScript. This removes tons of architecture-specific code and makes it easy to experiment with other pseudo-RNG algorithms. The crankshafted code is extremely good, keeping all things unboxed and doing only minimal checks, so it is basically equivalent to the handwritten code. When benchmarks are run without parallel recompilation, we get a few percent regression on SunSpider's string-validate-input and string-base64, but these benchmarks run so fast that the overall SunSpider score is hardly affected and within the usual jitter. Note that these benchmarks actually run even faster when we don't crankshaft at all on the main thread (the regression is not caused by bad code, it is caused by Crankshaft needing a few hundred microsecond for compilation of a trivial function). Luckily, when parallel recompilation is enabled, i.e. in the browser, we see no regression at all! R=mstarzinger@chromium.org Committed: http://code.google.com/p/v8/source/detail?r=17955

Patch Set 1 #

Total comments: 6

Patch Set 2 : Feedback. Rebased. #

Patch Set 3 : Use typed arrays #

Patch Set 4 : Fixed cctest #

Patch Set 5 : Comments only #

Unified diffs Side-by-side diffs Delta from patch set Stats (+57 lines, -674 lines) Patch
M src/arm/full-codegen-arm.cc View 1 2 1 chunk +0 lines, -44 lines 0 comments Download
M src/arm/lithium-arm.h View 1 2 2 chunks +0 lines, -23 lines 0 comments Download
M src/arm/lithium-arm.cc View 1 2 1 chunk +0 lines, -13 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 1 chunk +0 lines, -62 lines 0 comments Download
M src/assembler.h View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M src/assembler.cc View 1 1 chunk +0 lines, -6 lines 0 comments Download
M src/bootstrapper.cc View 1 2 3 4 2 chunks +30 lines, -11 lines 0 comments Download
M src/contexts.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/globals.h View 1 chunk +0 lines, -3 lines 0 comments Download
M src/heap.cc View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M src/hydrogen.cc View 1 2 3 4 2 chunks +0 lines, -18 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 2 chunks +0 lines, -23 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 1 chunk +0 lines, -51 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 1 chunk +0 lines, -63 lines 0 comments Download
M src/ia32/lithium-ia32.h View 1 2 2 chunks +0 lines, -23 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 2 1 chunk +0 lines, -13 lines 0 comments Download
M src/math.js View 1 2 1 chunk +8 lines, -1 line 0 comments Download
M src/mips/full-codegen-mips.cc View 1 2 1 chunk +0 lines, -42 lines 0 comments Download
M src/mips/lithium-codegen-mips.cc View 1 2 3 4 1 chunk +0 lines, -62 lines 0 comments Download
M src/mips/lithium-mips.h View 1 2 2 chunks +0 lines, -23 lines 0 comments Download
M src/mips/lithium-mips.cc View 1 2 1 chunk +0 lines, -13 lines 0 comments Download
M src/objects.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M src/runtime.h View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M src/serialize.cc View 1 2 3 4 1 chunk +0 lines, -4 lines 0 comments Download
M src/v8.h View 1 chunk +0 lines, -2 lines 0 comments Download
M src/v8.cc View 1 chunk +0 lines, -19 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 1 chunk +0 lines, -41 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 1 chunk +0 lines, -60 lines 0 comments Download
M src/x64/lithium-x64.h View 1 2 2 chunks +0 lines, -23 lines 0 comments Download
M src/x64/lithium-x64.cc View 1 2 1 chunk +0 lines, -13 lines 0 comments Download
M test/cctest/test-weaktypedarrays.cc View 1 2 3 12 chunks +14 lines, -12 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Sven Panne
Almost red-only... :-)
7 years, 1 month ago (2013-11-11 13:36:52 UTC) #1
Michael Starzinger
LGTM with a few minor comments to address. https://codereview.chromium.org/68723002/diff/1/src/assembler.cc File src/assembler.cc (left): https://codereview.chromium.org/68723002/diff/1/src/assembler.cc#oldcode1064 src/assembler.cc:1064: ExternalReference ...
7 years, 1 month ago (2013-11-11 14:11:11 UTC) #2
Sven Panne
Addressed feedback. Need to look into some regressions in SunSpider's string-base64 and string-validate-input benchmarks. Basically ...
7 years, 1 month ago (2013-11-12 07:09:12 UTC) #3
Yang
On 2013/11/12 07:09:12, Sven Panne wrote: > Addressed feedback. Need to look into some regressions ...
7 years, 1 month ago (2013-11-12 10:54:00 UTC) #4
Yang
On 2013/11/12 10:54:00, Yang wrote: > On 2013/11/12 07:09:12, Sven Panne wrote: > > Addressed ...
7 years, 1 month ago (2013-11-12 11:02:53 UTC) #5
Sven Panne
Now with typed arrays, which leads to much better code. PTAL again...
7 years, 1 month ago (2013-11-15 13:50:21 UTC) #6
Michael Starzinger
Still LGTM.
7 years, 1 month ago (2013-11-15 14:29:19 UTC) #7
Sven Panne
7 years, 1 month ago (2013-11-21 09:55:37 UTC) #8
Message was sent while issue was closed.
Committed patchset #5 manually as r17955 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698