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

Issue 1689007: Port improvement to Math.random to ARM. (Closed)

Created:
10 years, 8 months ago by rodolph
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Port improvement to Math.random to ARM. According to issue #670, Math.random was sped up on ia32 and x64 by creating a generated function RandomHeapNumber, whose body is inline assembly code that allocates a heap number, calls V8::Random to get a random uint32, and puts the uint32 divided by 2^32 into the heapnumber. BUG=none TEST=none

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -7 lines) Patch
M AUTHORS View 1 chunk +6 lines, -2 lines 0 comments Download
M src/arm/codegen-arm.cc View 1 1 chunk +35 lines, -5 lines 1 comment Download

Messages

Total messages: 5 (0 generated)
rodolph
10 years, 8 months ago (2010-04-22 16:33:55 UTC) #1
Erik Corry
This LGTM if you update the AUTHORS file too. Extra points for putting it back ...
10 years, 8 months ago (2010-04-22 16:59:51 UTC) #2
rodolph
On 2010/04/22 16:59:51, Erik Corry wrote: > This LGTM if you update the AUTHORS file ...
10 years, 8 months ago (2010-04-22 17:11:06 UTC) #3
Erik Corry
Committed as r4477. Thanks.
10 years, 8 months ago (2010-04-22 17:26:32 UTC) #4
Lasse Reichstein
10 years, 8 months ago (2010-04-23 12:12:50 UTC) #5
Complaining after the fact is still fun.

http://codereview.chromium.org/1689007/diff/5001/6001
File src/arm/codegen-arm.cc (right):

http://codereview.chromium.org/1689007/diff/5001/6001#newcode4244
src/arm/codegen-arm.cc:4244: __ CallRuntime(Runtime::kNumberUnaryMinus, 1);
It seems fragile to use a function meant for something else to create a
HeapNumber.
E.g., it would make perfect sense for someone to special-case negation of zero
in Runtime_NumberUnaryMinus (since we have a -0 constant already) - and there is
nothing there that suggests that it would break this code. 
In fact it would probably even be a good idea: The function is only called for
the smis 0 and Smi::kMinValue, or if we can't allocate a heap number in
NewSpace.

We should create an "AllocateHeapNumber" runtime function instead, if that is
what we need.

Powered by Google App Engine
This is Rietveld 408576698