Closed
Bug 1133565
Opened 10 years ago
Closed 10 years ago
SIMD: Factor template objects within a compartment
Categories
(Core :: JavaScript Engine: JIT, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
Tracking | Status | |
---|---|---|
firefox38 | --- | fixed |
People
(Reporter: bbouvier, Assigned: bbouvier)
References
Details
Attachments
(2 files)
9.01 KB,
patch
|
jandem
:
feedback+
|
Details | Diff | Splinter Review |
6.79 KB,
patch
|
jonco
:
review+
jandem
:
review+
|
Details | Diff | Splinter Review |
Each time Baseline sees a SIMD call site, it will create a template object of the right kind. This is inefficient, as each SIMD operation has its own call site. We can spare some memory by factoring the template objects.
Assignee | ||
Comment 1•10 years ago
|
||
How does this look? Sorry if I am misusing any function here, I'm fairly new to all this compartment world...
I've looked on the SIMD mandelbrot demo, it prevents creation from ~10 template objects. All these objects are inlined, so not sure it's a big win, we might want to look at real world SIMD kernels compiled from Emscripten.
Attachment #8565131 -
Flags: feedback?(jdemooij)
Comment 2•10 years ago
|
||
Comment on attachment 8565131 [details] [diff] [review]
simd-templates.patch
Review of attachment 8565131 [details] [diff] [review]:
-----------------------------------------------------------------
Nice!
::: js/src/builtin/TypedObject.h
@@ +333,5 @@
> enum Type {
> TYPE_INT32 = JS_SIMDTYPEREPR_INT32,
> TYPE_FLOAT32 = JS_SIMDTYPEREPR_FLOAT32,
> + TYPE_FLOAT64 = JS_SIMDTYPEREPR_FLOAT64,
> + LAST_TYPE
This name is a bit confusing; I think it'd be clearer as LAST_TYPE = TYPE_FLOAT64 and then use +1 when you use it. Or call it NUM_TYPES.
::: js/src/jit/JitCompartment.h
@@ +433,5 @@
> JitCode *stringConcatStub_;
> JitCode *regExpExecStub_;
> JitCode *regExpTestStub_;
>
> + JSObject *simdTemplateObjects_[SimdTypeDescr::LAST_TYPE];
Use mozilla::Array so that we get bounds checks automatically.
@@ +442,5 @@
>
> public:
> + JSObject *getSimdTemplateObjectFor(JSContext *cx, Handle<SimdTypeDescr*> descr) {
> + MOZ_ASSERT(descr->type() < SimdTypeDescr::LAST_TYPE);
> + JSObject **tpl = &simdTemplateObjects_[descr->type()];
I think the array should use ReadBarrieredObject instead of JSObject*, this is necessary for incremental GC. I thought we had to access these pointers during Ion compilation, but we don't so it should be fine.
Attachment #8565131 -
Flags: feedback?(jdemooij) → feedback+
Assignee | ||
Comment 3•10 years ago
|
||
Attachment #8565445 -
Flags: review?(jdemooij)
Attachment #8565445 -
Flags: review?(jcoppeard)
Comment 4•10 years ago
|
||
Comment on attachment 8565445 [details] [diff] [review]
Factor SIMD templates within a compartment
Review of attachment 8565445 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good!
Attachment #8565445 -
Flags: review?(jcoppeard) → review+
Comment 5•10 years ago
|
||
Comment on attachment 8565445 [details] [diff] [review]
Factor SIMD templates within a compartment
Review of attachment 8565445 [details] [diff] [review]:
-----------------------------------------------------------------
nit: Remove the comment from MSimdBox::congruentTo.
Comment 6•10 years ago
|
||
Comment on attachment 8565445 [details] [diff] [review]
Factor SIMD templates within a compartment
Review of attachment 8565445 [details] [diff] [review]:
-----------------------------------------------------------------
Beautiful.
Attachment #8565445 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 7•10 years ago
|
||
Thanks! and with the comment removed:
https://hg.mozilla.org/integration/mozilla-inbound/rev/04a909655b92
Comment 8•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in
before you can comment on or make changes to this bug.
Description
•