Commit graph

31 commits

Author SHA1 Message Date
Moonchild
5fd304507d Issue #2692 - Part 7: De-globalize {*}CompileOptions.
Make all users of the various *CompileOptions classes #include "js/CompileOptions.h"
so that nothing but that file has to know about these classes having a
JS_PUBLIC_API on them, that would have to be present in forward-declarations.
2025-03-13 23:03:43 +08:00
Moonchild
e665b30629 Issue #2645 - Return null if getName() PC is invalid. 2024-10-24 07:37:47 +08:00
Brian Smith
eef37b2cd5 Issue #2387 - Collection of fixes related to a crash while canceling a dynamic import. Add AddRef/Release hooks for embedding's script or module private value and set this script source object where appropriate. https://bugzilla.mozilla.org/show_bug.cgi?id=1519140 Partial, no Value passing changes. Clear the list of dynamic import requests after cancelling them in ScriptLoader::ParsingComplete as we do for other requests. https://bugzilla.mozilla.org/show_bug.cgi?id=1291535 ScriptLoader::OnStreamComplete never returns a failure. https://bugzilla.mozilla.org/show_bug.cgi?id=1627275 Also cancel the correct kind of parser for Modules. 2023-11-30 09:51:50 +08:00
Brian Smith
1c70f64e7c Issue #2236 - Fix import.meta module error in lambdas by moving parseGoal() into SharedContext. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1604792 Also remove ParseGoal being passed through Parser introduced in #1691 Part 2. 2023-05-10 11:55:55 +08:00
Martok
22a9d46ef1 Issue #2142 - Track isFieldInitializer on JSScript instead of Scope
Introduce a FunctionSyntaxKind for FieldInitializer since special rules
(around `arguments`) apply. At the same time we can move the flag from the
scope to the JSScript. This is similar to how derived constructors are handled
and makes the initWithEnclosingScope code closer to initWithEnclosingContext.

This version is a bit more complex than Mozilla's due to different storage of
bit flags on JSScript.

Based-on: m-c 1636800
2023-05-01 13:27:03 +08:00
Martok
235ca77949 Issue #2142 - Handle fields in derived classes
* Don't name field initializer lambdas

Based-on: m-c 1534721, 1551454, 1542448
2023-05-01 13:27:01 +08:00
Martok
51db22ff2f Issue #2142 - Implement syntax for public/private fields and computed field names
This state still has the initializers scoped on .initializers local variable, which will be changed later.

Based-on: m-c 1499448, 1530084, 1530832, 1529448 (partial), 1532921, 1528039, 1528038, 1535166, 1550628,
              1535166, 1550628, 1541641, 1547133, 1540787, 1535804/9
2023-05-01 13:26:43 +08:00
Brian Smith
1109559a5d Issue #1691 - Part 8: Fix --enable-debug builds and continue dynamic module import changes. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Support import from timeout handlers by associating the initiating script with the compiled JSScript. Fix error message that covers all import() failures that don't throw a JS exception. https://bugzilla.mozilla.org/show_bug.cgi?id=1331662 Partial - Replace nsJSUtils::EvaluateString calls by ExecutionContext scopes. Left EvaluateString() in nsXBLProtoImplField.cpp until ExecutionContext errors can be fixed.
(cherry picked from commit 22fcfc77971a9bb204df664c474681f4dcf54211)
2023-04-30 21:21:06 +08:00
Brian Smith
c69a47c393 Issue #1691 - Part 7f: Split up compile and execute so we can use ClassicScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Refactor nsJSUtils::ExecutionContext to separate compilation and execution steps and allow extraction of compiled JSScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1366773 Move buffer argument from JS::StartIncrementalEncoding to JS::FinishIncrementalEncoding.
(cherry picked from commit d4b520b08b958e116dfeeffdc61f3425610d1ce9)
2023-04-30 21:20:47 +08:00
Brian Smith
993476283d Issue #1691 - Part 7e: Dependencies for required to finish part 7d. https://bugzilla.mozilla.org/show_bug.cgi?id=1331662 Reimplement EvaluateString using the ExecutionContext class. https://bugzilla.mozilla.org/show_bug.cgi?id=1316078 Extract redudant code into StartOffThreadParseTask. Use an ExclusiveContext instead of a JSContext in XDR functions. Add a script decoder as a valid off-main-thread parse-task. https://bugzilla.mozilla.org/show_bug.cgi?id=900784 Add nsJSUtils functions for encoding and decoding the bytecode. https://bugzilla.mozilla.org/show_bug.cgi?id=1316081 Add XDRIncrementalEncoder to replace delazified LazyScript in the encoded XDR buffer. Add an XDRIncrementalEncoder instance on the ScriptSource. Expose a new JSAPI to incrementally encode bytecode when it is generated. https://bugzilla.mozilla.org/show_bug.cgi?id=1334091 XDR function use the sourceObject instead of the enclosingScript as argument.
(cherry picked from commit d6de9a669f4b2f5115670bd771cd53d7cfb3956a)
2023-04-30 21:20:33 +08:00
Brian Smith
1b811bd711 Issue #1691 - Part 6a: Support private values which contain pointers to cycle-collected C++ objects https://bugzilla.mozilla.org/show_bug.cgi?id=1342012
(cherry picked from commit 1286cca73d58332ba0becd0011f747713b8acfac)
2023-04-30 21:17:54 +08:00
Brian Smith
a8ab41b4c6 Issue #1691 - Part 2: Implement call import and import meta in the parser. https://bugzilla.mozilla.org/show_bug.cgi?id=1427610 https://bugzilla.mozilla.org/show_bug.cgi?id=1484948
(cherry picked from commit 6be083187f49e444de1bb116bb5930b20125190b)
2023-04-30 21:16:43 +08:00
Brian Smith
1a6b3a822c Issue #1691 - Part 1: Provide a way of associating a private value with a script or module.
This is a prerequisite for dynamic import

