Closed Bug 784620 Opened 12 years ago Closed 12 years ago

Support compiling JS in self-hosting mode in the shell

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: till, Assigned: till)

References

(Blocks 1 open bug)

Details

(Whiteboard: [js:t])

Attachments

(1 file, 1 obsolete file)

This would enable testing self-hosted code without recompiling the shell.
Whiteboard: [js:t]
Attached patch v1 (obsolete) — Splinter Review
So it occurred to me that making it possible to load an external JS file during runtime and to set that file using an environment variable is more useful than adding a special compile mode to the shell.

This patch adds the environment variable "MOZ_SELFHOSTEDJS" and changes the makefile and embedjs.py script very slightly to make creating the required JS file easier.

Usage:
1. modify any JS file that's compiled into selfhosted.js
2. invoke the shell or the browser with "MOZ_SELFHOSTEDJS=./selfhosted.js ./js" (for the shell, in the obj dir) or "MOZ_SELFHOSTEDJS=[path to js obj dir].selfhosted.js ./run-mozilla.sh ./firefox" (for the browser, in the dist/bin dir)
Assignee: general → tschneidereit
Status: NEW → ASSIGNED
Attachment #663833 - Flags: review?(luke)
Comment on attachment 663833 [details] [diff] [review]
v1

Punting to Terrence.
Attachment #663833 - Flags: review?(luke) → review?(terrence)
Comment on attachment 663833 [details] [diff] [review]
v1

Review of attachment 663833 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM
Attachment #663833 - Flags: review?(terrence) → review+
Attached patch v2Splinter Review
rebased, pushed to try here:
http://tbpl.mozilla.org/?tree=Try&rev=b0e52a4a5627
Attachment #670367 - Flags: review+
Comment on attachment 663833 [details] [diff] [review]
v1

hrmpf
Attachment #663833 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/5f1d0cfe99ac
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Comment on attachment 670367 [details] [diff] [review]
v2

Review of attachment 670367 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jscntxt.cpp
@@ +272,5 @@
> +    char *filename = getenv("MOZ_SELFHOSTEDJS");
> +    if (filename) {
> +        RootedScript script(cx, Compile(cx, shg, options, filename));
> +        if (script)
> +            ok = Execute(cx, script, *shg.get(), &rv);

So if script is null, we will return some uninitialized value?
(In reply to :Ms2ger from comment #8)
> So if script is null, we will return some uninitialized value?

Thanks for noticing. Luckily, Ehsan fixed that in bug 801344.
Depends on: 801344
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: