Closed
Bug 515496
(blazinglyfastthis)
Opened 15 years ago
Closed 15 years ago
Eliminate extra security check when computing this (in js_ComputeGlobalThis)
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mrbkap, Assigned: mrbkap)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
10.95 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
Currently, computing this is very expensive, even in the interpreter and tracer. We end up calling into a hook that needs to look at the stack and make all sorts of bizarre decisions. In reality, when we're in the interpreter, we never need to do this. All 'this' computations that happen in the interpreter can use the wrapper for their scope (note that assertion relies on full wrapperization, which is not quite here yet, thanks to evalInSandbox).
The overall proposal is to tie JSCLASS_GLOBAL_FLAGS to a slot on the global object that contains the "stunt this object" and eagerly use that when calling functions.
There is one case where we can't directly use the stunt this object, which is on entry from native code (via the API) in that case, we should be able to simply call the thisObject hook or something to find the right this object to use.
Comment 1•15 years ago
|
||
> All 'this' computations that happen in the interpreter
> can use the wrapper for their scope
Which wrapper? and what does "scope" mean here?
> (note that assertion relies on full wrapperization, which is not quite
> here yet, thanks to evalInSandbox).
How much effort would this be?
In bug 513160 comment 8 I proposed computing `this` eagerly rather than lazily, and caching those computations via the property cache. But certainly if the computation can be made BLAZINGLY FAST, that's even better.
Assignee | ||
Updated•15 years ago
|
Updated•15 years ago
|
Alias: blazinglyfastthis
Updated•15 years ago
|
Blocks: strictThis
Assignee | ||
Comment 2•15 years ago
|
||
So, a couple of things got in the way of really BLAZINGLY fast 'this'. In particular, I was really hoping to avoid having to call any hooks for 'this' wrapping in the common case. This doesn't quite get us there, but it gets rid of the security check that is now unnecessary.
In order to get rid of the wrapper *hook*, we need to group wrappers by origin, not scope as we do now. That patch is coming (for other, more awesome reasons as well).
Comment 3•15 years ago
|
||
Comment on attachment 433450 [details] [diff] [review]
Patch
>- * When the above FIXME is made fixed, the whole GC reachable frame
>- * mechanism can be removed as well.
I think this is true. The only other use of JSGCReachableFrame is in jsdbgapi.cpp:JS_GetFrameThis, and I think that can be removed.
Otherwise this patch looks great.
Attachment #433450 -
Flags: review?(jorendorff) → review+
Comment 4•15 years ago
|
||
Another note: It seems better to inline JS_GetGlobalForObject or at least avoid the expense of calling the public API. A JSObject method might be nice.
Comment 5•15 years ago
|
||
I pushed this to tm. mrbkap is busy.
http://hg.mozilla.org/tracemonkey/rev/9851a9b1647f
Whiteboard: fixed-in-tracemonkey
Comment 6•15 years ago
|
||
Adjusting the summary to reflect what actually happened here.
I'm leaving the (blazinglyfastthis) alias for now. I hope that alias can be re-assigned to a followup bug soon!
Summary: Make computing 'this' be BLAZINGLY FAST → Eliminate extra security check when computing this (in js_ComputeGlobalThis)
Comment 7•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 8•14 years ago
|
||
Is JS_THIS_OBJECT infallible now? Should bug 498543 be closed?
You need to log in
before you can comment on or make changes to this bug.
Description
•