(cherry picked from commit 2e2972647ee29340df51a804f05e40fc1da2c89b)
2023-04-30 21:16:28 +08:00
Moonchild
dabd32f955 Issue #1656 - Part 7: Nuke vim config lines in JS 2020-09-25 22:04:24 +08:00
Gaming4JC
a6872d9ea3 Bug 1343481 - Part 3: Add JSOP_AWAIT and rename {yieldIndex,yieldOffset} to {yieldAndAwaitIndex,yieldAndAwaitOffset}.
Tag #1287
2019-12-18 09:15:54 +08:00
Gaming4JC
7eb5d46c11 Bug 1343481 - Part 1: Remove {JSFunction,JSScript,LazyScript}.isGenerator() method.
Tag #1287
2019-12-18 09:15:51 +08:00
Gaming4JC
3f8f224e12 Bug 1364573 - Don't relazify class default constructors.
Because of the wacko way we handle toString offsets for class default constructors, those offsets cannot be recovered if we relazify the functions.
Luckily there's no reason to relazify them, their JSScripts are very small: either a single 'retrval' for non-derived, and still fairly small for derived.
2019-07-22 19:51:47 +08:00
Gaming4JC
ab85510c20 1216630 - Rename preludeStart and postludeEnd to toStringStart and toStringEnd and misc fixes. 2019-07-22 19:51:41 +08:00
Gaming4JC
f79ee2fd83 1216630 - Print class source when calling toString on the constructor.
This is accomplished in the following ways.
LazyScripts and JSScripts now have 4 offsets:
- Source begin and end for the actual source. This is used for lazy parsing.

- toString begin and end for toString. Some kinds of functions, like async, only have a different begin offset. Class constructors have different offsets for both begin and end.

For syntactically present (i.e. non-default) constructors, the class source span is remembered directly on the LazyScript or JSScript. The toString implementation then splices out the substring directly. For default constructors, a new SRC_CLASS SrcNote type is added. It's binary and has as its arguments the begin and end offsets of the class expression or statement. MakeDefaultConstructor reads the note and overrides the cloned self-hosted function's source object. This is probably the least intrusive way to accomplish this.
2019-07-22 19:51:38 +08:00
Gaming4JC
68b04671cb 1320408 - Change JSScript::sourceDataWithPrelude to static method
UXP Interdiff
2019-07-22 19:48:05 +08:00
Gaming4JC
d208cccd10 1320408 - Part 12: Change JSScript::sourceData to static method. 2019-07-22 19:48:01 +08:00
Gaming4JC
56a4517a1f 1320408 - Part 10: Change LazyScript::functionDelazifying to static method. 2019-07-22 19:47:56 +08:00
Gaming4JC
d451930d58 1320403 - Move JSFunction::EXPR_BODY to JSScript, LazyScript, and FunctionBox. 2019-07-22 19:46:14 +08:00
wolfbeast
b68de773fd Stage 1-1: Implement Function.prototype.toString revision proposal.
Tag #960
2019-04-13 07:00:18 +08:00
janekptacijarabaci
8af5664922 Bug 1346862 - Fix IteratorClose due to non-local jumps being catchable by try statements inside for-of
Issue #74
2019-02-15 23:39:32 +08:00
janekptacijarabaci
444483bf81 Bug 1342553, Bug 1343072, Bug 1344753 (details in the description)
Bug 1342553 - Part 0.1: Use try-catch for IteratorClose in for-of
Bug 1343072 - Update HasLiveStackValueAtDepth to follow the change in
JSTRY_FOR_OF
Bug 1344753 - Update for-of stack depth in
ControlFlowGenerator::processWhileOrForInLoop

Issue #74
2019-02-15 23:39:29 +08:00
janekptacijarabaci
d36d40760a Bug 1147371: Implement IteratorClose for array destructuring
Issue #74
2019-02-15 23:39:05 +08:00
janekptacijarabaci
5f3e5dc3fb Bug 1147371: Implement IteratorClose for for-of
Issue #74
2019-02-15 23:39:00 +08:00
janekptacijarabaci
e7ee7caf1e Bug 1320388: Move JSFunction::HAS_REST to JSScript and LazyScript
Issue #78
[Depends on] Bug 883377: Implement ES6 function "name" property
semantics
2019-02-15 23:38:38 +08:00
janekptacijarabaci
0e7a16c088 Bug 755821: Function() should use the parser's argument parsing code 2019-02-15 23:38:10 +08:00
Roy Tam
dcd9973243 import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo 2018-01-19 03:59:58 +08:00