Closed Bug 1066020 Opened 10 years ago Closed 10 years ago

Interpreter: Add JSConstIntegerSpec and use it for SIMD shuffle masks

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: bbouvier, Assigned: bbouvier)

Details

Attachments

(3 files, 1 obsolete file)

When asking till for the best way to define permanent properties on a stdlib object (namely the global SIMD object) while looking for ways to reduce memory in bug 1062907, he told me the best way would be to use a JSConstPropertySpec. As there is already somebody like this for double properties (JSConstDoubleSpec), we can templatize it for int32 and use it afterwards when defining the SIMD masks.
Comment on attachment 8487876 [details] [diff] [review] Use JSConstIntegerSpec for defining SIMD shuffle masks in the interpreter Review of attachment 8487876 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/builtin/SIMD.cpp @@ +374,5 @@ > > +static JSConstIntegerSpec SHUFFLE_MASKS[] = { > +#define ADD_INT32_SPEC(name, val) {val, name, 0, {0,0,0}}, > + FOR_EACH_SIMD_SHUFFLE_MASK(ADD_INT32_SPEC) > + {0,0,0,{0,0,0}} (fwiw, i've added an #undef ADD_INT32_SPEC after this line)
Comment on attachment 8487875 [details] [diff] [review] Add JSConstIntegerSpec to jsapi Review of attachment 8487875 [details] [diff] [review]: ----------------------------------------------------------------- Nice and simple, thanks. r=me with the requested name change applied. ::: js/src/jsapi.cpp @@ +3218,5 @@ > return nobj; > } > > +static inline Value > +CreateFromScalar(double x) "Create" is too ambiguous, I think. How about "ValueFromScalar"?
Attachment #8487875 - Flags: review?(till) → review+
As discussed on IRC: - removed the last two fields of the JSConstScalarSpec as they're not needed - inverted order of name and value, as it makes more sense to read the name before reading the value - not asking jorendorff for review as it isn't probably a widely used feature
Attachment #8487944 - Flags: review?(till)
Also addresses comments made on irc: - removes SIMDShuffleMasks*.h
Attachment #8487876 - Attachment is obsolete: true
Attachment #8487876 - Flags: review?(till)
Attachment #8487946 - Flags: review?(till)
Comment on attachment 8487944 [details] [diff] [review] Part 2 - refactor Review of attachment 8487944 [details] [diff] [review]: ----------------------------------------------------------------- Mmh, so much nicer. Sorry for the slow review. ::: js/src/jsapi.cpp @@ +3233,5 @@ > static bool > DefineConstScalar(JSContext *cx, HandleObject obj, const JSConstScalarSpec<T> *cds) > { > bool ok; > + unsigned attrs = JSPROP_READONLY | JSPROP_PERMANENT; Might just as well move this down to where it's used. This isn't ancient-times C anymore, after all. Same for `ok`, though I don't feel strongly about that.
Attachment #8487944 - Flags: review?(till) → review+
Comment on attachment 8487946 [details] [diff] [review] Part 3: Use JSConstIntegerSpec for defining SIMD shuffle masks in the interpreter Review of attachment 8487946 [details] [diff] [review]: ----------------------------------------------------------------- What's not to like about this?
Attachment #8487946 - Flags: review?(till) → review+
Thanks for the reviews! We could actually get rid of the bool ok in patch 2, by just making the control flow more explicit. remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/8a281ea111f7 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/c1cbab2a7889 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/d76097710bfb
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: