Commit graph

5,777 commits

Author SHA1 Message Date
Martok
ba9647a12a Issue #2142 - Remove the temporary fields option
Now that everything is finished, we don't need the feature flag any more.
2023-05-01 13:27:04 +08:00
Martok
1fac189aea Issue #2142 - Implement class static block
Based-on: m-c 1712138/{2,3}, 1713155/2
2023-05-01 13:27:03 +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
c3b19191f3 Issue #2142 - Parse and process static class fields
Based-on: m-c 1535804/{6,7}
2023-05-01 13:27:03 +08:00
Martok
b187006a7e Issue #2142 - Support SuperProperty in field initializers
Based-on: m-c 1555037/2
2023-05-01 13:27:03 +08:00
Martok
e0b5528c29 Issue #2142 - Optimize .initializers scoping and emitter
* Refactor code for emitting the .initializers array into ClassEmitter
* Only emit .initializers scope when actually required
* Remove unfinished code to handle non-present class field initialisers
* Use predicate count_if and any_of of ListNode
* Remove unnecessary parameters for class field parsing

Based-on: m-c 1553744, 1555979, 1555037/1, 1535804/{1-5}
2023-05-01 13:27:03 +08:00
Martok
c206114966 Issue #2142 - Set anonymous function name in field initializer
This was done wildly different in m-c 1552875, in the interest of keeping
|setOrEmitSetFunName| around it is implemented differently here.
2023-05-01 13:27:03 +08:00
Martok
f0b06f5ad6 Issue #2142 - Don't treat PNK_NAME specially emitAssignmentOrInit
If there ever was a point where this structure "avoids duplication", at least since the
*OpEmitter refactor emitting PNK_NAME differently makes it actually harder to follow.

Mozilla makes the same change at a different time.
2023-05-01 13:27:02 +08:00
Martok
f374ab472d Issue #2142 - Emit field keys in correct order
Based-on: m-c 1552229
2023-05-01 13:27:02 +08:00
Martok
1031b1fc43 Issue #2142 - Pass through arguments in synthesized constructors for derived classes
Based-on: m-c 1552022
2023-05-01 13:27:02 +08:00
Martok
bcb6203e4f Issue #2142 - Fix several scoping issues in field initializers
Based-on: m-c 1540789, 1547130, 1547467
2023-05-01 13:27:02 +08:00
Martok
8c6750014c Issue #2142 - Restrict contents of direct eval in fields
Based-on: m-c 1542406
2023-05-01 13:27:02 +08:00
Martok
849ab4417c Issue #2142 - Use JSOP_INITPROP for field initializers
We don't want to call setters for field initialization.

Based-on: m-c 1535471, 1547035
2023-05-01 13:27:01 +08:00
Martok
447261cf87 Issue #2142 - Implement ASI for fields
Based-on: m-c 1529772/{3,4}
2023-05-01 13:27:01 +08:00
Martok
014953c532 Issue #2142 - Factor out PropertyName parsing from Parser::propertyName()
Based-on: m-c 1529772/{1,2}
2023-05-01 13:27:01 +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
e6335ded89 Issue #2142 - Add FunctionEmitter, FunctionScriptEmitter, and FunctionParamsEmitter with current methods
Based-on: m-c 1473796/3, 1473796/4
2023-05-01 13:27:01 +08:00
Martok
1b89be6d0b Issue #2142 - Add PropertyEmitter, ObjectEmitter, ClassEmitter, LexicalScopeEmitter, DefaultEmitter
Based-on: m-c 1501577, 1521696, 1501578, 1473796/1
2023-05-01 13:27:01 +08:00
Martok
ab7721e4df Issue #2142 - Improve TokenPos handling in BCE
* Don't print bogus error locations on BCE internal errors
* Do not use TokenPos in BytecodeEmitter::{setFunctionBodyEndPos,setScriptStartOffsetIfUnset}

Based-on: m-c 1451826/1, 1530034, 1473796/2
2023-05-01 13:27:00 +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
Martok
afa7bddc96 Issue #2142 - Add internal option for fields, but always true
This allows us to perform bisects on the following commits without causing runtime issues.

Based-on: m-c 1529758
2023-05-01 12:27:22 +08:00
Martok
6abb54ff11 Issue #2142 - Reduce calls to FindReservedWord when checking for forbidden identifiers during parsing
Based-on: m-c 1351913/{1,2}
2023-05-01 12:27:10 +08:00
Martok
faed047e3f Issue #2142 - Ensure 'await' is always a restricted identifier when parsing modules
Based-on: m-c 1356189
2023-05-01 06:55:30 +08:00
Martok
3b9b111b2f Issue #2142 - Add predicate functions count_if and any_of to ListNode iterator 2023-05-01 06:55:15 +08:00
Martok
627d0da7dc Issue #2142 - Change InitPropertyOperation to accept a PropertyName directy and use DefineDataProperty
Based-on: m-c 1413907, 1547129
2023-05-01 06:55:00 +08:00
Martok
6f56a494e6 Issue #2142 - Extend newSuperCall for JSOP_SPREADSUPERCALL
Based-on: m-c 1537936
2023-05-01 06:54:43 +08:00
Martok
014ebe8ae2 Issue #2142 - Fold BytecodeEmitter::checkTypeSet into BytecodeEmitter::emitCheck
The bytecode emitter used to call checkTypeSet for each JOF_TYPESET op. Despite
correctness asserts in the TypeScript code, this was pretty error prone.

The solution is to move this check to BytecodeEmitter::emitCheck (called for
each opcode we emit), so we don't have to worry about this anymore.

Based-on: m-c 1521491/3
2023-05-01 06:54:25 +08:00
Martok
73a99c155d Issue #1691 - Follow-up: use error message with no arguments for bad import statements 2023-05-01 06:54:10 +08:00
Job Bautista
51426d1053 Issue #1862 - Follow-up: Replace deprecated Harfbuzz functions with current ones.
Based on Mozilla bug 1500356.
2023-05-01 06:53:51 +08:00
Job Bautista
45b34592b6 Issue #1691 - Follow-up: Fix CallSelfHostedFunction deprot introduced by Part 4. 2023-05-01 06:53:08 +08:00
Job Bautista
b592711bb2 Issue #2221 - Enable link-time optimization for Spidermonkey by default if building it shared.
Currently only Windows can take advantage of this.

The reason why the arrays of deunified sources are named like that in
Spidermonkey's moz.build is to avoid UnsortedErrors in python. There's probably
a better way to handle that, but I just want something that works for now.

