Closed Bug 1531716 Opened 6 years ago Closed 6 years ago

JS_ROUNDUP(x, y) evaluates y three times

Categories

(Core :: JavaScript Engine, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox67 --- wontfix
firefox72 --- fixed

People

(Reporter: jonco, Assigned: anba)

Details

Attachments

(4 files)

JS_ROUNDUP is defined like this:

#define JS_HOWMANY(x, y) (((x) + (y)-1) / (y))
#define JS_ROUNDUP(x, y) (JS_HOWMANY(x, y) * (y))

Hopefully this is never passed an expression with side effects!

This could be replaced by an inline function.

Taking this bug to replace the jstypes macros and update some other macros.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

And the two macros to convert to and from SmallChars.

Both macros compute the same result, so we can replace ROUNDUP with JS_ROUNDUP.

Depends on D51140

JS_BIT and JS_BITMASK are only used in contexts where uint32_t is used, so these
two functions are now typed to accept and return uint32_t.

JS_HOWMANY and the three JS_ROUND functions are only used with size_t inputs,
so these four functions are now typed to accept and return size_t.

Depends on D51141

We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again. applying /tmp/tmpyyKH7w js/src/vm/TypedArrayObject.cpp Hunk #4 FAILED at 234. 1 out of 5 hunks FAILED -- saving rejects to file js/src/vm/TypedArrayObject.cpp.rej abort: patch command failed: exited with status 256

Flags: needinfo?(andrebargull)
Pushed by ccoroiu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0e0afb29911a Part 1: Remove macros for generating the SmallChars array. r=jonco https://hg.mozilla.org/integration/autoland/rev/865b84a23e9e Part 2: Remove unused macro in vm/Probes.cpp. r=jonco https://hg.mozilla.org/integration/autoland/rev/93e5393aa92b Part 3: Replace ROUNDUP with JS_ROUNDUP. r=jonco https://hg.mozilla.org/integration/autoland/rev/3a9b6b73cab7 Part 4: Replace jstypes macros with constexpr functions. r=jonco
Flags: needinfo?(andrebargull)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: