Closed
Bug 781035
Opened 12 years ago
Closed 12 years ago
convert more places to use the C++ compile/evaluate api
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: Benjamin, Assigned: Benjamin)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
jorendorff
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #649861 -
Flags: review?(jorendorff)
Comment 1•12 years ago
|
||
Please provide a description, even if short, in all filed bugs. It makes things much easier for people who follow all the bugs in a particular component. Thanks!
Assignee | ||
Comment 2•12 years ago
|
||
I forgot one.
Assignee: general → bpeterson
Attachment #649861 -
Attachment is obsolete: true
Attachment #649861 -
Flags: review?(jorendorff)
Attachment #649925 -
Flags: review?(jorendorff)
Assignee | ||
Comment 3•12 years ago
|
||
Remove usage of JS::NullPtr.
Attachment #649925 -
Attachment is obsolete: true
Attachment #649925 -
Flags: review?(jorendorff)
Attachment #650274 -
Flags: review?(jorendorff)
Comment 4•12 years ago
|
||
Comment on attachment 650274 [details] [diff] [review]
use c++ api
Review of attachment 650274 [details] [diff] [review]:
-----------------------------------------------------------------
jst, this is just an API change. The new API isn't markedly better in these cases, but it's more explicit. I've reviewed it. Please request any additional reviews that are needed.
This eliminates two casts. Do we know why those were necessary in the first place? With the patch, does this still build on Windows?
::: dom/workers/WorkerPrivate.cpp
@@ +3795,5 @@
> &stringLength);
> + if (!string) {
> + retval = false;
> + break;
> + }
The original code called JS_ReportPendingException in the case where string is null.
@@ +3805,1 @@
> !JS_ReportPendingException(aCx)) {
And here: JS_ReportPendingException is supposed to be called when Evaluate returns false.
Attachment #650274 -
Flags: superreview?(jst)
Attachment #650274 -
Flags: review?(jorendorff)
Attachment #650274 -
Flags: review+
Comment 5•12 years ago
|
||
I should comment briefly on why this is desirable.
There are a bunch of compile-time options that affect script compilation and nothing else. Historically some of these have been stored in the JSContext, but then some JSAPI-using code just grabs a JSContext somewhat arbitrarily and starts using it, so I think historically the choice of language version, compile options, and other odds and ends has often been pretty arbitrary. This is bad. To counteract that we've been adding more and more JS_Compile* APIs, like JS_CompileUCScriptForPrincipalsVersionOrigin.
With CompileOptions, there are still a bunch of knobs (too many, I guess), but you can see all of them. They're all in one place. If you want to know exactly which options your code is going to be compiled with, just look at the CompileOptions object you've made. That's what the JS engine will use.
Compilation depends only on the CompileOptions; AFAIK it no longer depends on JSContext state in any subtle ways.
Ideally I would like to make CompileOptions itself independent of any JSContext state. This is a step in that direction without changing the semantics at all yet.
Comment 6•12 years ago
|
||
[A side note about CompileOptions: it's now passed to JSScript::Create(), which I don't particularly like, because that function only reads some of its fields -- 5 out of 11, to be exact.]
Comment 7•12 years ago
|
||
Get your own bug! :)
Updated•12 years ago
|
Attachment #650274 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/4bb09a1e8c15
https://hg.mozilla.org/mozilla-central/rev/d985281cad13
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in
before you can comment on or make changes to this bug.
Description
•