And yes, the deunified sources will be reunified if LTO is disabled.
2023-05-01 06:52:48 +08:00
Martok
0a74a57585 Issue #1285 - Follow-up: Correctly handle follow-up compilations of RegExp with named capturing groups 2023-05-01 06:52:29 +08:00
Martok
aece6260fb Issue #1894 - Follow-up: Fix return value ordering in IonMonkey nullish coalescing 2023-05-01 06:52:12 +08:00
Martok
e31a058ce9 Issue #2173 - Follow-up: Use common ancestor of PNK_(OPT)DOT in ASTSerializer::expression 2023-05-01 06:51:57 +08:00
Martok
a27e8bf989 Issue #2213 - Follow-up: Fix derieved Generator prototypes after previous change 2023-05-01 06:51:42 +08:00
Job Bautista
61874576e3 [Basilisk] Issue MoonchildProductions/UXP#1451 - Support hunspell as shared library 2023-04-30 21:43:17 +08:00
Job Bautista
2be4e3e69f [Pale-Moon] Issue MoonchildProductions/UXP#1451 - Support hunspell as shared library 2023-04-30 21:42:24 +08:00
FranklinDM
b7f217e5ad Issue #2073 - Follow-up: Use internal Move instead of std::move for consistency 2023-04-30 21:25:05 +08:00
FranklinDM
93644fd33e Issue #2218 - Part 2: Make SurfaceCache free ImageSurfaceCache objects outside of the lock
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1389479
2023-04-30 21:24:49 +08:00
FranklinDM
fa787f4a6a Issue #2218 - Part 1: Add nsExpirationTracker::NotifyEndTransaction(Locked) callbacks for subclasses to know when an aging iteration is complete
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1389479
2023-04-30 21:24:37 +08:00
FranklinDM
62e2fbc4e9 Bug 1432272 - Make Fetch API use the global's base URL instead of the entry document's base URL 2023-04-30 21:23:32 +08:00
Brian Smith
1ac1e90b6a Issue #1691 - Part 16: Dynamically imported modules can throw any value as an exception. https://bugzilla.mozilla.org/show_bug.cgi?id=1508672
(cherry picked from commit 910a37b53f1826a863cc3ab6eb61fc369f4505a0)
2023-04-30 21:23:02 +08:00
Brian Smith
f2b179156b Issue #1691 - Part 15: Make |new import()| a syntax error. https://bugzilla.mozilla.org/show_bug.cgi?id=1508672
(cherry picked from commit 45fda91268b6a3ca8471c8094f2d640ebad682f9)
2023-04-30 21:22:42 +08:00
Brian Smith
79ea755b7f Issue #1691 - Part 14: Fix a debug assert and memory leak. PNK_IMPORT_META and PNK_CALL_IMPORT are binary nodes... They function similar to list nodes, so they worked there, but debug mode asserts because of the wrong type. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Fixed a memory leak due to missing code in SourceScriptObject::finalize(). Thanks FranklinDM!
(cherry picked from commit 15e81193c692c2c2aec665e7e5a88d98a9b85eca)
2023-04-30 21:22:26 +08:00
Brian Smith
bc895eba9b Issue #1691 - Part 13: Remove MUST_MATCH_TOKEN* macros in Parser. https://bugzilla.mozilla.org/show_bug.cgi?id=1501928 This was helpful in debugging one of the crashes, the macros made debugging a nightmare.
(cherry picked from commit 7bceec3f7dff086305c3f50939a8c830ca7f107b)
2023-04-30 21:22:12 +08:00
Brian Smith
a892a75903 Issue #1691 - Part 12: Fix return value in ExecScript() and debug assert in ParseTask. https://bugzilla.mozilla.org/show_bug.cgi?id=1331662 Replace nsJSUtils::EvaluateString calls by ExecutionContext scopes. ExecutionContext: The mRetValue is not used even though it is checked in various asserts. This is how it is in the Mozilla code even years later, only the passed in value is used. ParseTask: JoinDecode() and JoinCompile() run the same code but the type is different causing a debug assert when it checks the type Script vs ScriptDecode.
(cherry picked from commit 8f577428b7834b7d0f0d5afacbe060fbb1ff2136)
2023-04-30 21:22:00 +08:00
Brian Smith
edb82ec9f2 Issue #1691 - Part 11: Fix incorrect reference counting in ModuleScript class.
(cherry picked from commit 4ef1fa98c9518f5c107424667229ddb6f9f97767)
2023-04-30 21:21:45 +08:00
Brian Smith
7e056a6f72 Issue #1691 - Part 10: Add and use method to annotate CC crashes with a class name. https://bugzilla.mozilla.org/show_bug.cgi?id=1277260 Make PtrInfo into a class and mark it final. Also fix an erroneous debug assert because mBaseURL not set in one code path.
(cherry picked from commit a1890054011adf0cf87be0d56047418c9f201420)
2023-04-30 21:21:31 +08:00
Brian Smith
be916ef7ca Issue #1691 - Part 9: Make import() work when the active script is in another document. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Associate event handler with active script when they are compiled.
(cherry picked from commit 1a3cc5d6828a05a6309d959fad3c7e959ab9eb8d)
2023-04-30 21:21:19 +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