Closed
Bug 877281
Opened 11 years ago
Closed 11 years ago
Convert WebIDL bindings to something CallArgs-like
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(9 files, 2 obsolete files)
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
jandem
:
review+
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
This uses the infrastructure from bug 877216.
Assignee | ||
Comment 1•11 years ago
|
||
Still needs jit changes to pass the right things in
Assignee | ||
Comment 2•11 years ago
|
||
Peter, would you review the codegen changes?
Jan, would you review the JS engine changes?
As far as the JS engine changes go, please pay careful attention to the visitCallDOMNative bits and ionframe bits in terms of the following:
1) Can we add more asserts somehow to make this whole setup safer?
2) Can we make better use of registers by having another scratch reg to work with?
At first glance no, but please double-check that!
3) Is there a cleaner way to compute the argv value to push on the stack?
In terms of performance this makes a no-op DOM call slower by about 0.5ns on my machine, presumably for two reasons. First of all, the C++ implementation has to return JS::UndefinedValue(). This used to involve just writing it to *vp, but now it has to effectively be written to *(args->array), which means an extra pointer-chase. Second, the actual jit codegen is a bit different, obviously. The relevant change is the old setup did this in the JIT:
;; movePtr(StackPointer, argVp)
movq %rsp, %r8
whereas the new setup does this:
;; computeEffectiveAddress(
;; Address(StackPointer, sizeof(uintptr_t) + 2*sizeof(Value)),
;; argArgs)
leaq 0x18(%rsp), %rcx
;; Push(argArgs);
push %rcx
;; movePtr(StackPointer, argArgs);
movq %rsp, %rcx
And I'm on x86-64 so having to pass one less argument to the ABI call doesn't matter: they're all getting passed in registers anyway. It's possible that on x86-32 there is no performance impact and that in a non-microbenchmark the reduced register pressure helps or something...
Attachment #755973 -
Flags: review?(peterv)
Attachment #755973 -
Flags: review?(jdemooij)
Assignee | ||
Updated•11 years ago
|
Attachment #755533 -
Attachment is obsolete: true
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #755976 -
Flags: review?(peterv)
Assignee | ||
Comment 4•11 years ago
|
||
This is pure search-and-replace
Attachment #755977 -
Flags: review?(peterv)
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #755981 -
Flags: review?(peterv)
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #755982 -
Flags: review?(terrence)
Assignee | ||
Comment 7•11 years ago
|
||
I'm sorry this is so big; I couldn't find a good way to split this up
Attachment #755990 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Blocks: ParisBindings
Whiteboard: [need jit changes] → [need review]
Comment 8•11 years ago
|
||
Comment on attachment 755982 [details] [diff] [review]
part 5. Add a set() method to Rooted.
Review of attachment 755982 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
::: js/public/RootingAPI.h
@@ +578,5 @@
> ptr = value;
> return ptr;
> }
>
> + void set(T value) {
Why not |const T &value|?
Attachment #755982 -
Flags: review?(terrence) → review+
Assignee | ||
Comment 9•11 years ago
|
||
> Why not |const T &value|?
I cribbed from MutableHandle.
But a possibly-good reason for not doing that is that this code:
Rooted<JSObject*> rooted(cx);
JSObject* obj = GetSomeObject();
rooted.set(obj);
would end up with an unsafe reference hazard if the set() argument is a const T&....
Comment 10•11 years ago
|
||
Comment on attachment 755973 [details] [diff] [review]
part 1. Convert WebIDL bindings to using something CallArgs-like.
Review of attachment 755973 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great, but would be good to take another look once the comments below are addressed.
::: js/src/ion/CodeGenerator.cpp
@@ +1416,5 @@
> Register obj = masm.extractObject(Address(StackPointer, 0), argObj);
> JS_ASSERT(obj == argObj);
>
> // Push a Value containing the callee object: natives are allowed to access their callee before
> // setitng the return value. The StackPointer is moved to &vp[0].
Nit: remove the last part: "The StackPointer..." since that movePtr is gone now.
@@ +1417,5 @@
> JS_ASSERT(obj == argObj);
>
> // Push a Value containing the callee object: natives are allowed to access their callee before
> // setitng the return value. The StackPointer is moved to &vp[0].
> masm.Push(ObjectValue(*target));
It seems like we can do
masm.computeEffectiveAddress(Address(StackPointer, 2 * sizeof(Value)), argArgs);
here to get vp + 2, if we no longer need argArgs for the argc below.
@@ +1428,2 @@
> // Push argument into what will become the IonExitFrame
> + masm.Push(argArgs);
masm.Push(Imm32(call->numStackArgs()); We can get rid of the extra move now because we no longer have to pass argc as argument.
@@ +1438,5 @@
> + JS_STATIC_ASSERT(JSJitMethodCallArgs::offsetOfArgc() ==
> + IonDOMMethodExitFrameLayout::offsetOfArgcFromArgv());
> + masm.computeEffectiveAddress(Address(StackPointer,
> + sizeof(uintptr_t) + 2*sizeof(Value)),
> + argArgs);
And remove this call.
::: js/src/ion/shared/IonFrames-x86-shared.h
@@ +433,5 @@
> IonExitFrameLayout exit_;
> // This must be the last thing pushed, so as to stay common with
> // IonDOMExitFrameLayout.
> JSObject *thisObj_;
> + Value* argv_;
Nit: Value *argv_; (same for the ARM version).
Attachment #755973 -
Flags: review?(jdemooij)
Assignee | ||
Comment 11•11 years ago
|
||
> Nit: remove the last part: "The StackPointer..." since that movePtr is gone now.
That's not a comment about the movePtr. That's a comment about where StackPointer points to after this Push() call, and I believe it's still correct, though I rephrased it a bit to make that clearer.
Made the rest of the changes. Very good catches!
Assignee | ||
Comment 12•11 years ago
|
||
Assignee | ||
Comment 13•11 years ago
|
||
Attachment #756308 -
Flags: review?(peterv)
Attachment #756308 -
Flags: review?(jdemooij)
Assignee | ||
Updated•11 years ago
|
Attachment #755973 -
Attachment is obsolete: true
Attachment #755973 -
Flags: review?(peterv)
Comment 14•11 years ago
|
||
Comment on attachment 756308 [details] [diff] [review]
Part 1 updated to Jan's review comments
Review of attachment 756308 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
Attachment #756308 -
Flags: review?(jdemooij) → review+
Updated•11 years ago
|
Attachment #756308 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #755976 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #755977 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #755981 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #755990 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 15•11 years ago
|
||
Thanks for the reviews!
https://hg.mozilla.org/integration/mozilla-inbound/rev/1907d472e5d4
https://hg.mozilla.org/integration/mozilla-inbound/rev/840183b434d2
https://hg.mozilla.org/integration/mozilla-inbound/rev/98ec2d7ed87f
https://hg.mozilla.org/integration/mozilla-inbound/rev/20f763a69b1f
https://hg.mozilla.org/integration/mozilla-inbound/rev/f047d17cdb78
https://hg.mozilla.org/integration/mozilla-inbound/rev/3c733ec01b14
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla24
Assignee | ||
Comment 16•11 years ago
|
||
Attachment #760062 -
Flags: review?(jdemooij)
Assignee | ||
Comment 17•11 years ago
|
||
I pushed the bustage fix as https://hg.mozilla.org/integration/mozilla-inbound/rev/39a59be2a4cc for the moment...
Assignee | ||
Comment 18•11 years ago
|
||
Attachment #760064 -
Flags: review?(jdemooij)
Assignee | ||
Comment 19•11 years ago
|
||
And pushed that second bustage fix as http://hg.mozilla.org/integration/mozilla-inbound/rev/697190293f4e
Comment 20•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/1907d472e5d4
https://hg.mozilla.org/mozilla-central/rev/840183b434d2
https://hg.mozilla.org/mozilla-central/rev/98ec2d7ed87f
https://hg.mozilla.org/mozilla-central/rev/20f763a69b1f
https://hg.mozilla.org/mozilla-central/rev/f047d17cdb78
https://hg.mozilla.org/mozilla-central/rev/3c733ec01b14
https://hg.mozilla.org/mozilla-central/rev/39a59be2a4cc
https://hg.mozilla.org/mozilla-central/rev/697190293f4e
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
Attachment #760062 -
Flags: review?(jdemooij) → review+
Updated•11 years ago
|
Attachment #760064 -
Flags: review?(jdemooij) → review+
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•