Compare commits

..
Author SHA1 Message Date
Basilisk-Dev 951a67b54a Issue #2229 Followup - Handle re-entrant module instantiation/evaluation during async module loads 2026-02-11 17:32:31 +01:00
Moonchild a4e51f46c5 Adapt top-level await call to use context top-level interpreterStack() 2026-02-11 15:25:58 +01:00
Basilisk-Dev 2aaaccb74a Issue #2229 - Add top level await tests 2026-02-11 13:54:56 +01:00
Basilisk-Dev 0214893894 Issue #2229 - Add comment regarding JIT to top level await code 2026-02-11 13:54:48 +01:00
Basilisk-Dev 0c2b578ff6 Issue #2229 - add better comments on top level await code 2026-02-11 13:54:41 +01:00
Basilisk-Dev ca66a790ad Issue #2229 - Initial implementation of top level await functionality 2026-02-11 13:54:31 +01:00
Moonchild 74aabee88b Name the Hasher struct definition to align with c++17 standard 2026-02-09 16:06:44 +01:00
Moonchild 7d07f2d2f4 Nullcheck shadowZone in TenuredCell barrier handling 2026-02-09 10:00:31 +01:00
Moonchild cad3893a9d Merge branch 'master' into idle-runnables-rebase
# Conflicts:
#	js/src/builtin/intl/LanguageTagGenerated.cpp
#	js/src/jit/x64/MacroAssembler-x64.cpp
#	js/src/jit/x86/MacroAssembler-x86.cpp
2026-02-08 13:27:39 +01:00
win7-7 0fc81f94e3 Set slice time to 18ms. 15ms causes hang. 18ms seems work well.
Set slice time to 18ms. 15ms causes hang/does not work well with UXP even with idle runnables. 18ms seems work well.
2026-02-01 12:41:30 +02:00
win7-7 403be64558 Set max nursery size in MB instead KB.
Set max nursery size in MB instead KB.
2026-02-01 12:41:19 +02:00
win7-7 37098b3189 1409380 - Simplify HeapSlot to make it trivially copyable remaining parts.
1409380 - Simplify HeapSlot to make it trivially copyable  remaining parts not done before, fixes memory corruption crash.
2026-01-31 21:53:30 +02:00
win7-7 7eb97f12d8 Fixes crash with one website. Found reproducible crash. This fixes it.
Fixes crash with one website. Found reproducible crash. This fixes it.
2026-01-29 17:40:25 +02:00
Moonchild 4fbf18bcaa Merge pull request 'Return Standard Space to Formatted Times with Day Periods' (#2921) from RealityRipple/UXP:space-time into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2921
2026-01-29 02:11:03 +02:00
Moonchild 3a91eabd43 Merge pull request 'Emoji 17.0 Support' (#2884) from RealityRipple/UXP:emoji-17.0 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2884
2026-01-29 01:34:14 +02:00
Moonchild 82ce55edc3 Merge pull request 'Update ICU to v78.1' (#2878) from RealityRipple/UXP:icu-78 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2878
2026-01-29 01:33:41 +02:00
win7-7 621044f3a8 Revert back Mozilla original code, it does not crash or hang.
Revert back Mozilla original code, it does not crash or hang.
2026-01-28 22:24:58 +02:00
win7-7 8c591b9b77 Revert "1376614 - Pass budget to forgetSkippable and return early when budget has been used"
This reverts commit d28a0aef50.
2026-01-28 20:07:23 +02:00
win7-7 432984bd4d Compiles with idle runnables.
Compiles with idle runnables.
2026-01-28 18:14:19 +02:00
win7-7 e445d8d55b Merge branch '1351790-60-GC' into idle-runnables-rebase 2026-01-28 18:05:25 +02:00
win7-7 4ebd0d0d09 Merge branch '1351790-60-GC' into idle-runnables-rebase 2026-01-28 18:05:06 +02:00
win7-7 ef8768fbf1 Revert SATS fully, idle runnables are working use them, faster.
Revert SATS fully, idle runnables are working use them, faster.
2026-01-28 18:04:38 +02:00
win7-7 a211da8c85 Revert "Fixes one of compilation error but templates are still issue even with this approach."
This reverts commit 3098a578cc.
2026-01-28 18:03:05 +02:00
win7-7 7d98e537b0 Revert "Fix for one more compilation error."
This reverts commit d3bc79eb5e.
2026-01-28 18:03:04 +02:00
win7-7 a850437475 Revert "Some fixes."
This reverts commit 9a5010a8e3.
2026-01-28 18:02:20 +02:00
win7-7 e15d6e7f56 Revert "Compiles and does not crash."
This reverts commit 48ba811bd6.
2026-01-28 18:02:18 +02:00
win7-7 046a0811dc Revert "Attempting add CC delay to scheduler."
This reverts commit 374cc99ce2.
2026-01-28 18:01:15 +02:00
win7-7 e9f7b071d1 Revert "Revert "Attempting add CC delay to scheduler.""
This reverts commit 1e0c11e56e.
2026-01-28 18:00:23 +02:00
win7-7 08fb5863a3 Revert "Restore this at least for now due being unsure due 1251463 done after this."
This reverts commit dd92323357.
2026-01-28 18:00:21 +02:00
win7-7 88260a6eed Revert SATS until its fully gone now that idle runnables are working.
Revert SATS until its fully gone now that idle runnables are working.
2026-01-28 17:58:34 +02:00
win7-7 5618549c4e Revert "It seems scheduler is not even used for GC and CC, its returning CollectorSchedule::eNone which is 0/nullptr."
This reverts commit 7ca8a03c57.
2026-01-28 17:56:32 +02:00
win7-7 55a6916831 Revert part 5 also. It does depends on part 4.
Revert part 5 also. It does depends on part 4.
2026-01-28 17:30:19 +02:00
win7-7 ee9bd4cc65 Compiles, crashes.
Compiles, crashes.
2026-01-28 02:05:57 +02:00
win7-7 1f10da9ecd 1455599 - Redo bug 1446693, creating separate AutoTraceSessions instead of expanding one
1455599 - Redo bug 1446693, creating separate AutoTraceSessions instead of expanding one
2026-01-24 22:28:06 +02:00
win7-7 733f480d22 Fix typo.
Fix typo.
2026-01-24 22:23:15 +02:00
win7-7 41adef5bf5 1445196 - Store the atom's pinned flag in the atom to simplify lookup
1445196 - Store the atom's pinned flag in the atom to simplify lookup.
2026-01-24 18:02:53 +02:00
win7-7 2257dc51ce It has been long time tried adjust CC time, try again after hooking scheduler this time.
It has been long time tried  adjust CC time, try again after hooking scheduler this time.
2026-01-23 01:58:23 +02:00
win7-7 3556434039 Implement a callback system for interrupting timed slice budgets for bug #1351790
Trying this again.
2026-01-22 21:58:06 +02:00
win7-7 4b79b5f98c Undo change it breaks compilation and issue is fixed, asserts no longer happen.
Undo change it breaks compilation and issue is fixed, asserts no longer happen.
2026-01-21 15:17:56 +02:00
win7-7 33657b64f3 Add preference for nursery size. DOM aspects were done some time period already.
Add preference for nursery size. DOM aspects were done some time period already.
2026-01-21 15:03:51 +02:00
win7-7 da9e8d4165 This should work without further issues.
This should work without issues like using vector GCPtr in one location then non-GCPtr in another causing issues in tracing.
2026-01-18 17:43:46 +02:00
win7-7 5ad7a156a9 Fix remaining errors without busting compilation.
Fix remaining errors without busting compilation.
2026-01-18 10:38:30 +02:00
win7-7 614787d028 Revert "Fix remaining errors from mixing two different approaches."
This reverts commit 2bc5bb2397.
2026-01-18 10:05:26 +02:00
win7-7 2bc5bb2397 Fix remaining errors from mixing two different approaches.
Fix remaining errors from mixing two different approaches.
2026-01-18 09:29:32 +02:00
win7-7 116229957b Crash is gone. Functionally seems work with indices. Going test with regexp zones and without to see this is ideal solution.
Crash is gone. Functionally seems work with indices. Going test with regexp zones and without to see this is ideal solution.
2026-01-18 08:50:46 +02:00
win7-7 fb2956fb02 Revert "Revert "Attempt fix regexp crash. Not working.""
This reverts commit 7f55d9bbf5.
2026-01-18 05:18:22 +02:00
win7-7 7f55d9bbf5 Revert "Attempt fix regexp crash. Not working."
This reverts commit 7206f041fc.
2026-01-18 02:17:48 +02:00
win7-7 7206f041fc Attempt fix regexp crash. Not working.
Attempt fix regexp crash. Not working.
2026-01-17 17:16:07 +02:00
win7-7 5348db4732 Fix two asserts crashing properly instead bypassing that revealed bigger unsafe objectgroup sweeping during usage issue.
Fix asserts properly instead bypassing that revealed bigger unsafe objectgroup sweeping during usage issue.
2026-01-17 13:31:00 +02:00
win7-7 60f203917b Fix last crashing assert.
Fix last crashing assert.
2026-01-17 04:59:00 +02:00
win7-7 e6c46b9c40 903519 - Reparent JSString from TenuredCell to Cell last missed aspect.
903519 - Reparent JSString from TenuredCell to Cell last missed aspect.
2026-01-16 23:14:41 +02:00
win7-7 5d1d150dc0 903519 - Done fully.
903519 - Change Relocated marker to not confuse string vs object bit, partially done before.
2026-01-16 23:02:33 +02:00
win7-7 69edcc0769 Fix logic not invert that if some registers are left still give extra registry causing slower performance than only doing extra registry when needed.
Fix logic not invert that if some registers are left still give extra registry causing slower performance than only doing extra registry when needed.
2026-01-16 13:18:39 +02:00
win7-7 dac6731cd3 These asserts now work after 903519 - Allocate strings in the nursery if enabled, leaving only one major assert left in jsgc.cpp.
These asserts now work after 903519 - Allocate strings in the nursery if enabled.
2026-01-16 11:54:34 +02:00
win7-7 477725502e Temporary. It no longer crashes with tradera.com and Speedometer 2.1 works with those asserts bypassed. Time re-enable them soon.
Temporary. It no longer crashes with tradera.com and Speedometer 2.1 works with those asserts bypassed. Time re-enable them soon.
2026-01-16 11:41:05 +02:00
win7-7 c4aa29c053 CodeGenerator.cpp missing JIT support for nursery, there was some missing implementation.
CodeGenerator.cpp missing JIT support for nursery, there was some missing implementation.
2026-01-16 11:40:37 +02:00
win7-7 43b93e7b93 Where did this come from?
Where did this come from? It fixes two crashing assertions. Still another crash further down.
2026-01-16 11:40:19 +02:00
win7-7 5270a74f4e 1380030 fully.
1380030 - Remove color constants from public API and replace with an internal MarkColor enum.

1380030 - Simplify and refactor use of isMarked*() methods.

I only had one part of this before: Refactor isMarked() methods into separate methods for each color and any.
2026-01-16 11:40:09 +02:00
win7-7 3b4f0a7b23 903519 - Allocate strings in the nursery if enabled
903519 - Allocate strings in the nursery if enabled, missed change somehow.
2026-01-16 02:19:39 +02:00
win7-7 cb02bcd562 903519 - Strings in the nursery: barriers
Cell.h was missed after headers split to nursery support. Third crash.
2026-01-16 00:06:50 +02:00
win7-7 e23bc876bc Enable nursery strings fixes from 67. Still crashes.
Enable nursery strings fixes from 67. Still crashes.
2026-01-15 21:28:02 +02:00
win7-7 f4de39242f Enable nursery strings.
Enable nursery strings and see to fix crash:

1442481 - Use whole cell buffer to post-barrier string -> string edges
2026-01-15 20:03:46 +02:00
win7-7 7d40f61a9e 1434263 - Refactor JSString to have an IsLinear flag instead of IsFlat.
1434263 - Refactor JSString to have an IsLinear flag instead of IsFlat. Fixes crash.
2026-01-15 19:01:09 +02:00
win7-7 cf8e7cd447 Fixes. Now compiles and links, still crashes at atoms zone similar previous nursery strings.
Fixes. Now compiles and links, still crashes at atoms zone similar previous nursery strings.
2026-01-15 06:50:04 +02:00
win7-7 bb98b67066 903519 - Disable nursery strings in a Zone if too many get tenured among with other fixes, won't fix startup crash assert though.
903519 - Disable nursery strings in a Zone if too many get tenured among with other fixes, won't fix startup crash assert though.

Also small fix for expanding macro correctly.
2026-01-15 05:53:57 +02:00
win7-7 b681a553cf Fixes to VMFunctions.cpp, assert no longer crashes.
Fixes to VMFunctions.cpp, assert no longer crashes.
2026-01-15 05:51:01 +02:00
win7-7 85f6eff03e 903519 - Remove verifier assumption that only objects are in the nursery
903519 - Remove verifier assumption that only objects are in the nursery. This is only relevant after 55 verifier.
2026-01-15 05:48:12 +02:00
win7-7 de707726f2 903519 - Strings in the nursery: barriers, one missed change.
903519 - Strings in the nursery: barriers, one missed change. Still crashes.
2026-01-15 05:47:03 +02:00
win7-7 afc78f5e59 Split up Heap.h to Cell.h and 903519 - Change Relocated marker to not confuse string vs object bit, RelocationOverlay.h aspect.
Split up Heap.h to Cell.h and 903519 - Change Relocated marker to not confuse string vs object bit, RelocationOverlay.h aspect.
2026-01-15 05:46:29 +02:00
win7-7 b653fcac30 CacheIR nursery changes.
CacheIR nursery changes.
2026-01-15 05:43:01 +02:00
win7-7 46e24137a7 1328948 + 1421152 + 903519 forgotten part.
1328948 - add is(), as() to Cell.

903519 - Strings in the nursery: JIT, HeapAPI.h was forgotten.

1421152 - Add a checked cast method to TenuredCell.
2026-01-15 05:42:24 +02:00
win7-7 ddc9649ec9 Resolve 1 missing symbol in linking.
Resolve 1 missing symbol in linking.
2026-01-15 05:40:05 +02:00
win7-7 935e07973b More fixes this almost compiles.. need cherry pick one more change.
More fixes this almost compiles.. need cherry pick one more change.
2026-01-15 05:38:29 +02:00
win7-7 ea11e1a5f4 More fixes this almost compiles.. maybe.
More fixes this almost compiles.. maybe.
2026-01-15 05:37:38 +02:00
win7-7 9e798de9c3 Forgotten change.
Forgotten change.
2026-01-15 05:37:26 +02:00
win7-7 203c22f61c Fixes.
Fixes.
2026-01-15 05:37:14 +02:00
win7-7 d6b5b8d3b2 Further fixes
Further fixes
2026-01-15 05:36:40 +02:00
win7-7 9c8c1c4c5b Fixes.
Fixes.
2026-01-15 05:36:21 +02:00
win7-7 1ebdc48dfd Comment out debug only code and change register types. This will not compile yet though to test how this would work.
Comment out debug only code  and change register types.
2026-01-15 05:36:01 +02:00
win7-7 22fa77d8c5 Fixes.
Fixes.
2026-01-15 05:35:02 +02:00
win7-7 f420827e40 Fixes.
Fixes.
2026-01-15 05:33:56 +02:00
win7-7 20b35e140a 903519 - Implement AutoSuppressNurseryCellAlloc to avoid nursery allocation just before offthread parse startup
903519 - Implement AutoSuppressNurseryCellAlloc to avoid nursery allocation just before offthread parse startup
2026-01-15 05:33:22 +02:00
win7-7 fc9c624ccc 903519 - Split out string nursery pointers from object nursery
903519 - Split out string nursery pointers from object nursery, this was not done before.
2026-01-15 05:32:13 +02:00
win7-7 3e4fea5bcf 1444335 - Nursery allocation is not infallible, even right after collecting the nursery
1444335 - Nursery allocation is not infallible, even right after collecting the nursery. Hoping this solves crash.
2026-01-15 05:31:14 +02:00
win7-7 c5e344b6c5 903519 - Register nursery string buffers to be freed
903519 - Register nursery string buffers to be freed, this was missed somehow before.
2026-01-15 05:30:57 +02:00
win7-7 cfe9b423f0 Bug 903519 - Strings in the nursery: JIT
Bug 903519 - Strings in the nursery: JIT, majority of it was not done before due CodeGenerator.cpp
2026-01-15 05:30:41 +02:00
win7-7 5eb5a8acef Fix more errors.
Fix more errors.
2026-01-15 05:30:15 +02:00
win7-7 85da1cff69 Sigh..
Sigh..
2026-01-15 05:29:20 +02:00
win7-7 69c5099535 Some more fixes.
Some more fixes.
2026-01-15 05:28:09 +02:00
win7-7 482c656612 Bug 903519 - allocate JSStrings and string data in the Nursery
903519 part 2: Reparent JSString from TenuredCell to Cell.

903519 Part 3: Make js::Allocate cast strings to requested type.

903519 Part 4: Force non-atom strings to have their low flag bit set in order to distinguish them from JSObjects in the nursery.

903519 Part 5: Strings in the nursery: allocation.

Mixed reset later.
2026-01-15 05:24:54 +02:00
win7-7 0486dedc04 Various fixes.
Various fixes. INIT_ROPE_FLAGS does not exist in this time of js engine, unsure why it was added. String.h fix  closure. Don't comment out new code in Barrier.h. Mir.h change back to MAryInstruction<4>, since MQuaternaryInstruction does not work and calls MAryInstruction<4> anyway. Note this likely need  parts of 1412912  hopefully solve failing static asserts.
2026-01-15 05:18:48 +02:00
win7-7 734a3e9a6d 1464912 - Add exposeToActiveJS specialization for JSString.
1464912 - Add exposeToActiveJS specialization for JSString. Necessary for nursery.
2026-01-15 05:15:55 +02:00
win7-7 08914564f7 Remaining file updated.
Remaining file updated.
2026-01-15 05:15:22 +02:00
win7-7 e325973198 903519 part 6 to 13 (partially)
903519 Part 6: Strings in the nursery: tracing and tenuring.

903519 Part 7: Strings in the nursery: barriers.

903519 Part 8: Discard nursery keys from EvalCache.

903519 Part 9:  Strings in the nursery: allow any thread to access zone of permanent atoms.

903519 Part 10: Strings in the nursery: MIR node.

903519 Part 11: Change Relocated marker to not confuse string vs object bit.

903519 Part 12: Default nursery strings to off, add ability to enable.

903519 Part 13: Strings in the nursery: JIT, partial due CodeGenerator.cpp differences startin from: // Follow any base pointer if the input is itself a dependent string.

This is due file changed: 1434230: Spectre mitigations for strings
2026-01-15 05:14:52 +02:00
win7-7 166ef47f8a Bug 903519- GC: allocate JSStrings and string data in the Nursery.
903519 part 1: Separate out AllocKinds for nursery-allocatable strings.

Rest of part TBD: Need  1350760 Atomizing strings needs to be faster first.
2026-01-15 04:27:42 +02:00
win7-7 743e5a1a1e 60 level before nursery strings.
1421319 - Split out GCManagedDeletePolicy into its own header.

1434622 - Use a separate lock to protect the shared script data table.
2026-01-15 04:22:43 +02:00
win7-7 dc8457f393 Compiles, links, does not crash. 59 GC.
Compiles, links, does not crash. 59 GC.
2026-01-15 00:13:54 +02:00
win7-7 e53bacb2af Fixes.
Mostly taking care of headers splitting.
2026-01-14 23:15:43 +02:00
win7-7 2ec204594e 59 GC.
59 GC.
2026-01-14 19:32:37 +02:00
win7-7 07416f31a7 58 GC no crashing.
Compiles link no crashing.
2026-01-14 06:30:36 +02:00
win7-7 b6d66f03c2 58 a1 GC. Trying see when issue with atoms started.
58 a1 GC. Trying see when issue with atoms started.
2026-01-14 05:10:42 +02:00
win7-7 0ef6a3cd11 Now it compiles, links and works, apparently 56 GC is stable, 57 next.
Now it compiles, links and works, apparently 56 GC is stable, 57 next.
2026-01-14 03:57:59 +02:00
win7-7 0777604a57 This does work.
This should work. Test gains.
2026-01-14 03:34:12 +02:00
Jon Coppeard e3ee4e213d Bug 1369748 - Refactor GCRuntime::beginMarkPhase r=sfink 2026-01-14 03:27:34 +02:00
win7-7 402b77b0cc 56 GC fixes.
56 GC fixes.
2026-01-14 03:25:32 +02:00
win7-7 4de056537f 56 GC.
Trying narrow when atom crash started between 55 and 60 and if its easy to revert.
2026-01-14 00:38:31 +02:00
win7-7 9e66bf54f8 1345427 - Assertion failure: ins->type() == inputType, at js/src/jit/Lowering.cpp:1440
1345427: Effectively change output type of MNearbyInt when specializing to float32;
2026-01-08 23:52:20 +02:00
win7-7 ddf2f2696f 1324566 - Inspector support for GlobalNameGetter, error fixed, march 28th 2024, there was backport of this but return false was accidentally leftover.
1324566 - Inspector support for GlobalNameGetter, error fixed, march 28th 2024, there was backport of this but return false was accidentally leftover.
2026-01-07 21:16:06 +02:00
win7-7 50b3876078 1344173 - Fix performance cliff involving OBJECT_FLAG_ITERATED and array natives also includes 1323782.
1344173 - Fix performance cliff involving OBJECT_FLAG_ITERATED and array natives.

1323782: Check iterated-flag before proceeding to fast path in Array.prototype.unshift.
2026-01-07 19:57:41 +02:00
win7-7 40a535ebe4 1370210 - obj_propertyIsEnumerable calls non-inlined IsSymbolOrSymbolWrapper
1370210 - Optimize ValueToId and ValueToIdPure to check the common cases first
2026-01-07 17:37:08 +02:00
André Bargull aa6aa7fd4f Bug 1379222 - Avoid [[Get]] for "prototype" property when calling builtin constructors. r=jandem 2026-01-07 11:14:10 +02:00
win7-7 be86c1d176 Accidental addition/regression from may 2025 merge. Took what was not needed and caused multi-threading regression for parsing.
Accidental addition/regression from may 2025 merge. Took what was not needed and caused multi-threading regression for parsing.
2026-01-07 08:43:27 +02:00
win7-7 868d880006 Security fixes toward 105 version.
Security fixes toward 105 version.
2026-01-07 03:04:46 +02:00
win7-7 ae402ea7d0 Security fixes toward 71 version.
Security fixes toward 71 version.
2026-01-07 03:04:46 +02:00
win7-7 413a013916 More security fixes toward 67 version.
More security fixes toward 67 version.
2026-01-07 03:04:46 +02:00
win7-7 c777af090c Somewhat 60 level of security.
Somewhat 60 level of security.
2026-01-07 03:04:46 +02:00
win7-7 7537fb19db Security fixes toward Firefox 58 level but might miss some. Check later.
Security fixes toward Firefox 58 level but might miss some. Check later.
2026-01-07 03:04:46 +02:00
win7-7 938db5d4f4 1354527 - Crash [@ js::jit::RInstructionResults::operator[]]
1354527 - Recover the iterator object when closing during exception handling.
2026-01-07 03:04:46 +02:00
win7-7 78d7cbae94 1352506 - Ion: Automatically call gen->setPerformsCall() if a LIR instruction performs a call
1352506: Remove dead code in the backtracking allocator;

1352506: Automatically setPerformsCall for LIR call instructions.

1352506: Don't conflate need for overrecursed check and static alignment in MIRGenerator;
2026-01-07 03:04:45 +02:00
win7-7 7b1182b162 1331900 - Delete Label's assignment operator.
Hiding it => linking error.
Deleting it => compilation error.
2026-01-07 03:01:37 +02:00
win7-7 1355bf066e Bug 1405457 - Scalar replacement for call objects. r=nbp
Scalar replacement for call objects, should make arrow-declare six-speed test faster.
2026-01-07 03:01:36 +02:00
win7-7 3c1f6618aa 1355155 - Scalar replacement for arrow functions.
1355155 - Scalar replacement for arrow functions.
2026-01-07 03:00:21 +02:00
win7-7 c9aadfae81 1358599 - Use runtime guards for jitcode pre-barriers instead of patchable jumps, leftover/accidental reintroduction by CacheIR backporting.
1358599  - Use runtime guards for jitcode pre-barriers instead of patchable jumps, leftover/accidental reintroduction by CacheIR backporting.
2026-01-06 20:26:31 +02:00
win7-7 7dcf9bd87c 1325480 - Baldr: make WasmInstanceObject::ExportMap a strong edge
1325480 - Baldr: make WasmInstanceObject::ExportMap a strong edge
2025-12-30 14:47:03 +02:00
win7-7 4733c72f73 1339089 - Inline floor/ceil/trunc/nearest for floating-point values when we have adequate SSE support
1339089: Inline floor/ceil/trunc/nearest in Ion when we have sse4.

1339089: Inline wasm::floor/trunc/nearest/round in the baseline compiler too;
2025-12-30 14:17:20 +02:00
win7-7 f5a5a9c670 1316831 - Wasm baseline: Disable bounds checking on constant accesses below the minimum heap length
1316831 - wasm baseline, omit known-good bounds checks

Also includes 1353347 - wasm baseline, properly chop int32 constants to 32 bits.
2025-12-30 13:05:57 +02:00
win7-7 b41ec4cb88 1337444 - wasm: runtime crash involving i64 globals
1337444: Fix regalloc of load/store i64 globals;
2025-12-30 10:26:27 +02:00
win7-7 c37c115515 1335068 - Wasm: Split the global allocation out of the CodeSegment
1335068 - Break wasm globals out of the code segment.
2025-12-30 10:26:26 +02:00
win7-7 7a2faa9022 Bug 1312751 - Merge ARM load and store code for Wasm
1312751 - Refactor wasm{Load,Store}{,I64} to MacroAssembler-arm.

1312751 - Wasm baseline, use refactored ARM load/store methods.
2025-12-30 05:05:26 +02:00
win7-7 6b6e768d34 1330339 - Assertion failure: !done() && debugEnabled(), at js/src/wasm/WasmFrameIterator.cpp:223
1330339 - Ensure wasm debug is enabled when observesFrame is queried.
2025-12-30 03:36:19 +02:00
win7-7 5473390f2a 1330491 - Assertion failure: maybeBytecode, at js/src/wasm/WasmCode.cpp:581 with Debugger
1330491 - Always provide wasm bytecode for debuggable instance.
2025-12-30 03:32:40 +02:00
win7-7 c49182a32c 1331064 - Assertion failure: throwing, at js/src/jscntxt.cpp:946 with wasm and Debugger
1331064 - Ignore wasm onExceptionUnwind events in JSTRAP_ERROR state.
2025-12-30 03:29:33 +02:00
win7-7 b3244bc4e3 1331592 - Assertion failure: data_.state_ == INTERP, at js/src/vm/Stack.cpp:495 with Debugger and wasm
1331592 - Skipping wasm frames during debugger eval.
2025-12-30 03:27:00 +02:00
win7-7 6ce674cbbb 1332493- Crash [@ js::wasm::Instance::object]
1332493 - Initialize wasm::DebugFrame before stack overflow check.
2025-12-30 03:22:26 +02:00
win7-7 83f856312d 1342497 - Baldr: store current frame, not previous frame, in wasm::FrameIterator
1342497 - Baldr: store current frame, not previous frame, in wasm::FrameIterator.
2025-12-30 02:30:49 +02:00
win7-7 10a4f5b7fd 1330489 - Crash [@ mozilla::UniquePtr<JS::ubi::EdgeRange, JS::DeletePolicy<JS::ubi::EdgeRange> >::operator->] with wasm and Debugger
1330489 - Ignore imports for wasm debug frames and discard frames in activation on throw.
2025-12-30 02:06:22 +02:00
win7-7 e86a5e51f9 1331452 - jit-test/tests/debug/wasm-06.js failures with CGC builds
1331452 - Keep scope in a slot in WasmFunctionCallObjects.

1331452 - Followup: hazard fix.
2025-12-30 01:37:40 +02:00
win7-7 f10ccfe95d 1286948
1286948 - Adds debug mode for WASM baseline compiler.

1286948 - Adds scope and environment for wasm calls (Adds artificial JS scope and environment for wasm frames. That allows
debugger to properly handle call stack).

1286948 - Adds prolog and epilog debug traps and handlers (Using toggled call/traps to invoke handler to process enter and leave
frame events).

1286948 - onEnterFrame/onLeaveFrame wasm events and callstack (Handles onEnterFrame and onLeaveFrame trap handling. The FrameIter is used in
the DebuggerFrame instead of ScriptFrameIter. The debug wasm frame is created
and can be found on callstack during those event).

Does not compile without 1331452 - Keep scope in a slot in WasmFunctionCallObjects along with 1335773 - Inspects wasm function locals to build
2025-12-30 00:41:22 +02:00
win7-7 e2f4479519 1326027: Remove RawF32 and RawF64;
1326027: Remove RawF32 and RawF64;

I did not do 1326027: include SSE2 flags in autospider due they were not even in js/src/moz.build so does SSE2 matter to UXP?
2025-12-29 17:12:53 +02:00
win7-7 a9b2d27c09 1342045: Allow wasm::Memory of size 2**32
1342045: Allow wasm::Memory of size 2**32
2025-12-29 15:40:26 +02:00
win7-7 ce005e09e2 Bug 1332772 - Baldr: tweak memory/table limits
1332772 - Baldr: tweak memory/table limits
2025-12-29 15:40:26 +02:00
win7-7 a93c8aa52e Bug 1324008 Baldr: tweak internal limits to match other browsers
1324008 - Baldr: tweak internal limits to match other browsers.
2025-12-29 15:40:25 +02:00
win7-7 f382876cf1 1329096 + 1316814
1316814 - Split wasm iterator's readEnd and popEnd.

1316814 - wasm baseline, use the iterator's control stack.

1329096 - Wasm baseline, remove the label pool and use NonAssertingLabel instead.

 1316814 is for preparation later for 1277562 (
Wasm: tiered compiler).
2025-12-29 05:52:21 +02:00
win7-7 dd0036f86d 1326160 Wasm baseline: Division by nonzero constants can omit divide-by-zero check
1326160 - Omit divide by zero and overflow checks for some constants
2025-12-29 05:52:12 +02:00
win7-7 c8ccc86f8f 1316803 Wasm baseline: fold constant rhs into integer operations
1316803 part 1 - fold constant rhs for add/sub/shift/rotate/bitwise-ops.

1316803 part 2 - optimize division for constant rhs.
2025-12-29 05:52:04 +02:00
win7-7 8b606eb9eb 1318252 - Baldr: Serialize Import's DefinitionKind
Otherwise, all imports are treated as function imports after deserialization. Fixes crash with 1321122.
2025-12-29 05:51:54 +02:00
win7-7 ab5a076455 1329018 Wasm: Move validation to helper threads, also 1317678
1329018 - Part 1: Wasm: Add plumbing for compile threads to report validation errors.

1329018 - Part 2: Wasm: Move function validation to helper threads.

Also: 1317678 - don't unconditionally unroll stack probe loop
2025-12-29 05:51:43 +02:00
win7-7 7d6b67362a 1321122 - Baldr: add Module.customSections.
1321122 - Baldr: add Module.customSections.

As added here:
  https://github.com/WebAssembly/design/pull/877
2025-12-29 05:51:29 +02:00
win7-7 4ad8f1da3d Don't undo progress on batch compilation accidentally.
Don't undo progress on batch compilation accidentally.
2025-12-29 05:51:17 +02:00
win7-7 9e359c59f6 1316634 - Implement efficient WebAssembly.validate
1316634: Use ModuleEnvironment in the FunctionDecoder.

1316634: Move function validation to WasmBinaryFormat.h/cpp && rename it WasmValidate.

1316634: Implement efficient WebAssembly.validate

1316634: Use CheckedInt before checking against maximum limits
2025-12-29 05:50:58 +02:00
win7-7 98454f6882 1455703: Check for OOM in AstDecodeModuleTail
1455703: Check for OOM in AstDecodeModuleTail.
2025-12-29 05:50:47 +02:00
win7-7 53373d080d 1317319 wasm: Factor out section decoding, Part 2
1317319: Factor out Table section decoding.

1317319: Factor out Global section decoding.

1317319: Factor out Export section decoding.

1317319: Factor out Start section decoding.

1317319: Factor out Elem section decoding.

1317319: Move sections decoding around to follow their order in the binary.

1317319: Rename ModuleGeneratorData to ModuleEnvironment.

1317319: Embed most section decoding under DecodeModuleEnvironment.

1317319: Account imported globals when checking against the maximum number of globals.

1317319: Fix BinaryToAST function validation.

Fix error losing PrevEncodingVersion when refactoring for 1317319  part 2.

1317319: Tweak AstDecodeFunctionBody;
2025-12-29 05:50:27 +02:00
win7-7 75797914d3 1298139 - Make LoopUnroller code handle OOM correctly
1298139 - Make LoopUnroller code handle OOM correctly
2025-12-27 15:47:39 +02:00
win7-7 e73af388e7 1331414: Adding javascript.options.jit.full_debug_checks in about:config for people that want to use debug builds for surfing with less slowdown
1331414: Adding javascript.options.jit.full_debug_checks in about:config for people that want to use debug builds for surfing with less slowdown
2025-12-27 14:12:51 +02:00
win7-7 dd5bc68ead Stability fixes backporting.
1438645 - Prevent XDR from reading past its buffer.,

1325345 - Add compartment asserts to JS_FireOnNewGlobalObject and other APIs.

1339411 - Rewrite and optimize object allocation paths, NatibeObject.h, NativeObject-inl.h and jsiter.cpp were not updated use  JS::Result for stability, do that now.
2025-12-27 14:12:51 +02:00
win7-7 a6962a692c 1370922 - [Ion] Handle allocation failure when generating Math.min.
1370922 - [Ion] Handle allocation failure when generating Math.min.
2025-12-27 08:08:45 +02:00
win7-7 33f89a1439 This change to add 1316078 part 4 - Add a script decoder as a valid off-main-thread parse-task was missed.
This change to add 1316078 part 4 - Add a script decoder as a valid off-main-thread parse-task was missed.
2025-12-27 04:40:42 +02:00
win7-7 93f9f7d24a Typo fix.
Typo fix.
2025-12-26 11:52:08 +02:00
win7-7 55a63ec46c Mix 55 js engine backporting mostly bugfixes.
1369337 - Forcibly create length and @@iterator properties for arguments when redefining.

1369680 - Use HasOwnProperty when resolving lazy properties to avoid triggering proxy traps in the proto-chain.

1319443 - Fix GlobalScopes XDR to encode global function bindings.

1335571 - Use template craziness to allow covering more cases with compartment asserts.
2025-12-26 10:47:29 +02:00
win7-7 f3cecfa567 Performance improvements jit
1322724: IonMonkey - Add the hit count information on the extra false branch blocks

1322932: IonMonkey - Only iterate the backedge of the inner-loop when it has already be visited

1329901 - Remove expensive isObservableOperand() loop guards.

1330667: IonMonkey - Create a new constant for every optimized arguments use.

1342016 - Fast-path for isObservableSlot().

1388045 - Branch Pruning: Check the compile info associated with the resume point.
2025-12-23 01:04:58 +02:00
win7-7 e3885f523f 1357680 and followup security fixes.
1357680 part 1 - Track Ion-inlined scripts explicitly so we can inline functions with unknown properties.

1357680 part 2 - Remove unnecessary setNewGroupUnknown call in SetClassAndProto.

1357680 part 3 - Don't mark the new group as having unknown properties when changing an object's proto.

1365518 - Fix polymorphic inlining to work correctly for functions that had their group/proto changed.

1368570 - Fix js::FinishCompilation to handle OOM correctly.

1395919 - Don't copy the unknown-properties flag in AddPropertyTypesAfterProtoChange.

1544386 part 1 - Call ElementAccessHasExtraIndexedProperty instead of ArrayPrototypeHasIndexedProperty when inlining array natives.

1538006 - Propagate unknownProperties when changing prototype.

1538006 - Don't emit unbarriered writes to an object if its group might change.
2025-12-23 01:04:58 +02:00
win7-7 b7be1f6c2b Two lines in this file were missed when doing 1342856 - Optimize volatile register spilling for C++ calls from IC stubs
Two lines in this file were missed when doing 1342856 - Optimize volatile register spilling for C++ calls from IC stubs, fixed now.
2025-12-23 01:04:58 +02:00
win7-7 140f70940c Performance not previously done CacheIR changes.
1331136 - Handle more StringChar cases with ropes in CacheIR.

1325358 - Reuse stack-slots, that we couldn't pop, for spilling in CacheIR.
2025-12-22 12:25:25 +02:00
win7-7 69d5ace8fd Assert fixes and sec-fix.
Bug 1335146: IonMonkey - Don't do flow-aa on blocks without entry predecessor.

1329665 - Use fallible allocator in FlowAliasAnalysis::saveStoreDependency.

1329651: IonMonkey - Ensure ballast in EliminateDeadResumePointOperands.

Sec-fix: 1355050 - Root the RegExpShared in RegExpMacroAssembler

1375436: Assertion failure: throwing, at js/src/jscntxt.cpp:1466 with Debugger and async

Fix typo while at it in CodeGenerator.cpp
2025-12-22 11:40:21 +02:00
win7-7 4c8f86d478 Revert "Issue #2847 - Update tests and toolkit CSS to account for windows-win11"
This reverts commit da7dff0437.
2025-12-21 22:30:17 +02:00
win7-7 d7e22cf281 Revert "Issue #2847 - Extend -moz-os-version media query with win11. (re-land)"
This reverts commit 2c321e2baf.
2025-12-21 22:30:12 +02:00
win7-7 7082185f68 Revert "Issue #1843 - Clean up WindowsVersion.h"
This reverts commit b2ddd84ac6.
2025-12-21 22:29:48 +02:00
win7-7 62ea27545b Revert "Issue #1843 - Refactor IsWindowsBuildOrLater()"
This reverts commit de0eb45320.
2025-12-21 22:29:46 +02:00
win7-7 5fa3f455ac Remove template.
Remove template. This did not exist in 55 js engine due multi-threading changes and causes build bustage. To be merged soon previous commit.
2025-12-21 21:01:06 +02:00
win7-7 6b741c8822 Master merge.
Master merge. .setStreams(streams) was missing Issue #1442 - Part 2: Add a run-time preference for toggling the streams API one part somehow get that in now also.
2025-12-21 07:24:44 +02:00
win7-7 d22bb11b4a Fixes.
Fixes.
2025-05-08 22:50:55 +03:00
win7-7 bc46ede454 Master merge.
Master merge.
2025-05-08 22:09:17 +03:00
win7-7 feff5b6048 Part of previous merge.
Part of previous merge.
2025-01-22 00:20:12 +02:00
win7-7 eae6d323b2 Merge remote-tracking branch 'Upstream/master' into scheduling-alternative-approach-to-idle-runnables-performance-gains-if-this-works 2025-01-22 00:01:03 +02:00
win7-7 e394a75a94 Fix.
Fix.
2024-09-28 00:21:43 +03:00
win7-7 59dfe1e3f0 Merge branch 'master' into scheduling-alternative-approach-to-idle-runnables-performance-gains-if-this-works 2024-09-27 23:46:26 +03:00
win7-7 d125c305fb Merge branch 'master' into scheduling-alternative-approach-to-idle-runnables-performance-gains-if-this-works 2024-07-30 12:54:23 +03:00
win7-7 28af6c763b Revert "1294042 - Implement the folding of MPow"
This reverts commit 68518438a3.

Major performance regression, not worth of taking in.
2024-05-24 01:47:01 +03:00
win7-7 22517596f4 1388014 - LIRGenerator/CodeGenerator snapshot code should be faster
1388014 part 1 - IonMonkey: Devirtualize MResumePoint::getOperand function calls.

1388014 part 2 - IonMonkey: Simplify RValueAllocation hash function.
2024-05-23 23:56:47 +03:00
win7-7 68518438a3 1294042 - Implement the folding of MPow
1294042 - Implement constant folding for MPow.

Fold MPow instructions that have constant `x` and `p` arguments.
2024-05-23 16:12:04 +03:00
win7-7 c11bc29b86 1368626 - NativeSetProperty should have a fast-path when adding a new property to avoid unnecessary property lookups
1368626 - Avoid duplicate lookups when setting a new property.
2024-05-23 12:45:48 +03:00
win7-7 0e468a6462 1367815, only GC was added assert but ProxyObject.cpp was not changed.
Testing.1367815, only GC was added assert but ProxyObject.cpp was not changed.
2024-05-23 00:37:23 +03:00
win7-7 f4a3412f35 1400278 - Fix non-unified build bustage.
1400278 - Fix non-unified build bustage.

Style check bustage fix also.
2024-05-23 00:37:23 +03:00
win7-7 82476e071d 1333757 - one assert was missed.
1333757 - one assert was missed.
2024-05-23 00:37:23 +03:00
win7-7 fedca13522 1324002 - two missed assert changes.
1324002 - two missed assert changes.
2024-05-23 00:37:23 +03:00
win7-7 de91b9b7ad 1360372 - Avoid rooting hazard when entering atoms compartment
This patch avoids a rooting hazard involving the atoms compartment. There is code in jsatom.cpp that enters the atoms compartment while unrooted pointers are on the stack. Now that enterZoneGroup can potentially yield, this leads to a rooting hazard. This patch avoids the hazard by using a totally separate path that avoids enterZoneGroup when entering the atoms compartment.
2024-05-23 00:37:22 +03:00
win7-7 7ca8a03c57 It seems scheduler is not even used for GC and CC, its returning CollectorSchedule::eNone which is 0/nullptr.
Make this work.It seems scheduler is not even used for GC and CC,

Hopefully actually make scheduler used for CC and GC.. instead merely returning 0/nulltpr thus not scheduling GC/CC at all using undefined setting.

Further attempt to hook this up to GC and CC hopefully correctly.

TriggerGCOrGCSlice definition cannot be eGC due 3 values it could be.

Same goes to IsGCScheduled unless use || that it can be any of 3 values.

Use 3 values it can be.
2024-05-23 00:37:22 +03:00
win7-7 e11973672e Attempting add CCDelay again making it equal to NS_CC_DELAY to schedule.
Attempting add CCDelay again making it equal to NS_CC_DELAY to schedule.

Assert for CCDelay, also makeCCDelay similar order as original NS_CC_DELAY, before ForgetSkippable.
2024-05-23 00:37:22 +03:00
win7-7 bc98ad1fe4 Trying adjust some functions. nsIEventTarget does not exists until later due xpcom changes that are not ported.
Trying adjust some functions. nsIEventTarget does not exists until later due xpcom changes that are not ported.
2024-05-19 01:10:57 +03:00
win7-7 ee75386daa Revert "Trying add overrides back."
This reverts commit 2b77ab0100.
2024-05-18 23:05:05 +03:00
win7-7 2b77ab0100 Trying add overrides back.
Trying add overrides back.
2024-05-18 22:56:57 +03:00
win7-7 8068ca29b9 Removing #ifdef RELEASE_OR_BETA. Doubt it will allow compile this but whatever might as well test..
Removing  #ifdef RELEASE_OR_BETA. Doubt it will allow compile this but whatever might as well test..
2024-05-18 22:52:24 +03:00
win7-7 9d4228688b 1455709 - Assertion failure: bytes_ >= bytesAtStartOfGC_, at js/src/gc/GC.cpp:2040
1455709 - Assertion failure: bytes_ >= bytesAtStartOfGC_, at js/src/gc/GC.cpp:2040
2024-05-18 03:46:56 +03:00
win7-7 dd92323357 Restore this at least for now due being unsure due 1251463 done after this.
Restore this at least for now due being unsure due 1251463 done after this removing timer making scheduling of it not possible and thus removing definition removing it entirely even though definition was still left after 1251463.
2024-05-17 15:57:10 +03:00
win7-7 1e0c11e56e Revert "Attempting add CC delay to scheduler."
This reverts commit 374cc99ce2.

Won't work. Due lack of definition later.
2024-05-17 15:44:53 +03:00
win7-7 374cc99ce2 Attempting add CC delay to scheduler.
Attempting add CC delay to scheduler.
2024-05-17 15:39:29 +03:00
win7-7 a30f08efb9 Attempting adjust settings. Hoping that would make this branch more usefull without either over-usage of memory or lack of gains.
Attempting adjust settings. Hoping that would make this branch more usefull without either over-usage of memory or lack of gains.
2024-05-17 15:11:31 +03:00
win7-7 9686600b0d Trying default settings.
Trying default settings.

Nope memory usage keep raising but not without this branch.
2024-05-17 01:09:34 +03:00
win7-7 2f4b351977 Revert "Try adjust CC also."
No longer seems fit with recent changes.

Try partial revert instead
2024-05-17 00:53:47 +03:00
win7-7 48ba811bd6 Compiles and does not crash.
Compiles and does not crash. Anything further unsure for testing.

Potentially performance gains in terms of significantly less pausing/better scheduling for async slow GC and CC tasks. Still unsure overall impact for memory usage tradeoff etc.
2024-05-17 00:20:35 +03:00
win7-7 9a5010a8e3 Some fixes.
RuntimeService.cpp is now issue compiling.
2024-05-17 00:20:35 +03:00
win7-7 d3bc79eb5e Fix for one more compilation error.
Fix for one more compilation error.

nsCancelableRunnable no longer exists. its CancelableRunnable now.

This still won't compile due nsCycleCollectorTraceJsHelpers.cpp undeclared identifier, identifier not found, AddToCCKind not being member of Mozilla.
2024-05-17 00:20:35 +03:00
win7-7 3098a578cc Fixes one of compilation error but templates are still issue even with this approach.
Fixes one of compilation error but templates are still issue even with this approach.
2024-05-17 00:20:35 +03:00
win7-7 1a2d14049a 1168990
1168990  attempt. Mozilla should be ashamed for  old system with one liner copying or numbered lines when pasting attachement (one that never got into central or earlier pushed so its attachement only is outdated system)

eForgetSkippable should be same as setting changed before.
2024-05-17 00:20:33 +03:00
win7-7 c092978d4e Seems overrides are not necessary for this version unlike for Mozilla since they do not override base class memebers anyway?
Seems overrides are not necessary for this version unlike for Mozilla since they do not override base class memebers anyway?
2024-05-16 15:30:11 +03:00
win7-7 4452886433 Fix idle runnable DOM issues 1367905 fixes.
Fix idle runnable DOM issues 1367905 fixes.

Sadly this still does not compile. It just get further.

nsThreadUtils.cpp is still not fully fixed and nsCOMPtr.h has some conversion errors.
2024-05-16 06:06:41 +03:00
win7-7 e26432bd41 Fix compilation of do_CreateInstance
Fix compilation of do_CreateInstance.
2024-05-16 05:25:40 +03:00
win7-7 cbef4215c1 Fallout from mozilla version of file.
Fallout from mozilla version of file.
2024-05-16 03:20:04 +03:00
win7-7 410470b5dd Part 4 could not suck more.
Part 4 could not suck more.

Sigh..

do_CreateInstance where was this defined so identifier is found..
2024-05-16 02:14:57 +03:00
win7-7 af55a08cb8 1325254 - optimize TimerThread data structures
1325254 P1 Make TimerThread::mTimers store RefPtr<nsTimerImpl> objects.

1325254 P2 Make TimerThread list store an entry struct and just drop nsTimerImpl ref on cancel.

1325254 P3 Sort TimerThread list as a binary heap.

1325254 P4 Dynamically allocate Entry structs stored in TimerThread::mTimers.

1325254 P5 Make nsITimer::Cancel() O(c).
2024-05-16 01:38:37 +03:00
win7-7 c4a56e826c Hmph.. another issue due needing 1325254 (which does not just work) or figuring out way get rid of Value.
Hmph.. another issue due needing 1325254 or figuring out way get rid of Value.
2024-05-16 01:32:32 +03:00
win7-7 7773a52aea Just import file from Mozilla.
Just import file from Mozilla.

It does help with templates but of course there is another issue.
2024-05-16 01:28:45 +03:00
win7-7 347cabe474 1358476, add support for timeout when doing idle dispatch
Templates suck. I cannot make this work likely.
2024-05-16 00:51:08 +03:00
win7-7 cf48056359 1311425 - Make requestIdleCallback aware of timeouts.
Prepare for handling several sources of idleness.

Make idle callbacks aware of nsITimers.

Add pref for how far into the timer queue.

1311425 - Avoid expiration timers when scheduling idle runnables.

review comment fix to ensure low priority timers aren't taken into account when calling NS_GetTimerDeadlineHintOnCurrentThread.
2024-05-16 00:38:51 +03:00
win7-7 bd5e4f8def 1366750 - Rename nsIIncrementalRunnable to nsIIdleRunnable
1366750 - Rename nsIIncrementalRunnable to nsIIdleRunnable.
2024-05-16 00:38:38 +03:00
win7-7 7fad0769a6 1371242 - Investigate if CC slices could use idle periods more likely
1371242, try to run CC slices more likely during idle periods.
2024-05-16 00:38:20 +03:00
win7-7 75fe504c42 I might revert this depending what it does on outside Android in memory usage since its Android relevant.
1397864, put back the higher GC budget when GC is triggered by a timer
2024-05-16 00:38:09 +03:00
win7-7 851ad0bb4b 1368972 - Increase slice time for long-running incremental GCs
1368972 - Increase slice time for long-running incremental GCs when CC has tried to run.
2024-05-16 00:37:56 +03:00
win7-7 d28a0aef50 1376614 - Pass budget to forgetSkippable and return early when budget has been used
1376614 - Pass budget to forgetSkippable and return early when budget has been used,
2024-05-16 00:37:45 +03:00
win7-7 f556ce369c 1373067 - Ensure CC isn't started too often
1373067 - Ensure CC isn't started too often.
2024-05-16 00:37:35 +03:00
win7-7 04f7faa060 1367905 - Try to run GC/CC slices, including forgetSkippable, during idle time
1367905 - Try to run GC/CC slices, including forgetSkippable, during idle time.

1367905 - Try to run GC/CC slices, including forgetSkippable, during idle time, tweaks to keep reftest memory usage lower.
2024-05-16 00:37:23 +03:00
win7-7 046ec8015b 1436697 - Heap growth factor limits are too low
1436697 - Fix GC heap growth factor limits.
2024-05-15 15:37:37 +03:00
win7-7 545dc241fe Merge branch 'master' into Try-increase-CC-timing 2024-05-10 21:13:54 +03:00
win7-7 58d0f9bb64 1314169 - Move the WasmFaultHandler to last priority on Windows ASan builds.
Fix ASAN. It no longer crashes at start.

Win64 ASan relies on a VectoredExceptionHandler to create shadow memory regions on demand.

If WasmFaultHandler gets the exception first, it can itself fault while looking at shadow memory, leading to an infinite recursion.

Unfortunately, due to an ordering problem, we also have to disable the MemoryProtectionExceptionHandler when we do this.
2024-05-10 21:09:40 +03:00
win7-7 081dbf1e22 1341889 - Add some other checks to determine where realloc is going wrong
1341889 - Part 1: Add more checks during reallocation to rule out other possibilities.

1341889 - Part 2: Add a hazard suppression for malloc_usable_size.
2024-05-10 19:34:17 +03:00
win7-7 8550df99d4 1329499 - Extend PageProtectingVector to detect poison patterns + 1332594 - Detect poison in AssemblerBuffer resulting from calling realloc
1329499 - Part 1: Detect the jemalloc freed memory poison pattern during append calls.

1329499 - Part 2: Keep outside actors from messing with our old buffer during realloc.

1332594 - Part 1: Simplify PageProtectingVector and make it initialize new buffers.

1332594 - Part 2: Check AssemblerBuffer for corruption during realloc.
2024-05-10 19:34:17 +03:00
win7-7 8a230e9ca9 Revert "1675153"
This reverts commit dc6b803b6a222646a517caed538a64ebb2db2b64.
2024-05-10 19:34:17 +03:00
win7-7 5a133b0282 1341093 - Some of this was missed when working on malloc incremental trigger while taking one part.
1341093 - Transfer malloc bytes when zones are merged.
2024-05-10 19:34:16 +03:00
win7-7 2e03fc2828 1393597 - NotifyOffThreadScriptLoadCompletedRunnable hangs a lot
1393597 - Remove FinishIncrementalGC when merging compartments.
2024-05-10 19:34:16 +03:00
win7-7 3b323765e6 1371908 - GlobalHelperThreadState::mergeParseTaskCompartment finishes GC at random times
1371908 - When merging compartments only finish an ongoing GC if it affects the destination compartment.
2024-05-10 19:34:16 +03:00
win7-7 5c8fb04c73 1406438 - GCRuntime::allNonEmptyChunks should be called under the GC lock
1406438 - Ensure GC lock held when iterating all non-empty chunks.
2024-05-10 19:34:16 +03:00
win7-7 67c7fd3a35 1343363 - RegExp.prototype[@@replace] needs to clone input regexp for elem-base path
1343363 - Check RegExp wasn't modified in RegExp.p.@@replace global elem-base optimized path.
2024-05-10 19:34:16 +03:00
win7-7 f5f4e7e733 1359421 - Simplify/optimize SharedContext::isFunctionBox
1359421 - Simplify/optimize SharedContext::isFunctionBox by removing an unnecessary virtual call.
2024-05-10 19:34:16 +03:00
win7-7 cacf3fd950 1371097 - String.replace() could be faster
1371097 - Change sRopeMatchThresholdRatioLog2 from 5 to 4 to flatten less eagerly.
2024-05-10 19:34:16 +03:00
win7-7 602611512b 1371215 - Some string matching improvements
1371215 part 1 - Use the memchr optimization on OS X too, as it's fast now.

1371215 part 2 - Remove FirstCharMatcher16bit as it's not used much and has some perf issues.

1371215 part 3 - Optimize and simplify Matcher a bit more.
2024-05-10 19:34:16 +03:00
win7-7 c3b55c8dc9 1370208 - Inline Boolean when called as a function
1370208 - Inline Boolean constructor when called as a function.
2024-05-10 19:34:16 +03:00
win7-7 3a67447109 1351947 - Skiplist tower height probability distribution is skewed
1351947 - Remove bias in skiplist tower height.

This was generating a random int, counting number of consecutive low-order bits, and returning max(that, 1), which would result in a 3/4 chance of returning 1, 1/8 of returning 2, 1/16 of returning 3, etc. But we don't want the spike in probably at height 1. So instead, just add one to the number of bits to get a plain ½^i distribution of i=1..MAX_HEIGHT.
2024-05-10 19:34:16 +03:00
win7-7 2ce9f8a373 1365793 - JSONParser::readString() is slower than it needs to be on Windows because of isxdigit()
1365793 - JSONParser::readString() is slower than it needs to be on Windows because of isxdigit().
2024-05-10 19:34:15 +03:00
win7-7 6be77085b3 1346543.
1346543.
2024-05-10 19:34:15 +03:00
win7-7 d0f902c09c 1356207 - Optimize ToLength better with Ion
1356207 - Optimize self-hosted ToLength better with Ion.
2024-05-10 19:34:15 +03:00
win7-7 9db2445b6e 1354974 - Array.slice(2**31) is always an empty array
1354974: Handle array indices greater than 2^31-1 when collecting indices for Array.prototype.slice.
2024-05-10 19:34:15 +03:00
win7-7 e1ddb6f032 1344476 - Add helper function to emit JSOP_POP or JSOP_POPN for given amount
1344476 - Add BytecodeEmitter::emitPopN to emit shorter bytecode for given pop count.

Actually use this helper function instead just having added it before already.
2024-05-10 19:34:15 +03:00
win7-7 4056cd2aef 1354554 - Remove iterator result object from the stack before the back edge in for-of loop to optimize more in JIT
1354554 - Remove iterator result object from the stack and place IteratorNext at the top of the loop to avoid having unnecessary values at the backedge.
2024-05-10 19:34:15 +03:00
win7-7 122044f0b7 1354212: Fix source representation for async generators created through AsyncGenerator intrinsic.
1354212: Fix source representation for async generators created through AsyncGenerator intrinsic.

For ASAN testing. I don't care fixing tests.
2024-05-10 19:34:15 +03:00
win7-7 eeb2e3e1cc 1357330.
1357330.
2024-05-10 19:34:15 +03:00
win7-7 12bfb1535d 1358300 - Harmless (?) underflow in ArrayBufferObject::create()
1358300 - Fix underflow resulting in wasted space for 0-byte ArrayBuffer.

Hoping this fixes ASAN, if not back it out.
2024-05-10 19:34:15 +03:00
win7-7 1ee39fdabd 1366696 - Small performance improvements for RegExp.prototype.@@split and RegExp.prototype.@@replace
1366696 - Part 1: Only create new splitter if sticky flag is present in input regexp.

1366696 - Part 2: Improve performance of RegExp.prototype.@@replace with non-global regexp.

1366696 - Part 3: Improve performance of RegExp.prototype.@@replace with global regexp.

1366696 - Part 4: Remove unnecessary rooting in SelfHosting.cpp for return values
2024-05-10 19:34:15 +03:00
win7-7 998b9684a4 1368344 - Disable GC zeal in testUnbarrieredEquality.
1368344 - Disable GC zeal in testUnbarrieredEquality.
2024-05-10 19:34:14 +03:00
win7-7 79aba03ab0 1352006 - Inline NewArrayIterator in Ion + 1367088 - Improve StringIterator performance
1352006 - Inline NewArrayIterator in Ion.

1367088 - Part 1: Generalize NewArrayIterator so it can be reused for other iterator types.

1367088 - Part 2: Inline NewStringIterator in Ion.

1367088 - Part 3: Add inline paths when calling String.fromCodePoint with non-Latin1 code points.
2024-05-10 19:34:14 +03:00
win7-7 3191c17824 1329113 - AutoCloseIterator::~AutoCloseIterator ignores the return value of CloseIterator
1329113 - Use PropertyIteratorObject* in AutoCloseIterator.
2024-05-10 19:34:14 +03:00
win7-7 a6698ed0ee 1331350 - IonMonkey: Fuse BitAnd, Compare and Test into BitAndAndBranch
1331350 - Fuse BitAnd, Compare and Test into BitAndAndBranch.
2024-05-10 19:34:14 +03:00
win7-7 0c46838c35 1354275 - Ion: Inlining native calls need resume points if they throw
1354275 - Fix handling of Array() throwing in Ion
2024-05-10 19:34:14 +03:00
win7-7 88d1a5d3cc 1343723 - Crash [@ js::jit::MachineState::read] involving Promise
1343723 - ResumePoint not needed for MNewLexicalEnvironmentObject.
2024-05-10 19:34:14 +03:00
win7-7 4d6b81fb3d 1273858 - Ion-compile JSOP_PUSHLEXICALENV/JSOP_POPLEXICALENV
1273858 - Support LexicalEnvironmentObjects during Ion bailout.

1273858 - Ion-compile JSOP_PUSHLEXICALENV/JSOP_POPLEXICALENV.

1273858 - Ion-compile JSOP_FRESHENLEXICALENV/JSOP_RECREATELEXICALENV.
2024-05-10 19:34:14 +03:00
win7-7 951f46cfe3 1318677 part 4.
1318677 part 4 - Use a smaller enum representation for js::jit::AbortReason. Part 4 was missed before.
2024-05-10 19:34:14 +03:00
win7-7 8026ebd0d8 1356424 - Assertion failure: numFailures_ > 0 (numFailures_ should not overflow), at js/src/jit/ICState.h:113
1356424 - Fix DoSetElemFallback to try to transition before attaching an add-slot stub.
2024-05-10 19:34:14 +03:00
win7-7 9aaf4cfda7 1335862 - Implement mayResolve for arguments objects
1335862 - Implement mayResolve for arguments objects.
2024-05-10 19:34:13 +03:00
win7-7 614ba23221 Try adjust CC also.
See if this changes pausing or not if you delay CC after major GC to start also after 1 minute instead 6 seconds.

Combination of CC with GC.
2024-05-10 19:34:13 +03:00
win7-7 dd846dc7fa 1675153
1675153. In UXP settings is in DOM.

Try increase delay to 5 min.

It does work to stop pausing for 5 minutes but causes even bigger pausing after delay period ends.
2024-05-10 19:34:13 +03:00
win7-7 6b4870eb46 1575895 - Don't start GC slices due to malloc allocation if we're already collecting the zone.
At some point we can think about triggering incremental slices here the way we do for the GC heap allocations but for now it's simplest to just not trigger any more slices if we're already allocating.

 This is different to what happens in maybeAllocTriggerZoneGC where we have a delay between triggering slices implemented with gcDelayBytes.

We don't check this threshold on every malloc allocation, but this could still result in us doing back-to-back slices, effectively a non-incremental GC.
2024-05-10 19:34:13 +03:00
win7-7 29b1a4f052 1384010 - Create prefs for allocation threshold factors.
1384010 - Create prefs for allocation threshold factors.
2024-05-10 19:34:13 +03:00
win7-7 cc0b094ca0 1554954 + 1570905
1570905 - Rework the GC triggers to make the incremental trigger the default and the non-incremental trigger some factor of this.
2024-05-10 19:34:13 +03:00
win7-7 a0d1ed8821 Testing performance impact of increasing this further. 2024-05-10 19:34:13 +03:00
win7-7 048dab5c36 1373214 - missing part for hybrid js engine.
1373214 - missing part for hybrid js engine.
2024-05-10 19:34:13 +03:00
win7-7 a6182c9bf4 627220 - Finalize external strings in the background
627220 part 1 - Remove unused Zone* argument from external string finalizers.

627220 part 2 - Finalize external strings in the background.
2024-05-10 19:34:13 +03:00
win7-7 2e447d0b62 1382275 + 1385833 + 1409751 (part 1 and 3)
1382275 - Refactor incremental sweeping to more clearly express the control flow.

1385833 - Simplify incremental sweeping and combine script and JIT code finalization phases.

1409751 part 1 - Make incremental sweep actions call a method on GCRuntime rather than a function. (skipped part 2/renaming).

1409751 part 3 - Move sweep group iteration inside the sweep action tree

Rename to not confuse with existing ZoneGroupIter.
2024-05-10 19:34:13 +03:00
win7-7 b5e5e480b9 1390087 - Assertion failure: zone->isGCScheduled(), at js/src/jsgc.cpp:6785
1390087 - Ignore zones that we can't collect when scheduling zones for GC.
2024-05-10 19:34:12 +03:00
win7-7 18583c6fa8 Fixes.
Fixes.
2024-05-10 19:34:12 +03:00
win7-7 9f4318485a Fixes.
Fixes.
2024-05-10 19:34:12 +03:00
win7-7 e6067db46e 1367900 - Record the values and thresholds for GC triggers
1367900 - Record the values and thresholds for GC triggers.
2024-05-10 19:34:12 +03:00
win7-7 45f0a9048a Fixes.
Fixes.
2024-05-10 19:34:12 +03:00
win7-7 d778b7f568 1386660
1386660.
2024-05-10 19:34:12 +03:00
win7-7 236afc6643 1408375
1408375
2024-05-10 19:34:12 +03:00
win7-7 2c3ca185be 1384049 - Trigger an incremental GC based on malloc memory counters
1384049 - Trigger an incremental GC based on malloc memory counters.
2024-05-10 19:34:12 +03:00
win7-7 62ca3b6a83 1405980 - Intermittent GECKO(4316) | Assertion failure: zone->isGCScheduled(), at z:/build/build/src/js/src/jsgc.cpp:7046
1405980 - Dump debugging information if zones are not scheduled as expected
2024-05-10 19:34:12 +03:00
win7-7 6629021d09 1405274 - Improve our malloc memory accounting framework
1405274 - Always update runtime malloc counter too when malloc memory is associated with a zone.

1405274 - Make malloc counters count up instead of down.

1405274 - Add a dynamic malloc bytes threshold.
2024-05-10 19:34:11 +03:00
win7-7 6485d411d7 1376954 - consider marking NodeList [isProbablyShortLivingObject]
1376954 part 1. Ensure that we don't try to nursery-allocate non-wrappercached DOM objects.

1376954 part 2. Support nursery allocation of DOM proxy objects.

1376954 part 3. Allow nursery allocation of DOM nodelists.
2024-05-10 19:34:11 +03:00
win7-7 e6ec60004c 1377055 - Disallow setting JSCLASS_SKIP_NURSERY_FINALIZE on proxies
1377055. Assert that JSCLASS_SKIP_NURSERY_FINALIZE is not used on proxies.
2024-05-10 19:34:11 +03:00
win7-7 bb6c603729 1377368 - ProxyObject::New won't create foreground finalized proxies in the nursery
1377368 - Support allocating foreground finalized proxies in the nursery.
2024-05-10 19:34:11 +03:00
win7-7 31eba3a570 1377056 - Fix broken support for nursery-allocated proxies with objectMoved hooks
1377056. Ensure that the objectMoved hook, if any, is called when tenuring a nursery-allocated proxy.
2024-05-10 19:34:11 +03:00
win7-7 7d39fab55e 1378717
1378717 - Speed up gray root buffering tracer by removing a virtual dispatch and some release asserts.

1378717 - Allow inlining of TraceEdge API's null check.

1378717 - Store JS holders in a vector for faster iteration.
2024-05-10 19:34:11 +03:00
win7-7 21f16cf996 1384047
1384047 - Relax assertion that zones are empty when they are deleted
2024-05-10 19:34:11 +03:00
win7-7 0334b77d8c 1366340
1366340 - Delete parsing zones immediately after their contents are merged.
2024-05-10 19:34:11 +03:00
win7-7 628b15aa34 1377466 + 1380387.
1377466 - Rename PokeGC and add a reason code for GCs triggered by this.

Also includes:

1380387 - Only repeat shutdown GCs for removed roots.
2024-05-10 19:34:11 +03:00
win7-7 c55d97f6ac Fallout from 1351107
Fallout from 1351107.
2024-05-10 19:34:11 +03:00
win7-7 254938c8d2 Sigh..
Sigh.. I don't like doing this but it won't compile otherwise even if it does to Mozilla. Its not ideal include this back.
2024-05-10 19:34:10 +03:00
win7-7 febdf25865 1225031
1225031.
2024-05-10 19:34:10 +03:00
win7-7 6ee19133b4 1351107 - Move RegExpFlags, RegExpShared, and RegExpCompartment out of RegExpObject.h, into the more minimal vm/RegExpShared.h
Some fixes.

This actually makes regexp zone compile but not other newer commit..

Also safer part of those bigger changes to take.
2024-05-10 19:34:10 +03:00
win7-7 8bb290e8e5 1400278
1400278 - Move definition of ZoneAllocPolicy to jsalloc.h

1400278 - Fix compilation errors to do with unreachable return statements

1400278 - Replace use of RuntimeAllocPolicy with ZoneAllocPolicy

1400278 - Replace runtime allocation with system or zone allocation where possible.

1400278 - Remove RuntimeAllocPolicy now it's no longer used.
2024-05-10 19:34:10 +03:00
win7-7 42620b7b21 Trying this again.I want performance gain until stopping.
Trying this again.I want performance gain until stopping.
2024-05-10 19:34:10 +03:00
win7-7 3f1407630e https://hg.mozilla.org/mozilla-central/rev/3586c6c537791ff194d10746ee54e5836e2c23c4
https://hg.mozilla.org/mozilla-central/rev/3586c6c537791ff194d10746ee54e5836e2c23c4
2024-05-10 19:34:10 +03:00
win7-7 9e851ef8a7 1364120 - Remove FINISH_LARGE_EVALUATE gc.
This change reverts the modification added in Bug 852331. It is outdated for
or multiple reasons:
 - We no longer have the bytecode analysis straight after the full parse.
   - We have Lazy parsing now.
   - We replaced the analysis by using IonBuilder at the time of the first Baseline
     compilation which uses a LifoAlloc, and which are discarded right
     away. (almost as mentioned in Bug 852331 comment 1)
 - LARGE_SCRIPT_LENGTH is above the HUGE_LENGTH heuristics of the
   CanCompileOffThread function, which takes another path for executing the
   code compiled off-main-thread.
2024-05-10 19:34:10 +03:00
win7-7 8c875d5ba0 Revert "This might actually cause GC pausing not just benchmarking testing temporary."
This reverts commit 7c0ba280cc4006432a81c52140aaf4750daf2d1b.
2024-05-10 19:34:10 +03:00
win7-7 f980f89518 Fix some gray marking + void is still used not undefined.
Fix some gray marking + void is still used not undefined.
2024-05-10 19:34:09 +03:00
win7-7 7f133d224f 1410370 - Fix zone scheduling in incremental GC to continue collection of previously collected zones
1410370 - Fix zone scheduling in incremental GC to continue collection of previously collected zones
2024-05-10 19:34:09 +03:00
win7-7 5457359f00 1396936 - Simplify tenuring of objects with unique IDs
1396936 - Simplify tenuring of objects with unique IDs and remove hash table lookup for every tenured object.

Hoping removing hash table lookup has performance gain.
2024-05-10 19:34:09 +03:00
win7-7 639fb0e78a 1396931 - Simplify sweeping nursery allocated dictionary mode objects
1396931 - Simplify sweeping of dictionary mode objects allocated in the nursery
2024-05-10 19:34:09 +03:00
win7-7 89812295bd 1407314 - Optimise nursery collection for most common cases
1407314 - Improve tenuring performance by rearranging allocKindForTenure() methods and adding fast path for plain objects

Fix rooting hazards by updating annotations for renamed function.

Fix remaning rooting hazards by telling the analysis that the object moved hook can't GC.
2024-05-10 19:34:09 +03:00
win7-7 bcbbf2368e Update graphite to 1.3.11 and OTS to 8.1.4 version like done in 55 branch.
Update graphite to 1.3.11 and OTS to 8.1.4 (this version had performance improvements specifically) version like done in 55 branch.
2024-05-10 19:34:09 +03:00
win7-7 18abcf3fba OOM changes.
OOM changes. Not sure changes outside node were necessary but they were in branch so taking them at least for now.
2024-05-10 19:34:09 +03:00
win7-7 b7f90272c3 1330536
1330536
2024-05-10 19:34:09 +03:00
win7-7 a1953c1eb7 This might actually cause GC pausing not just benchmarking testing temporary.
This might actually cause GC pausing not just benchmarking testing temporary.
2024-05-10 19:34:09 +03:00
win7-7 b2d2200ecf Further changes again.
Further changes again. I have revert some changes temporary to be able compare to 55 js engine.
2024-05-10 19:34:08 +03:00
win7-7 4841a3cce6 Further changes.
Further changes.
2024-05-10 19:34:08 +03:00
win7-7 6cb4c13411 JSONPrinter.cpp and .h
JSONPrinter.cpp and .h addition to VM (1322560).

Also:

1322560 - Convert GC statistics over to JSONPrinter.

1322560 - Add APIs for retrieving major GC timing info.
2024-05-10 19:34:08 +03:00
win7-7 a1fe1978d5 1362977 - Rename CellSize to CellAlignBytes and improve the naming of related constants
1362977 - Rename CellSize to CellAlignBytes and improve the naming of related constants. Outside GC.
2024-05-10 19:34:08 +03:00
win7-7 3c67b9451d 55 js GC for most part.
55 js GC for most part.

ZoneGroup naming is kept since this seems for once pure renaming without functional change when other one changed method.
2024-05-10 19:34:08 +03:00
win7-7 e4affe2a84 Multi-threading dynamic import.
Multi-threading dynamic import.
2024-05-10 19:34:08 +03:00
win7-7 113577e233 1334409 - TraceLogging: Add memory reporter for TraceLogging
1334409 - TraceLogging: Add memory reporter for TraceLogging.
2024-05-10 19:34:08 +03:00
win7-7 1c8e690435 1326096 - Add memory reporter for external strings
1326096 part 1. Add a way to set an external string memory runtime callback.

1326096 part 2. If there is an external string memory runtime callback, call it from memory reporting code.

1326096 part 3. Pass a useful external string memory reporter to SpiderMonkey from Gecko code.

1326096 followup. Suppress the false-positive GC analysis failure due to us doing an indirect call that the static analysis doesn't understand.

1326096 another followup: fix build bustage on CLOSED TREE.

Also includes 1336957, use diagnostic assert for wrapper existence.
2024-05-10 19:34:08 +03:00
win7-7 87edb7afef 1359436 - Add leak checking to CycleCollectedJSContext and related classes.
1359436 - Add leak checking to CycleCollectedJSContext and related classes.
2024-05-10 19:34:08 +03:00
win7-7 2a7d8c13ab Only taking this in due existing in 55 also. 1359653 was backed out in 55 already..
1363301 - Always provide live wrappers for ScriptSourceObjects.
2024-05-10 19:34:07 +03:00
win7-7 c3b8c3fc29 55 js xpconnect.
55 js xpconnect:

1332172 - Remove XPC_MAP_WANT_*. (touches dom, toolkit, storage also (Use XPC_SCRIPTABLE mentioned))

1325542 - Remove XPCNativeScriptableFlags (js xpconnect only)

1324330 (part 2) - Make XPC_MAP_FLAGS non-optional when using xpc_map_end.h.

1324330 (part 5) - Remove nsDOMClassInfo::mName.

1324330 (part 1) - Mark js::Class and related types as NONHEAP.

Use XPC_SCRIPTABLE

Use XPC_SCRIPTABLE in toolkit.

Use XPC_SCRIPTABLE in storage.

use XPC_SCRIPTABLE in DOM.

1329846 (part 1) - Remove XPCNativeScriptableInfo.

1335654 part 1. Propagate AutoEnterPolicy's mayThrow argument to the enter() methods of proxy handlers, so they know whether it's OK to throw some sort of custom exception or whether they should just silently deny.

1306538 - Move js::ReportASCIIErrorWithId to AddonWrapper.cpp.
2024-05-10 19:34:07 +03:00
win7-7 e2642e0717 1318627 - Remove Zone::active
1318627 - Remove Zone::active and related infrastructure.
2024-05-10 19:34:07 +03:00
André Bargull fab2eeb435 Bug 1380344 - Add Ion support for IsPackedArray. r=jandem 2024-05-10 19:34:07 +03:00
win7-7 ef7d00b103 ASAN changes to fix assertions and stack and heap buffer overflow.
ASAN changes to fix assertions and stack and heap buffer overflow.

ASAN changes to fix assertions and stack overflow part 1 of ASAN changes.

Including: 1494030 - Fix an assertion,

1291413 - Fix assertion when resuming an Animation with both a start time and hold time,

1322770: Remove bogus assertion from SMIL motion code,

1322849 - Add a range check when the duration is multiplied by the repeat count,

1352453 - Check image dimension when computing border space size,

1359397 - Don't allow Selection in nodes not in the document (resolves some assertions),

1361052 - DeleteSelectionAndPrepareToCreateNode should be more safety (libeditor/EditorBase.cpp in UXP),

1381541 - queryCommandState should consider that parent node of selection is null,

1394405 - Relax the assertion in CalculateDistanceToEllipticArc to deal with the floating point precision problem,

1397795 - Fix stack overflow crash due to box-shadow,

1401726 - Fix crash in nsLabelsNodeList::PopulateSelf,

1407895 - ensure mDecoder->Suspend() is called on a newly created decoder if mPausedForInactiveDocumentOrChannel is true,

1418477 - Part 1. Should check error status of unum_open, no crash test so part 1 only.

1429523 - Make IMEContentObserver ignore character data change notifications of invisible data nodes,

1494380 - Ignore emphasis marks on combined text with horizontal writing mode,

1499099 - Clamp result codes to NS_ERROR_MODULE_DOM_FILEHANDLE result codes in ActorsParent,

1499854 - Binary should not be affected by locale,

1505817 - Handle the case where a float is dynamically inserted inside a continuation,

1507961 - Check that an SVG DOM item wasn't removed from its list before scheduling its animation update,

1536892 - Check a frame does maintain overflow before adding to OverflowChangedTracker,

1596516 - NodeIsBlockStatic should return false for non-element,

1614360 - Signal error to child on attempts to read beyond EOF instead of asserting,

1626970 - Use saturating operators to avoid scrolling position overflow,

1626973 - Add assertions for result of MaybeUpdateSize,

1626973 - Make attempt to increase the file size via IDBFileHandle.truncate an error,
2024-05-10 19:34:06 +03:00
win7-7 12edf014ed 1358135 - Preserve code also when running Baseline code
1358135 part 1 - Fix some browser tests to trigger a shrinking GC instead of a normal GC.

1358135 part 2 - Preserve a Zone's JIT code also when it has Baseline code on the stack.
2024-04-23 17:52:14 +03:00
win7-7 50f2f23d94 Bug 1429783 - Reset frozen state in nsIScriptElement::LoseParserInser… …tedness() r=smaug
Bug 1429783 - Reset frozen state in nsIScriptElement::LoseParserInsertedness() r=smaug
2024-04-23 17:52:14 +03:00
André Bargull 31085ea59b Bug 1372081 - Ion-inline FinishBoundFunctionInit for normal and bound functions
Bug 1372081 - Ion-inline FinishBoundFunctionInit for normal and bound functions
2024-04-23 17:52:13 +03:00
win7-7 c7df2bcc44 1368446 - Fix gray marking assertion failures by calling ExposeObjectToActiveJS in UncheckedUnwrap
1368446 - Fix gray marking assertion failures by calling ExposeObjectToActiveJS in UncheckedUnwrap
2024-04-23 17:52:13 +03:00
win7-7 7d6f560dca 1343590 - Improve CallArgs gray marking assertions
1343590 - Improve CallArgs gray marking assertions
2024-04-23 17:52:13 +03:00
win7-7 624deb2e3a 1340604 - Add more test code for weak map gray marking behaviour
1340604 - Add more test code for weak map gray marking behaviour
2024-04-23 17:52:13 +03:00
win7-7 0ff1fed569 1339770 - Add tests for gray marking of CCWs , partially only, add test later.
1339770 - Add tests for gray marking of CCWs
2024-04-23 17:52:12 +03:00
win7-7 9a49599661 1339770 - Add jsapi tests for weak map gray marking.
1339770 - Add jsapi tests for weak map gray marking.
2024-04-23 17:52:12 +03:00
win7-7 6ed00d1ba9 1334433 - Add gray marking jsapi tests
1334433 - Add gray marking jsapi tests
2024-04-23 17:52:12 +03:00
win7-7 2e34fc320d 1322648 - Assertion failure: js::CurrentThreadCanAccessRuntime(runtime_), at dist/include/js/HeapAPI.h:135
1322648 - Don't start parse task if its zone is being collected
2024-04-23 17:52:12 +03:00
win7-7 07ba3cfc33 1338623 - Investigate making gray marking assertions run all the time again
1338623 - Add a slower but more exact gray marking check for checking correctness.

Reorder. 1337502  first.
2024-04-23 17:52:12 +03:00
win7-7 4dc67f8b7d 1333757 - Add same-compartment and not-marked-gray asserts to JSFunction's initExtendedSlot and setExtendedSlot and NativeObject's initFixedSlot and setFixedSlot
1333757 - Add some asserts to slot-setting functions on JSFunction and NativeObject.
2024-04-23 17:52:12 +03:00
win7-7 a0eeb71b4f 1337502 - js::AutoCompartment should assert the same things JSAutoCompartment does
1337502 - AutoCompartment should have the same asserts as JSAutoCompartment.
2024-04-23 17:52:11 +03:00
win7-7 79335cb60e 1332321 - The *SKIPPABLE_*_INHERITED macros are footguns
1332321. Make all cycle collection participants explicitly say whether they need skippability themselves, or just want whatever skippability their descendants want.

This way we can't end up with a situation in which an ancestor doesn't care about skippability but a descendant does and doesn't get it, because the ancestor just claimed no skippability was needed.
2024-04-23 17:52:10 +03:00
win7-7 07dba3711a 1333391 - Move GetCPUCount to threading layer
1333391 - move GetCPUCount to the threading layer.

For background see bug 1333059.  The JS engine does not use PR_GetProcessorCount, because it does not use NSPR, instead it has its own definition (GetCPUCount) tucked away in the garbage collector.
2024-04-22 06:01:01 +03:00
win7-7 89520483c2 Missing pieces due zeal having still some relevance in UXP.
1352430 - Add zeal mode to exercise incremental foreground finalization
2024-04-22 05:48:47 +03:00
win7-7 ffd8f2e31f Multi-threading misses.
Multi-threading misses, lack of ActiveThreadOrGCTaskData in four locations where it should be used like 55 js engine had.
2024-04-22 04:48:34 +03:00
win7-7 d05f5f93eb 1354733 - Avoid wrapping dead wrappers into CCWs
1354733: Part 1 - Allow creating DeadObjectProxies directly.

1354733: Part 2 - Never rewrap dead wrappers.
2024-04-22 04:48:34 +03:00
win7-7 dcf0ad0ca5 1370823 - Don't evict the nursery in NukeCrossCompartmentWrappers and RecomputeWrappers
1370823 - Don't evict the nursery in NukeCrossCompartmentWrappers and RecomputeWrappers.
2024-04-22 04:48:34 +03:00
win7-7 ec3d3d63c4 816784 - Lots of time spent in WindowDestroyedEvent::Run/js::NukeCrossCompartmentWrappers when closing tabs/windows
816784 part 1 - Use a 2d hashmap to store cross compartment wrappers.

816784 part 2 - Optimize NukeCrossCompartmentWrappers() to iterate only the targetting wrappers.

816784 part 3 - Optimize the other places that iterate CCWs.

816784 part 4 - Fix the rooting hazards that the analysis report.
2024-04-22 04:48:33 +03:00
win7-7 d990bd922c Bug 1369533: Return dead wrappers rather than null for dead CallbackObject values
We don't have access to an appropriate context to create the dead wrapper in when the callback is nuked, so instead, this patch creates a new dead wrapper in the caller compartment each time the property is accessed. This is the same behavior we'd get when trying to re-wrap a cross-compartment dead wrapper, so it's consistent with the way we handle these situations elsewhere.
2024-04-22 01:01:56 +03:00
win7-7 10a8959b5e 1369367 - Crash in mozilla::dom::WindowBinding::get_onunload
1369367. DOM callbacks can now store a null object; teach codegen to handle that.
2024-04-22 00:55:08 +03:00
win7-7 e1234df4c6 1322273 - Return DeadObjectProxy when attempting to wrap object for a nuked compartment
1322273 - Cut wrappers that point out of a browser compartment when nuking it.

1322273 - Return DeadObjectProxy when wrapping for nuked compartment.
2024-04-22 00:52:56 +03:00
win7-7 d360dbda12 1336988 - Crash in JSAutoCompartment::JSAutoCompartment | mozilla::dom::CallbackObjectHolderBase::ToXPCOMCallback
1336988: Correctly handle dead callback objects when iterating over event listeners.
2024-04-22 00:37:28 +03:00
win7-7 326176a583 1273251 - Remove cross-compartment event handlers and observers when nuking wrappers
1273251: Part 1 - Mark nuked sandboxes as nuked and non-scriptable.

1273251: Part 2 - Mark extension window compartments as nuked, and nuke all wrappers.

1273251: Part 3 - Allow CallbackObject to contain a null callable.

1273251: Part 4 - Drop CallbackObject's JS objects for nuked compartments during CC.

1273251: Part 5 - Add tests for event listeners in nuked sandboxes.

Part 6 dropped due webextensios. I'm taking this to test CC performance impact combined with later porting.
2024-04-22 00:30:51 +03:00
win7-7 a73f8009bd Fix assert.
Fix assert.
2024-04-21 01:15:49 +03:00
win7-7 da350be5e3 1376961 - Compartment checks do a slow TLS lookup
1376961 - Inline CurrentThreadIsHeapBusy in START_ASSERT_SAME_COMPARTMENT to avoid a TLS lookup for each compartment check.
2024-04-20 22:36:55 +03:00
win7-7 46681ed44c Fix long time ago missed change.
Fix long time ago missed change.
2024-04-20 16:40:36 +03:00
win7-7 b44f4b86e4 Fix crash hopefully.
Fix crash hopefully.
2024-04-20 16:38:53 +03:00
win7-7 2753b32fb7 Revert "Bug 1378740 - Share RegExpShareds across compartments within a zone. r=jonco"
This reverts commit 744b3a2029a59bab9d4ff10f79fc4396bd315b04.
2024-04-20 04:29:01 +03:00
win7-7 d3008e39fb 1368325 - js::gc::BarriersAreAllowedOnCurrentThread() shows up in performance profiles
1368325 - Remove JSContext::allowGCBarriers and related code as it's not used anywhere.
2024-04-20 04:29:01 +03:00
win7-7 614b3a40c7 1328252 - Always unbox NewArray/NewObject cached optimizations.
1328252 - IonMonkey: Always unbox NewArray/NewObject cached optimizations
2024-04-20 04:29:01 +03:00
win7-7 9d7edf480d 1382023 - Pull some irregexp patches
1382023 - Fold repeated assertions.

This is a pull of v8 commit c8e4c8b9263b5009716804f06f39225a9dd7fc68, reviewed at https://codereview.chromium.org/2768443003.

1382023 - Optimize better in presence of lookaround.

This is a pull of v8 commit 8df7c2a21b07174c3704894ca1d149b2711dfa58, reviewed at https://codereview.chromium.org/2777583003.
2024-04-20 04:29:01 +03:00
win7-7 866fa65950 1368461 - Allow nursery-allocating most RegExp objects
1368461 part 1 - Allow nursery allocation for RegExps allocated by CloneRegExpObject.

1368461 part 2 - Pass NewObjectKind to RegExpAlloc so most callers can use nursery allocation.
2024-04-20 04:29:01 +03:00
win7-7 8c174b3de1 Bug 1379980 - Clean up RegExp code a bit. r=jonco
Clean up RegExp code a bit.

This removes some unnecessary roots and makes sure we fire the pre-barrier in initIgnoringLastIndex by using sharedRef instead of NativeObject::setPrivate(nullptr). Before bug 1378736 we didn't have that pre-barrier.
2024-04-20 04:29:01 +03:00
Jan de Mooij 44c27fd00c Bug 1115355 - Optimize RegExpObject allocation in Ion. r=evilpie 2024-04-20 04:29:01 +03:00
win7-7 6644834f33 Bug 1379936 - Make sure lastIndex slot is always initialized to 0 when cloning regexps in Ion. r=nbp
Make sure lastIndex slot is always initialized to 0 when cloning regexps in Ion
2024-04-20 04:29:01 +03:00
Jan de Mooij 3ddec557c2 Bug 1378740 - Share RegExpShareds across compartments within a zone. r=jonco 2024-04-20 04:29:00 +03:00
win7-7 cf58c2000b Bug 1373290 - Move object/string pre-barrier null check to JIT code. r=nbp
Speedometer gains to test.
2024-04-20 04:29:00 +03:00
win7-7 2c6ec969dd 1366263
RegExpMatcher, RegExpSearcher, and RegExpTester not always inlined in Speedometer

Focusing to optimize Speedometer, so more ports to optimize that.
2024-04-20 04:29:00 +03:00
win7-7 3c6eabe019 Bug 1384318 - Inline native check for emitMegamorphicLoadSlot variants. r=jandem
Inline native check for emitMegamorphicLoadSlot variants
2024-04-20 04:29:00 +03:00
André Bargull 39c7b683a6 Bug 1381891 - Inline IsTypedArray even when non-TypedArrays were observed. r=jandem 2024-04-20 04:29:00 +03:00
win7-7 3211d10154 Bug 1373615 - Clean up and optimize property enumeration code. r=evilpie
Hopefully to speed up Speedometer further
2024-04-20 04:29:00 +03:00
win7-7 34e783f953 Bug 1169746 - Don't use templateObjects for derived constructor calls. r=jandem
Missed one part of changes in make SuperCall work in the JITs while doing others.
2024-04-20 04:29:00 +03:00
Jan de Mooij 1fdc6b8aad Bug 1383343 part 2 - Add a cache for Function.prototype.toString. r=anba 2024-04-20 04:29:00 +03:00
Jan de Mooij 481fa91411 Bug 1383343 part 1 - Avoid StringBuffer overhead in FunctionToString in the common case. r=anba 2024-04-20 04:28:59 +03:00
Ted Campbell f2bdab9493 Bug 1377051 - Support JSOP_SETELEM_SUPER in Baseline r=jandem
MozReview-Commit-ID: 5YycYP7J2w0

--HG--
extra : rebase_source : 7fc00a2d18055149ea179dba0227275f1cffcca8

# Conflicts:
#	js/src/jit/BaselineCompiler.cpp
#	js/src/vm/Interpreter.cpp
2024-04-20 04:28:59 +03:00
Ted Campbell 0585e66d1b Bug 1377051 - Support JSOP_SETPROP_SUPER in Baseline r=jandem
MozReview-Commit-ID: LNOVCntYDsM

--HG--
extra : rebase_source : 987cd42d72fc3beca649025295a9ac725c31b88b
2024-04-20 04:28:59 +03:00
Iain Ireland 4573900173 Bug 1709328: Fix baseline IC register assignment for GetElemSuper r=jandem
When bug 1472211 reordered the operands of GetElemSuper, we got our register assignments out of sync. Our GetElemSuper baseline ICs have been silently failing ever since.

This patch re-establishes a consistent assignment between BaselineCodeGen::emit_GetElemSuper, GetPropIRGenerator, and BaselineCacheIRCompiler::init:
  obj = input operand 0 = baseline frame slot 0
  id/key = input operand 1 = R1
  receiver = input operand 2 = R0

We have a testcase for megamorphic GetElemSuper, but it didn't catch this bug because our ICs just failed silently (either because a property name is not a valid receiver, or because the superbase object is not a valid property name) and let the fallback handle it. The testcase I've attached to this bug doesn't fail prior to bug 1661211 part 1, where we added support for non-object receivers for GetElemSuper, but I checked out old revisions immediately before and after bug 1472211 and verified in rr that GetNativeDataPropertyByValuePure was passed the correct id before, and the receiver object after.

Drive-by: while investigating this bug, I realized that `attachMegamorphicNativeSlot` had an unused argument left over from TI removal.

Differential Revision: https://phabricator.services.mozilla.com/D114513

[Waterfox note: That last comment regarding `attachMegamorphicNativeSlot` isn't
actually true in Waterfox, so that part of the patch has been left out.]
2024-04-20 04:28:59 +03:00
win7-7 d324e729a4 Restore super for BytecodeEmitter.h
Restore super for BytecodeEmitter.h
2024-04-20 04:28:59 +03:00
André Bargull c412c0cb24 Bug 1472211 - Part 2: Reorder operands in Super-Elem bytecode operations. r=arai 2024-04-20 04:28:59 +03:00
Jan de Mooij 9f3735a156 Bug 1410683 - Adjust BaselineFrame frameSize when pushing extra value for JSOP_GETELEM_SUPER. r=evilpie 2024-04-20 04:28:59 +03:00
Tom Schuster c1a6f484b2 Bug 1378186 - Implement super.property in Ion. r=jandem 2024-04-20 04:28:59 +03:00
Tom Schuster 79e5dd5d95 Bug 1378186 - Fix GetElemSuper stack handling in baseline. r=jandem 2024-04-20 04:28:59 +03:00
Ted Campbell d23ebcde94 Bug 1169745 - Support JSOP_GETELEM_SUPER in Baseline. r=jandem
MozReview-Commit-ID: BDrZvZ5n3Q4
2024-04-20 04:28:58 +03:00
Ted Campbell 39d791d61f Bug 1169745 - Support JSOP_GETPROP_SUPER in Baseline. r=jandem
MozReview-Commit-ID: KTeUTsRpDWq
2024-04-20 04:28:58 +03:00
Ted Campbell 84e93e2b1d Bug 1169745 - Fix vm/Opcodes.h for JSOP_GETPROP_SUPER / JSOP_GETELEM_SUPER. r=jandem
MozReview-Commit-ID: 88UehsiXP0i
2024-04-20 04:28:58 +03:00
Ted Campbell c8eea8d7d8 Bug 1169746 - Handle JSOP_SPREADSUPERCALL correctly in ICCall_Native. r=sstangl
MozReview-Commit-ID: KEWS1s4Y9dL
2024-04-20 04:28:58 +03:00
Ted Campbell 338d492f67 Bug 1169746 - Support |super()| in Baseline. r=jandem
- Update BaselineIC for JSOP_SUPERCALL / JSOP_SPREADSUPERCALL
    - Support JSOP_SUPERFUN
    - Support JSOP_CHECKTHISREINIT

MozReview-Commit-ID: BlWsaUGeBqS
2024-04-20 04:28:58 +03:00
Ted Campbell fb798f678c Bug 1169746 - Disable JSOP_SUPERCALL in IonBuilder. r=jandem
This opcode has been blocked on other missing opcodes for a long
    time and requires further testing before it is unblocked again.

MozReview-Commit-ID: 7oKkJwxjVu5
2024-04-20 04:28:58 +03:00
Ted Campbell c170bdb63f Bug 1169745 - Support JSOP_SUPERBASE in Baseline. r=jandem
MozReview-Commit-ID: QA2j2Wsrs8
2024-04-20 04:28:58 +03:00
win7-7 727e6fbcc5 1169743 - Make classes with extends work in the Jits
1169743 - Rework JSOP_CLASSHERITAGE to be jit-friendly.

1169743 - Implement class decls with extends in Baseline

1169743 - Implement class decls with extends in Baseline (cont.)

 Add baseline support for
JSOP_INITHOMEOBJECT
JSOP_CLASSCONSTRUCTOR
SOP_DERIVEDCONSTRUCTOR

Include IfEmitter.h for ObjectEmitter.cpp for ifThenElse.
2024-04-20 04:28:58 +03:00
Ted Campbell b4c053b3c2 Bug 1169745 - JSOP_GETPROP_SUPER should Typescript::Monitor. r=jandem
MozReview-Commit-ID: IRRNhDBzMAF
2024-04-20 04:28:57 +03:00
Shu-yu Guo ca1cff10c7 Bug 1374462 - Fix super getprop and super getelem to not box 'this' values. (r=jorendorff) 2024-04-20 04:28:57 +03:00
André Bargull eac15753cd Bug 1379639 - Move Number.isInteger to self-hosted code and avoid bailouts in isSafeInteger. r=jandem 2024-04-20 04:28:57 +03:00
win7-7 a5273c59f5 Bug 1377489 - Eliminate unnecessary string allocation + copy under FunctionToString.
Bug 1377489 - Eliminate unnecessary string allocation + copy under FunctionToString. r=luke

--HG--
extra : rebase_source : 5d37fa9645ca8eed4bd0228d5a739f04878de979

https://github.com/WaterfoxCo/Waterfox-Classic/commit/96bad8f8fc16b8c389cbc1441d8e174239cad986
2024-04-20 04:28:57 +03:00
Kannan Vijayan bf400873f7 Bug 1366377 - Optimize single-char splitting in VM. r=jorendorff. 2024-04-20 04:28:57 +03:00
Kannan Vijayan fe4a8303ac Bug 1366377 - Unify StringSplitString ObjectGroup and fix Ion MCallOptimize. r=tcampbell
# Conflicts:
#	js/src/jit/MIR.h
2024-04-20 04:28:57 +03:00
Kannan Vijayan c9912bdb42 Bug 1366377 - Add CacheIR stub for String_split. r=tcampbell 2024-04-20 04:28:57 +03:00
Jan de Mooij f11929991d Bug 1397071 - Call InitElemOperation in IonSetPropertyIC::update to support more cases. r=anba 2024-04-20 04:28:57 +03:00
Tom Schuster ab272bb688 Bug 1344483 - Remove MInitProp from Ion. r=jandem 2024-04-20 04:28:56 +03:00
Tom Schuster 1b5eca77fd Bug 1344483 - Use an IC for JSOP_INITPROP in Ion. r=jandem 2024-04-20 04:28:56 +03:00
Tom Schuster b66232a6ae Bug 1344483 - Nop jsop_toid for string/symbol. r=jandem 2024-04-20 04:28:56 +03:00
Jan de Mooij 11bdf03021 Bug 1423139 - Don't attach a SetArrayLength stub for JSOP_INITELEM. r=evilpie 2024-04-20 04:28:56 +03:00
Jan de Mooij d938de496d Bug 1397026 - Make sure JSOP_INIT* IC behavior matches [[DefineOwnProperty]] instead of [[Set]]. r=anba 2024-04-20 04:28:56 +03:00
Jan de Mooij b2d14d2e6a Bug 1376691 - Improve Ion-inlining of Array.isArray. r=nbp 2024-04-20 04:28:56 +03:00
Jan de Mooij 63ce32dda8 Bug 1385215 part 2 - Inline Object.prototype.toString in Ion. r=evilpie 2024-04-20 04:28:56 +03:00
Jan de Mooij 2186c761c1 Bug 1385215 part 1 - Ion-inline native calls in jsop_funcall/jsop_funapplyarguments. r=nbp 2024-04-20 04:28:55 +03:00
Jan de Mooij 6c380a5045 Bug 1376799 - Optimize Object.prototype.toString. r=evilpie
--HG--
extra : rebase_source : 01f1dfcdf9bb991c8c40cf8dc9b521501456350f
2024-04-20 04:28:55 +03:00
André Bargull 42f7e16e60 Bug 1383644 - Inline ToObject when called with MIRType::Value. r=jandem 2024-04-20 04:28:55 +03:00
André Bargull f5f46d67da Bug 1303335: Move parts of Object.getOwnProperty and Object.defineProperty to self-hosted code. r=till 2024-04-20 04:28:55 +03:00
win7-7 d63973d7be 1353358 - Support JSOP_OPTIMIZE_SPREADCALL in Ion
1353358 - Use IfThenElseEmitter when optimizing spreadcall

1353358 - Support JSOP_OPTIMIZE_SPREADCALL in Ion
2024-04-20 04:28:55 +03:00
win7-7 db35816c5f 1342882 - Hit MOZ_CRASH(unexpected type) at js/src/jit/Lowering.cpp:2323
1342882: IonMonkey - Don't allow magic types for concatenation
2024-04-20 04:28:55 +03:00
win7-7 7187a265e7 1328148 - Use MConcat for more cases
1328148: IonMonkey - Use MConcat for more cases.
2024-04-20 04:28:55 +03:00
win7-7 df25253b19 Bug 1505385: Fix exception handling in IsDuckTypedErrorObject r=tcampbell
Fix exception handling in IsDuckTypedErrorObject
2024-04-20 04:28:55 +03:00
win7-7 0f8b8f2d2d 1338920 - Make spreadcall work in Ion
1338920 - Support JSOP_SPREADCALLARRAY in Ion.

1338920 - Support JSOP_SPREADCALL in Ion.
2024-04-20 04:28:55 +03:00
win7-7 e29432f9ae 1346028 - Ion: Implement INITELEM_INC
1346028 - Allow MCallInitElementArray to take dynamic index.

1346028 - Support JSOP_INITELEM_INC in Ion.
2024-04-20 04:28:54 +03:00
win7-7 2100422d48 1355058 - Fix some minor perf issues in IonBuiler
1355058 part 1 - Try the TypedObject optimizations last as typed objects are disabled by default.

1355058 part 2 - Avoid creating unnecessary type constraints in IonBuilder::typedObjectPrediction.
2024-04-20 04:28:54 +03:00
win7-7 3e054e2dba 1353679 - Optimize the Object case in obj_toString
1353679 part 1 - Optimize the Object case in Object.prototype.toString because it's very common.

1353679 part 2 - Atomize strings returned from Object.prototype.toString to avoid allocating duplicate strings.
2024-04-20 04:28:54 +03:00
win7-7 c483b14432 1345205 - Zen Garden Wasm demo runs 2.22x slower and starts up 4.49x slower in 32-bit Firefox compared to 64-bit
1345205 - Bump MaxCodeBytesPerProcess to 140mb on 32-bit and decrease BufferSize to 8mb.

Zen Garden Wasm demo is no longer available even so this should be ported.
2024-04-20 04:28:54 +03:00
win7-7 bfdb70af6c 1369042 - Optimize the @@toStringTag and @@toPrimitive lookups
1369042 - Optimize @@toStringTag and @@toPrimitive property lookups in the VM.
2024-04-20 04:28:54 +03:00
win7-7 fff0e2db73 1341263 - Optimize null/undefined comparisons more in CompareIC
1341263 - Optimize null/undefined comparisons more in CompareIC.
2024-04-20 04:28:54 +03:00
win7-7 e421e88a28 1341087 - Optimize symbol equality operations
1341087 - Implement symbol equality comparison in Ion.

1341087 - Implement bitwise symbol equality comparison in Ion.

1341087 - Implement symbol equality comparison in SharedIC.
2024-04-20 04:28:54 +03:00
win7-7 6c0ce4725e 1336216 - IONFLAGS=logs Does not work on Win32
1336216 - Fix JIT_SPEW_DIR on Win32.
2024-04-20 04:28:54 +03:00
win7-7 46e82487d8 1339481 - Structured clone can be really slow
1339481 - Specialize writing bytes in structured clone
2024-04-20 04:28:54 +03:00
win7-7 799918c6c2 1372956 - Assertion failure: !denseElementsAreFrozen(), at js/src/vm/NativeObject-inl.h:266
1372956 - Fix unshift fast path to check for frozen elements.
2024-04-20 04:28:53 +03:00
win7-7 6edada4850 1373356 - Assertion failure: getDenseCapacity() == 0, at js/src/vm/NativeObject-inl.h:310
1373356 - Fix NativeObject::sparsifyDenseElements to discard shifted elements.
2024-04-20 04:28:53 +03:00
win7-7 5d5c65f279 1364346 - Optimize Array.prototype.unshift
1364346 part 1 - Optimize Array.prototype.unshift fast path and use it more.

1364346 part 2 - Rename unshiftElements to moveShiftedElements, tweak heuristics.

1364346 part 3 - Optimize Array.prototype.unshift by taking advantage of shifted elements.
2024-04-20 04:28:53 +03:00
win7-7 f64fe7c07d 1350864 - Freezing an array does not set non-writable length correctly
1350864 - Fix SetIntegrityLevel to set non-writable length correctly when freezing arrays.
2024-04-20 04:28:53 +03:00
win7-7 8bc06235a3 1348772 - Optimize Array.prototype.shift to be O(1) instead of O(n)
1348772 - Optimize Array.prototype.shift to have O(1) perf instead of O(n).

JS code often uses arrays as queues, with a loop to shift() all items, and this resulted in quadratic behavior for us. That kind of code is much faster now.
2024-04-20 04:28:52 +03:00
win7-7 2316f6fae1 1383648 - Measure if it's useful to keep the Array.prototype.sort entry point in self-hosted code
1383648 - Move the Array.prototype.sort entry point to self-hosted code.
2024-04-18 22:04:17 +03:00
win7-7 6d20b66e1f 1302441 - Break assertion down into smaller assertions.
1302441 - Break assertion down into smaller assertions.

For 1348772.
2024-04-18 18:01:40 +03:00
win7-7 2e003e0cb9 1350286 - Memory allocated by NurseryAwareHashMap is not tracked in about:memory (detected by DMD in heap-unclassifieds)
1350286 - Report size of nursery entries vector for NurseryAwayreHashMap.
2024-04-18 16:36:40 +03:00
win7-7 29f62143d6 1355065 - Remove public read barrier API
1355065 - Remove unused read barrier API.

Following bug 1353758 can remove the public read barrier API, since it was only used for the external string cache.
2024-04-18 16:36:31 +03:00
win7-7 fdb3594bfe 1341367 assertion fix.
1341367 assertion fix.
2024-04-18 16:36:23 +03:00
win7-7 a274e871aa 1360961 - Crash in js::GetPrototype during cross-compartment hasInstance
1360961 - Assert that dying objects are not passed into the JSAPI

1360961 - Add a barrier to the plugin object wrapper table to handle incrementally finalized JSObjects

1360961 - Fix spurious rooting hazard
2024-04-18 14:59:25 +03:00
win7-7 0e2351bdb8 1352430 - Sweep foreground objects incrementally
1352430 - Finalize foreground objects incrementally.

1352430 - Update the GC finalize callback to communicate the new state.

1352430 - Update XPConnect sweeping to handle incrementally finalized objects.

1352430 - Add barrier to wrapper cache to clear dying objects that have not yet been finalized.

1352430 - Add barrier to CPOWs table to remove dying objects.
2024-04-18 14:59:25 +03:00
win7-7 64e598feb7 1359001 - AutoAssertGCCallback calls into the JS engine in opt builds
1359001 - Make AutoAssertGCCallback a no-op in opt builds.

This class is used to assert that we're currently running inside a GC callback.  It doesn't do anything in opt builds, but currently it calls into the JS engine anyway.

Preparation for 1352430.
2024-04-18 14:07:02 +03:00
win7-7 fae026b69b 1337414 - Crash [@ js::AutoClearTypeInferenceStateOnOOM::AutoClearTypeInferenceStateOnOOM] or Assertion failure: CurrentThreadCanAccessZone(zone), at vm/TypeInference.cpp:4536
1337414 - Don't trace into GC things owned by other runtimes in CheckHeapTracer
2024-04-18 14:07:01 +03:00
win7-7 3e5bca1ede 1341752 - js::TraceChildren should assert that it's not called with a GC thing from another runtime
1341752 - Assert that thing has correct runtime in js::TraceChildren.
2024-04-18 14:07:01 +03:00
Jon Coppeard 9a365a9bc6 Bug 1402649 - Fix valid GC cell pointer asserts and error handling in module instantiation r=sfink 2024-04-18 14:07:01 +03:00
Jon Coppeard 63f4105e6b Bug 1399944 - Check for valid GC cell pointers in various places r=sfink 2024-04-18 14:07:01 +03:00
Jon Coppeard e1756590fc Bug 1399933 - Replace use of ObjectValueCrashOnTouch with PoisonedObjectValue r=sfink 2024-04-18 14:07:00 +03:00
win7-7 070a5de4b0 1317761 - Prefer use of 'trace' to 'mark'
1317761 - Standardise names of tracing methods.

The rule will be:
 - a method that traces all contained GC things will be called 'trace' and take a JSTracer*
 - a method that's specific to GC marking will have the word 'mark' in the name and take a GCMarker*

Hopefully this solves debug crash when done completely.
2024-04-18 14:06:59 +03:00
win7-7 9e42c1ff1e Fix debug revealed error.
Fix debug revealed error.
2024-04-18 02:38:48 +03:00
win7-7 8e09213578 Bug 1506524: Handle LambdaArrow in MFunctionEnvironment::foldsTo. r=nbp
Handle LambdaArrow in MFunctionEnvironment::foldsTo.
2024-04-18 02:38:48 +03:00
win7-7 2a79a7f65d 1336579 - [meta] Attach SetProp Function prototype
1336579 - Attach AddSlot stubs for setting function.prototype.
2024-04-18 02:38:48 +03:00
André Bargull a490201b52 Bug 1380111 - Inline iterator code into Map/Set forEach to avoid extra allocations. r=till
--HG--
extra : rebase_source : 1244d9d9b19b25b19728da4b94ce0c391cab8ad2
extra : histedit_source : c6b736c9f005e51cb366a0f241be2b4a5dcdf2c3
2024-04-18 02:38:48 +03:00
win7-7 cb4c208f5a 1366372 - Array.from is way too slow
1366372 - Remove performance pitfalls in Array.from method.
2024-04-18 02:38:48 +03:00
win7-7 3bcf86a412 1350896 - Use Ion GetElem/SetElem ICs in more cases
1350896 - Use Ion GetElem/SetElem ICs in more cases.
2024-04-18 02:38:48 +03:00
win7-7 7824938d73 1340496 - CacheIR: Add SetProp/SetElem WindowProxy stubs
1340496 - Add IC support for setting existing properties on WindowProxies.
2024-04-18 02:38:48 +03:00
win7-7 62b589cb48 1133423 - setting an already-existing expando property on document is very slow
1133423 - Optimize sets of expando properties and expando setter calls on DOM proxies.
2024-04-18 02:38:47 +03:00
win7-7 64b93b8c2a 1337773 - Add an Ion IC for JSOP_IN
1337773 - Add IonInIC

1337773 - Use IonInIC for MIn and rename to MInCache
2024-04-18 02:38:47 +03:00
win7-7 e74958e316 1359952 - [JITs] Unify InIRGenerator and HasOwnIRGenerator
1359952 - Fix CacheIRCompiler handling of boolean results.

1359952 - Remove shape arg from TestMatchingReceiver.

1359952 - Add ownProp flag to CanAttachDenseElementHole.

1359952 - Add HasPropIRGenerator.

Fix.

Fix.
2024-04-18 02:38:47 +03:00
win7-7 1aa8ac54a4 1351388 - InIRGenerator::tryAttachNativeIn should handle non-data properties
1351388 - Allow non-data properties in InIRGenerator::tryAttachNativeIn
2024-04-18 02:38:47 +03:00
André Bargull 2f33e2efab Bug 1380087 - Add an intrinsic to test for Map and Set objects. r=till 2024-04-18 02:31:33 +03:00
Tom Schuster 0608259633 Bug 1383646 - Optimize x.indexOf(x) for AngularJS. r=anba 2024-04-18 02:31:33 +03:00
André Bargull 02c557ed14 Bug 1430800: Optimize String.raw by avoiding rest-parameter array allocation. r=evilpie 2024-04-18 02:31:32 +03:00
Jan de Mooij d519d684a9 Bug 1388354 - Optimize ToPropertyKey a bit. r=anba 2024-04-18 02:31:32 +03:00
Jon Coppeard 3d2204b276 Bug 1380778 - Fixup shape pointers into the nursery using a dedicated list r=sfink
1380778 - Fix review comment I missed
2024-04-18 02:31:32 +03:00
win7-7 88fc7eaea1 1381058 - Report which store buffer fills up for FULL_STORE_BUFFER minor GCs
1381058 - Split full store buffer reasons into a separate reason for each store buffer
2024-04-18 02:31:32 +03:00
Jon Coppeard d88e7b71a7 Bug 1367795 - Use multiple parallel tasks for weak cache sweeping r=sfink 2024-04-18 02:31:32 +03:00
Jon Coppeard 5bd35904ed Bug 1367795 - Use a single parallel task for weak cache sweeping r=sfink 2024-04-18 02:31:32 +03:00
Jon Coppeard 97136f3bee Bug 1367795 - Add tests for incremental weak cache sweeping r=sfink 2024-04-18 02:31:32 +03:00
Jon Coppeard d61d5d385a Bug 1367795 - Move weak cache sweeping out of the initial slice for the sweep group r=sfink 2024-04-18 02:31:32 +03:00
Jon Coppeard b1adcf7e06 Bug 1367795 - Allow movable cell hashing to handle matching against a dead table entry r=sfink 2024-04-18 02:31:32 +03:00
Jon Coppeard 866092128f Bug 1367795 - Refactor movable cell hashing methods to move them to MovableCellHasher<T> r=sfink 2024-04-18 02:31:32 +03:00
Jon Coppeard 0681d2148e Bug 1367795 - Add barriers to JS::WeakCache for GCHashMap r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard b7509b44be Bug 1367795 - Add barriers to JS::WeakCache for GCHashSet r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard d3e111e57a Bug 1367795 - Specialise JS::WeakCache for GCHashMap so we can add barriers r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard d24fe1ef01 Bug 1367795 - Specialise JS::WeakCache for GCHashSet so we can add barriers r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard 8c0dcda3c7 Bug 1367795 - Refactor some use of WeakCache r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard 2e13337427 Bug 1376096 - Add per-sweep-group actions in addition to per-zone actions r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard 5d5a8cd017 Bug 1376101 - Remove some unnecessary read barriers r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard 0eacb090ce Bug 1373209 - Use non-mutating iterator when checking tables after moving GC r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard 40f518359a Bug 1372524 - Add missing explicit keywords r=me 2024-04-18 02:31:31 +03:00
Jon Coppeard 6de4590b68 Bug 1371234 - Clear GC edges when deleting a GC managed object outside a GC r=sfink 2024-04-18 02:31:31 +03:00
Jon Coppeard 793027b533 Bug 1372569 - Skip sweeping empty weak caches r=sfink 2024-04-18 02:31:30 +03:00
Jon Coppeard e8a4ed6fa0 Bug 1372524 - Refactor WeakCache implementation a little r=sfink 2024-04-18 02:31:30 +03:00
win7-7 e032ff1842 1370069 - Crash [@ js::GCMarker::eagerlyMarkChildren] and various other crashes and assertions involving gczeal(17)
1370069 - Fix several issues with incremental atom sweeping
2024-04-18 02:31:30 +03:00
win7-7 04688d3eed 1369444 - Sweep the atoms table incrementally
1369444 - Sweep the atoms table incrementally.
2024-04-18 02:31:30 +03:00
win7-7 f5a685ce80 Add newline back to end.
Add newline unsure when this get accidentally removed. Figure out order later.
2024-04-18 02:31:30 +03:00
Jan de Mooij e9a3eff8c0 Bug 1372182 part 9 - Inline more functions. r=anba 2024-04-18 02:31:30 +03:00
Jan de Mooij 01bf8ced84 Bug 1372182 part 8 - Optimize AddTypePropertyId. r=evilpie 2024-04-18 02:31:30 +03:00
Jan de Mooij 0106b2c98a Bug 1372182 part 7 - Inline some more functions. r=anba 2024-04-18 02:31:30 +03:00
Jan de Mooij 259873eb35 Bug 1372182 part 6 - Inline PurgeEnvironmentChain. r=anba 2024-04-18 02:31:30 +03:00
Jan de Mooij 7adc3c8699 Bug 1372182 part 5 - Inline PropertyTree::getChild in NativeObject::getChildProperty. r=evilpie 2024-04-18 02:31:29 +03:00
Jan de Mooij 3d02d60dfd Bug 1372182 part 4 - Refactor/optimize PropertyTree::getChild a bit. r=jonco 2024-04-18 02:31:29 +03:00
Jan de Mooij 599f17bae6 Bug 1372182 part 3 - Merge jspropertytree.* with vm/Shape.* r=evilpie 2024-04-18 02:31:29 +03:00
Jan de Mooij da10ca4925 Bug 1372182 part 2 - Refactor NativeObject::allocSlot to make things faster for non-dictionary objects. r=anba 2024-04-18 02:22:53 +03:00
Jan de Mooij 54d0f2c609 Bug 1372182 part 1 - Inline NativeObject::dynamicSlotsCount and related methods. r=anba 2024-04-18 02:22:53 +03:00
win7-7 323a9119b3 1386685 Inline StackDefs and StackUses
Inline StackDefs and StackUses, Speedometer.
2024-04-18 02:22:53 +03:00
win7-7 72913c5a71 1339535 - JSObject::setHadElementsAccess happens too early
1339535 - Set the hadElementsAccess flag less eagerly to avoid unnecessary Shape changes.
2024-04-18 02:22:53 +03:00
win7-7 974b578b42 1414238 - Optimize BaselineCompiler::emitBody a bit
1414238 - Optimize BaselineCompiler::emitBody a bit.
2024-04-18 02:22:53 +03:00
win7-7 5f3197eee2 1354582 - call/apply inlining should support non-singleton callees
1354582 - Support non-singleton functions in IonBuilder::getSingleCallTarget.
2024-04-18 02:22:52 +03:00
win7-7 c10324f4ca 1326302 - More changes to PageProtectingVector
1326302 - Part 1: Redesign PageProtectingVector for minimum overhead.

1326302 - Part 2: Expose the ability to fully or partially disable protection and use it for WASM.

1326302 - Part 3: Guard against reentrancy in PageProtectingVector.

1326302 - Part 4: Guard against reentrancy when patching jumps as well.
2024-04-18 02:22:51 +03:00
win7-7 52d70a588d 1322445 - Switch PageProtectingVector from protecting fully used pages to fully unused pages.
1322445 - Extend PageProtectingVector to protect unused pages as well.
2024-04-18 00:23:04 +03:00
win7-7 16f820a139 1358596 - Check for sanity in DOM slot handling got removed
1358596. Restore check for sanity of slot indices on DOM objects that got lost.

https://hg.mozilla.org/mozilla-central/rev/35ba8c31d7f3 removes js::shadow::Object::MAX_FIXED_SLOTS and the DOM assert that used it.

But that assert is critical: We have jit code that depends on it.  Specifically, CodeGenerator::visitGetDOMMemberV and CodeGenerator::visitGetDOMMemberT both assume the slot is a fixed slot.  The assert used to assert that the slot index was small enough that this was true.  At the moment nothing prevents the DOM from ending up with a slot index that doesn't fit in fixed slots here...
2024-04-18 00:23:04 +03:00
win7-7 ee81d4262e 1364288 - TSan: thread races on global TestingFunctions state vars
1364288 - Fix thread races on global JS shell vars
2024-04-18 00:23:04 +03:00
win7-7 bfd6b8c476 1456524 - Assertion failure: !cycleEnd_, at js/src/jit/MoveResolver.h:286 with OOM
1456524 - Maintain MoveResolver invariants.

The MoveResolver is a persistent data structure that requires state to not leak between borrowers. An early-exit optimization in the case of OOM allows for state to leak, leading to impossible move list inputs, tripping assertions.
2024-04-18 00:23:04 +03:00
win7-7 52fe5e056e 1337367 - Postpone spilling bundles till end of register allocation's main loop
1337367 - Postpone spilling bundles till after regalloc main loop

1299147 is already in currently.
2024-04-18 00:23:03 +03:00
win7-7 51535fe9c3 1346191 - Some Speedometer tests spend a lot of time in IonBuilder
1346191 - Change Ion warmup threshold for small functions to be the same as the one for other functions.
2024-04-18 00:23:03 +03:00
win7-7 bd1bf0a3e2 1346217 - Optimize adding/defining new properties on native objects
1346217 part 1 - Remove IsExtensible check from NativeObject::addProperty.

1346217 part 2 - Remove IsExtensible check from NativeObject::putProperty.

1346217 part 3 - Optimize UpdateShapeTypeAndValue.

1346217 part 4 - Optimize CallAddPropertyHook*.

1346217 part 5 - Optimize AddOrChangeProperty to call addProperty instead of putProperty when possible.

1346217 part 6 - Inline NativeObject::getChildPropertyOnDictionary into its only caller.

1346217 part 7 - Ensure NativeObject::updateSlotsForSpan and NativeObject::setLastProperty get inlined.

1346217 part 8 - Optimize IdIsIndex to check the first character before calling StringIsArrayIndex.

1346217 part 9 - Enable some assertions that were commented out a long time ago.
2024-04-18 00:23:03 +03:00
win7-7 8fa957e3ee 1373094 - Assertion failure: MIR instruction returned object with unexpected type, at js/src/jit/MacroAssembler.cpp:1695
1373094 - Fix ICUpdatedStub::addUpdateStubForValue to use the correct group.
2024-04-18 00:23:03 +03:00
win7-7 5701b9f7a6 1369774 - Assertion failure: types, at js/src/jit/SharedIC.cpp:2560 with TypedObject
1369774 - Fix ICUpdatedStub::addUpdateStubForValue to handle TypedObjects correctly.
2024-04-18 00:23:03 +03:00
win7-7 b4cc364da9 1368509 - Generalize Baseline type update stubs
1368509 part 1 - Clean up DoTypeUpdateFallback a bit.

1368509 part 2 - Generalize Baseline unknown/unknownObject type update stubs.
2024-04-18 00:23:02 +03:00
win7-7 4a2c246152 1350263 - Port Baseline TypeOf IC to CacheIR
1350263 - Primitive typeof CacheIR support.

1350263 - Ion/MacroAssembler typeof object improvements.

1350263 - Typeof object CacheIR support.
2024-04-17 23:24:24 +03:00
win7-7 bb754cce93 1358047 - Move Baseline CacheIR stubcode map from JitCompartment to JitZone
1358047 - Move Baseline CacheIR code map from JitCompartment to JitZone.
2024-04-17 23:24:24 +03:00
win7-7 d8946757c7 1357468 - Optimize Object.hasOwnProperty on Speedometer
1357468 - More Object.hasOwnProperty optimizations for Speedometer.
2024-04-17 23:24:24 +03:00
win7-7 60c34662e9 1356822 - Assertion failure: self->template is<U>(), at js/src/jsobj.h:612
1356822 - Fix IonBuilder::jsop_bindname to pass the global lexical to the IC in the BINDGNAME case.
2024-04-17 23:24:24 +03:00
win7-7 fdcfa4d441 1353359 - Port BindName IC to CacheIR
1353359 part 1 - Add BindNameIRGenerator and use it in Baseline.

1353359 part 2 - Add BindName stub for global (BINDGNAME) lookups.

1353359 part 3 - Add BindName stub for non-global (BINDNAME) lookups.

1353359 part 4 - Use BindName IC in Ion and remove the old IonCache infrastructure.
2024-04-17 23:24:24 +03:00
win7-7 7318a54200 1348905 - Fix Octane-TypeScript regression from bug 1328140
1348905 part 1 - Remove unnecessary IsPreliminaryObject check so we attach megamorphic setprop stubs in more cases.

1348905 part 2 - Clean up and fix HasTypePropertyId.

1348905 part 3 - Make SetNativeDataProperty skip the type barrier if the IC knows we don't need one.

I read that some functions that weren't being inlined by Clang according to the profiler but really should be. I think taking this across is good idea.
2024-04-17 23:24:24 +03:00
win7-7 d137ac6d9c 1491350 - Assertion failure: !JS_IsExceptionPending(cx), at js/src/jsexn.h:130 with OOM and hasOwnProperty
1491350: Clear pending OOM exceptions before returning from hasNativeProperty / getNativePropertyByValue.
2024-04-17 23:24:24 +03:00
win7-7 be320ce908 1344469 - Optimize Object.hasOwnProperty
1344469 - Part 1 - Add JSOP_HASOWN to Interpreter and BytecodeEmitter.

1344469 - Part 2 - Baseline fallback support for HasOwn.

1344469 - Part 3 - CacheIR for HasOwn with baseline support.

1344469 - Part 4 - Megamorphic stub.

1344469 - Part 5 - CacheIR HasOwn in Ion.

1344469 - Part 6 - Port not defined property optimzation to HasOwn.
2024-04-17 23:24:23 +03:00
win7-7 2368833a7a 1345160 - Assertion failure: maybeTempDouble != InvalidFloatReg, at js/src/jit/IonCacheIRCompiler.cpp:1367
1345160 - Fix LIRGenerator::visitSetPropertyCache to consider INITELEM* ops too.
2024-04-16 19:36:21 +03:00
win7-7 fda136ed86 1344463 - Emit JSOP_INITELEM for _DefineDataProperty calls in self-hosted code
1344463 - Optimize JSOP_INITELEM in Ion and emit it for 3-arguments _DefineDataProperty in self-hosted code.

1344463 followup - Fix comment copy/paste issue.
2024-04-16 19:36:20 +03:00
win7-7 a66dd0ca75 1350171 - Assertion failure: numFailures_ > 0 (numFailures_ should not overflow), at js/src/jit/ICState.h:113
1350171 - Try to transition IC mode before attaching AddSlot stubs.
2024-04-16 13:49:45 +03:00
win7-7 ce1db324e7 1336580 - AddSlot ICs fail because of unperformed new script analysis
1336580 - Attach AddSlot stubs before we run the new-script analysis.
2024-04-16 13:31:16 +03:00
win7-7 ea102bfe8b 1337763 - Attach In stub for DenseElementHole
1337763 - Factor out GeneratePrototypeHoleGuards

1337763 - Add DenseInHole IC to CacheIR
2024-04-16 13:09:22 +03:00
win7-7 6474fbaf4c Fix errors.
Fix obvious errors.

Devtools work and javascript engine seems stable. Seems be issue that 1323854 was not done fully for some reason and was incomplete.
2024-04-16 02:29:38 +03:00
win7-7 fd5f7453c1 1326213 - Unneeded abort at "Cannot inspect prototype chain."
1326213 - IonMonkey: Don't abort when trying to speculate on unstable proto.
2024-04-16 01:39:01 +03:00
win7-7 0853614cc3 1341071 - Fix Ion IC post write barriers
1341071 - Fix Ion IC post barriers to be part of the IC stubs instead of adding them in IonBuilder.
2024-04-15 22:19:06 +03:00
win7-7 08afa0077e 1307651 - Assertion failure: fallibleScope_ ([OOM] Cannot allocate a new chunk in an infallible scope.), at js/src/ds/LifoAlloc.cpp:105
1307651 - IonMonkey - Ensure ballast in jsop_rest,
2024-04-15 20:20:20 +03:00
win7-7 90ee6164fc 1328133 - Assertion failure: fallibleScope_ ([OOM] Cannot allocate a new chunk in an infallible scope.), at js/src/ds/LifoAlloc.cpp:105
1328133: IonMonkey - Ensure ballast in PrototypeHasIndexedProperty
2024-04-15 20:20:11 +03:00
win7-7 88a9977260 Remove duplication.
Remove duplication.
2024-04-15 20:20:00 +03:00
win7-7 f0831439b9 1342261 - Assertion failure: comp == compartment || runtime()->isAtomsCompartment(comp) || (srcKind == JS::TraceKind::Object && InCrossCompartmentMap(static_cast<JSObject*>(src), thing)), at js/src/jsgc.cpp:3725
1342261 - Permit cross-compartment edges in CacheIR stubs.
2024-04-15 06:03:57 +03:00
win7-7 4014f3df94 Re-reverting 1323099 with AbortReasonOr.
Re-reverting with AbortReasonOr/reinstating 1323099 back to js engine.

Seems this does fix crash now with AbortReasonOr used.
2024-04-15 05:49:44 +03:00
win7-7 55fe5d748a 1338825 - CacheIR: Attach the addSlot stub for Arrays
1338825 - CacheIR: Attach the addSlot stub for Arrays.
2024-04-15 05:47:39 +03:00
win7-7 da93ee00a2 338323 - CacheIR should not attach SetArrayLength stub for non-writable length
1338323 - Don't attach SetArrayLength stub if length is not writable.
2024-04-15 05:47:30 +03:00
win7-7 7abb44da2e 1363054 - Make type monitor stubs work with unknown objects/values
1363054 part 1 - Remove redundant addMonitorStubForValue calls.

1363054 part 2 - Remove some shared stubs code that's no longer needed.

1363054 part 3 - Pass StackTypeSet* to addMonitorStubForValue.

1363054 part 4 - Attach generalized type monitor stubs for unknown/unknownObject type sets.
2024-04-15 04:08:52 +03:00
win7-7 187ecd28af 1351951
1351951 - Cleanup InitFromBailout to fight bit-rot

1351951 - Add ICStubCompiler::assumeStubFrame

1351951 - Cleanup GetStubReturnAddress handling
2024-04-15 02:55:00 +03:00
win7-7 dc702c8386 Fix and back to square one.
Fix and back to square one.

Original crash is back.. AbortReasonOr did not fix it.
2024-04-15 02:19:15 +03:00
win7-7 9a216abb41 Rervert this also.
Rervert this also.
2024-04-15 02:00:34 +03:00
win7-7 953c43ca66 Another revert.
Another revert.
2024-04-15 01:31:03 +03:00
win7-7 0d4cf78dc2 Fixes to reverting.
Fixes to reverting.
2024-04-15 01:11:20 +03:00
win7-7 a43c69d359 Revert.
Revert.
2024-04-15 00:48:59 +03:00
win7-7 f41d3f1b4e Revert "Issue #2308 & #1240 Follow-up - Fill in missing JSOP_INC/DEC cases for Ion on Intel32/64."
This reverts commit 8f26f1a873.
2024-04-15 00:33:57 +03:00
win7-7 cdd998842c Revert "Issue #2308 & #1240 Follow-up - Fill in missing JSOP_INC/DEC cases for Doubles in Ion."
This reverts commit dca8417ba7.
2024-04-15 00:32:22 +03:00
win7-7 433722f499 1318677 - Optimize Result<Ok, E> with sizeof(E) < sizeof(uintptr_t)
1318677 part 1 - Use a smaller mask to remove the error tag.

1318677 part 2 - mozilla::Result: Use a single enum to dispatch to the Result implementation.

1318677 part 3 - mozilla::Result: Add a new packing strategy to pack small enumerated values in a single word.
2024-04-15 00:16:08 +03:00
win7-7 0f03218651 1324829 - Add mozilla::Result::andThen
1324829 - Add the `mozilla::Result::andThen` method;
2024-04-15 00:16:08 +03:00
win7-7 a2a1740b05 Fix 5.
Fix 5.
2024-04-15 00:16:08 +03:00
win7-7 cd206eebf4 Fix.
Fix.
2024-04-14 23:38:27 +03:00
win7-7 b158e9ea8f Fixes 3.
Fixes 3.
2024-04-14 22:23:14 +03:00
win7-7 15df16e324 Fixes 2
Fixes 2
2024-04-14 22:08:36 +03:00
win7-7 c7731e02dd Fixes.
Fixes. Pending, still not working.
2024-04-14 21:45:20 +03:00
win7-7 1987259efd 1392530 - Devirtualize MDefinition::op()
1392530 part 1 - Make MDefinition::Opcode an enum class.

1392530 part 2 - Devirtualize MDefinition::op() by storing the op in MDefinition.

1392530 part 3 - Make MDefinition::valueHash() overloads more consistent.
2024-04-14 21:30:06 +03:00
Jan de Mooij 8af078cff2 Bug 1391611 - Devirtualize MNode::kind(). r=nbp
Sigh seems without doing 1392530 abstract class, hmph. Its too much work again.
2024-04-14 20:18:52 +03:00
win7-7 5c9e7d673b Fixes.
Fixes.

Mostly BigIntl misses and various other post-AbortReason additions.
2024-04-14 18:43:31 +03:00
win7-7 d0ba446b7f 1416794 - MOZ_CRASH in js::jit::IonBuilder::inlineScriptedCall (with --ion-eager)
1416794 - InliningDecision_Error is always reported with a pending exception, use AbortReason_Error instead of _Alloc.
2024-04-14 16:51:43 +03:00
win7-7 ec9a51d489 1375435 - Assertion failure: resumePointsEmpty(), at js/src/jit/MIRGraph.cpp:1092
1375435 - Clear the GetPropertyCache prior resume-point at the end of IonBuilder build functions.
2024-04-14 16:48:07 +03:00
win7-7 35ab18b55c 1286505 part 3 - IonBuilder::jsop_getname, remove useless push & pop.
1286505 part 3 - IonBuilder::jsop_getname, remove useless push & pop.
2024-04-14 16:45:09 +03:00
win7-7 7890d16d99 1286505 part 2 - Use Result<V,E> to report errors within IonBuilder.
1286505 part 2 - Use Result<V,E> to report errors within IonBuilder.

Hopefully did not miss anything since part 2 was so huge.
2024-04-14 16:44:04 +03:00
win7-7 380eadbce9 1286505 part 1
1286505 part 1 - Convert AbortReason enum to an enum class.

Merge part 2 and 3 after seeing compilation and working.
2024-04-14 03:33:40 +03:00
win7-7 c27f9b9514 Revert.. 1323099
Revert.. 1323099

Yep its cause of crashing right now.
2024-04-13 23:07:29 +03:00
win7-7 73ff0451c9 1360523 - Make the number of reserved slots dynamic for proxy classes
1360523 - Define number of reserved slots explicitly for each proxy js::Class.
2024-04-13 22:46:45 +03:00
win7-7 297d138d88 1360520 - Use grayLinkExtraSlot instead of hard coding 1 in ProxyObject::trace
1360520 - Add a GrayLinkReservedSlot constant and use it instead of hardcoding 1.
2024-04-13 22:46:45 +03:00
win7-7 17f999f099 1356691 - Make DeadObjectProxies preserve IsCallable and IsConstructor statically instead of an extra slot
1356691 - Preserve DeadObjectProxy's IsCallable and IsConstructor values statically with templates.
2024-04-13 22:46:45 +03:00
win7-7 0603b66102 1237504 - Refactor proxy slot layout to allow proxies to have more than 2 slots.
The patch makes the following proxy changes: *

The number of slots in ProxyValueArray is now dynamic and depends on the number of reserved slots we get from the Class.
* "Extra slots" was renamed to "Reserved slots" to make this clearer. * All proxy Classes now have 2 reserved slots, but it should be easy to change that for proxy Classes that need more than 2 slots. * Proxies now store a pointer to these slots and this means GetReservedSlot and SetReservedSlot can be used on proxies as well. We no longer need GetReservedOrProxyPrivateSlot and SetReservedOrProxyPrivateSlot.

And some changes to make DOM Proxies work with this:

* We now store the C++ object in the first reserved slot (DOM_OBJECT_SLOT) instead of in the proxy's private slot. This is pretty nice because it matches what we do for non-proxy DOM objects. * We now store the expando in the proxy's private slot so I removed GetDOMProxyExpandoSlot and changed the IC code to get the expando from the private slot instead.
2024-04-13 22:28:37 +03:00
win7-7 d031081111 1386700 Move trivial MBasicBlock accessors to the header file
Define some trivial MBasicBlock methods in the header file so the compiler can inline them
2024-04-13 21:07:51 +03:00
win7-7 fd3ee6b65f 1339207 - Always build CacheIRSpewer in Nightly
1339207 - Always build CacheIRSpewer in Nightly builds.

Get this to compile.
2024-04-13 19:21:09 +03:00
win7-7 96db97db34 1334590 - AddressSanitizer: heap-buffer-overflow [@ char* js::QuoteString<char16_t>] with READ of size 2 with newExternalString
1334590 - Fix QuoteString to not read a character out of bounds.
2024-04-13 18:39:36 +03:00
win7-7 b686edad72 1348821 - Change CacheIR spewer to log IC mode
1348821 - For MegamorphicNativeSlot differentiate between HandleMissing.

1348821 - Log CacheIR IC mode.

1348821 - Log address and shape of objects in CacheIR.

1348821 - probably fix unified build failure.

1348821 - Fix it.
2024-04-13 18:19:23 +03:00
win7-7 ac5c565e78 Various fixes
Various fixes.

Mostly misses in previous porting.
2024-04-13 17:55:08 +03:00
win7-7 a097cbe67e Fixes + 1341061 - Refactor NAME-related runtime functions.
1341061 - Refactor NAME-related runtime functions.
2024-04-13 17:05:36 +03:00
win7-7 fe8ee4ab94 1337871 - Fix EmitBaselineEnterStubFrame and EmitBaselineLeaveStubFrame to not clobber the tail call register
1337871 - Clean up and optimize code for entering/leaving Baseline stub frames.

1337871 part 2 - Remove some shared IC code that's no longer used.
2024-04-13 16:31:53 +03:00
win7-7 fa33e7fcb5 Fixes.
Fixes.
2024-04-13 16:11:28 +03:00
win7-7 401a9e3937 1328140 - Handle IC failures better
1328140 - Improve handling of IC failures, add megamorphic IC stubs.
2024-04-13 15:55:40 +03:00
win7-7 7de4ae1cb9 1344198 - Inline various Shape search functions.
1344198 - Inline various Shape search functions.
2024-04-13 14:24:17 +03:00
win7-7 2881f11a40 1349298 - Assertion failure: numOptimizedStubs_ < 16, at js/src/jit/ICState.h:104
1349298 - Add a stub limit to Baseline's TypeOf IC.
2024-04-13 14:16:11 +03:00
win7-7 457d69606d 1345707 - Assertion failure: nonProxyIsExtensible(), at js/src/vm/NativeObject.cpp:848
1345707 - Don't attach set-dense-hole stubs for non-extensible objects.
2024-04-13 14:14:23 +03:00
win7-7 314c232381 1344691 - CacheIR: dense element stub should support element (re)allocation
1344691 - Make add-dense-element stub support element (re)allocation.
2024-04-13 14:12:19 +03:00
win7-7 441c661f6a 1337024 - Convert SETELEM dense/typed array IC to CacheIR
1337024 part 1 - Convert Baseline stubs for setting dense/unboxed elements to CacheIR.

1337024 part 2 - Port Baseline stubs for adding dense/unboxed elements to CacheIR.

1337024 part 3 - Port Baseline TypedArray/TypedObject SetElem stub to CacheIR.
2024-04-13 13:55:08 +03:00
win7-7 ea59448ce4 1344218 - Remove holder and holderShape arguments from IonBuilder::testCommonGetterSetter
1344218 - Rewrite IonBuilder::testCommonGetterSetter to search for the holder instead of taking it as argument.
2024-04-13 13:06:41 +03:00
win7-7 06571fc30f 1344195 - CloneOldBaselineStub should not clone the stub if we didn't recompile the script
1344195 - Fix CloneOldBaselineStub to not clone the stub if we didn't recompile the script.
2024-04-13 13:06:40 +03:00
win7-7 bc9358cf16 Fixes.
Fixes.

1328140 nothing further will work without it.
2024-04-13 03:53:59 +03:00
win7-7 468b342cf2 1342856 - CacheIR: optimize volatile register spilling in IC code
1342856 - Optimize volatile register spilling for C++ calls from IC stubs.
2024-04-13 03:00:26 +03:00
win7-7 89d4c5e60d 1333067 - Remove old Ion GetPropertyIC code
1333067 - Remove old Ion GetPropertyIC code.
2024-04-13 02:59:44 +03:00
win7-7 3bcde029b8 1326437 - Use CacheIR GetName IC in Ion
1326437 part 2 - Don't shape guard non-extensible call objects.

1326437 part 3 - Port Ion GetName IC to CacheIR.
2024-04-13 02:12:54 +03:00
win7-7 1b492fd251 1357024 + 1360852.
1357024 - Fix fixupAliasedInputs to not leave an unusable register on 32-bit platforms.

1360852 - Fix emitGuardIsInt32Index to allocate input register before calling addFailurePath.
2024-04-13 01:52:18 +03:00
win7-7 2cafbee461 1341067 - Port Ion SetProp/SetElem IC to CacheIR
1341067 - Port Ion SetProp/SetElem IC to CacheIR.

1341067 followup - Fix non-unified build bustage.

1341067 followup - Some renaming review nits I forgot to qref.
2024-04-13 01:49:39 +03:00
win7-7 0f00238263 1338828 - Add SetProp/SetElem stub for (DOM) Proxies
1338828 part 1 - Add CacheIR SetProp/SetElem stubs for proxies.

1338828 part 2 - Add CacheIR SetProp/SetElem stubs for shadowing DOM proxies.

1338828 part 3 - Add CacheIR SetProp/SetElem stubs for unshadowed setter calls on DOM proxies.
2024-04-13 00:23:48 +03:00
win7-7 ba6de14368 1319087 - CacheIR: optimize cross-compartment wrappers
1319087 - Implement a CrossCompartmentWrapper IC stub.

1342170 - Fixes jscompartment inlines for js/src/jit files.
2024-04-13 00:00:26 +03:00
win7-7 0ff46bc423 1331034 - CacheIR: Debugging Tools
1331034 - Introduce a JSONPrinter class.

1331034 - Make JSONSpewer inherit from JSONPrinter.

1331034 - Introduce CacheIRSpewer.
2024-04-12 22:18:57 +03:00
win7-7 9b9355af4a 1334187 - Port Baseline JSOP_IN to CacheIR
1334187 - Add ICCacheIR_Regular base class.

1334187 - Add CacheIR scaffolding for JSOP_IN.

1334187 - Port In_Dense from BaselineIC to CacheIR.

1334187 - Port In_Native/In_NativePrototype from BaselineIC to CacheIR.

1334187 - Port In_NativeDoesNotExist from BaselineIC to CacheIR.
2024-04-12 22:18:56 +03:00
win7-7 3c629fb796 1335405 - Use SetPropIRGenerator for Baseline SetElem stubs
1335405 part 1 - Replace unused JOF_SET with JOF_PROPINIT and JOF_PROPSET.

1335405 part 2 - Use SetPropIRGenerator for Baseline SETELEM stubs.
2024-04-12 22:18:56 +03:00
win7-7 ec6a268fca 1323099 - Ion GetProperty IC should be used when the input is a Value
1323099 part 1 - Use Ion GetPropertyIC also when the input is a boxed Value.
2024-04-12 22:18:55 +03:00
win7-7 fd01c1b5f1 1091978 - Investigate having a Baseline IC for adding a property even if that involves slot allocation/reallocation
1091978 - Make CacheIR AddProp stub support dynamic slot (re)allocation.
2024-03-30 20:00:56 +02:00
win7-7 814dbc8985 1334727 - CacheIR: Set array length IC
1334727 - CacheIR: SetProp array length IC.
2024-03-30 19:49:23 +02:00
win7-7 ec594f011d 1333690 - Port Baseline SetProp IC to CacheIR, part two
1333690 part 1 - Port Baseline setter stubs to CacheIR.

1333690 part 2 - Remove now-dead code related to ReceiverGuard.

1333690 part 3 - Port Baseline AddSlot stub to CacheIR.
2024-03-30 19:49:23 +02:00
win7-7 5e155729b5 1359252 - Assertion failure: [barrier verifier] Unmarked edge: Object 0x7ffff46d1070 'obj' edge to Object 0x7ffff46f4070, at js/src/gc/Verifier.cpp:379
1359252 - Add pre-write barrier for JIT writes to NativeIterator::obj.
2024-03-30 05:07:22 +02:00
win7-7 6a0844bafa 1367455 - Scheduled GCs should avoid interrupting running GCs
1367455 - Attempt to avoid interrupting currently running GCs.
2024-03-30 00:29:09 +02:00
win7-7 6e777e9b93 1325686: De-unify Interpreter.cpp.
1325686: De-unify Interpreter.cpp.

Increases compilation time of files its unified with.
2024-03-30 00:29:07 +02:00
win7-7 c7c8a12996 Merge branch 'build-everything-unified' into UXP-custom-new-hybrid-js-engine-IonControlFlow-splitting-unified-building-fully 2024-03-29 23:52:37 +02:00
win7-7 857c5d58f6 1358504 - Add a 1-entry cache to ObjectGroup::defaultNewGroup
1358504 - Add a 1-entry cache to ObjectGroup::defaultNewGroup.
2024-03-29 23:52:14 +02:00
win7-7 e61d2ae1f7 1341090 -Update malloc bytes count when allocating executable memory
1341090: Refactor malloc counters in Zone and GCRuntime.

1341090: Implement a JIT code counter.
2024-03-29 23:52:06 +02:00
win7-7 c02c9501af 1427860 - Crash [@ JSScript::functionNonDelazifying] involving saveIncrementalBytecode
1427860 - XDR failures should leave script isUncompleted().

Failures during XDR may leave the script partially initialized in a way that confuses coverage collection. This ensures the shared script data is removed from a script if there are any XDR failures in it.
2024-03-29 22:55:14 +02:00
win7-7 97f7f4c96a 1351357 - OffMainThread XDR Decoding fails to decode RegExp.
1351357 - Use the ReadOnlyCompileOptions from the HelperThread while decoding RegExp.
2024-03-29 22:55:14 +02:00
win7-7 4db011908a 1358521 - XDROffThreadDecoder fails to decode inner functions (Gecko)
1358521 - XDRScript: Only fail on mismatch between the top-level JSScript and the decoding CompileOption.
2024-03-29 22:55:14 +02:00
win7-7 2ebaf1fa0b Decode XDR off-main-thread, missing parts.
900784 part 0.11 - Instrument XDR Encode/Decode function with the TraceLogger.

1316078 part 2 - Make XDR traceLogger work on a different thread.

Some other parts also missed functionality.
2024-03-29 22:55:12 +02:00
win7-7 a994a4cc0f 1321437 - Differential Testing: Different output message involving Object.freeze
1321437 - Fix ThrowReadOnlyError to match the error message we would throw in the VM.
2024-03-29 20:23:33 +02:00
win7-7 f5cd021bb3 1324020 - Unreachable code in EnumerableOwnProperties?
1324020 - Remove unreachable code in EnumerableOwnProperties function.
2024-03-29 20:12:41 +02:00
win7-7 32b7be5f5f 1320989 - Remove unused dead zone state in GCRuntime
1320989 - Remove unused state in GCRuntime related to dead zones
2024-03-29 19:16:41 +02:00
win7-7 a1e2f91f81 1359093 - Inline the ToWindowProxyIfWindow is-global check
1359093 - Inline the ToWindowProxyIfWindow is-global check.
2024-03-29 18:54:51 +02:00
win7-7 25aa18f502 1323242 - Ignore spurious wakeups when waiting for background sweeping to finish
1323242 - Ignore spurious wakeups when waiting for background thread to finish sweeping.
2024-03-29 18:38:11 +02:00
win7-7 fce6332ebf 1341367 - HashTable::Ptr::isValid returns the opposite of what you expect
1341367 - Make the sense of HashTable::Ptr::isValid match its name.
2024-03-29 18:35:23 +02:00
win7-7 9e3dd9489c 981201 - Remove JS_IsRunning
981201 - Stop using JS_IsRunning in PreciseGCRunnable::Run and remove JS_IsRunning.
2024-03-29 18:22:52 +02:00
win7-7 215f274244 1331115 - Typo in variable name in IdToObjectMap::trace()
1331115 - Fix two typos in CPOW code.
2024-03-29 18:13:41 +02:00
win7-7 ccbe7182bf 1332946 - CacheIR: IC for function.length
1332946 - CacheIR: IC for function.length.
2024-03-29 17:25:49 +02:00
win7-7 e7b2df62d8 1332593 - Optimize lookups of plain data properties on WindowProxies
1332593 - Optimize lookups of data properties on WindowProxies.
2024-03-29 17:25:49 +02:00
win7-7 a999b6c58b 1329016 - CacheIR: Allow -0 (negative zero) index
1329016 - Allow negative zero in CacheIR index check.
2024-03-29 17:25:49 +02:00
win7-7 524fb724c7 1329195 - CacheIR: Update old stubs instead of attaching a new stub when a DOM proxy's generation changes
1329195 - Update old stubs instead of attaching a new stub when a DOM proxy's generation changes.
2024-03-29 17:25:48 +02:00
win7-7 716ac8bea2 1330793 - Google docs regularly hangs when selecting text
1330793 - Refactor int32 index guard to not modify the input register.
2024-03-29 17:25:48 +02:00
win7-7 817aef696a 1326067 - Port Baseline SetProp IC to CacheIR
1326067 part 1 - Change Baseline SetProp IC to leave the RHS value on the stack instead of returning it.

1326067 part 2 - Convert Baseline setslot IC stub to CacheIR.

1326067 part 3 - Port Baseline unboxed object SetProp stub to CacheIR.

1326067 part 4 - Port Baseline TypedObject SetProp stub to CacheIR.

1326067 part 6 - Fix EmitStubGuardFailure to not clobber registers on ARM/MIPS.

1326067 part 7 - Fix type update code to use the unboxed object instead of the UnboxedExpandoObject.
2024-03-29 17:25:47 +02:00
win7-7 f8faa86a46 965992 - Make own property gets of expandos on DOM proxies faster
965992 part 1 - Rename some CacheIR instructions related to DOM proxies.

965992 part 2 - Add inline caches for getting DOM expando properties.

965992 part 3 - Add an is-object debug assert to GuardDOMExpandoMissingOrGuardShape.
2024-03-29 01:04:54 +02:00
win7-7 5423603463 1328077 - CacheIR: Attach DenseElementHole even with zero dense elements
1328077 - Attach dense element hole IC even with zero dense elements.
2024-03-28 23:12:52 +02:00
win7-7 ca97b0fe77 1328076 - CacheIR: Attach primitive IC even for non-existant properties
1328076 - Attach primitive IC for more properties.
2024-03-28 23:12:52 +02:00
win7-7 8d3f1895c7 1323190 - Attach Proxy GetElem IC
1323190 - Attach Proxy GetElem IC.

1323190 - Remove Proxy friendapi.

1323190 - Inline Proxy::get into JIT VM functions.
2024-03-28 23:12:51 +02:00
win7-7 f2c6cbdca2 1323096 - CacheIR: optimize more value[double] cases
1323096 - Optimize object[double] and object[string] like object[int32].
2024-03-28 23:12:15 +02:00
win7-7 b725e9c1e0 1476417 - Differential Testing: Different output message involving arguments
1476417: Add a resume point after assigning to a mapped argument.
2024-03-28 23:12:15 +02:00
win7-7 b1d49832ae 1326589 - Assertion failure: info.frame()->isFunctionFrame() || info.frame()->isEvalFrame(), at js/src/jit/SharedIC.cpp:2612 or Assertion failure: stub->monitorsThis() || *GetNextPc(pc) == JSOP_CHECKTHIS || *GetNextPc(pc) == JSOP_CHECKRETURN, at js/src/jit/SharedIC
1326589 - Correct CacheIR issue with uninitialized let and GetGName.
2024-03-28 23:12:14 +02:00
win7-7 74c41f3fb9 1324566 - Port Baseline GetName IC to CacheIR
1324566 - Set available registers after initializing the input locations.

1324566 - Port Baseline GetName_Env to CacheIR.

1324566 - Port Baseline GlobalNameValue to CacheIR.

1324566 - Port Baseline GlobalNameAccessor to CacheIR.

1324566 - Inspector support for GlobalNameGetter.
2024-03-28 23:12:14 +02:00
win7-7 7f4603ffc7 1325361 - Optimize PropertyReadNeedsTypeBarrier for typed objects
1325361 - Remove check for typed objects from PropertyReadNeedsTypeBarrier.
2024-03-28 19:52:18 +02:00
win7-7 e5cc1eff91 1334356 - Crash [@ js::jit::IonCannon] or Assertion failure: Should have monitored undefined result, at js/src/jit/MacroAssembler.cpp:1597
1334356 - Don't attach a missing-property stub if extra warnings are enabled.
2024-03-28 19:52:18 +02:00
win7-7 ea5a391a55 1330248 - Assertion failure: hasIonScript(), at js/src/jsscript.h:1417
1330248 - Make sure the script still has an IonScript before attaching a stub.
2024-03-28 19:52:18 +02:00
win7-7 6df296d65d 1326150 - Assertion failure: hasValue(), at js/src/jit/RegisterSets.h:210
1326150 - Don't attach getter stubs to IonGetPropertyIC if the IC result isn't monitored.
2024-03-28 19:52:18 +02:00
win7-7 b84023f9cd 1322093 - Generate Ion IC stubs from CacheIR
Part 1 - Split up BaselineCacheIR.{cpp,h}.

Part 2 - Add a mechanism to share codegen for cache ops between Baseline/Ion.

Part 3 - Optimize type guards if we know they always succeed.

Part 4 - Add OperandLocation::Constant since Ion ICs can have constant operands.

Part 5 - Factor out restoreInputState from emitFailurePath.

Part 6 - Add helpers for pushing/popping values.

Part 7 - Make restoreInputState work for Ion ICs.

Part 8 - Rename BaselineCacheIR.{cpp,h} to BaselineCacheIRCompiler.{cpp,h}.

Part 9 - Minor cleanup.

Part 10 - Add initInputLocation overloads for register types used by Ion.

Part 11 - GetPropIRGenerator changes to support idempotent Ion ICs.

Part 12 - Move codegen for some ops to shared code.

Part 13 - Share codegen of ops that use the output register.

Part 14 - Add MacroAssembler::storeRegsInMask.

Part 15 - Rename JitFrame_IonAccessorIC to JitFrame_IonICCall.

Part 16 - Add IonIC infrastructure.

Part 17 - Barrier reads from typed objects so we can attach a typed object IC stub.

Part 18 - Add IonCacheIRCompiler to compile Ion IC stubs from CacheIR.

Part 19 - Enable the new IonGetPropertyIC that's based on CacheIR.

Followup - Make idempotent ICs handle unshadowed DOM proxies to fix Dromaeo regressions.

Followup - Fix the --disable-ion build.

Followup - Add a missing return that got lost in the rewrite.
2024-03-28 19:52:17 +02:00
win7-7 c3bde22400 1323037 - CacheIR: support dense elements with holes.
1323037 - CacheIR for dense elements with holes.
2024-03-28 19:52:17 +02:00
win7-7 88fe03e069 1322091 - Port remaining Baseline GETELEM stubs to CacheIR
1322091 part 1 - Port Baseline string GETELEM stub to CacheIR.

1322091 part 2 - Port Baseline lazy arguments GETELEM stub to CacheIR.

1322091 part 3 - Port Baseline ArgumentsObject GETELEM stub to CacheIR.

1322091 part 4 - Port Baseline dense element GETELEM stub to CacheIR.

1322091 part 5 - Port Baseline unboxed array GETELEM stub to CacheIR.

1322091 part 6 - Port Baseline TypedArray/TypedObject GETELEM stub to CacheIR.
2024-03-28 19:52:17 +02:00
win7-7 a862f88877 1338374 remnants.
1338374 remnants.
2024-03-27 23:27:45 +02:00
win7-7 83bed13b86 Bug 1383467 - Only cancel Ion compilations that use nursery pointers when performing a minor GC
Only cancel Ion compilations that use nursery pointers when performing a minor GC.

One part of 1338374 in js engine seems be missing by looks of it.
2024-03-27 23:27:45 +02:00
win7-7 bdcc4a0acf 1398140: Remove the Ion helper thread pausing
We have this mechanism where we allow 1 helper thread at a time to do Ion compilation. If a higher priority task comes in, we can pause other compilation threads, process the new task on a new thread, then unpause the paused thread(s).

This adds quite a lot of complexity (to code that's already complicated enough!). It also has some issues:

* We would like to Ion-compile scripts in parallel, especially when the CPU has 4+ cores.

* Pausing compilation threads means these threads are not available for other tasks (GC, Wasm, parsing).

* IonBuilderHasHigherPriority includes the size and warm up count of the outer script, but due to inlining it's not clear whether that's very useful.
2024-03-27 23:27:45 +02:00
win7-7 0ae9feecb5 1541580 - Cleanup ProxyObject creation
1541580 - Cleanup ProxyObject creation.
Sec-fix.
2024-03-27 23:27:44 +02:00
win7-7 44e7eecd45 1358753 - Allocate ProxyValueArray inline
1358753 - Allocate ProxyValueArray inline in the object instead of using malloc.
2024-03-27 23:27:44 +02:00
win7-7 9ec733bf86 1339507 - Optimize shape/group lookups in ProxyObject::create
1339507 - Cache the shape/group lookup in ProxyObject::create.
2024-03-27 18:59:54 +02:00
win7-7 585fbf3f88 1339411 - Rewrite and optimize object allocation paths.
1339411 - Rewrite and optimize object allocation paths.

Also includes  1342170 - Fixes NativeObject::create inlines for js/src/vm/ files.
2024-03-27 18:55:21 +02:00
win7-7 37a98e5e1c 1347489 - Vector in StringSegmentRange should have some inline capacity
1347489 - Give StringSegmentRange stack Vector some inline capacity to avoid malloc/free overhead.
2024-03-27 17:21:41 +02:00
win7-7 02b18a6506 1331475 - Don't atomize "ArraySort" for every call to the self-hosted ArraySort function.
1331475 - Don't atomize "ArraySort" for every call to the self-hosted ArraySort function.
2024-03-27 17:03:21 +02:00
win7-7 4b49337269 1342439 - Clean up and optimize overrecursion checks
1342439 part 1 - Replace macros to check for overrecursion with functions.

1342439 part 2 - Optimize CheckRecursionLimit to avoid uninlined RunningWithTrustedPrincipals call.
2024-03-27 16:39:06 +02:00
win7-7 a6fde36b2c 1365654 - Hash table Enum objects cannot be returned from a function.
1365654 - Add a move constructor to HashTable::Enum.

1365654 - Fix style bustage.
2024-03-27 16:35:05 +02:00
win7-7 d047306ff5 Fixes.
Fixes for IonControlFlow.cpp.

Do not use hard assert for now due crash.

Also fix nullish for IonControlFlow.cpp and .h and IonBuilder.cpp

 Bug 1331354 - IonMonkey: Use CopyWithNewTargets for more cases during CFG creation.

1344753 - Update for-of stack depth in ControlFlowGenerator::processWhileOrForInLoop.
2024-03-27 16:35:05 +02:00
win7-7 465f517c04 1342345 part 2 - Use a Vector for AutoCycleDetector.
1342345 part 2 - Use a Vector for AutoCycleDetector.

Part 1 is already in by upstream but part 2 is not.
2024-03-27 16:35:05 +02:00
win7-7 32b703c447 1319746: Add a memory reporter for CFGGraph on BaselineScript
1319746: Add a memory reporter for CFGGraph on BaselineScript.
2024-03-27 16:35:05 +02:00
win7-7 9d1f057852 1324580: Assertion failure: fallibleScope_ ([OOM] Cannot allocate a new chunk in an infallible scope.), at js/src/ds/LifoAlloc.cpp:105
1324580: IonMonkey - Fix out of memory error in IonBuilder.
2024-03-27 16:35:04 +02:00
win7-7 29aa9336a6 1323854 - Assertion failure: exprStack == stackDepth, at js/src/jit/Recover.cpp:110
1323854 - IonMonkey: Part 1: Update start pc on empty backedges.

1323854 - IonMonkey: Part2: Keep the same semantics as bytecode on CFGCompare.

1323854 - Fix unused bodies variable, r=bustage on CLOSED TREE.
2024-03-27 16:35:04 +02:00
win7-7 7e39075d81 1323027 - 2.64% kraken (osx-10-10) regression on push 2f96ca59484d (Thu Dec 8 2016)
1323027: IonMonkey - Remove empty blocks.
2024-03-27 16:35:04 +02:00
win7-7 0546adbe18 1322774: IonMonkey - Test for OOM condition when creating cases for tableswitch
1322774: IonMonkey - Test for OOM condition when creating cases for tableswitch.
2024-03-27 16:35:04 +02:00
win7-7 523d3bc699 1322900 - Firefox Nightly 53.0a1 (2016-12-10) crashes in [@ js::jit:: ... ] & [@ ComputeImmediateDominators ]
1322900 - IonMonkey: Make sure all predecessors are iterated during removal of successor blocks.
2024-03-27 16:35:04 +02:00
win7-7 7e71afbe69 1322932: IonMonkey - Only iterate the backedge of the inner-loop when it has already be visited
1322932: IonMonkey - Only iterate the backedge of the inner-loop when it has already be visited.

IonBuilder.cpp changes are not necessary without 1322724 (Android performance regression, nobody cares mobile on UXP).
2024-03-27 16:35:04 +02:00
win7-7 857a385126 Remove single-threaded BigInt conditions to make it multi-threaded.
Remove single-threaded BigInt conditions to make it multi-threaded.

Fixes debug crash following Mozilla in way they did this.
2024-03-27 16:35:04 +02:00
win7-7 3b7da42cbc Fixes.
Fixes. It builds. Unsure of stability yet.

Crashes but unrelated to this but due multi-threading and bigintl issues.
2024-03-27 16:35:04 +02:00
win7-7 ae477322ba 1310155 - Split IonBuilder into cfg and the rest.
1310155 - IonMonkey, part 1.1: Use a separate allocator for all control flow graphs.

1310155: IonMonkey - Part 1.2 - Remove accidental pushed spewing.
2024-03-27 16:35:04 +02:00
win7-7 d8f2deee88 1310155 - Split IonBuilder into cfg and the rest.
1310155 - IonMonkey, part 0.1: Make sure to report the out of memory during IonBuilder.

1310155 - IonMonkey, part 0.2: Make sure debug_check_operand works again.

1310155 - IonMonkey, part 1.0: Split graph creation from IonBuilder.

This is big enough warrant 1.1 later.
2024-03-27 16:35:03 +02:00
win7-7 f81c7a1cbc Fixes.
Fixes.
2024-03-27 16:35:03 +02:00
win7-7 57f1bb8efe 1320670 - Use CacheIR GetPropIRGenerator for Baseline's GetElement IC
1320670 part 1 - Use jsid instead of PropertyName in GetPropIRGenerator.

1320670 part 2 - Use GetPropIRGenerator for GETELEM stubs in Baseline.
2024-03-27 16:35:03 +02:00
win7-7 a178841a3e 1320145 - Port remaining GETPROP stubs to CacheIR
1320145 part 1 - Port string.length stub to CacheIR.

1320145 part 2 - Port length/callee stubs on lazy arguments to CacheIR.
2024-03-27 16:35:03 +02:00
win7-7 a94a7a8813 1320118 - Some CacheIR cleanup
1320118 part 1 - Remove emitted_ bool from GetPropIRGenerator.

1320118 part 2 - Clean up tryAttachNative to handle all cases in the switch statement.

1320118 part 3 - Introduce AutoStubFrame to emit stub frames.
2024-03-27 16:35:03 +02:00
win7-7 408772a7ad 1319087 - Introduce CacheIR for TypeMonitorResult/ReturnFromIC.
1319087 part 1: Introduce CacheIR for TypeMonitorResult/ReturnFromIC.

This fixes crash with 1319437.
2024-03-27 16:35:03 +02:00
win7-7 0e93a032e7 1322320 - CacheIR: ensure we don't attach duplicate Baseline stubs
1322320  - Ensure we don't attach duplicate Baseline stubs.

Does not fix crash.
2024-03-27 16:35:03 +02:00
win7-7 4d0da559e2 1319437 - Port Baseline GETPROP DOM proxy stubs to CacheIR
1319437 part 1 - Add a generic proxy GETPROP stub to CacheIR.

1319437 part 2 - Port code for GETPROP on shadowing DOM proxies to CacheIR.

1319437 part 3 - Support 64-bit fields in CacheIR stubs.

1319437 part 4 - Port code for unshadowed GETPROP on DOM proxies to CacheIR.

1319437 part 5 - Use CustomAutoRooter for CacheIRWriter.

Some fixes. It still does not compile.
Template error.
2024-03-27 16:35:03 +02:00
win7-7 eddcb40c49 Debug fixed assert.
Debug fixed assert.
2024-03-27 16:35:02 +02:00
win7-7 87830d945c Fixes.
Fixes + reverting part 2/simplification (Remove numFuncDefs() from the ModuleGenerator) which should not be strictly needed anyway for later parts of these changes. It was just simplification based to 1317319  (which is not in and I'm not yet sure I will take it in).
2024-03-27 16:35:02 +02:00
win7-7 cf456c4555 1320374 - Baldr: batch compilations
1320374: Rename THREAD_TYPE_ASMJS into THREAD_TYPE_WASM.

1320374: Remove numFuncDefs() from the ModuleGenerator.

1320374: wasm: move IonCompileTask out of FunctionGenerator.

1320374: Rename IonCompileTask to CompileTask and {Compile,Instantiate}Task to {1}PromiseTask.

1320374: Add missing null-checks.

1320374: Batch function compilations.
2024-03-27 16:35:02 +02:00
win7-7 375d60b200 1319388 - Wasm baseline: Generate function prologue in-line
1319388 - Add add32ToPtrWithPatch and patchAdd32ToPtr to MacroAssembler.

1319388 - wasm baseline: Generate function prologue in-line by patching.
2024-03-27 16:35:02 +02:00
win7-7 4e2df6bc29 1319415 - Assertion failure: isAvailable(r), at js/src/wasm/WasmBaselineCompile.cpp:692
1319415 - pop value stack on block end before attempting to capture join register.
2024-03-27 16:35:02 +02:00
win7-7 bbeb531a8f 1316850 - Wasm baseline: Vet the 0xC changes
1316850 - check return from fallible allocator.

1316850 - no need to allow null label in pushControl.

1316850 - make sure we don't fall through into endFunction.

1316850 - reduce code duplication.

1316850 - clean up void handling.

1316850 - restore old value stack popping regime, with a twist.
2024-03-27 16:35:02 +02:00
win7-7 9b687aa30b Fixes.
1316815 followup build fix on a CLOSED TREE

This was not taken in additionally some need be r.reg instead just r like in signExtendI64_8 and signExtendI64_16.

popJoinRegUnlessVoid does not exist yet. It need be allocJoinReg. pushJoinRegUnlessVoid need be pushJoinReg.
2024-03-27 16:35:02 +02:00
win7-7 7f47ddc64d 1322288 - Assertion failure: isAvailable(r), at js/src/wasm/WasmBaselineCompile.cpp:806
1322288 - wasm baseline, reserve float join registers in optimized control flow.

Introduced by 1286816 so fixing it now.
2024-03-27 16:35:02 +02:00
win7-7 86f5e04348 1316827 - Wasm baseline: Improve double stack adjustments following calls.
1316827 - WASM: the stack is now free'd once, even when an adjustment is needed.
2024-03-27 16:35:01 +02:00
win7-7 df4158e60f 1316848 - Wasm baseline: Avoid using a zero temp register for EqzI64
1316848 - Wasm baseline: Avoid using a zero temp register for EqzI64.
2024-03-27 16:35:01 +02:00
win7-7 f2a142a598 1316816 - Wasm baseline: Avoid double dispatch in popI64(), popF32(), popF64()
1316816: Refactor {load,pop}{I64,F32,F64} to avoid testing src.kind() twice.

This makes the code follow the same pattern as loadI32/popI32.
2024-03-27 16:35:01 +02:00
win7-7 fe3e0e23ca 1316815 - Wasm baseline: Make RegI32, RegI64, RegF32, RegF64 inherit from, not wrap, Register, Register64, FloatRegister
1316815 - Make RegI32, RegI64, RegF32, RegF64 inherit from, not wrap, Register, Register64, FloatRegister.
2024-03-27 16:35:01 +02:00
win7-7 a62602bad0 1286816 - Wasm baseline: Optimize boolean evaluation for control
1286816 -  branch64(reg,reg) stub for arm64.

1286816 - InvertCondition(DoubleCondition).

1286816 - wasm baseline, simplify code generation of branches.

1286816 - wasm baseline, test cases for boolean optimization for control.

1286816 - wasm baseline, optimize boolean expressions for control.

Depedency 1316614 is already in.
2024-03-27 16:35:01 +02:00
win7-7 ee8afb858e 1324989 - InvertCondition is undefined on non-jit platform.
1324989 - InvertCondition is undefined on non-jit platform.
2024-03-27 16:35:01 +02:00
win7-7 15e258a4c7 1338834 - Speed up JSContext::currentScript by doing the compartment check first
1338834 - Speed up JSContext::currentScript by doing the compartment check first.
2024-03-27 16:35:01 +02:00
win7-7 9c79fa9b76 1350371 - jsapi-test testNewContext says about leaking JSRuntime
1350371 - Call destroyRuntime when initialization fails in js::NewContext.
2024-03-27 16:35:01 +02:00
win7-7 0a09262ccf 1321884 - helper threads leak the HeldMutexStack
1321884 - clean up the HeldMutexStack on helper threads

The HeldMutexStack is cleaned up in JS_ShutDown() on the main thread, but since it is thread local we need to clean it up on other threads where it is used.
2024-03-27 16:35:01 +02:00
win7-7 f3ab2a89d8 1341355 - Refactor mark stack to improve type safety and allow iteration
1341355 - Refactor the mark stack.

1341355 - Add abstractions to improve type checking of mark stack contents and add iterator.
2024-03-27 16:35:00 +02:00
win7-7 645b2b2e0c 1332745 - Split runtime-wide pointer updates from per-zone updates in compacting GC
1332745 - Split runtime-wide pointer udpates from per-zone updates in compacting GC.

Fixes second debug crash/assert.
2024-03-27 16:35:00 +02:00
win7-7 24401bb666 Fix one of debug crash.
Fix debug crash and errors done during implementation of multi-threading.

There is second different debug crash.
2024-03-27 16:35:00 +02:00
win7-7 6f2b671469 Fixes.
Fixes.
2024-03-27 16:35:00 +02:00
win7-7 276da307ac 1317703 - Port Baseline native getter stub to CacheIR.
1317703 - Port Baseline native getter stub to CacheIR.
2024-03-27 16:35:00 +02:00
win7-7 199a02a7ed 1318634 - Fix AddCacheIRGetPropFunction to add the receiver after doing other checks.
1318634 - Fix AddCacheIRGetPropFunction to add the receiver after doing other checks.
2024-03-27 16:35:00 +02:00
win7-7 e9f7b634fd 1310125 - Port Baseline scripted getter stub to CacheIR.
1310125 part 1 - Don't use |holder| for own property getters/setters in IonBuilder.

1310125 part 2 - Port Baseline scripted getter IC stub to CacheIR.

1310125 part 3 - Fix IsCacheableGetPropCallScripted perf regression.
2024-03-27 16:35:00 +02:00
win7-7 2a921f09a3 1377738 - virtual memory leak in JS_DestroyContext
1377738 - Fix leak of nursery memory.
2024-03-27 16:35:00 +02:00
win7-7 82a872b473 Bug 1410640 - Enable nursery allocation of arrow functions. r=jonco
Enable nursery allocation of arrow functions.
2024-03-27 16:35:00 +02:00
Jan de Mooij 7cfb14e6fa Bug 1415486 - Nursery allocate async functions. r=arai 2024-03-27 16:34:59 +02:00
win7-7 62d20f3290 867815 - Support visitIteratorStart when using generational GC.
867815 - Add post barrier for visitIteratorStart

867815 - Fix visitIteratorStart shape/group guard for unboxed objects.
2024-03-27 16:34:59 +02:00
win7-7 dbd087e37a Fixes.
Fixes.
2024-03-27 16:34:59 +02:00
win7-7 e6138e7c12 1359800 - Refactor some sweeping logic
1359800 - Use IsAboutToBeFinalized rather than marking state directly during sweeping.

1359800 - Check allocatedDuringIncremental flag in IsMarked functions
2024-03-27 16:34:59 +02:00
win7-7 1d3610f9ea 1360526 - Parallelise more table sweeping
1360526 - Parallelise more table sweeping.
2024-03-27 16:34:59 +02:00
win7-7 d708b02e22 1337450 - Simplify GC resets and aborts
1337450 - Simplify GC resets and aborts.

1340010 only affects ifdef GC zeal which does not exist in UXP.
2024-03-27 16:34:59 +02:00
win7-7 56f51bf5eb 1332357 - Fix DumpHeap to only evict the nursery if requested by caller
1332357 - Fix DumpHeap to only evict the nursery if requested by caller.
2024-03-27 16:34:59 +02:00
win7-7 4ce4a5e323 1322312 - Assert that GCRuntime::enter/leaveUnsafe region is only used on the main thread, remnants.
1322312 - Assert that GCRuntime::enter/leaveUnsafe region is only used on the main thread. Before multi-threading this was done, take remaining parts.
2024-03-27 16:34:59 +02:00
win7-7 f9c2fe780b 1321277 - Refactor arena sweeping for simplicity
1321277 - Refactor arena sweeping for simplicity.
2024-03-27 16:34:59 +02:00
win7-7 6663ded438 1364051 - Make WriteBarrieredBase copy constructor protected
1364051 - Make WriteBarrieredBase copy constructor protected.
2024-03-27 16:34:58 +02:00
win7-7 96b7b6e6c5 1344315 - Suppress protected data checks when handing off runtimes between cooperative threads
1344315 - Suppress protected data checks when handing off runtimes between cooperative threads.
2024-03-27 16:34:58 +02:00
win7-7 a4f4a086ba 1341358 - Don't accidentally clear the incumbent global callback when finishing a cooperative thread
1341358 - Don't accidentally clear the incumbent global callback when finishing a cooperative thread.
2024-03-27 16:34:58 +02:00
win7-7 12323855f7 1412298 - Wait for cooperative threads before worker threads when shutting down the JS shell
1412298 - Wait for cooperative threads before worker threads when shutting down the JS shell.
2024-03-27 16:34:58 +02:00
win7-7 d7af7cb6ae 1341321 - Require runtimes to be single threaded when using a Debugger
1341321 - Require runtimes to be single threaded when using a Debugger.
2024-03-27 16:34:58 +02:00
win7-7 0e03bdbd95 1345307 - Implement runtime-wide WeakCache
1345307 - Implement runtime-wide WeakCache.
2024-03-27 16:34:58 +02:00
win7-7 adbd68337f 1338614 - Refactor incremental barrier APIs and make them call the read barrier
1338614 - Refactor incremental barrier APIs and make them call the read barrier.

Following 55 js engine.
2024-03-27 16:34:58 +02:00
win7-7 9d6bab4635 Debug fixes.
Also another fallout from 1334194/accidentally undone progress revealed by debug.

Also 1333000 is not in currently so undone additions, might be worth of taking in later along with 1332601.

Also debug found fixes.
2024-03-27 16:34:58 +02:00
win7-7 b688c64520 This was accidentally changed to false.
This was accidentally changed to false.
2024-03-27 16:34:57 +02:00
win7-7 99d8a60efd Revert "1343590 - Improve CallArgs gray marking assertions"
This reverts commit f3c2006234.

This need be done later since  ValueIsNotGray does not exist yet, only in future.
2024-03-27 16:34:57 +02:00
win7-7 4b69698441 Add back if (cx->zone()->needsIncrementalBarrier()) {
if (cx->zone()->needsIncrementalBarrier()) { this seems be needed in this file without CacheIR.
2024-03-27 16:34:57 +02:00
win7-7 e57a6f8991 1358599 follow up fixes until CacheIR is there.
1358599 follow-up fixes until CacheIR is there.
2024-03-27 16:34:57 +02:00
win7-7 9b37db16e2 1364014 - Remove unnecessary is-array check in GCMarker::restoreValueArray.
1364014 - Remove unnecessary is-array check in GCMarker::restoreValueArray.

7 years ago:

In restoreValueArray we fail if we have dense elements and the object is not an array. Looking at blame data this check was added 5 years ago (over 10 years ago) and it's probably from the "only arrays can have dense elements" days.

I instrumented the browser and we're hitting this case a bunch of times, sometimes for objects with more than 500 elements.
2024-03-27 16:34:57 +02:00
win7-7 25eafab3f9 1259730 + 1323083 - Change representation of GC mark state to enable incremental gray marking
1259730 - Make UnmarkGray use an explicit mark stack instead of recursion

1323083 - Change representation of GC mark state to enable incremental gray marking.
2024-03-27 16:34:57 +02:00
win7-7 5b8d980be1 1359077 - Optimize a few things in ExposeGCThingToActiveJS.
1359077 - Optimize a few things in ExposeGCThingToActiveJS.
2024-03-27 16:34:57 +02:00
win7-7 f38f4f5376 1358599 - Use runtime guards for jitcode pre-barriers instead of patchable jumps.
1358599 - Use runtime guards for jitcode pre-barriers instead of patchable jumps.
2024-03-27 16:34:57 +02:00
win7-7 0a5904101d 1337427 - Implement GCVector::sweep
1337427 - Implement GCVector::sweep.

New functionality. Bring it in see if it impact performance of GC.
2024-03-21 12:19:49 +02:00
win7-7 6fb09a688d 1342653 - Change Nursery::cellsWithUid_ from HashSet to Vector
1342653 -  Change Nursery::cellsWithUid_ from HashSet to Vector.
2024-03-21 03:28:48 +02:00
win7-7 f3c2006234 1343590 - Improve CallArgs gray marking assertions
1343590 - Improve CallArgs gray marking assertions.
2024-03-21 02:30:04 +02:00
win7-7 fbe1637fe0 1322539 - Call ExposeObjectToActiveJS on the targets of xray wrappers
1322539 - Call ExposeObjectToActiveJS on the targets of xray wrappers.
2024-03-21 02:24:29 +02:00
win7-7 a8bafc3790 1335751 - Add js::CheckGrayMarkingState friend API to check there are black to gray edges
1335751 - Add js::CheckGrayMarkingState friend API to check there are black to gray edges.

Mostly taking this in to see impact on GC and make it easier track 55 js engine GC state.

I don't care Android/old Fennec UXP does not even support Adroid, so checks are not taken in.
2024-03-21 02:22:16 +02:00
win7-7 1a7386295d 1342181 - FinalizeDeferredThings can change gray marking state between FixGrayBits GC and start of CC
1343986 - Fix setting of gray bits valid flag after GC.
2024-03-21 02:08:10 +02:00
win7-7 8c1851b6f3 1343986 - Fix setting of gray bits valid flag after GC
1343986 - Fix setting of gray bits valid flag after GC.
2024-03-21 02:04:11 +02:00
win7-7 59a55e5e94 1340537 - Don't trace parse task things if they cannot be GCed
1340537 - Don't trace parse task things if they cannot be GCed.

For  preparation of 1335751.
2024-03-21 02:00:25 +02:00
win7-7 be943bbbe8 Fixes to revert incorrect changes.
Fixes to revert incorrect changes.
2024-03-21 01:53:03 +02:00
win7-7 680718719c Fixes to get this to compile with statistics changes.
Fixes.
2024-03-21 01:44:14 +02:00
win7-7 ed41693d19 Fixes.
Fixes.
2024-03-21 00:36:49 +02:00
win7-7 294292bfc4 1361401 - Make gc::Statistics counts atomic as these can be updated by helper threads
1361401 - Make gc::Statistics counts atomic as these can be updated by helper threads.
2024-03-21 00:28:08 +02:00
win7-7 e9e6df1a11 1335413 - Use mozilla array containers in GC statistics code
1335413 - Use mozilla array containers in GC statistics code.
2024-03-21 00:17:41 +02:00
win7-7 2defe9efea 1326343 - Do not compute with null Timestamp on OOM
1326343 - Do not compute with null Timestamp on OOM.
2024-03-20 23:50:47 +02:00
win7-7 01f5bf2d80 1173354 - Stop tracking GC begin/end callback time since it did not handle nesting
Second part.
2024-03-20 23:42:14 +02:00
win7-7 686b1a3fe2 1173354 - Switch GC statistics over to TimeStamp/TimeDuration.
I need this to keep track of all other GC changes between 52 and 55 so I can know what impacted GC performance.
2024-03-20 23:33:41 +02:00
win7-7 42effc35d6 1353758 followup - Also purge external string cache after compacting GC
1353758 followup - Also purge external string cache after compacting GC.
2024-03-20 22:08:35 +02:00
win7-7 6ba23eb2d7 Miss from 1348134.
Miss from 1348134.
2024-03-20 21:58:01 +02:00
win7-7 6d743a97f4 1356631 - Change LargeAllocationCallback to be process-wide
This is necessary to allow helper threads to attempt large allocations and recover from fragmentation situations with the LargeAllocationFailureCallback.
2024-03-20 21:39:38 +02:00
win7-7 00d6c934c4 1353758- Move the external string cache to the JS engine and improve it also has 1352323.
First add 1352323 - Add JS_NewMaybeExternalString function that creates either an external string or returns a static string then add 1353758.

1353758-  Move the external string cache to the JS engine and improve it.
2024-03-20 21:22:42 +02:00
win7-7 37d94c0acc 1357012 - Use fallible append for compression tasks and use UniquePtrs.
1357012 - Use fallible append for compression tasks and use UniquePtrs.
2024-03-20 20:51:40 +02:00
win7-7 1c9002f0db 1348134 - ScriptSource compression is often wasteful.
1348134 - Stop eagerly compressing ScriptSources.

1348134 - Handle compression tasks with major GCs instead of eagerly.

1348134 - Pin chars returned from ScriptSource as an analog to Rooted.
2024-03-20 20:35:20 +02:00
win7-7 2de2133d2d Forget these changes for avoiding atoms collecting slowdown. Take them now.
1374797 - Fix logic around triggering atoms GCs.

1384550 - Skip atoms collection if it's no longer possible.

Only affect after multi-threading changes. Forget to take these fixes before.
2024-03-20 18:48:46 +02:00
win7-7 40bb25b290 1342642 - Assertion failure: CurrentThreadCanAccessRuntime(cx->runtime()), at threading/ProtectedData.cpp:97 or Assertion failure: rt->jitRuntime()->preventBackedgePatching() || rt->activeContext()->handlingJitInterrupt(), at jit/ExecutableAllocator.cpp:330
1342642 - Don't modify jitcode when interrupting an idle cooperative thread.
2024-03-20 13:57:25 +02:00
win7-7 c33b480b9b 1527839 - Set maximum recursion limit for ExtractLinearSum
1527839 - Set maximum recursion limit for ExtractLinearSum.
2024-03-20 13:55:10 +02:00
win7-7 e420bd791b 1341326 - Set stack limit and stack size properly for helper threads
1341326 - Set stack limit and stack size properly for helper threads.
2024-03-20 13:52:18 +02:00
Jan de Mooij 54db5dc303 Bug 1377238 - Free finished IonBuilders off-thread. r=jonco 2024-03-20 13:35:52 +02:00
win7-7 110d6322f9 1360502 - Prioritise GC parallel tasks when selecting tasks to run on helper threads
1360502 - Prioritise GC parallel tasks when selecting tasks to run on helper threads
2024-03-20 12:43:08 +02:00
win7-7 195d6d9726 Various fixes.
Various fixes. This does compile and works without crashing also.
2024-03-20 05:26:48 +02:00
win7-7 8c9e91ccc3 I have no idea why in 1334194 I accidentally undone jit multi-threading progress.. revert those unwanted changes.
I have no idea why in 1334194 I accidentally undone jit multi-threading progress.. revert those unwanted changes.
2024-03-20 03:20:18 +02:00
win7-7 0e7206e5cb Multi-threading miss.
Multi-threading miss.
2024-03-20 03:11:29 +02:00
win7-7 9896148404 There is still ExclusiveContext, revealed by removing main thread from engine.
There is still ExclusiveContext, revealed by removing main thread from engine.
2024-03-20 03:09:23 +02:00
win7-7 cad64ea41a Brace in wrong location.
Brace in wrong location.
2024-03-20 03:05:03 +02:00
win7-7 4f6040306e Fixes.
TypedObject.cpp was missing brace

1335095  accidentally changed MarkInterpreterActivations to TraceInterpreterActivations and  MarkJitActivations to TraceJitActivations.

JitFrames.h file was missed while doing 1340822 .
2024-03-20 02:54:14 +02:00
win7-7 eaf0fdb5e3 1340822 - Move nursery and caches from ZoneGroup back to the runtime
1340822 - Move nursery and caches from ZoneGroup back to the runtime.

Also add back uncompressedSourceCache, it was accidentally removed in 1337070 instead just reordering it.
2024-03-20 02:06:30 +02:00
win7-7 4c57bac545 1337968 - Add API and shell harness for cooperative multithreading
1337968 - Add API and shell harness for cooperative multithreading.
2024-03-20 01:16:44 +02:00
win7-7 2fe5e60be9 1337491 - Off thread parsing changes for multithreaded runtimes
1337491 - Off thread parsing changes for multithreaded runtimes.
2024-03-20 00:39:01 +02:00
win7-7 a27998ec96 1337117 - Remove references to main thread in the JS engine
1337117 - Remove references to main thread in the JS engine.
2024-03-19 23:38:05 +02:00
win7-7 019819e4d2 1337109 - Fix some minor places where a single context/zone group per runtime is assumed
1337109 - Fix some minor places where a single context/zone group per runtime is assumed.
2024-03-19 21:56:44 +02:00
win7-7 3f2523cc99 1337112 - Remove links from JSRuntime to its single context and zone group
1337112 - Remove links from JSRuntime to its single context and zone group.
2024-03-19 21:49:50 +02:00
win7-7 bf572de933 1337070 - Tolerate multiple zone groups and cooperating contexts in the GC
1337070 - Tolerate multiple zone groups and cooperating contexts in the GC.
2024-03-19 20:36:49 +02:00
win7-7 92deb40510 1337084 - Tolerate multiple threads running JS in JIT simulators
1337084 - Tolerate multiple threads running JS in JIT simulators.

Check later if 1285074 - Make ICacheMap manipulation signal-safe is necessary or not.
2024-03-19 19:25:45 +02:00
win7-7 e2c3f68af0 1336603 - Move PCCounts state from ZoneGroup back to the runtime
1336603 - Move PCCounts state from ZoneGroup back to the runtime.
2024-03-19 16:36:31 +02:00
win7-7 242911896e 1339944 - Prohibit context switches while handling OOM during type inference operations
1339944 - Prohibit context switches while handling OOM during type inference operations.
2024-03-19 16:18:19 +02:00
win7-7 7df83e6a64 1335846 - Prohibit changing the active cooperatively scheduled thread during operations that affect GC
1335846 - Prohibit changing the active cooperatively scheduled thread during operations that affect GC.
2024-03-19 16:15:54 +02:00
win7-7 dba069dda0 1335130 - Allow iterating over the zone groups in a runtime
1335130 - Allow iterating over the zone groups in a runtime.
2024-03-19 16:10:35 +02:00
win7-7 1f0f4d5b9d 1334885 - Allow wasm signal handlers to work with multiple threads in a runtime
1334885 - Allow wasm signal handlers to work with multiple threads in a runtime.
2024-03-19 16:03:59 +02:00
win7-7 907d8b4c15 1337106 - Handle multiple contexts per runtime in memory reporter
1337106 - Handle multiple contexts per runtime in memory reporter.
2024-03-19 15:47:07 +02:00
win7-7 cbdf4da0bc 1357367 - Hit MOZ_CRASH(element wasn't found in this list!) or Assertion failure: ionLazyLinkListSize_ > 0, at js/src/gc/ZoneGroup.cpp:103
1357367 - Only finish IonBuilders for the zone group a context is in.

Also includes 1351102 - Fix GetFinishedBuilder to check the runtime instead of the compartment
2024-03-19 15:42:28 +02:00
win7-7 881682099f 1347539 - Crash [@ js::TenuringTracer::traverse] or Assertion failure: ownerContext().context() == nullptr, at js/src/gc/ZoneGroup.cpp:55 or various crashes with use-after-free involving evalInCooperativeThread
1347539 - Keep track of the Ion lazy link list at the zone group level
2024-03-19 15:21:34 +02:00
win7-7 4e88513b49 1334880 - Don't use JSContext* symbolic address in wasm jitcode
1334880 - Don't use JSContext* symbolic address in wasm jitcode.
2024-03-19 15:07:56 +02:00
win7-7 ad89a89313 1335095 - Allow cooperating JSContexts to iterate over each others' activations.
1335095 - Allow cooperating JSContexts to iterate over each others' activations.

WasmTypes.cpp will be changed whole soon with 1334880.
2024-03-19 15:01:52 +02:00
win7-7 a989af22fc 1334194 - Don't differentiate between thread kinds in the trace logger
1334194 - TraceLogger changes for multithreaded runtimes.

Also: 1334194: Follow-up fixes to tracelogger thread safety.
2024-03-19 13:48:18 +02:00
win7-7 fd3dcf1a29 1334927 - Handle multiple contexts per runtime in the SPS profiler
1334927 - Handle multiple contexts per runtime in the SPS profiler.
2024-03-19 02:14:05 +02:00
win7-7 5a49801dd7 1334212 - Handle multiple contexts per runtime in compiled JIT code
1334212 - Handle multiple contexts per runtime in compiled JIT code.
2024-03-19 01:47:19 +02:00
win7-7 ec3edcc62e 1334837 - Add JSContext* to runtime for the active cooperatively scheduled thread
1334837 - Add JSContext* to runtime for the active cooperatively scheduled thread
2024-03-19 00:55:38 +02:00
win7-7 d361b4a5a6 1334845 - Create only one JSContext per helper thread
1334845 - Create only one JSContext per helper thread.
2024-03-19 00:26:16 +02:00
win7-7 e5c099ec0b Follow-up assertion fixes.
1336866 - Lock GC while getting heap growth factor in testing function.

1336893 - Tolerate redundant writes in WriteOnceData checks.

1337324 - Fix GCManagedDeletePolicy so that it again tolerates being called off thread.
2024-03-19 00:12:44 +02:00
win7-7 2cdc040a18 Compiles and links.
Compiles and links.
Generational GC is not possible keep preference same way when using multi-threaded js engine anymore.

./mach run succesful. Build started and worked. I need do cleaner branch later.
2024-03-18 23:52:46 +02:00
win7-7 e4a50eea9b Fixes + reverting.
.ref(), to multi-threading additions to jsgc.cpp and fixing sweepZoneGroups to sweepZones.

Also reverting 1465108  for now. Might try redo later.
2024-03-18 23:00:27 +02:00
win7-7 59c579be00 Fix GCRuntime.h missing some previous due accidental removal.
Fix GCRuntime.h missing some previous due accidental removal.
2024-03-18 21:33:48 +02:00
win7-7 1557dd11dd 1329632: Add a null-check for empty filenames in wasm stack traces
Follow-up crash fix.
2024-03-18 20:31:18 +02:00
win7-7 bdc2f37409 1326501 - Baldr: optimize getFuncName
Bug 1326501 - Baldr: optimize getFuncName  is necessary due it introducing runtime for WasmCode.h ensureProfilingState.
2024-03-18 20:29:10 +02:00
win7-7 88e470c7db Further mix fixes.
Further mix fixes.

Bug 1326501 - Baldr: optimize getFuncName  is necessary due it introducing runtime for WasmCode.h ensureProfilingState.
2024-03-18 20:13:25 +02:00
win7-7 dd74a29715 Mixed fixes.
Mixed fixes including removing template from jsnum.h, missed line and lack of comma in jsscript.cpp, fixing jsgc.cpp file somewhat, its still not fixed but bit progress including duplicate removal
2024-03-18 19:34:16 +02:00
win7-7 054620ca38 Some fixes.
Some fixes.
2024-03-18 18:08:00 +02:00
win7-7 b41660f968 Missed change.
Missed change.
2024-03-18 16:09:59 +02:00
win7-7 eea7b9237c This should have been removed.
This should have been removed.
2024-03-18 16:07:24 +02:00
win7-7 10b4acc850 Leftover accidentally taken from previous branch/based to it.
Leftover accidentally taken from previous branch.
2024-03-18 15:53:26 +02:00
win7-7 d398ba11ff Fixes.
Still does not compile
2024-03-18 14:31:52 +02:00
win7-7 f546d7de6e Fixes.
duration_(nullptr), to 0.

JS::Value does not fit unwrappedExceptionStack_ use js::SavedFrame*.
2024-03-18 13:17:34 +02:00
win7-7 980beb9801 Accident.
Accident.
2024-03-18 12:52:19 +02:00
win7-7 93ca9d7f09 1465108 + smaller fixes.
1465108 + smaller fixes.
2024-03-18 05:44:19 +02:00
win7-7 d2e1f9dd51 Remove other leftovers of asJSContext
Remove other leftovers of asJSContext.
2024-03-18 04:42:49 +02:00
win7-7 2a1c575302 Remove asJSContext() from BigIntType.cpp
Remove asJSContext() from BigIntType.cpp
2024-03-18 04:40:13 +02:00
win7-7 cac53eb3fa Further fixes
Further fixes. JSExternalStringSizeofCallback does not exist in current js engine and GeckoProfiler is renaming of SPSProfiler.

GCRuntime.h(102): error C2614: 'js::gc::BackgroundDecommitTask': illegal member initialization: 'GCParallelTask' is not a base or member

AtomicsObject.cpp(772): error C2668: 'js::ToNumber': ambiguous call to overloaded function

These issues remain.
2024-03-18 04:27:50 +02:00
win7-7 c30f3ef4bc Of course there had be typos.
Of course there had be typos.
2024-03-18 03:12:30 +02:00
win7-7 e34734ef21 Hmm ExclusiveContext* cx misses.
Hmm  ExclusiveContext* cx misses. Going merge with one commit soon.
2024-03-18 03:04:36 +02:00
win7-7 eae0418d24 1325050 - Structure reorganization for multithreaded runtimes
1325050 - Structure reorganization for multithreaded runtimes
2024-03-18 02:16:04 +02:00
win7-7 a57830cfd0 Merge branch 'master' into UXP-custom-new-GC-atom-marking-more 2024-03-11 15:02:57 +02:00
win7-7 300459ef22 bug1353694 - Adds the missing call to cx->markAtom() and changes the functions to use Atoms to match bug 1350760.
Adds the missing call to cx->markAtom() and changes the functions to use Atoms to match bug 1350760
2024-01-30 10:28:27 +02:00
win7-7 cd8a7928af Bug 1350760 - Atomizing strings needs to be faster.
Also includes: 1341033: Make sure zones mark any children of marked atoms.

1350760 part 1: Templatize and optimize AtomMarkingRuntime::markAtom.

1350760 part 2: Ensure SparseBitmap::setBit gets inlined.

1350760 part 3: Add AtomMarkingRuntime::inlinedMarkAtom to eliminate markAtom call overhead when atomizing.

1350760 part 4: Call JSString::validateLength only when we have to allocate a new atom.

1350760 part 5: Make sure various hashtable lookups get inlined when atomizing strings.

1350760 part 6: Add a Zone cache for recently atomized strings.
2024-01-29 18:45:02 +02:00
win7-7 efefc3498b Bug 1321277 - Allow incremental GC when keepAtoms is set
1213977: Don't reset an ongoing incremental GC if AutoKeepAtoms is set.

This should be safe after 1324002 atom marking + 1340597 - Avoid triggering read barrier in DumpHeap and when collecting stats as necessary for security.
2024-01-29 16:24:31 +02:00
win7-7 34f87236c6 Bug 1321277 - Collect the atoms zone in the last ditch GC.
Bug 1321277 - Remove use of AutoKeepAtoms from last ditch GC
2024-01-29 15:32:16 +02:00
win7-7 47cfbac4ed Bug 1324002 - Mark atoms separately in each zone, also includes 1328967, 1335642, 1335643, 1337578, 1341006, 1370541, 1438880.
1324002: Mark atoms separately in each zone:

Fixes: removing () reference to multi-threading in AtomMarking.cpp and fixing Scope.h to use trailingNames.start();

Also includes:

1328967: Allow GCZonesIter to be used by helper threads during GC.

1335642: Mark RegExp source atoms crossing zone boundaries in a better place.

1335643: Fix bogus assert by marking atoms when serializing cross-zone saved frames.

1337578: Mark atoms when cloning functions.

1341006: Use a sparse representation for atom mark bitmaps in zones

1370541: Always assert that the atom is marked when setting a function's name.

1438880: Add release checks before instantiating a lambda or regexp.
2024-01-29 15:08:10 +02:00
win7-7 bbb9731779 Bug 1467403 - BytecodeEmitter::finishTakingSrcNotes is quadratic, and can take multiple seconds on large JavaScript files.
Bug 1517135: Improve performance of BytecodeEmitter::finishTakingSrcNotes.

Bug 1517135: Remove dead declaration from BytecodeEmitter.h

Go to https://carnap.io/about

This website loading takes longer without these changes.
2024-01-28 23:41:26 +02:00
win7-7 b2150a8434 Bug 1467403 - Remove the source notes handling for prologue bytecode.
Bug 1467403 - Remove the source notes handling for prologue bytecode.
2024-01-28 23:41:08 +02:00
win7-7 5026ebe4fb Bug 1460385 - Don't trace propid in TraceCycleCollectorChildren.
The propid is a jsid, and a jsid can never be anything the CC cares about, so there's no reason to trace it. In at least one profile of Google Inbox, tracing shape propids is taking the majority of time in the CC and causing very long pauses.

This might be win in GC ubench benchmark. Going still test with UXP platform but mozregression suggest win.
2024-01-22 15:12:56 +02:00
win7-7 2784a7440e Bug 1520423 - Use AutoTArray in filter code
Bug 1520423 - Use AutoTArray in filter code.

Unlike 1520294 this can be done without depending on 1417699.

See:

https://compat-table.github.io/compat-table/esnext/ expand table with Feature name down arrow, notice how slow mouse-over hover is, this patch improves performance to extent, this website hovering with mouse is still slow but less than before.
2024-01-21 20:00:43 +02:00
win7-7 762ce30e9d Web compatibility backporting.
Bug 1334554: Handle the return value of nsFilterInstance::PaintFilteredFrame, needed for 1336480.

Bug 1336480 Part 1: Apply suface limitation in nsFilterInstance::ComputeNeededBoxes.

There is no need to limit output space bounds in
nsFilterInstance::OutputFilterSpaceBounds(), it's just far too early.

Bug 1336480 Part 2: Test case.

Bug 1526609: When interrupting the reflow of abspos kids, still account for the old overflow areas.

Otherwise, if we're scrolled, the scroll frame will think that our scroll range was reduced, which will in turn clamp the scroll position, which is not good.
2024-01-21 17:47:22 +02:00
win7-7 be75437f35 1110928 - Per-document GC poking should not trigger a full GC
Bug 1110928, part 1: Hoist the LOAD_END PokeGC out of nsJSContext::LoadEnd.

nsDocumentViewer knows which document is involved which will help us later.

Also, fix a typo in the comment.

Bug 1110928, part 2: Call PokeGC in nsDocumentViewer::PageHide before the call to OnPageHide.

This ensures that the document isn't destroyed when we call PokeGC, which will be useful later.

Bug 1110928, part 4: Try to pass a relevant zone to PokeGC.

Bug 1110928 part 5: trigger full GC only when closing top level outer window.

Bug 1110928 part 6: trigger ZoneGC after evicting from bfcache

Bug 1110928 part 7: ensure zone GC collects the zone from which canvas context is originated

Bug 1110928 part 8: first request GC should be a full GC
2024-01-20 18:14:32 +02:00
win7-7 7dc5fcadee Fix .html file crash with dynamic module import. 2024-01-18 16:33:29 +02:00
win7-7 d860716b9e Merge branch 'master' into UXP-custom-still-error-fix 2024-01-18 16:32:57 +02:00
win7-7 ac4213d11a MOZ_MUST_USE to C++17 [[nodiscard]] to LookupForAdd, LookupResult, EnsureInserted.
MOZ_MUST_USE to C++17 [[nodiscard]] to LookupForAdd, LookupResult, EnsureInserted.
2024-01-18 16:32:30 +02:00
win7-7 b6d012bc0d Some more hashtable changes to avoid lookups.
Bug 1372007 - Replace calls to Contains+Put with LookupForAdd and Contains+Get+Put with LookupRemoveIf to avoid unnecessary hashtable lookups.

Bug 1372048 - Use LookupForAdd instead of Contains+Get/Put to avoid an unnecessary hashtable lookup.

Bug 1372327 - Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups.

Bug 1376483 - Use Lookup instead of Get+Remove, and LookupForAdd instead of Get+Put, to avoid unnecessary hashtable lookups.

Bug 1376487 - Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups.
2024-01-18 16:32:30 +02:00
win7-7 339705a43e Remove pointless spaces accidentally added.
Remove pointless spaces accidentally added.
2024-01-18 16:32:30 +02:00
win7-7 dc8ae7d8d6 Further hashtable changes to reduce lookups.
Bug 1367209:
nsCounterManager::DestroyNodesFor does an unconditional hashtable iteration on every frame destruction

part 2,3 and 4.

Bug 1370593 - avoid redundant lookups in nsRefPtrHashtable::Remove;

We already have a handle to the entry in the hashtable, we can remove that directly, rather than implicitly looking up the entry to remove in Remove().

Bug 1371960 - Use EnsureInserted instead of Contains+PutEntry to avoid unnecessary hashtable lookups.

Bug 1372031 - Use EnsureInserted instead of Contains+PutEntry to avoid unnecessary hashtable lookups.

Bug 1374125 - Use EnsureInserted instead of Contains+PutEntry to avoid unnecessary hashtable lookups.

Bug 1376126 - Use Lookup() entry instead of Get+Remove in CycleCollectedJSRuntime::RemoveJSHolder to avoid unnecessary hashtable lookups.

Bug 1376127 - Use LookupForAdd instead of Get+Put in CycleCollectedJSRuntime::DeferredFinalize to avoid unnecessary hashtable lookups.

Bug 1376463 - Use Lookup instead of Get+Remove to avoid unnecessary hashtable lookups.
2024-01-18 16:32:30 +02:00
win7-7 70acbe0142 avoid hashtable lookup nsClassHashtable.h
make RemoveAndForget() use RemoveEntry(), not Remove(), to remove the entry to avoid a second hashtable lookup, nsClassHashtable.h back when  LookupRemoveIf() was introduced had this change, take it in.
2024-01-18 16:29:08 +02:00
win7-7 be0b87cb77 Backout vector due there is no solution to crashing yet.
Backout vector due there is no solution to crashing yet.
2024-01-18 11:48:49 +02:00
win7-7 aab43246c5 1539366 Typing or scrolling in Phabricator on long pages is super slow
Bug 1539366 - Use SetCoord to restore mPIStartBorderData's coord so that it also set mValid. r=mats a=jcristau Without this the restore doesn't have any effect as the next frame sees that coord has mIsValid=false

Bug 1539366 - Use a temporary object to compute the mPIStartBorderData coords so that we don't clobber the regular state. r=mats a=jcristau

Bug 1539366 - Avoid calling AreOnSameLine once we know we've already changed lines since it can be expensive to compute. r=mats a=jcristau

Go to https://phabricator.services.mozilla.com/D24930

Scroll all the way to the bottom of Phabricator example website, see how slow it is before these patches, it is fast after these patches.
2024-01-18 01:08:32 +02:00
win7-7 2da8928bbd Bug 1366250, don't flush layout when calling element.focus() on already focused element. Ensure layout is flushed after changing input.type, r=ehsan
don't flush layout when calling element.focus() on already focused element. Ensure layout is flushed after changing input.type

Also includes follow-up:

bug 1366517, because of XBL usage, limit not-flushing-always-during-focus() to non-chrome, r=ehsan

Improves Speedometer performance.
2024-01-18 01:08:09 +02:00
win7-7 61646c0fca Custom changes (vector, nsGenCon, hashtables performance improvements) with UXP up-to-date
Custom changes with UXP up-to-date
2024-01-18 01:07:01 +02:00
win7-7 7fe76b76b3 Merge branch 'master' into build-everything-unified 2024-01-17 20:47:58 +02:00
win7-7 3a59e7f8b6 Merge branch 'master' into build-everything-unified 2024-01-06 18:51:11 +02:00
win7-7 8cfa5de132 Merge branch 'master' into build-everything-unified 2023-12-06 20:58:19 +02:00
win7-7 623e3eb9d8 Merge branch 'master' into build-everything-unified 2023-11-29 19:09:43 +02:00
win7-7 7f83281928 Restore unified building to caps and chrome.
Restore unified building to caps and chrome.
2023-11-10 18:30:24 +02:00
win7-7 40e515d441 Bug 1351820 - Build more more netwerk files in unified mode.
This updates the unifed sources for a few netwerk build files. In some cases files were excluded because we thought they used plarena.h, but that turned to be false. A few files needed to be updated to add missing imports/exports due to shifting of compilation units.

This along with other unified building previously reduces compilation time about 1 minute.
2023-11-10 13:07:29 +02:00
win7-7 4c976817c9 Bug 1348991 - Use unified sources in startup cache.
The startup cache source files are incorrectly marked as using plarena.h, we can make building them unified.
2023-11-10 12:31:55 +02:00
win7-7 ff063d5a38 Bug 1348998 - Build XML with unified sources.
It looks like we can build parser/xml with unified sources.
2023-11-10 12:31:44 +02:00
win7-7 2234371a02 Bug 1351910 - Build more files as unified in ipc/glue
One file was excluded for using plarena which it did not. The other was excluded for "clashes with strdup," it does not use strdup.
2023-11-10 12:31:33 +02:00
win7-7 9b2b7e6589 Bug 1362644 - Build more SpiderMonkey files in unified mode.
Neither vm/Initializiation.cpp nor the threading files need to be built in non-unified mode. They don't have any conflicting definitions or need any file-specific compiler flags.
2023-11-10 12:31:20 +02:00
win7-7 b66b756a15 Bug 1351831 - Build more xpconnect code in unified sources.
These files were being excluding because we thought they used plarena.h, but it turns out they did not. A few tweaks needed to be made to clarify whether we wanted to use mozilla::UniquePtr or js::UniquePtr.
2023-11-10 12:31:03 +02:00
2737 changed files with 211356 additions and 338578 deletions

No files matched your search

+1 -1
View File
@@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Clobber for libvpx changes
Clobber for ICU 78.1
+1 -1
View File
@@ -112,5 +112,5 @@ function shutdownPromise(contentBrowser) {
*/
function forceGC() {
Cu.forceCC();
Cu.forceGC();
Cu.forceShrinkingGC();
}
+1
View File
@@ -127,6 +127,7 @@ def old_configure_options(*options):
'--enable-alsa',
'--enable-appcompat-guid',
'--enable-av1',
'--enable-jxl',
'--enable-b2g-bt',
'--enable-b2g-camera',
'--enable-b2g-ril',
+5
View File
@@ -33,7 +33,12 @@ EXPORTS.mozilla = [
]
SOURCES += [
# Compile this separately since nsExceptionHandler.h conflicts
# with something from nsNullPrincipal.cpp.
'BasePrincipal.cpp',
]
UNIFIED_SOURCES += [
'DomainPolicy.cpp',
'nsJSPrincipals.cpp',
'nsNullPrincipal.cpp',
+1 -1
View File
@@ -16,7 +16,7 @@ EXPORTS.mozilla.chrome += [
'RegistryMessageUtils.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'nsChromeProtocolHandler.cpp',
'nsChromeRegistry.cpp',
'nsChromeRegistryChrome.cpp',
+1 -1
View File
@@ -8,4 +8,4 @@
# Referenced by milestone.py.
#--------------------------------------------------------
6.8.1
6.8.0
+4
View File
@@ -348,7 +348,11 @@ ifdef SHARED_LIBRARY
ifdef IS_COMPONENT
EXTRA_DSO_LDOPTS += -bundle
else
ifdef MOZ_IOS
_LOADER_PATH := @rpath
else
_LOADER_PATH := @executable_path
endif
EXTRA_DSO_LDOPTS += -dynamiclib -install_name $(_LOADER_PATH)/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
endif
endif
@@ -130,7 +130,6 @@ marker.gcreason.label.DOM_WORKER=Periodic Worker GC
marker.gcreason.label.INTER_SLICE_GC=Periodic Incremental GC Slice
marker.gcreason.label.FULL_GC_TIMER=Periodic Full GC
marker.gcreason.label.SHUTDOWN_CC=Shutdown
marker.gcreason.label.FINISH_LARGE_EVALUATE=Large Eval
marker.gcreason.label.DOM_WINDOW_UTILS=User Inactive
marker.gcreason.label.USER_INACTIVE=User Inactive
@@ -169,6 +168,5 @@ marker.gcreason.description.DOM_WORKER=The worker was idle for a relatively long
marker.gcreason.description.INTER_SLICE_GC=There has been a relatively long time since the last incremental GC slice.
marker.gcreason.description.FULL_GC_TIMER=JavaScript returned to the event loop, and it has been a relatively long time since we performed a garbage collection.
marker.gcreason.description.SHUTDOWN_CC=The browser destroyed a JavaScript runtime or context, and this was the final garbage collection before shutting down.
marker.gcreason.description.FINISH_LARGE_EVALUATE=The browser finished evaluating a large script, and performed a GC because the script will never be run again.
marker.gcreason.description.DOM_WINDOW_UTILS=The user was inactive for a long time. Took the opportunity to perform GC when it was unlikely to be noticed.
marker.gcreason.description.USER_INACTIVE=The user was inactive for a long time. The browser took the opportunity to perform GC when it was unlikely to be noticed.
+2 -2
View File
@@ -1113,9 +1113,9 @@ Animation::ResumeAt(const TimeDuration& aReadyTime)
// but it's currently not necessary.
MOZ_ASSERT(mPendingState == PendingState::PlayPending,
"Expected to resume a play-pending animation");
MOZ_ASSERT(mHoldTime.IsNull() != mStartTime.IsNull(),
MOZ_ASSERT(!mHoldTime.IsNull() || !mStartTime.IsNull(),
"An animation in the play-pending state should have either a"
" resolved hold time or resolved start time (but not both)");
" resolved hold time or resolved start time");
// If we aborted a pending pause operation we will already have a start time
// we should use. In all other cases, we resolve it from the ready time.
+6 -9
View File
@@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -35,16 +36,12 @@ NS_INTERFACE_MAP_END
void
AnimationTimeline::NotifyAnimationUpdated(Animation& aAnimation)
{
if (mAnimations.Contains(&aAnimation)) {
return;
if (mAnimations.EnsureInserted(&aAnimation)) {
if (aAnimation.GetTimeline() && aAnimation.GetTimeline() != this) {
aAnimation.GetTimeline()->RemoveAnimation(&aAnimation);
}
mAnimationOrder.insertBack(&aAnimation);
}
if (aAnimation.GetTimeline() && aAnimation.GetTimeline() != this) {
aAnimation.GetTimeline()->RemoveAnimation(&aAnimation);
}
mAnimations.PutEntry(&aAnimation);
mAnimationOrder.insertBack(&aAnimation);
}
void
+1 -3
View File
@@ -185,9 +185,7 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
if (aRestyleType == RestyleType::Throttled) {
if (!elementsToRestyle.Contains(key)) {
elementsToRestyle.Put(key, false);
}
elementsToRestyle.LookupForAdd(key).OrInsert([]() { return false; });
mPresContext->Document()->SetNeedStyleFlush();
} else {
// Get() returns 0 if the element is not found. It will also return
+2 -4
View File
@@ -150,22 +150,20 @@ EffectSet::GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType)
void
EffectSet::AddEffect(dom::KeyframeEffectReadOnly& aEffect)
{
if (mEffects.Contains(&aEffect)) {
if (!mEffects.EnsureInserted(&aEffect)) {
return;
}
mEffects.PutEntry(&aEffect);
MarkCascadeNeedsUpdate();
}
void
EffectSet::RemoveEffect(dom::KeyframeEffectReadOnly& aEffect)
{
if (!mEffects.Contains(&aEffect)) {
if (!mEffects.EnsureRemoved(&aEffect)) {
return;
}
mEffects.RemoveEntry(&aEffect);
MarkCascadeNeedsUpdate();
}
+1 -1
View File
@@ -277,7 +277,7 @@ Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const
void
Attr::GetTextContentInternal(nsAString& aTextContent,
ErrorResult& aError)
OOMReporter& aError)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
+1 -1
View File
@@ -43,7 +43,7 @@ public:
// nsIDOMNode interface
NS_FORWARD_NSIDOMNODE_TO_NSINODE
virtual void GetTextContentInternal(nsAString& aTextContent,
ErrorResult& aError) override;
OOMReporter& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,
ErrorResult& aError) override;
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
+9 -5
View File
@@ -592,7 +592,10 @@ CustomElementRegistry::Define(const nsAString& aName,
}
JSContext *cx = jsapi.cx();
JS::Rooted<JSObject*> constructor(cx, aFunctionConstructor.Callable());
// Note: No calls that might run JS or trigger CC before this point, or
// there's a (vanishingly small) chance of our constructor being nulled
// before we access it.
JS::Rooted<JSObject*> constructor(cx, aFunctionConstructor.CallableOrNull());
/**
* 1. If IsConstructor(constructor) is false, then throw a TypeError and abort
@@ -925,7 +928,7 @@ CustomElementRegistry::Get(JSContext* aCx, const nsAString& aName,
return;
}
aRetVal.setObjectOrNull(data->mConstructor->Callable());
aRetVal.setObject(*data->mConstructor->Callback(aCx));
return;
}
@@ -950,10 +953,11 @@ CustomElementRegistry::WhenDefined(const nsAString& aName, ErrorResult& aRv)
return promise.forget();
}
if (mWhenDefinedPromiseMap.Contains(nameAtom)) {
mWhenDefinedPromiseMap.Get(nameAtom, getter_AddRefs(promise));
auto entry = mWhenDefinedPromiseMap.LookupForAdd(nameAtom);
if (entry) {
promise = entry.Data();
} else {
mWhenDefinedPromiseMap.Put(nameAtom, promise);
entry.OrInsert([&promise](){ return promise; });
}
return promise.forget();
+28 -28
View File
@@ -307,9 +307,15 @@ void
Element::Focus(mozilla::ErrorResult& aError)
{
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(this);
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
nsFocusManager* fm = nsFocusManager::GetFocusManager();
// Also other browsers seem to have the hack to not re-focus (and flush) when
// the element is already focused.
if (fm && domElement) {
aError = fm->SetFocus(domElement, 0);
if (fm->CanSkipFocus(this)) {
fm->NeedsFlushBeforeEventHandling(this);
} else {
aError = fm->SetFocus(domElement, 0);
}
}
}
@@ -1575,6 +1581,9 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aParent->HasFlag(NODE_CHROME_ONLY_ACCESS)) {
SetFlags(NODE_CHROME_ONLY_ACCESS);
}
if (HasFlag(NODE_IS_ANONYMOUS_ROOT)) {
aParent->SetMayHaveAnonymousChildren();
}
if (aParent->IsInShadowTree()) {
ClearSubtreeRootPointer();
SetFlags(NODE_IS_IN_SHADOW_TREE);
@@ -4098,42 +4107,33 @@ enum nsPreviousIntersectionThreshold {
void
Element::RegisterIntersectionObserver(DOMIntersectionObserver* aObserver)
{
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>* observers =
RegisteredIntersectionObservers();
if (observers->Contains(aObserver)) {
return;
}
// Value can be:
// -2: Makes sure next calculated threshold always differs, leading to a
// notification task being scheduled.
// -1: Non-intersecting.
// >= 0: Intersecting, valid index of aObserver->mThresholds.
RegisteredIntersectionObservers()->Put(aObserver, eUninitialized);
RegisteredIntersectionObservers()->LookupForAdd(aObserver).OrInsert([]() {
// Value can be:
// -2: Makes sure next calculated threshold always differs, leading to a
// notification task being scheduled.
// -1: Non-intersecting.
// >= 0: Intersecting, valid index of aObserver->mThresholds.
return eUninitialized;
});
}
void
Element::UnregisterIntersectionObserver(DOMIntersectionObserver* aObserver)
{
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>* observers =
RegisteredIntersectionObservers();
observers->Remove(aObserver);
RegisteredIntersectionObservers()->Remove(aObserver);
}
bool
Element::UpdateIntersectionObservation(DOMIntersectionObserver* aObserver, int32_t aThreshold)
{
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>* observers =
RegisteredIntersectionObservers();
if (!observers->Contains(aObserver)) {
return false;
}
int32_t previousThreshold = observers->Get(aObserver);
if (previousThreshold != aThreshold) {
observers->Put(aObserver, aThreshold);
return true;
}
return false;
bool updated = false;
RegisteredIntersectionObservers()->LookupRemoveIf(aObserver,
[&updated, aThreshold] (int32_t& aValue) {
updated = aValue != aThreshold;
aValue = aThreshold;
return false; // don't remove the entry
});
return updated;
}
void
+2 -2
View File
@@ -1295,10 +1295,10 @@ FragmentOrElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
void
FragmentOrElement::GetTextContentInternal(nsAString& aTextContent,
ErrorResult& aError)
OOMReporter& aError)
{
if (!nsContentUtils::GetNodeTextContent(this, true, aTextContent, fallible)) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
aError.ReportOOM();
}
}
+1 -1
View File
@@ -129,7 +129,7 @@ public:
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::ErrorResult& aError) override;
mozilla::OOMReporter& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,
mozilla::ErrorResult& aError) override;
+4 -1
View File
@@ -275,9 +275,12 @@ const NativePropertyHooks sWindowNamedPropertiesNativePropertyHooks[] = { {
nullptr
} };
// Note that this class doesn't need any reserved slots, but SpiderMonkey
// asserts all proxy classes have at least one reserved slot.
static const DOMIfaceAndProtoJSClass WindowNamedPropertiesClass = {
PROXY_CLASS_DEF("WindowProperties",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS),
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS |
JSCLASS_HAS_RESERVED_SLOTS(1)),
eNamedPropertiesObject,
false,
prototypes::id::_ID_Count,
+3 -1
View File
@@ -1176,7 +1176,9 @@ nsLabelsNodeList::MaybeResetRoot(nsINode* aRootNode)
void
nsLabelsNodeList::PopulateSelf(uint32_t aNeededLength)
{
MOZ_ASSERT(mRootNode, "Must have root");
if (!mRootNode) {
return;
}
// Start searching at the root.
nsINode* cur = mRootNode;
+10 -13
View File
@@ -117,14 +117,11 @@ void
nsDOMAttributeMap::DropAttribute(int32_t aNamespaceID, nsIAtom* aLocalName)
{
nsAttrKey attr(aNamespaceID, aLocalName);
Attr *node = mAttributeCache.GetWeak(attr);
if (node) {
// Break link to map
node->SetMap(nullptr);
// Remove from cache
mAttributeCache.Remove(attr);
}
mAttributeCache.LookupRemoveIf(attr,
[] (Attr* aNode) {
aNode->SetMap(nullptr); // break link to map
return true; // remove from cache
});
}
Attr*
@@ -134,13 +131,13 @@ nsDOMAttributeMap::GetAttribute(mozilla::dom::NodeInfo* aNodeInfo)
nsAttrKey attr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom());
Attr* node = mAttributeCache.GetWeak(attr);
RefPtr<Attr>& entryValue = mAttributeCache.GetOrInsert(attr);
Attr* node = entryValue;
if (!node) {
// Newly inserted entry!
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
RefPtr<Attr> newAttr =
new Attr(this, ni.forget(), EmptyString());
mAttributeCache.Put(attr, newAttr);
node = newAttr;
entryValue = new Attr(this, ni.forget(), EmptyString());
node = entryValue;
}
return node;
+26 -20
View File
@@ -118,8 +118,7 @@ using namespace mozilla::dom;
#define NS_DEFINE_CLASSINFO_DATA_HELPER(_class, _helper, _flags, \
_chromeOnly, _allowXBL) \
{ #_class, \
nullptr, \
{ nullptr, \
XPC_MAKE_CLASS_OPS(_flags), \
XPC_MAKE_CLASS(#_class, _flags, \
&sClassInfoData[eDOMClassInfo_##_class##_id].mClassOps), \
@@ -160,18 +159,18 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
DOM_BASE_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE |
nsIXPCScriptable::WANT_RESOLVE |
nsIXPCScriptable::WANT_HASINSTANCE |
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
XPC_SCRIPTABLE_WANT_PRECREATE |
XPC_SCRIPTABLE_WANT_RESOLVE |
XPC_SCRIPTABLE_WANT_HASINSTANCE |
XPC_SCRIPTABLE_DONT_ENUM_QUERY_INTERFACE)
NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
DOM_BASE_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE |
nsIXPCScriptable::WANT_RESOLVE |
nsIXPCScriptable::WANT_HASINSTANCE |
nsIXPCScriptable::WANT_CALL |
nsIXPCScriptable::WANT_CONSTRUCT |
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
XPC_SCRIPTABLE_WANT_PRECREATE |
XPC_SCRIPTABLE_WANT_RESOLVE |
XPC_SCRIPTABLE_WANT_HASINSTANCE |
XPC_SCRIPTABLE_WANT_CALL |
XPC_SCRIPTABLE_WANT_CONSTRUCT |
XPC_SCRIPTABLE_DONT_ENUM_QUERY_INTERFACE)
// Misc Core related classes
@@ -194,13 +193,13 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
nsMessageManagerSH<nsEventTargetSH>,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_ENUMERATE |
nsIXPCScriptable::IS_GLOBAL_OBJECT)
XPC_SCRIPTABLE_WANT_ENUMERATE |
XPC_SCRIPTABLE_IS_GLOBAL_OBJECT)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentProcessMessageManager,
nsMessageManagerSH<nsDOMGenericSH>,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_ENUMERATE |
nsIXPCScriptable::IS_GLOBAL_OBJECT)
XPC_SCRIPTABLE_WANT_ENUMERATE |
XPC_SCRIPTABLE_IS_GLOBAL_OBJECT)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageBroadcaster, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageSender, nsDOMGenericSH,
@@ -569,7 +568,7 @@ nsDOMClassInfo::Init()
}
nsDOMClassInfoData& data = sClassInfoData[i];
nameSpaceManager->RegisterClassName(data.mName, i, data.mChromeOnly,
nameSpaceManager->RegisterClassName(data.mClass.name, i, data.mChromeOnly,
data.mAllowXBL, &data.mNameUTF16);
}
@@ -667,7 +666,7 @@ nsDOMClassInfo::GetFlags(uint32_t *aFlags)
NS_IMETHODIMP
nsDOMClassInfo::GetClassName(char **aClassName)
{
*aClassName = NS_strdup(mData->mName);
*aClassName = NS_strdup(mData->mClass.name);
return NS_OK;
}
@@ -686,6 +685,13 @@ nsDOMClassInfo::GetClass()
return &mData->mClass;
}
// virtual
const JSClass*
nsDOMClassInfo::GetJSClass()
{
return Jsvalify(&mData->mClass);
}
NS_IMETHODIMP
nsDOMClassInfo::PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj)
@@ -756,7 +762,7 @@ nsDOMClassInfo::Resolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JS::Rooted<JSObject*> global(cx, ::JS_GetGlobalForObject(cx, obj));
JS::Rooted<JS::PropertyDescriptor> desc(cx);
if (!JS_GetPropertyDescriptor(cx, global, mData->mName, &desc)) {
if (!JS_GetPropertyDescriptor(cx, global, mData->mClass.name, &desc)) {
return NS_ERROR_UNEXPECTED;
}
@@ -859,7 +865,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
if (if_info) {
nsXPIDLCString name;
if_info->GetName(getter_Copies(name));
NS_ASSERTION(nsCRT::strcmp(CutPrefix(name), mData->mName) == 0,
NS_ASSERTION(nsCRT::strcmp(CutPrefix(name), mData->mClass.name) == 0,
"Class name and proto chain interface name mismatch!");
}
}
+1 -3
View File
@@ -30,9 +30,7 @@ typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
struct nsDOMClassInfoData
{
// XXX: mName is the same as the name gettable from the callback. This
// redundancy should be removed eventually.
const char *mName;
// The ASCII name is available as mClass.name.
const char16_t *mNameUTF16;
const js::ClassOps mClassOps;
const js::Class mClass;
+11 -11
View File
@@ -337,11 +337,14 @@ nsMutationReceiver::ContentRemoved(nsIDocument* aDocument,
nsMutationReceiver* orig = GetParent() ? GetParent() : this;
if (Observer()->GetReceiverFor(aChild, false, false) != orig) {
bool transientExists = false;
nsCOMArray<nsMutationReceiver>* transientReceivers = nullptr;
Observer()->mTransientReceivers.Get(aChild, &transientReceivers);
if (!transientReceivers) {
transientReceivers = new nsCOMArray<nsMutationReceiver>();
Observer()->mTransientReceivers.Put(aChild, transientReceivers);
bool isNewEntry = false;
nsCOMArray<nsMutationReceiver>* transientReceivers =
Observer()->mTransientReceivers.LookupForAdd(aChild).OrInsert(
[&isNewEntry] () {
isNewEntry = true;
return new nsCOMArray<nsMutationReceiver>();
});
if (!isNewEntry) {
} else {
for (int32_t i = 0; i < transientReceivers->Count(); ++i) {
nsMutationReceiver* r = transientReceivers->ObjectAt(i);
@@ -1110,12 +1113,9 @@ nsAutoMutationBatch::Done()
}
if (allObservers.Length()) {
nsCOMArray<nsMutationReceiver>* transientReceivers = nullptr;
ob->mTransientReceivers.Get(removed, &transientReceivers);
if (!transientReceivers) {
transientReceivers = new nsCOMArray<nsMutationReceiver>();
ob->mTransientReceivers.Put(removed, transientReceivers);
}
nsCOMArray<nsMutationReceiver>* transientReceivers =
ob->mTransientReceivers.LookupForAdd(removed).OrInsert(
[] () { return new nsCOMArray<nsMutationReceiver>(); });
for (uint32_t k = 0; k < allObservers.Length(); ++k) {
nsMutationReceiver* r = allObservers[k];
nsMutationReceiver* orig = r->GetParent() ? r->GetParent() : r;
+6 -8
View File
@@ -691,16 +691,15 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
return resource->mDocument;
}
RefPtr<PendingLoad> load;
mPendingLoads.Get(clone, getter_AddRefs(load));
if (load) {
RefPtr<PendingLoad>& loadEntry = mPendingLoads.GetOrInsert(clone);
if (loadEntry) {
RefPtr<PendingLoad> load(loadEntry);
load.forget(aPendingLoad);
return nullptr;
}
load = new PendingLoad(aDisplayDocument);
mPendingLoads.Put(clone, load);
RefPtr<PendingLoad> load(new PendingLoad(aDisplayDocument));
loadEntry = load;
if (NS_FAILED(load->StartLoad(clone, aRequestingNode))) {
// Make sure we don't thrash things by trying this load again, since
@@ -823,8 +822,7 @@ nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
"Must have both or neither");
RefPtr<PendingLoad> load;
mPendingLoads.Get(aURI, getter_AddRefs(load));
mPendingLoads.Remove(aURI);
mPendingLoads.Remove(aURI, getter_AddRefs(load));
nsresult rv = NS_OK;
+9
View File
@@ -180,6 +180,7 @@ static const char* kObservedPrefs[] = {
};
nsFocusManager::nsFocusManager()
: mEventHandlingNeedsFlush(false)
{ }
nsFocusManager::~nsFocusManager()
@@ -1573,6 +1574,7 @@ nsFocusManager::CheckIfFocusable(nsIContent* aContent, uint32_t aFlags)
}
// Make sure that our frames are up to date
mEventHandlingNeedsFlush = false;
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell *shell = doc->GetShell();
@@ -4220,6 +4222,13 @@ nsFocusManager::MarkUncollectableForCCGeneration(uint32_t aGeneration)
}
}
bool
nsFocusManager::CanSkipFocus(nsIContent* aContent)
{
return mFocusedContent == aContent &&
(!aContent || !nsContentUtils::IsChromeDoc(aContent->OwnerDoc()));
}
nsresult
NS_NewFocusManager(nsIFocusManager** aResult)
{
+25
View File
@@ -7,6 +7,7 @@
#define nsFocusManager_h___
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIFocusManager.h"
#include "nsIObserver.h"
@@ -92,6 +93,26 @@ public:
return handlingDocument.forget();
}
void NeedsFlushBeforeEventHandling(nsIContent* aContent)
{
if (mFocusedContent == aContent) {
mEventHandlingNeedsFlush = true;
}
}
bool CanSkipFocus(nsIContent* aContent);
void FlushBeforeEventHandlingIfNeeded(nsIContent* aContent)
{
if (mEventHandlingNeedsFlush) {
nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
if (doc) {
mEventHandlingNeedsFlush = false;
doc->FlushPendingNotifications(Flush_Layout);
}
}
}
/**
* Update the caret with current mode (whether in caret browsing mode or not).
*/
@@ -635,6 +656,10 @@ private:
// moving focus.
nsCOMPtr<nsIDocument> mMouseButtonEventHandlingDocument;
// If set to true, layout of the document of the event target should be
// flushed before handling focus depending events.
bool mEventHandlingNeedsFlush;
static bool sTestMode;
// the single focus manager
+1 -1
View File
@@ -1854,7 +1854,7 @@ nsMessageManagerScriptExecutor::InitChildGlobalInternal(
const uint32_t flags = nsIXPConnect::INIT_JS_STANDARD_CLASSES;
JS::CompartmentOptions options;
options.creationOptions().setZone(JS::SystemZone);
options.creationOptions().setSystemZone();
options.behaviors().setVersion(JSVERSION_LATEST);
if (xpc::SharedMemoryEnabled()) {
+3
View File
@@ -503,6 +503,9 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aParent->HasFlag(NODE_CHROME_ONLY_ACCESS)) {
SetFlags(NODE_CHROME_ONLY_ACCESS);
}
if (HasFlag(NODE_IS_ANONYMOUS_ROOT)) {
aParent->SetMayHaveAnonymousChildren();
}
if (aParent->IsInShadowTree()) {
ClearSubtreeRootPointer();
SetFlags(NODE_IS_IN_SHADOW_TREE);
+1 -1
View File
@@ -95,7 +95,7 @@ public:
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::ErrorResult& aError) override
mozilla::OOMReporter& aError) override
{
GetNodeValue(aTextContent);
}
-3
View File
@@ -101,8 +101,6 @@ GK_ATOM(animations, "animations")
GK_ATOM(anonid, "anonid")
GK_ATOM(anonlocation, "anonlocation")
GK_ATOM(any, "any")
GK_ATOM(any_hover, "any-hover")
GK_ATOM(any_pointer, "any-pointer")
GK_ATOM(applet, "applet")
GK_ATOM(applyImports, "apply-imports")
GK_ATOM(applyTemplates, "apply-templates")
@@ -1535,7 +1533,6 @@ GK_ATOM(patternContentUnits, "patternContentUnits")
GK_ATOM(patternTransform, "patternTransform")
GK_ATOM(patternUnits, "patternUnits")
GK_ATOM(pc, "pc")
GK_ATOM(pointer, "pointer")
GK_ATOM(pointer_events, "pointer-events")
GK_ATOM(points, "points")
GK_ATOM(pointsAtX, "pointsAtX")
+52 -33
View File
@@ -538,7 +538,7 @@ DialogValueHolder::Get(JSContext* aCx, JS::Handle<JSObject*> aScope,
class IdleRequestExecutor final : public nsIRunnable
, public nsICancelableRunnable
, public nsIIncrementalRunnable
, public nsIIdleRunnable
{
public:
explicit IdleRequestExecutor(nsGlobalWindow* aWindow)
@@ -582,7 +582,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleRequestExecutor)
NS_INTERFACE_MAP_ENTRY(nsIRunnable)
NS_INTERFACE_MAP_ENTRY(nsICancelableRunnable)
NS_INTERFACE_MAP_ENTRY(nsIIncrementalRunnable)
NS_INTERFACE_MAP_ENTRY(nsIIdleRunnable)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRunnable)
NS_INTERFACE_MAP_END
@@ -1026,7 +1026,7 @@ protected:
static nsGlobalWindow* GetOuterWindow(JSObject *proxy)
{
nsGlobalWindow* outerWindow = nsGlobalWindow::FromSupports(
static_cast<nsISupports*>(js::GetProxyExtra(proxy, 0).toPrivate()));
static_cast<nsISupports*>(js::GetProxyReservedSlot(proxy, 0).toPrivate()));
MOZ_ASSERT_IF(outerWindow, outerWindow->IsOuterWindow());
return outerWindow;
}
@@ -1053,9 +1053,12 @@ static const js::ClassExtension OuterWindowProxyClassExtension = PROXY_MAKE_EXT(
nsOuterWindowProxy::ObjectMoved
);
// Give OuterWindowProxyClass 2 reserved slots, like the other wrappers, so
// JSObject::swap can swap it with CrossCompartmentWrappers without requiring
// malloc.
const js::Class OuterWindowProxyClass = PROXY_CLASS_WITH_EXT(
"Proxy",
0, /* additional class flags */
JSCLASS_HAS_RESERVED_SLOTS(2), /* additional class flags */
&OuterWindowProxyClassExtension);
const char *
@@ -1071,7 +1074,7 @@ nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) const
{
nsGlobalWindow* outerWindow = GetOuterWindow(proxy);
if (outerWindow) {
outerWindow->ClearWrapper();
outerWindow->ClearWrapper(proxy);
// Ideally we would use OnFinalize here, but it's possible that
// EnsureScriptEnvironment will later be called on the window, and we don't
@@ -1479,6 +1482,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
#endif
mNotifiedIDDestroyed(false),
mAllowScriptsToClose(false),
mTopLevelOuterContentWindow(false),
mTimeoutInsertionPoint(nullptr),
mTimeoutIdCounter(1),
mTimeoutFiringDepth(0),
@@ -1682,9 +1686,9 @@ nsGlobalWindow::~nsGlobalWindow()
("DOMWINDOW %p destroyed", this));
if (IsOuterWindow()) {
JSObject *proxy = GetWrapperPreserveColor();
JSObject *proxy = GetWrapperMaybeDead();
if (proxy) {
js::SetProxyExtra(proxy, 0, js::PrivateValue(nullptr));
js::SetProxyReservedSlot(proxy, 0, js::PrivateValue(nullptr));
}
// An outer window is destroyed with inner windows still possibly
@@ -2772,7 +2776,7 @@ CreateNativeGlobalForInner(JSContext* aCx,
}
if (top && top->GetGlobalJSObject()) {
options.creationOptions().setSameZoneAs(top->GetGlobalJSObject());
options.creationOptions().setExistingZone(top->GetGlobalJSObject());
}
options.creationOptions().setSecureContext(aIsSecureContext);
@@ -2857,9 +2861,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
// transplanting code, since it has no good way to handle errors. This uses
// the untrusted script limit, which is not strictly necessary since no
// actual script should run.
bool overrecursed = false;
JS_CHECK_RECURSION_CONSERVATIVE_DONT_REPORT(cx, overrecursed = true);
if (overrecursed) {
if (!js::CheckRecursionLimitConservativeDontReport(cx)) {
NS_WARNING("Overrecursion in SetNewDocument");
return NS_ERROR_FAILURE;
}
@@ -3047,7 +3049,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
NewOuterWindowProxy(cx, newInnerGlobal, thisChrome));
NS_ENSURE_TRUE(outer, NS_ERROR_FAILURE);
js::SetProxyExtra(outer, 0, js::PrivateValue(ToSupports(this)));
js::SetProxyReservedSlot(outer, 0, js::PrivateValue(ToSupports(this)));
// Inform the nsJSContext, which is the canonical holder of the outer.
mContext->SetWindowProxy(outer);
@@ -3065,8 +3067,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
JS::Rooted<JSObject*> obj(cx, GetWrapperPreserveColor());
js::SetProxyExtra(obj, 0, js::PrivateValue(nullptr));
js::SetProxyExtra(outerObject, 0, js::PrivateValue(nullptr));
js::SetProxyReservedSlot(obj, 0, js::PrivateValue(nullptr));
js::SetProxyReservedSlot(outerObject, 0, js::PrivateValue(nullptr));
outerObject = xpc::TransplantObject(cx, obj, outerObject);
if (!outerObject) {
@@ -3074,7 +3076,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
return NS_ERROR_FAILURE;
}
js::SetProxyExtra(outerObject, 0, js::PrivateValue(ToSupports(this)));
js::SetProxyReservedSlot(outerObject, 0, js::PrivateValue(ToSupports(this)));
SetWrapper(outerObject);
@@ -3191,7 +3193,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
newInnerWindow->mChromeEventHandler = mChromeEventHandler;
}
nsJSContext::PokeGC(JS::gcreason::SET_NEW_DOCUMENT);
nsJSContext::PokeGC(JS::gcreason::SET_NEW_DOCUMENT, GetWrapperPreserveColor());
kungFuDeathGrip->DidInitializeContext();
// We wait to fire the debugger hook until the window is all set up and hooked
@@ -3336,6 +3338,9 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull();
MOZ_RELEASE_ASSERT(!parentWindow || !mTabGroup || mTabGroup == Cast(parentWindow)->mTabGroup);
mTopLevelOuterContentWindow =
!mIsChrome && GetScriptableTopInternal() == this;
NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");
if (mFrames) {
@@ -3417,7 +3422,12 @@ nsGlobalWindow::DetachFromDocShell()
mChromeEventHandler = nullptr; // force release now
if (mContext) {
nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL);
// When we're about to destroy a top level content window
// (for example a tab), we trigger a full GC by passing null as the last
// param. We also trigger a full GC for chrome windows.
nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL,
(mTopLevelOuterContentWindow || mIsChrome) ?
nullptr : GetWrapperPreserveColor());
mContext = nullptr;
}
@@ -3811,7 +3821,7 @@ void
nsGlobalWindow::PoisonOuterWindowProxy(JSObject *aObject)
{
MOZ_ASSERT(IsOuterWindow());
if (aObject == GetWrapperPreserveColor()) {
if (aObject == GetWrapperMaybeDead()) {
PoisonWrapper();
}
}
@@ -9409,13 +9419,23 @@ public:
AutoSafeJSContext cx;
JS::Rooted<JSObject*> obj(cx, currentInner->FastGetGlobalJSObject());
// We only want to nuke wrappers for the chrome->content case
if (obj && !js::IsSystemCompartment(js::GetObjectCompartment(obj))) {
js::NukeCrossCompartmentWrappers(cx,
BrowserCompartmentMatcher(),
js::SingleCompartment(js::GetObjectCompartment(obj)),
win->IsInnerWindow() ? js::DontNukeWindowReferences
: js::NukeWindowReferences);
JSCompartment* cpt = js::GetObjectCompartment(obj);
nsCOMPtr<nsIPrincipal> pc = nsJSPrincipals::get(JS_GetCompartmentPrincipals(cpt));
nsAutoString addonId;
if (NS_SUCCEEDED(pc->GetAddonId(addonId)) && !addonId.IsEmpty()) {
// We want to nuke all references to the add-on compartment.
xpc::NukeAllWrappersForCompartment(cx, cpt,
win->IsInnerWindow() ? js::DontNukeWindowReferences
: js::NukeWindowReferences);
} else {
// We only want to nuke wrappers for the chrome->content case
js::NukeCrossCompartmentWrappers(cx, BrowserCompartmentMatcher(), cpt,
win->IsInnerWindow() ? js::DontNukeWindowReferences
: js::NukeWindowReferences,
js::NukeIncomingReferences);
}
}
}
@@ -14369,17 +14389,16 @@ nsGlobalWindow::GetGroupMessageManager(const nsAString& aGroup,
nsGlobalChromeWindow* myself = static_cast<nsGlobalChromeWindow*>(this);
nsCOMPtr<nsIMessageBroadcaster> messageManager =
myself->mGroupMessageManagers.Get(aGroup);
if (!messageManager) {
nsFrameMessageManager* parent =
static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
myself->mGroupMessageManagers.LookupForAdd(aGroup).OrInsert(
[this, &aError] () {
nsFrameMessageManager* parent =
static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
messageManager = new nsFrameMessageManager(nullptr,
parent,
MM_CHROME | MM_BROADCASTER);
myself->mGroupMessageManagers.Put(aGroup, messageManager);
}
return new nsFrameMessageManager(nullptr,
parent,
MM_CHROME | MM_BROADCASTER);
});
return messageManager;
}
+2
View File
@@ -1800,6 +1800,8 @@ protected:
// even if "dom.allow_scripts_to_close_windows" is false.
bool mAllowScriptsToClose : 1;
bool mTopLevelOuterContentWindow : 1;
nsCOMPtr<nsIScriptContext> mContext;
nsWeakPtr mOpener;
nsCOMPtr<nsIControllers> mControllers;
+11 -10
View File
@@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -9,21 +10,21 @@
#include "nsIXPCScriptable.h"
#define DOM_BASE_SCRIPTABLE_FLAGS \
(nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY | \
nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY | \
nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY | \
nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE | \
nsIXPCScriptable::DONT_ASK_INSTANCE_FOR_SCRIPTABLE | \
nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES)
(XPC_SCRIPTABLE_USE_JSSTUB_FOR_ADDPROPERTY | \
XPC_SCRIPTABLE_USE_JSSTUB_FOR_DELPROPERTY | \
XPC_SCRIPTABLE_USE_JSSTUB_FOR_SETPROPERTY | \
XPC_SCRIPTABLE_ALLOW_PROP_MODS_TO_PROTOTYPE | \
XPC_SCRIPTABLE_DONT_ASK_INSTANCE_FOR_SCRIPTABLE | \
XPC_SCRIPTABLE_DONT_REFLECT_INTERFACE_NAMES)
#define DEFAULT_SCRIPTABLE_FLAGS \
(DOM_BASE_SCRIPTABLE_FLAGS | \
nsIXPCScriptable::WANT_RESOLVE | \
nsIXPCScriptable::WANT_PRECREATE)
XPC_SCRIPTABLE_WANT_RESOLVE | \
XPC_SCRIPTABLE_WANT_PRECREATE)
#define DOM_DEFAULT_SCRIPTABLE_FLAGS \
(DEFAULT_SCRIPTABLE_FLAGS | \
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \
nsIXPCScriptable::CLASSINFO_INTERFACES_ONLY)
XPC_SCRIPTABLE_DONT_ENUM_QUERY_INTERFACE | \
XPC_SCRIPTABLE_CLASSINFO_INTERFACES_ONLY)
#endif /* nsIDOMClassInfo_h___ */
+1 -2
View File
@@ -16,7 +16,6 @@
#include "mozilla/CORSMode.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
@@ -421,7 +420,7 @@ nsINode::ChildNodes()
}
void
nsINode::GetTextContentInternal(nsAString& aTextContent, ErrorResult& aError)
nsINode::GetTextContentInternal(nsAString& aTextContent, OOMReporter& aError)
{
SetDOMStringToNull(aTextContent);
}
+8 -2
View File
@@ -1335,7 +1335,7 @@ protected:
public:
void GetTextContent(nsAString& aTextContent,
mozilla::ErrorResult& aError)
mozilla::OOMReporter& aError)
{
GetTextContentInternal(aTextContent, aError);
}
@@ -1593,6 +1593,9 @@ private:
ParserHasNotified,
// Sets if the node is apz aware or we have apz aware listeners.
MayBeApzAware,
// Set if the element might have any kind of anonymous content children,
// which would not be found through the element's children list.
ElementMayHaveAnonymousChildren,
// Set if this node has at some point (and may still have)
// display:none or display:contents children.
NodeMayHaveChildrenWithLayoutBoxesDisabled,
@@ -1735,6 +1738,9 @@ public:
return GetBoolFlag(MayBeApzAware);
}
void SetMayHaveAnonymousChildren() { SetBoolFlag(ElementMayHaveAnonymousChildren); }
bool MayHaveAnonymousChildren() const { return GetBoolFlag(ElementMayHaveAnonymousChildren); }
void SetMayHaveChildrenWithLayoutBoxesDisabled()
{
SetBoolFlag(NodeMayHaveChildrenWithLayoutBoxesDisabled);
@@ -1971,7 +1977,7 @@ protected:
}
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::ErrorResult& aError);
mozilla::OOMReporter& aError);
virtual void SetTextContentInternal(const nsAString& aTextContent,
mozilla::ErrorResult& aError)
{
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -14,6 +14,7 @@
#include "nsIXPConnect.h"
#include "nsIArray.h"
#include "mozilla/Attributes.h"
#include "mozilla/TimeStamp.h"
#include "nsThreadUtils.h"
#include "xpcpublic.h"
@@ -90,7 +91,7 @@ public:
int32_t aExtraForgetSkippableCalls = 0);
// Run a cycle collector slice, using a heuristic to decide how long to run it.
static void RunCycleCollectorSlice();
static void RunCycleCollectorSlice(mozilla::TimeStamp aDeadline);
// Run a cycle collector slice, using the given work budget.
static void RunCycleCollectorWorkSlice(int64_t aWorkBudget);
@@ -104,17 +105,18 @@ public:
static void RunNextCollectorTimer();
static void PokeGC(JS::gcreason::Reason aReason, int aDelay = 0);
// The GC should probably run soon, in the zone of object aObj (if given).
static void PokeGC(JS::gcreason::Reason aReason, JSObject* aObj, int aDelay = 0);
static void KillGCTimer();
static void PokeShrinkingGC();
static void KillShrinkingGCTimer();
static void MaybePokeCC();
static void KillCCTimer();
static void KillICCTimer();
static void KillCCRunner();
static void KillICCRunner();
static void KillFullGCTimer();
static void KillInterSliceGCTimer();
static void KillInterSliceGCRunner();
// Calling LikelyShortLivingObjectCreated() makes a GC more likely.
static void LikelyShortLivingObjectCreated();
@@ -129,7 +131,6 @@ public:
return global ? mGlobalObjectRef.get() : nullptr;
}
static void NotifyDidPaint();
protected:
virtual ~nsJSContext();
+2 -2
View File
@@ -313,8 +313,8 @@ nsWindowRoot::GetEnabledDisabledCommandsForControllers(nsIControllers* aControll
// Use a hash to determine which commands have already been handled by
// earlier controllers, as the earlier controller's result should get
// priority.
if (!aCommandsHandled.Contains(commands[e])) {
aCommandsHandled.PutEntry(commands[e]);
if (aCommandsHandled.EnsureInserted(commands[e])) {
// We inserted a new entry into aCommandsHandled.
bool enabled = false;
controller->IsCommandEnabled(commands[e], &enabled);
+28 -11
View File
@@ -95,12 +95,25 @@ public:
* object returned is not guaranteed to be kept alive past the next CC.
*
* This should only be called if you are certain that the return value won't
* be passed into a JS API function and that it won't be stored without being
* be passed into a JSAPI function and that it won't be stored without being
* rooted (or otherwise signaling the stored value to the CC).
*/
JSObject* GetWrapperPreserveColor() const
JSObject* GetWrapperPreserveColor() const;
/**
* Get the cached wrapper.
*
* This getter does not check whether the wrapper is dead and in the process
* of being finalized.
*
* This should only be called if you really need to see the raw contents of
* this cache, for example as part of finalization. Don't store the result
* anywhere or pass it into JSAPI functions that may cause the value to
* escape.
*/
JSObject* GetWrapperMaybeDead() const
{
return GetWrapperJSObject();
return mWrapper;
}
#ifdef DEBUG
@@ -121,14 +134,23 @@ public:
}
/**
* Clear the wrapper. This should be called from the finalizer for the
* wrapper.
* Clear the cache.
*/
void ClearWrapper()
{
MOZ_ASSERT(!PreservingWrapper(), "Clearing a preserved wrapper!");
SetWrapperJSObject(nullptr);
}
SetWrapperJSObject(nullptr);
/**
* Clear the cache if it still contains a specific wrapper object. This should
* be called from the finalizer for the wrapper.
*/
void ClearWrapper(JSObject* obj)
{
if (obj == mWrapper) {
ClearWrapper();
}
}
/**
@@ -288,11 +310,6 @@ private:
SetWrapperFlags(WRAPPER_IS_NOT_DOM_BINDING);
}
JSObject *GetWrapperJSObject() const
{
return mWrapper;
}
void SetWrapperJSObject(JSObject* aWrapper);
FlagsType GetWrapperFlags() const
+15
View File
@@ -10,6 +10,21 @@
#include "js/GCAPI.h"
#include "js/TracingAPI.h"
inline JSObject*
nsWrapperCache::GetWrapperPreserveColor() const
{
JSObject* obj = mWrapper;
if (obj && js::gc::EdgeNeedsSweepUnbarriered(&obj)) {
// The object has been found to be dead and is in the process of being
// finalized, so don't let the caller see it. As an optimisation, remove it
// from the cache so we don't have to do this check in future.
const_cast<nsWrapperCache*>(this)->ClearWrapper();
return nullptr;
}
MOZ_ASSERT(obj == mWrapper);
return obj;
}
inline JSObject*
nsWrapperCache::GetWrapper() const
{
+7 -4
View File
@@ -2118,7 +2118,10 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
// the untrusted script limit, which is not strictly necessary since no
// actual script should run.
// TODO: Make sure to retain 'onerror' if bug 1342439 lands.
JS_CHECK_RECURSION_CONSERVATIVE(aCx, aError.StealExceptionFromJSContext(aCx); return);
if (!js::CheckRecursionLimitConservative(aCx)) {
aError.StealExceptionFromJSContext(aCx);
return;
}
JS::Rooted<JSObject*> aObj(aCx, aObjArg);
const DOMJSClass* domClass = GetDOMClass(aObj);
@@ -2206,9 +2209,9 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
// NB: It's important to do this _after_ copying the properties to
// propertyHolder. Otherwise, an object with |foo.x === foo| will
// crash when JS_CopyPropertiesFrom tries to call wrap() on foo.x.
js::SetReservedOrProxyPrivateSlot(newobj, DOM_OBJECT_SLOT,
js::GetReservedOrProxyPrivateSlot(aObj, DOM_OBJECT_SLOT));
js::SetReservedOrProxyPrivateSlot(aObj, DOM_OBJECT_SLOT, JS::PrivateValue(nullptr));
js::SetReservedSlot(newobj, DOM_OBJECT_SLOT,
js::GetReservedSlot(aObj, DOM_OBJECT_SLOT));
js::SetReservedSlot(aObj, DOM_OBJECT_SLOT, JS::PrivateValue(nullptr));
aObj = xpc::TransplantObject(aCx, aObj, newobj);
if (!aObj) {
+45 -50
View File
@@ -153,7 +153,7 @@ UnwrapDOMObject(JSObject* obj)
MOZ_ASSERT(IsDOMClass(js::GetObjectClass(obj)),
"Don't pass non-DOM objects to this function");
JS::Value val = js::GetReservedOrProxyPrivateSlot(obj, DOM_OBJECT_SLOT);
JS::Value val = js::GetReservedSlot(obj, DOM_OBJECT_SLOT);
return static_cast<T*>(val.toPrivate());
}
@@ -168,7 +168,7 @@ UnwrapPossiblyNotInitializedDOMObject(JSObject* obj)
MOZ_ASSERT(IsDOMClass(js::GetObjectClass(obj)),
"Don't pass non-DOM objects to this function");
JS::Value val = js::GetReservedOrProxyPrivateSlot(obj, DOM_OBJECT_SLOT);
JS::Value val = js::GetReservedSlot(obj, DOM_OBJECT_SLOT);
if (val.isUndefined()) {
return nullptr;
}
@@ -1032,19 +1032,22 @@ MaybeWrapNonDOMObjectOrNullValue(JSContext* cx, JS::MutableHandle<JS::Value> rva
MOZ_ALWAYS_INLINE bool
MaybeWrapValue(JSContext* cx, JS::MutableHandle<JS::Value> rval)
{
if (rval.isString()) {
return MaybeWrapStringValue(cx, rval);
}
if (rval.isObject()) {
return MaybeWrapObjectValue(cx, rval);
}
// This could be optimized by checking the zone first, similar to
// the way strings are handled. At present, this is used primarily
// for structured cloning, so avoiding the overhead of JS_WrapValue
// calls is less important than for other types.
if (rval.isBigInt()) {
return JS_WrapValue(cx, rval);
if (rval.isGCThing()) {
if (rval.isString()) {
return MaybeWrapStringValue(cx, rval);
}
if (rval.isObject()) {
return MaybeWrapObjectValue(cx, rval);
}
// This could be optimized by checking the zone first, similar to
// the way strings are handled. At present, this is used primarily
// for structured cloning, so avoiding the overhead of JS_WrapValue
// calls is less important than for other types.
if (rval.isBigInt()) {
return JS_WrapValue(cx, rval);
}
MOZ_ASSERT(rval.isSymbol());
JS_MarkCrossZoneId(cx, SYMBOL_TO_JSID(rval.toSymbol()));
}
return true;
}
@@ -1538,25 +1541,27 @@ GetUseXBLScope(const ParentObject& aParentObject)
template<class T>
inline void
ClearWrapper(T* p, nsWrapperCache* cache)
ClearWrapper(T* p, nsWrapperCache* cache, JSObject* obj)
{
cache->ClearWrapper();
JS::AutoAssertGCCallback inCallback;
cache->ClearWrapper(obj);
}
template<class T>
inline void
ClearWrapper(T* p, void*)
ClearWrapper(T* p, void*, JSObject* obj)
{
JS::AutoAssertGCCallback inCallback;
nsWrapperCache* cache;
CallQueryInterface(p, &cache);
ClearWrapper(p, cache);
ClearWrapper(p, cache, obj);
}
template<class T>
inline void
UpdateWrapper(T* p, nsWrapperCache* cache, JSObject* obj, const JSObject* old)
{
JS::AutoAssertGCCallback inCallback(obj);
JS::AutoAssertGCCallback inCallback;
cache->UpdateWrapper(obj, old);
}
@@ -1564,7 +1569,7 @@ template<class T>
inline void
UpdateWrapper(T* p, void*, JSObject* obj, const JSObject* old)
{
JS::AutoAssertGCCallback inCallback(obj);
JS::AutoAssertGCCallback inCallback;
nsWrapperCache* cache;
CallQueryInterface(p, &cache);
UpdateWrapper(p, cache, obj, old);
@@ -1751,7 +1756,7 @@ struct WrapNativeHelper
JSObject* obj;
if ((obj = cache->GetWrapper())) {
// GetWrapper always unmarks gray.
MOZ_ASSERT(!JS::ObjectIsMarkedGray(obj));
MOZ_ASSERT(JS::ObjectIsNotGray(obj));
return obj;
}
@@ -1759,11 +1764,11 @@ struct WrapNativeHelper
if (!CouldBeDOMBinding(parent)) {
// WrapNativeFallback never returns a gray thing.
obj = WrapNativeFallback<T>::Wrap(cx, parent, cache);
MOZ_ASSERT_IF(obj, !JS::ObjectIsMarkedGray(obj));
MOZ_ASSERT(JS::ObjectIsNotGray(obj));
} else {
// WrapObject never returns a gray thing.
obj = parent->WrapObject(cx, nullptr);
MOZ_ASSERT_IF(obj, !JS::ObjectIsMarkedGray(obj));
MOZ_ASSERT(JS::ObjectIsNotGray(obj));
}
return obj;
@@ -1785,12 +1790,12 @@ struct WrapNativeHelper<T, false>
"Unexpected object in nsWrapperCache");
obj = rootedObj;
#endif
MOZ_ASSERT(!JS::ObjectIsMarkedGray(obj));
MOZ_ASSERT(JS::ObjectIsNotGray(obj));
return obj;
}
obj = WrapNativeISupports(cx, parent, cache);
MOZ_ASSERT_IF(obj, !JS::ObjectIsMarkedGray(obj));
MOZ_ASSERT(JS::ObjectIsNotGray(obj));
return obj;
}
};
@@ -1809,7 +1814,7 @@ FindAssociatedGlobal(JSContext* cx, T* p, nsWrapperCache* cache,
if (!obj) {
return nullptr;
}
MOZ_ASSERT(!JS::ObjectIsMarkedGray(obj));
MOZ_ASSERT(JS::ObjectIsNotGray(obj));
obj = js::GetGlobalForObjectCrossCompartment(obj);
@@ -1826,7 +1831,7 @@ FindAssociatedGlobal(JSContext* cx, T* p, nsWrapperCache* cache,
JS::Rooted<JSObject*> rootedObj(cx, obj);
JSObject* xblScope = xpc::GetXBLScope(cx, rootedObj);
MOZ_ASSERT_IF(xblScope, JS_IsGlobalObject(xblScope));
MOZ_ASSERT_IF(xblScope, !JS::ObjectIsMarkedGray(xblScope));
MOZ_ASSERT(JS::ObjectIsNotGray(xblScope));
return xblScope;
}
@@ -1951,9 +1956,9 @@ GetOrCreateDOMReflectorNoWrap(JSContext* cx, T& value,
template <class T>
inline JSObject*
GetCallbackFromCallbackObject(T* aObj)
GetCallbackFromCallbackObject(JSContext* aCx, T* aObj)
{
return aObj->Callback();
return aObj->Callback(aCx);
}
// Helper for getting the callback JSObject* of a smart ptr around a
@@ -1962,26 +1967,26 @@ GetCallbackFromCallbackObject(T* aObj)
template <class T, bool isSmartPtr=IsSmartPtr<T>::value>
struct GetCallbackFromCallbackObjectHelper
{
static inline JSObject* Get(const T& aObj)
static inline JSObject* Get(JSContext* aCx, const T& aObj)
{
return GetCallbackFromCallbackObject(aObj.get());
return GetCallbackFromCallbackObject(aCx, aObj.get());
}
};
template <class T>
struct GetCallbackFromCallbackObjectHelper<T, false>
{
static inline JSObject* Get(T& aObj)
static inline JSObject* Get(JSContext* aCx, T& aObj)
{
return GetCallbackFromCallbackObject(&aObj);
return GetCallbackFromCallbackObject(aCx, &aObj);
}
};
template<class T>
inline JSObject*
GetCallbackFromCallbackObject(T& aObj)
GetCallbackFromCallbackObject(JSContext* aCx, T& aObj)
{
return GetCallbackFromCallbackObjectHelper<T>::Get(aObj);
return GetCallbackFromCallbackObjectHelper<T>::Get(aCx, aObj);
}
static inline bool
@@ -2074,16 +2079,6 @@ AppendNamedPropertyIds(JSContext* cx, JS::Handle<JSObject*> proxy,
nsTArray<nsString>& names,
bool shadowPrototypeProperties, JS::AutoIdVector& props);
namespace binding_detail {
class FastErrorResult :
public mozilla::binding_danger::TErrorResult<
mozilla::binding_danger::JustAssertCleanupPolicy>
{
};
} // namespace binding_detail
enum StringificationBehavior {
eStringify,
eEmpty,
@@ -2907,8 +2902,7 @@ public:
~BindingJSObjectCreator()
{
if (mReflector) {
js::SetReservedOrProxyPrivateSlot(mReflector, DOM_OBJECT_SLOT,
JS::UndefinedValue());
js::SetReservedSlot(mReflector, DOM_OBJECT_SLOT, JS::UndefinedValue());
}
}
@@ -2916,14 +2910,15 @@ public:
CreateProxyObject(JSContext* aCx, const js::Class* aClass,
const DOMProxyHandler* aHandler,
JS::Handle<JSObject*> aProto, T* aNative,
JS::Handle<JS::Value> aExpandoValue,
JS::MutableHandle<JSObject*> aReflector)
{
js::ProxyOptions options;
options.setClass(aClass);
JS::Rooted<JS::Value> proxyPrivateVal(aCx, JS::PrivateValue(aNative));
aReflector.set(js::NewProxyObject(aCx, aHandler, proxyPrivateVal, aProto,
aReflector.set(js::NewProxyObject(aCx, aHandler, aExpandoValue, aProto,
options));
if (aReflector) {
js::SetProxyReservedSlot(aReflector, DOM_OBJECT_SLOT, JS::PrivateValue(aNative));
mNative = aNative;
mReflector = aReflector;
}
+2 -2
View File
@@ -39,9 +39,9 @@ public:
{
}
JS::Handle<JSObject*> Callable() const
JS::Handle<JSObject*> CallableOrNull() const
{
return Callback();
return CallbackOrNull();
}
JS::Handle<JSObject*> CallablePreserveColor() const
+65 -5
View File
@@ -36,6 +36,44 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CallbackObject)
tmp->DropJSObjects();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIncumbentGlobal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(CallbackObject)
JSObject* callback = tmp->CallbackPreserveColor();
if (!aRemovingAllowed) {
// If our callback has been cleared, we can't be part of a garbage cycle.
return !callback;
}
// mCallback is always wrapped for the CallbackObject's incumbent global. In
// the case where the real callback is in a different compartment, we have a
// cross-compartment wrapper, and it will automatically be cut when its
// compartment is nuked. In the case where it is in the same compartment, we
// have a reference to the real function. Since that means there are no
// wrappers to cut, we need to check whether the compartment is still alive,
// and drop the references if it is not.
if (MOZ_UNLIKELY(!callback)) {
return true;
}
auto pvt = xpc::CompartmentPrivate::Get(callback);
if (MOZ_LIKELY(tmp->mIncumbentGlobal && pvt) && MOZ_UNLIKELY(pvt->wasNuked)) {
// It's not safe to release our global reference or drop our JS objects at
// this point, so defer their finalization until CC is finished.
AddForDeferredFinalization(new JSObjectsDropper(tmp));
DeferredFinalize(tmp->mIncumbentGlobal.forget().take());
return true;
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(CallbackObject)
return !tmp->mCallback;
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(CallbackObject)
return !tmp->mCallback;
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CallbackObject)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIncumbentGlobal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@@ -66,6 +104,18 @@ CallbackObject::HoldJSObjectsIfMoreThanOneOwner()
}
}
JSObject*
CallbackObject::Callback(JSContext* aCx)
{
JSObject* callback = CallbackOrNull();
if (!callback) {
callback = JS_NewDeadWrapper(aCx);
}
MOZ_DIAGNOSTIC_ASSERT(callback);
return callback;
}
CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
ErrorResult& aRv,
const char* aExecutionReason,
@@ -90,8 +140,14 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
webIDLCallerPrincipal = nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller();
}
JSObject* wrappedCallback = aCallback->CallbackPreserveColor();
if (!wrappedCallback) {
aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
NS_LITERAL_CSTRING("Cannot execute callback from a nuked compartment."));
return;
}
// First, find the real underlying callback.
JSObject* realCallback = js::UncheckedUnwrap(aCallback->CallbackPreserveColor());
JSObject* realCallback = js::UncheckedUnwrap(wrappedCallback);
nsIGlobalObject* globalObject = nullptr;
JSContext* cx;
@@ -154,13 +210,14 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
cx = mAutoEntryScript->cx();
// Unmark the callable (by invoking Callback() and not the CallbackPreserveColor()
// variant), and stick it in a Rooted before it can go gray again.
// Unmark the callable (by invoking CallbackOrNull() and not the
// CallbackPreserveColor() variant), and stick it in a Rooted before it can
// go gray again.
// Nothing before us in this function can trigger a CC, so it's safe to wait
// until here it do the unmark. This allows us to construct mRootedCallable
// with the cx from mAutoEntryScript, avoiding the cost of finding another
// JSContext. (Rooted<> does not care about requests or compartments.)
mRootedCallable.emplace(cx, aCallback->Callback());
mRootedCallable.emplace(cx, aCallback->CallbackOrNull());
}
// JS-implemented WebIDL is always OK to run, since it runs with Chrome
@@ -309,7 +366,10 @@ CallbackObjectHolderBase::ToXPCOMCallback(CallbackObject* aCallback,
jsapi.Init();
JSContext* cx = jsapi.cx();
JS::Rooted<JSObject*> callback(cx, aCallback->Callback());
JS::Rooted<JSObject*> callback(cx, aCallback->CallbackOrNull());
if (!callback) {
return nullptr;
}
JSAutoCompartment ac(cx, callback);
RefPtr<nsXPCWrappedJS> wrappedJS;
+56 -14
View File
@@ -45,7 +45,7 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(DOM_CALLBACKOBJECT_IID)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CallbackObject)
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(CallbackObject)
// The caller may pass a global object which will act as an override for the
// incumbent script settings object when the callback is invoked (overriding
@@ -78,12 +78,24 @@ public:
Init(aCallback, aAsyncStack, aIncumbentGlobal);
}
JS::Handle<JSObject*> Callback() const
// This is guaranteed to be non-null from the time the CallbackObject is
// created until JavaScript has had a chance to run. It will only return null
// after a JavaScript caller has called nukeSandbox on a Sandbox object, and
// the cycle collector has had a chance to run.
//
// This means that any native callee which receives a CallbackObject as an
// argument can safely rely on the callback being non-null so long as it
// doesn't trigger any scripts before it accesses it.
JS::Handle<JSObject*> CallbackOrNull() const
{
mCallback.exposeToActiveJS();
return CallbackPreserveColor();
}
// Like CallbackOrNull(), but will return a new dead proxy object in the
// caller's compartment if the callback is null.
JSObject* Callback(JSContext* aCx);
JSObject* GetCreationStack() const
{
return mCreationStack;
@@ -112,12 +124,12 @@ public:
/*
* If the callback is known to be non-gray, then this method can be
* used instead of Callback() to avoid the overhead of
* used instead of CallbackOrNull() to avoid the overhead of
* ExposeObjectToActiveJS().
*/
JS::Handle<JSObject*> CallbackKnownNotGray() const
{
MOZ_ASSERT(!JS::ObjectIsMarkedGray(mCallback));
MOZ_ASSERT(JS::ObjectIsNotGray(mCallback));
return CallbackPreserveColor();
}
@@ -159,13 +171,33 @@ protected:
bool operator==(const CallbackObject& aOther) const
{
JSObject* thisObj =
js::UncheckedUnwrap(CallbackPreserveColor());
JSObject* otherObj =
js::UncheckedUnwrap(aOther.CallbackPreserveColor());
JSObject* wrappedThis = CallbackPreserveColor();
JSObject* wrappedOther = aOther.CallbackPreserveColor();
if (!wrappedThis || !wrappedOther) {
return this == &aOther;
}
JSObject* thisObj = js::UncheckedUnwrap(wrappedThis);
JSObject* otherObj = js::UncheckedUnwrap(wrappedOther);
return thisObj == otherObj;
}
class JSObjectsDropper final
{
public:
explicit JSObjectsDropper(CallbackObject* aHolder)
: mHolder(aHolder)
{}
~JSObjectsDropper()
{
mHolder->DropJSObjects();
}
private:
RefPtr<CallbackObject> mHolder;
};
private:
inline void InitNoHold(JSObject* aCallback, JSObject* aCreationStack,
nsIGlobalObject* aIncumbentGlobal)
@@ -488,8 +520,11 @@ public:
nsCOMPtr<nsISupports> supp =
CallbackObjectHolderBase::ToXPCOMCallback(GetWebIDLCallback(),
NS_GET_TEMPLATE_IID(XPCOMCallbackT));
// ToXPCOMCallback already did the right QI for us.
return supp.forget().downcast<XPCOMCallbackT>();
if (supp) {
// ToXPCOMCallback already did the right QI for us.
return supp.forget().downcast<XPCOMCallbackT>();
}
return nullptr;
}
// Try to return a WebIDLCallbackT version of this object.
@@ -530,7 +565,9 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
const char* aName,
uint32_t aFlags = 0)
{
CycleCollectionNoteChild(aCallback, aField.GetISupports(), aName, aFlags);
if (aField) {
CycleCollectionNoteChild(aCallback, aField.GetISupports(), aName, aFlags);
}
}
template<class T, class U>
@@ -567,10 +604,15 @@ public:
this->get().operator=(arg);
}
// Codegen relies on being able to do Callback() on us.
JS::Handle<JSObject*> Callback() const
// Codegen relies on being able to do CallbackOrNull() and Callback() on us.
JS::Handle<JSObject*> CallbackOrNull() const
{
return this->get()->Callback();
return this->get()->CallbackOrNull();
}
JSObject* Callback(JSContext* aCx) const
{
return this->get()->Callback(aCx);
}
~RootedCallback()
+105 -36
View File
@@ -449,6 +449,9 @@ class CGDOMJSClass(CGThing):
traceHook = 'nullptr'
reservedSlots = slotCount
if self.descriptor.interface.isProbablyShortLivingObject():
if not self.descriptor.wrapperCache:
raise TypeError("Need a wrapper cache to support nursery "
"allocation of DOM objects")
classFlags += " | JSCLASS_SKIP_NURSERY_FINALIZE"
if self.descriptor.interface.getExtendedAttribute("NeedResolve"):
resolveHook = RESOLVE_HOOK_NAME
@@ -528,7 +531,9 @@ class CGDOMProxyJSClass(CGThing):
return ""
def define(self):
flags = ["JSCLASS_IS_DOMJSCLASS"]
# We need one reserved slot (DOM_OBJECT_SLOT).
flags = ["JSCLASS_IS_DOMJSCLASS",
"JSCLASS_HAS_RESERVED_SLOTS(1)"]
# We don't use an IDL annotation for JSCLASS_EMULATES_UNDEFINED because
# we don't want people ever adding that to any interface other than
# HTMLAllCollection. So just hardcode it here.
@@ -1671,14 +1676,14 @@ class CGAddPropertyHook(CGAbstractClassHook):
""")
def finalizeHook(descriptor, hookName, freeOp):
def finalizeHook(descriptor, hookName, freeOp, obj):
finalize = ""
if descriptor.wrapperCache:
finalize += "ClearWrapper(self, self);\n"
finalize += "ClearWrapper(self, self, %s);\n" % obj
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
finalize += "self->mExpandoAndGeneration.expando = JS::UndefinedValue();\n"
if descriptor.isGlobal():
finalize += "mozilla::dom::FinalizeGlobal(CastToJSFreeOp(%s), obj);\n" % freeOp
finalize += "mozilla::dom::FinalizeGlobal(CastToJSFreeOp(%s), %s);\n" % (freeOp, obj)
finalize += ("AddForDeferredFinalization<%s>(self);\n" %
descriptor.nativeType)
return CGIfWrapper(CGGeneric(finalize), "self")
@@ -1694,7 +1699,8 @@ class CGClassFinalizeHook(CGAbstractClassHook):
'void', args)
def generate_code(self):
return finalizeHook(self.descriptor, self.name, self.args[0].name).define()
return finalizeHook(self.descriptor, self.name,
self.args[0].name, self.args[1].name).define()
class CGClassObjectMovedHook(CGAbstractClassHook):
@@ -3225,7 +3231,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
*/
const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(${id});
MOZ_ASSERT_IF(entrySlot, !JS::ObjectIsMarkedGray(entrySlot));
MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
""",
id=self.id)
@@ -3471,21 +3477,21 @@ def CreateBindingJSObject(descriptor, properties):
# We don't always need to root obj, but there are a variety
# of cases where we do, so for simplicity, just always root it.
if descriptor.proxy:
create = dedent(
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
expandoValue = "JS::PrivateValue(&aObject->mExpandoAndGeneration)"
else:
expandoValue = "JS::UndefinedValue()"
create = fill(
"""
JS::Rooted<JS::Value> expandoValue(aCx, ${expandoValue});
creator.CreateProxyObject(aCx, &sClass.mBase, DOMProxyHandler::getInstance(),
proto, aObject, aReflector);
proto, aObject, expandoValue, aReflector);
if (!aReflector) {
return false;
}
""")
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
create += dedent("""
js::SetProxyExtra(aReflector, JSPROXYSLOT_EXPANDO,
JS::PrivateValue(&aObject->mExpandoAndGeneration));
""")
""",
expandoValue=expandoValue)
else:
create = dedent(
"""
@@ -3730,7 +3736,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
return false;
}
MOZ_ASSERT(JS_IsGlobalObject(global));
MOZ_ASSERT(!JS::ObjectIsMarkedGray(global));
MOZ_ASSERT(JS::ObjectIsNotGray(global));
// That might have ended up wrapping us already, due to the wonders
// of XBL. Check for that, and bail out as needed.
@@ -3946,11 +3952,15 @@ class CGUpdateMemberSlotsMethod(CGAbstractStaticMethod):
body += fill(
"""
static_assert(${slot} < js::shadow::Object::MAX_FIXED_SLOTS,
"Not enough fixed slots to fit '${interface}.${member}. Ion's visitGetDOMMemberV/visitGetDOMMemberT assume StoreInSlot things are all in fixed slots.");
if (!get_${member}(aCx, aWrapper, aObject, args)) {
return false;
}
// Getter handled setting our reserved slots
""",
slot=memberReservedSlot(m, self.descriptor),
interface=self.descriptor.interface.identifier.name,
member=m.identifier.name)
body += "\nreturn true;\n"
@@ -4252,7 +4262,9 @@ class CastableObjectUnwrapper():
// that already has a content reflection...
if (!IsDOMObject(js::UncheckedUnwrap(&${source}.toObject()))) {
nsCOMPtr<nsIGlobalObject> contentGlobal;
if (!GetContentGlobalForJSImplementedObject(cx, Callback(), getter_AddRefs(contentGlobal))) {
JS::Handle<JSObject*> callback = CallbackOrNull();
if (!callback ||
!GetContentGlobalForJSImplementedObject(cx, callback, getter_AddRefs(contentGlobal))) {
$*{exceptionCode}
}
JS::Rooted<JSObject*> jsImplSourceObj(cx, &${source}.toObject());
@@ -4924,7 +4936,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
}
${typeName}::EntryType* entry;
if (idsSeen.Contains(propName)) {
if (!idsSeen.EnsureInserted(propName)) {
// Find the existing entry.
auto idx = recordEntries.IndexOf(propName);
MOZ_ASSERT(idx != recordEntries.NoIndex,
@@ -4940,7 +4952,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
// Safe to do an infallible append here, because we did a
// SetCapacity above to the right capacity.
entry = recordEntries.AppendElement();
idsSeen.PutEntry(propName);
}
entry->mKey = propName;
${valueType}& slot = entry->mValue;
@@ -6728,8 +6739,10 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
return conversion, False
if type.isCallback() or type.isCallbackInterface():
wrapCode = setObject(
"*GetCallbackFromCallbackObject(%(result)s)",
# Callbacks can store null if we nuked the compartments their
# objects lived in.
wrapCode = setObjectOrNull(
"GetCallbackFromCallbackObject(cx, %(result)s)",
wrapAsType=type)
if type.nullable():
wrapCode = (
@@ -7179,7 +7192,8 @@ class CGCallGenerator(CGThing):
if needsCallerType:
args.append(CGGeneric("callerType"))
if isFallible:
canOOM = "canOOM" in extendedAttributes
if isFallible or canOOM:
args.append(CGGeneric("rv"))
args.extend(CGGeneric(arg) for arg in argsPost)
@@ -7263,8 +7277,12 @@ class CGCallGenerator(CGThing):
self.cgRoot.prepend(callerCheck)
self.cgRoot.prepend(CGGeneric("CallerType callerType;\n"))
if isFallible:
self.cgRoot.prepend(CGGeneric("binding_detail::FastErrorResult rv;\n"))
if isFallible or canOOM:
if isFallible:
reporterClass = "binding_detail::FastErrorResult"
else:
reporterClass = "binding_danger::OOMReporterInstantiator"
self.cgRoot.prepend(CGGeneric("%s rv;\n" % reporterClass))
self.cgRoot.append(CGGeneric(dedent(
"""
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx))) {
@@ -9043,9 +9061,10 @@ class CGSpecializedGetter(CGAbstractStaticMethod):
nativeName = MakeNativeName(descriptor.binaryNameFor(name))
_, resultOutParam, _, _, _ = getRetvalDeclarationForType(attr.type,
descriptor)
infallible = ('infallible' in
descriptor.getExtendedAttributes(attr, getter=True))
if resultOutParam or attr.type.nullable() or not infallible:
extendedAttrs = descriptor.getExtendedAttributes(attr, getter=True)
canFail = ('infallible' not in extendedAttrs or
'canOOM' in extendedAttrs)
if resultOutParam or attr.type.nullable() or canFail:
nativeName = "Get" + nativeName
return nativeName
@@ -9343,13 +9362,27 @@ class CGMemberJITInfo(CGThing):
# while we have the right type.
getter = ("(JSJitGetterOp)get_%s" %
IDLToCIdentifier(self.member.identifier.name))
getterinfal = "infallible" in self.descriptor.getExtendedAttributes(self.member, getter=True)
extendedAttrs = self.descriptor.getExtendedAttributes(self.member, getter=True)
getterinfal = "infallible" in extendedAttrs
# At this point getterinfal is true if our getter either can't throw
# at all, or can only throw OOM. In both cases, it's safe to move,
# or dead-code-eliminate, the getter, because throwing OOM is not
# semantically meaningful, so code can't rely on it happening. Note
# that this makes the behavior consistent for OOM thrown from the
# getter itself and OOM thrown from the to-JS conversion of the
# return value (see the "canOOM" and "infallibleForMember" checks
# below).
movable = self.mayBeMovable() and getterinfal
eliminatable = self.mayBeEliminatable() and getterinfal
aliasSet = self.aliasSet()
getterinfal = getterinfal and infallibleForMember(self.member, self.member.type, self.descriptor)
# Now we have to set getterinfal to whether we can _really_ ever
# throw, from the point of view of the JS engine.
getterinfal = (getterinfal and
"canOOM" not in extendedAttrs and
infallibleForMember(self.member, self.member.type, self.descriptor))
isAlwaysInSlot = self.member.getExtendedAttribute("StoreInSlot")
if self.member.slotIndices is not None:
assert isAlwaysInSlot or self.member.getExtendedAttribute("Cached")
@@ -9412,7 +9445,16 @@ class CGMemberJITInfo(CGThing):
# argument conversions, since argument conversions that can
# reliably throw would be effectful anyway and the jit doesn't
# move effectful things.
hasInfallibleImpl = "infallible" in self.descriptor.getExtendedAttributes(self.member)
extendedAttrs = self.descriptor.getExtendedAttributes(self.member)
hasInfallibleImpl = "infallible" in extendedAttrs
# At this point hasInfallibleImpl is true if our method either
# can't throw at all, or can only throw OOM. In both cases, it
# may be safe to move, or dead-code-eliminate, the method,
# because throwing OOM is not semantically meaningful, so code
# can't rely on it happening. Note that this makes the behavior
# consistent for OOM thrown from the method itself and OOM
# thrown from the to-JS conversion of the return value (see the
# "canOOM" and "infallibleForMember" checks below).
movable = self.mayBeMovable() and hasInfallibleImpl
eliminatable = self.mayBeEliminatable() and hasInfallibleImpl
# XXXbz can we move the smarts about fallibility due to arg
@@ -9422,7 +9464,8 @@ class CGMemberJITInfo(CGThing):
# We have arguments or our return-value boxing can fail
methodInfal = False
else:
methodInfal = hasInfallibleImpl
methodInfal = (hasInfallibleImpl and
"canOOM" not in extendedAttrs)
# For now, only bother to output args if we're side-effect-free.
if self.member.affects == "Nothing":
args = sig[1]
@@ -10930,6 +10973,7 @@ class CGResolveOwnPropertyViaResolve(CGAbstractBindingMethod):
// to avoid re-resolving the properties if someone deletes
// them.
JSAutoCompartment ac(cx, obj);
JS_MarkCrossZoneId(cx, id);
JS::Rooted<JS::PropertyDescriptor> objDesc(cx);
if (!self->DoResolve(cx, obj, id, &objDesc)) {
return false;
@@ -11351,7 +11395,7 @@ class CGProxyUnwrap(CGAbstractMethod):
obj = js::UncheckedUnwrap(obj);
}
MOZ_ASSERT(IsProxy(obj));
return static_cast<${type}*>(js::GetProxyPrivate(obj).toPrivate());
return static_cast<${type}*>(js::GetProxyReservedSlot(obj, DOM_OBJECT_SLOT).toPrivate());
""",
type=self.descriptor.nativeType)
@@ -12059,7 +12103,8 @@ class CGDOMJSProxyHandler_finalize(ClassMethod):
def getBody(self):
return (("%s* self = UnwrapPossiblyNotInitializedDOMObject<%s>(proxy);\n" %
(self.descriptor.nativeType, self.descriptor.nativeType)) +
finalizeHook(self.descriptor, FINALIZE_HOOK_NAME, self.args[0].name).define())
finalizeHook(self.descriptor, FINALIZE_HOOK_NAME,
self.args[0].name, self.args[1].name).define())
class CGDOMJSProxyHandler_getElements(ClassMethod):
@@ -12173,6 +12218,21 @@ class CGDOMJSProxyHandler_isCallable(ClassMethod):
return true;
""")
class CGDOMJSProxyHandler_canNurseryAllocate(ClassMethod):
"""
Override the default canNurseryAllocate in BaseProxyHandler, for cases when
we should be nursery-allocated.
"""
def __init__(self):
ClassMethod.__init__(self, "canNurseryAllocate", "bool",
[],
virtual=True, override=True, const=True)
def getBody(self):
return dedent("""
return true;
""")
class CGDOMJSProxyHandler(CGClass):
def __init__(self, descriptor):
@@ -12210,6 +12270,11 @@ class CGDOMJSProxyHandler(CGClass):
if descriptor.operations['LegacyCaller']:
methods.append(CGDOMJSProxyHandler_call())
methods.append(CGDOMJSProxyHandler_isCallable())
if descriptor.interface.isProbablyShortLivingObject():
if not descriptor.wrapperCache:
raise TypeError("Need a wrapper cache to support nursery "
"allocation of DOM objects")
methods.append(CGDOMJSProxyHandler_canNurseryAllocate())
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
parentClass = 'ShadowingDOMProxyHandler'
@@ -14290,10 +14355,12 @@ class CGNativeMember(ClassMethod):
# And the caller type, if desired.
if needsCallerType(self.member):
args.append(Argument("CallerType", "aCallerType"))
# And the ErrorResult
# And the ErrorResult or OOMReporter
if 'infallible' not in self.extendedAttrs:
# Use aRv so it won't conflict with local vars named "rv"
args.append(Argument("ErrorResult&", "aRv"))
elif 'canOOM' in self.extendedAttrs:
args.append(Argument("OOMReporter&", "aRv"))
# The legacycaller thisval
if self.member.isMethod() and self.member.isLegacycaller():
# If it has an identifier, we can't deal with it yet
@@ -15208,11 +15275,11 @@ class CGJSImplClass(CGBindingImplClass):
}
// Now define it on our chrome object
JSAutoCompartment ac(aCx, mImpl->Callback());
JSAutoCompartment ac(aCx, mImpl->CallbackOrNull());
if (!JS_WrapObject(aCx, &obj)) {
return nullptr;
}
if (!JS_DefineProperty(aCx, mImpl->Callback(), "__DOM_IMPL__", obj, 0)) {
if (!JS_DefineProperty(aCx, mImpl->CallbackOrNull(), "__DOM_IMPL__", obj, 0)) {
return nullptr;
}
return obj;
@@ -17006,6 +17073,8 @@ class CGEventGetter(CGNativeMember):
def getArgs(self, returnType, argList):
if 'infallible' not in self.extendedAttrs:
raise TypeError("Event code generator does not support [Throws]!")
if 'canOOM' in self.extendedAttrs:
raise TypeError("Event code generator does not support [CanOOM]!")
if not self.member.isAttr():
raise TypeError("Event code generator does not support methods")
if self.member.isStatic():
+19 -2
View File
@@ -568,17 +568,29 @@ class Descriptor(DescriptorProvider):
return self.isGlobal() and self.supportsNamedProperties()
def getExtendedAttributes(self, member, getter=False, setter=False):
def ensureValidThrowsExtendedAttribute(attr):
def ensureValidBoolExtendedAttribute(attr, name):
if (attr is not None and attr is not True):
raise TypeError("Unknown value for 'Throws': " + attr[0])
raise TypeError("Unknown value for '%s': %s" % (name, attr[0]))
def ensureValidThrowsExtendedAttribute(attr):
ensureValidBoolExtendedAttribute(attr, "Throws")
def ensureValidCanOOMExtendedAttribute(attr):
ensureValidBoolExtendedAttribute(attr, "CanOOM")
def maybeAppendInfallibleToAttrs(attrs, throws):
ensureValidThrowsExtendedAttribute(throws)
if throws is None:
attrs.append("infallible")
def maybeAppendCanOOMToAttrs(attrs, canOOM):
ensureValidCanOOMExtendedAttribute(canOOM)
if canOOM is not None:
attrs.append("canOOM")
name = member.identifier.name
throws = self.interface.isJSImplemented() or member.getExtendedAttribute("Throws")
canOOM = member.getExtendedAttribute("CanOOM")
if member.isMethod():
# JSObject-returning [NewObject] methods must be fallible,
# since they have to (fallibly) allocate the new JSObject.
@@ -587,6 +599,7 @@ class Descriptor(DescriptorProvider):
throws = True
attrs = self.extendedAttributes['all'].get(name, [])
maybeAppendInfallibleToAttrs(attrs, throws)
maybeAppendCanOOMToAttrs(attrs, canOOM)
return attrs
assert member.isAttr()
@@ -597,6 +610,10 @@ class Descriptor(DescriptorProvider):
throwsAttr = "GetterThrows" if getter else "SetterThrows"
throws = member.getExtendedAttribute(throwsAttr)
maybeAppendInfallibleToAttrs(attrs, throws)
if canOOM is None:
canOOMAttr = "GetterCanOOM" if getter else "SetterCanOOM"
canOOM = member.getExtendedAttribute(canOOMAttr)
maybeAppendCanOOMToAttrs(attrs, canOOM)
return attrs
def supportsIndexedProperties(self):
+13 -13
View File
@@ -33,7 +33,7 @@ js::DOMProxyShadowsResult
DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
{
JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy));
JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
JS::Value v = js::GetProxyPrivate(proxy);
bool isOverrideBuiltins = !v.isObject() && !v.isUndefined();
if (expando) {
bool hasOwn;
@@ -63,24 +63,26 @@ struct SetDOMProxyInformation
{
SetDOMProxyInformation() {
js::SetDOMProxyInformation((const void*) &DOMProxyHandler::family,
JSPROXYSLOT_EXPANDO, DOMProxyShadows);
DOMProxyShadows);
}
};
SetDOMProxyInformation gSetDOMProxyInformation;
// static
JSObject*
DOMProxyHandler::GetAndClearExpandoObject(JSObject* obj)
{
MOZ_ASSERT(IsDOMProxy(obj), "expected a DOM proxy object");
JS::Value v = js::GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
JS::Value v = js::GetProxyPrivate(obj);
if (v.isUndefined()) {
return nullptr;
}
if (v.isObject()) {
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, UndefinedValue());
js::SetProxyPrivate(obj, UndefinedValue());
} else {
js::ExpandoAndGeneration* expandoAndGeneration =
static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
@@ -113,7 +115,7 @@ JSObject*
DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle<JSObject*> obj)
{
NS_ASSERTION(IsDOMProxy(obj), "expected a DOM proxy object");
JS::Value v = js::GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
JS::Value v = js::GetProxyPrivate(obj);
if (v.isObject()) {
return &v.toObject();
}
@@ -148,7 +150,7 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle<JSObject*> obj)
return expando;
}
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, ObjectValue(*expando));
js::SetProxyPrivate(obj, ObjectValue(*expando));
return expando;
}
@@ -279,7 +281,7 @@ JSObject *
DOMProxyHandler::GetExpandoObject(JSObject *obj)
{
MOZ_ASSERT(IsDOMProxy(obj), "expected a DOM proxy object");
JS::Value v = js::GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
JS::Value v = js::GetProxyPrivate(obj);
if (v.isObject()) {
return &v.toObject();
}
@@ -300,14 +302,12 @@ ShadowingDOMProxyHandler::trace(JSTracer* trc, JSObject* proxy) const
DOMProxyHandler::trace(trc, proxy);
MOZ_ASSERT(IsDOMProxy(proxy), "expected a DOM proxy object");
JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
JS::Value v = js::GetProxyPrivate(proxy);
MOZ_ASSERT(!v.isObject(), "Should not have expando object directly!");
if (v.isUndefined()) {
// This can happen if we GC while creating our object, before we get a
// chance to set up its JSPROXYSLOT_EXPANDO slot.
return;
}
// The proxy's private slot is set when we allocate the proxy,
// so it cannot be |undefined|.
MOZ_ASSERT(!v.isUndefined());
js::ExpandoAndGeneration* expandoAndGeneration =
static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
+20 -26
View File
@@ -13,35 +13,29 @@
#include "js/Proxy.h"
#include "nsString.h"
#define DOM_PROXY_OBJECT_SLOT js::PROXY_PRIVATE_SLOT
namespace mozilla {
namespace dom {
enum {
/**
* DOM proxies have an extra slot for the expando object at index
* JSPROXYSLOT_EXPANDO.
*
* The expando object is a plain JSObject whose properties correspond to
* "expandos" (custom properties set by the script author).
*
* The exact value stored in the JSPROXYSLOT_EXPANDO slot depends on whether
* the interface is annotated with the [OverrideBuiltins] extended attribute.
*
* If it is, the proxy is initialized with a PrivateValue, which contains a
* pointer to a js::ExpandoAndGeneration object; this contains a pointer to
* the actual expando object as well as the "generation" of the object. The
* proxy handler will trace the expando object stored in the
* js::ExpandoAndGeneration while the proxy itself is alive.
*
* If it is not, the proxy is initialized with an UndefinedValue. In
* EnsureExpandoObject, it is set to an ObjectValue that points to the
* expando object directly. (It is set back to an UndefinedValue only when
* the object is about to die.)
*/
JSPROXYSLOT_EXPANDO = 0
};
/**
* DOM proxies store the expando object in the private slot.
*
* The expando object is a plain JSObject whose properties correspond to
* "expandos" (custom properties set by the script author).
*
* The exact value stored in the proxy's private slot depends on whether the
* interface is annotated with the [OverrideBuiltins] extended attribute.
*
* If it is, the proxy is initialized with a PrivateValue, which contains a
* pointer to a js::ExpandoAndGeneration object; this contains a pointer to
* the actual expando object as well as the "generation" of the object. The
* proxy handler will trace the expando object stored in the
* js::ExpandoAndGeneration while the proxy itself is alive.
*
* If it is not, the proxy is initialized with an UndefinedValue. In
* EnsureExpandoObject, it is set to an ObjectValue that points to the
* expando object directly. (It is set back to an UndefinedValue only when
* the object is about to die.)
*/
template<typename T> struct Prefable;
+78
View File
@@ -101,6 +101,7 @@ struct StringArrayAppender
} // namespace dom
class ErrorResult;
class OOMReporter;
namespace binding_danger {
@@ -161,6 +162,7 @@ public:
}
operator ErrorResult&();
operator OOMReporter&();
void Throw(nsresult rv) {
MOZ_ASSERT(NS_FAILED(rv), "Please don't try throwing success");
@@ -555,6 +557,82 @@ class IgnoredErrorResult :
{
};
namespace dom {
namespace binding_detail {
class FastErrorResult :
public mozilla::binding_danger::TErrorResult<
mozilla::binding_danger::JustAssertCleanupPolicy>
{
};
} // namespace binding_detail
} // namespace dom
// This part is a bit annoying. We want an OOMReporter class that has the
// following properties:
//
// 1) Can be cast to from any ErrorResult-like type.
// 2) Has a fast destructor (because we want to use it from bindings).
// 3) Won't be randomly instantiated by non-binding code (because the fast
// destructor is not so safe.
// 4) Doesn't look ugly on the callee side (e.g. isn't in the binding_detail or
// binding_danger namespace).
//
// We do this by having two classes: The class callees should use, which has the
// things we want and a private constructor, and a friend subclass in the
// binding_danger namespace that can be used to construct it.
namespace binding_danger {
class OOMReporterInstantiator;
} // namespace binding_danger
class OOMReporter : private dom::binding_detail::FastErrorResult
{
public:
void ReportOOM()
{
Throw(NS_ERROR_OUT_OF_MEMORY);
}
private:
// OOMReporterInstantiator is a friend so it can call our constructor and
// MaybeSetPendingException.
friend class binding_danger::OOMReporterInstantiator;
// TErrorResult is a friend so its |operator OOMReporter&()| can work.
template<typename CleanupPolicy>
friend class binding_danger::TErrorResult;
OOMReporter()
: dom::binding_detail::FastErrorResult()
{
}
};
namespace binding_danger {
class OOMReporterInstantiator : public OOMReporter
{
public:
OOMReporterInstantiator()
: OOMReporter()
{
}
// We want to be able to call MaybeSetPendingException from codegen. The one
// on OOMReporter is not callable directly, because it comes from a private
// superclass. But we're a friend, so _we_ can call it.
bool MaybeSetPendingException(JSContext* cx)
{
return OOMReporter::MaybeSetPendingException(cx);
}
};
} // namespace binding_danger
template<typename CleanupPolicy>
binding_danger::TErrorResult<CleanupPolicy>::operator OOMReporter&()
{
return *static_cast<OOMReporter*>(
reinterpret_cast<TErrorResult<JustAssertCleanupPolicy>*>(this));
}
/******************************************************************************
** Macros for checking results
******************************************************************************/
-1
View File
@@ -111,4 +111,3 @@ MSG_DEF(MSG_PMO_INVALID_MEMBERS, 0, JSEXN_TYPEERR, "PerformanceMeasureOptions ca
MSG_DEF(MSG_PMO_CONSTRUCTOR_INACCESSIBLE, 0, JSEXN_TYPEERR, "Can't access PerformanceMark constructor, performance is null.")
MSG_DEF(MSG_PMO_UNEXPECTED_START_TIME, 0, JSEXN_TYPEERR, "Expected startTime >= 0.")
MSG_DEF(MSG_PMO_INVALID_ATTR_FOR_NON_GLOBAL, 1, JSEXN_TYPEERR, "Cannot get PerformanceTiming attribute values for non-Window global object. Given: {0}.")
MSG_DEF(MSG_NOT_SUBMIT_BUTTON, 0, JSEXN_TYPEERR, "The submitter is not a submit button.")
+1
View File
@@ -46,6 +46,7 @@ SimpleGlobal_finalize(js::FreeOp *fop, JSObject *obj)
{
SimpleGlobalObject* globalObject =
static_cast<SimpleGlobalObject*>(JS_GetPrivate(obj));
globalObject->ClearWrapper(obj);
NS_RELEASE(globalObject);
}
+1 -1
View File
@@ -86,7 +86,7 @@ private:
virtual ~SimpleGlobalObject()
{
ClearWrapper();
MOZ_ASSERT(!GetWrapperMaybeDead());
}
const GlobalType mType;
+1 -1
View File
@@ -131,7 +131,7 @@ ToJSValue(JSContext* aCx,
// Make sure we're called in a compartment
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
aValue.setObject(*aArgument.Callback());
aValue.setObjectOrNull(aArgument.Callback(aCx));
return MaybeWrapValue(aCx, aValue);
}
+17 -10
View File
@@ -4116,15 +4116,19 @@ class IDLAttribute(IDLInterfaceMember):
def handleExtendedAttribute(self, attr):
identifier = attr.identifier()
if identifier == "SetterThrows" and self.readonly:
if ((identifier == "SetterThrows" or identifier == "SetterCanOOM")
and self.readonly):
raise WebIDLError("Readonly attributes must not be flagged as "
"[SetterThrows]",
"[%s]" % identifier,
[self.location])
elif (((identifier == "Throws" or identifier == "GetterThrows") and
elif (((identifier == "Throws" or identifier == "GetterThrows" or
identifier == "CanOOM" or identifier == "GetterCanOOM") and
self.getExtendedAttribute("StoreInSlot")) or
(identifier == "StoreInSlot" and
(self.getExtendedAttribute("Throws") or
self.getExtendedAttribute("GetterThrows")))):
self.getExtendedAttribute("GetterThrows") or
self.getExtendedAttribute("CanOOM") or
self.getExtendedAttribute("GetterCanOOM")))):
raise WebIDLError("Throwing things can't be [StoreInSlot]",
[attr.location])
elif identifier == "LenientThis":
@@ -4287,6 +4291,9 @@ class IDLAttribute(IDLInterfaceMember):
identifier == "SetterThrows" or
identifier == "Throws" or
identifier == "GetterThrows" or
identifier == "SetterCanOOM" or
identifier == "CanOOM" or
identifier == "GetterCanOOM" or
identifier == "ChromeOnly" or
identifier == "Func" or
identifier == "SecureContext" or
@@ -4944,13 +4951,12 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
def handleExtendedAttribute(self, attr):
identifier = attr.identifier()
if identifier == "GetterThrows":
if (identifier == "GetterThrows" or
identifier == "SetterThrows" or
identifier == "GetterCanOOM" or
identifier == "SetterCanOOM"):
raise WebIDLError("Methods must not be flagged as "
"[GetterThrows]",
[attr.location, self.location])
elif identifier == "SetterThrows":
raise WebIDLError("Methods must not be flagged as "
"[SetterThrows]",
"[%s]" % identifier,
[attr.location, self.location])
elif identifier == "Unforgeable":
if self.isStatic():
@@ -5023,6 +5029,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
"attribute, setter, and deleter",
[attr.location, self.location])
elif (identifier == "Throws" or
identifier == "CanOOM" or
identifier == "NewObject" or
identifier == "ChromeOnly" or
identifier == "UnsafeInPrerendering" or
+8
View File
@@ -74,6 +74,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/Conversions.h"
#include "js/HeapAPI.h"
#include "mozilla/Alignment.h"
#include "mozilla/Assertions.h"
@@ -121,6 +122,7 @@
#include "nsFontMetrics.h"
#include "Units.h"
#include "CanvasUtils.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "nsStyleSet.h"
#include "mozilla/layers/CanvasClient.h"
@@ -1747,6 +1749,12 @@ CanvasRenderingContext2D::RegisterAllocation()
if (context) {
JS_updateMallocCounter(context, mWidth * mHeight * 4);
}
JSObject* wrapper = GetWrapperPreserveColor();
if (wrapper) {
CycleCollectedJSContext::Get()->
AddZoneWaitingForGC(JS::GetObjectZone(wrapper));
}
}
static already_AddRefed<LayerManager>
+14 -76
View File
@@ -9,7 +9,6 @@
#include "mozilla/CheckedInt.h"
#include "mozilla/UniquePtrExtensions.h"
#include "nsPrintfCString.h"
#include "WebGLActiveInfo.h"
#include "WebGLBuffer.h"
#include "WebGLContextUtils.h"
#include "WebGLFramebuffer.h"
@@ -28,30 +27,6 @@ namespace mozilla {
// For a Tegra workaround.
static const int MAX_DRAW_CALLS_SINCE_FLUSH = 100;
static uint8_t
NumUsedLocationsByElemTypeForDraw(GLenum elemType)
{
switch (elemType) {
case LOCAL_GL_FLOAT_MAT2:
case LOCAL_GL_FLOAT_MAT2x3:
case LOCAL_GL_FLOAT_MAT2x4:
return 2;
case LOCAL_GL_FLOAT_MAT3x2:
case LOCAL_GL_FLOAT_MAT3:
case LOCAL_GL_FLOAT_MAT3x4:
return 3;
case LOCAL_GL_FLOAT_MAT4x2:
case LOCAL_GL_FLOAT_MAT4x3:
case LOCAL_GL_FLOAT_MAT4:
return 4;
default:
return 1;
}
}
////////////////////////////////////////
class ScopedResolveTexturesForDraw
@@ -356,7 +331,6 @@ class ScopedDrawHelper final
{
WebGLContext* const mWebGL;
bool mDidFake;
std::vector<GLuint> mDisabledUnusedAttribs;
public:
ScopedDrawHelper(WebGLContext* webgl, const char* funcName, uint32_t firstVertex,
@@ -393,43 +367,11 @@ public:
}
mDidFake = true;
const auto& linkInfo = mWebGL->mActiveProgramLinkInfo;
#ifdef XP_MACOSX
if (mWebGL->gl->WorkAroundDriverBugs()) {
std::vector<bool> isActiveAttrib(mWebGL->mBoundVertexArray->mAttribs.Length(),
false);
for (const auto& progAttrib : linkInfo->attribs) {
const auto loc = progAttrib.mLoc;
if (loc < 0) {
continue;
}
const auto usedLocs =
NumUsedLocationsByElemTypeForDraw(progAttrib.mActiveInfo->mElemType);
for (uint32_t i = 0; i < usedLocs; ++i) {
const auto usedLoc = static_cast<uint32_t>(loc) + i;
if (usedLoc < isActiveAttrib.size()) {
isActiveAttrib[usedLoc] = true;
}
}
}
for (uint32_t i = 0; i < mWebGL->mBoundVertexArray->mAttribs.Length(); ++i) {
const auto& attrib = mWebGL->mBoundVertexArray->mAttribs[i];
if (!attrib.mEnabled || isActiveAttrib[i]) {
continue;
}
mWebGL->gl->fDisableVertexAttribArray(i);
mDisabledUnusedAttribs.push_back(i);
}
}
#endif
////
// Check UBO sizes.
const auto& linkInfo = mWebGL->mActiveProgramLinkInfo;
for (const auto& cur : linkInfo->uniformBlocks) {
const auto& dataSize = cur->mDataSize;
const auto& binding = cur->mBinding;
@@ -535,10 +477,6 @@ public:
if (mDidFake) {
mWebGL->UndoFakeVertexAttrib0();
}
for (const auto loc : mDisabledUnusedAttribs) {
mWebGL->gl->fEnableVertexAttribArray(loc);
}
}
};
@@ -669,12 +607,12 @@ WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei vertCount,
return;
MakeContextCurrent();
if (vertCount > mMaxVertIdsPerDraw) {
ErrorOutOfMemory(
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
return;
}
if (vertCount > mMaxVertIdsPerDraw) {
ErrorOutOfMemory(
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
return;
}
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
@@ -917,12 +855,12 @@ WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei vertCount, GLenum type,
return;
MakeContextCurrent();
if (vertCount > mMaxVertIdsPerDraw) {
ErrorOutOfMemory(
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
return;
}
if (vertCount > mMaxVertIdsPerDraw) {
ErrorOutOfMemory(
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
return;
}
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
+6 -3
View File
@@ -176,8 +176,6 @@ public:
void
Trace(const TraceCallbacks& aCallbacks, void* aClosure)
{
AssertIsOnOwningThread();
ConsoleCallData* tmp = this;
for (uint32_t i = 0; i < mCopiedArguments.Length(); ++i) {
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCopiedArguments[i])
@@ -2278,11 +2276,16 @@ Console::NotifyHandler(JSContext* aCx, const Sequence<JS::Value>& aArguments,
JS::Rooted<JS::Value> value(aCx);
JS::Rooted<JSObject*> callable(aCx, mConsoleEventNotifier->CallableOrNull());
if (NS_WARN_IF(!callable)) {
return;
}
// aCx and aArguments are in the same compartment because this method is
// called directly when a Console.something() runs.
// mConsoleEventNotifier->Callable() is the scope where value will be sent to.
if (NS_WARN_IF(!PopulateConsoleNotificationInTheTargetScope(aCx, aArguments,
mConsoleEventNotifier->Callable(),
callable,
&value,
aCallData))) {
return;
+1 -1
View File
@@ -322,7 +322,7 @@ DOMEventTargetHelper::GetEventHandler(nsIAtom* aType,
{
EventHandlerNonNull* handler = GetEventHandler(aType, EmptyString());
if (handler) {
*aValue = JS::ObjectValue(*handler->Callable());
*aValue = JS::ObjectValue(*handler->Callback(aCx));
} else {
*aValue = JS::NullValue();
}
+7 -1
View File
@@ -1533,10 +1533,16 @@ EventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
} else {
eventType.Assign(Substring(nsDependentAtomString(listener.mTypeAtom), 2));
}
nsCOMPtr<nsIDOMEventListener> callback = listener.mListener.ToXPCOMCallback();
if (!callback) {
// This will be null for cross-compartment event listeners which have been
// destroyed.
continue;
}
// EventListenerInfo is defined in XPCOM, so we have to go ahead
// and convert to an XPCOM callback here...
RefPtr<EventListenerInfo> info =
new EventListenerInfo(eventType, listener.mListener.ToXPCOMCallback(),
new EventListenerInfo(eventType, callback.forget(),
listener.mFlags.mCapture,
listener.mFlags.mAllowUntrustedEvents,
listener.mFlags.mInSystemGroup);
+8 -7
View File
@@ -137,7 +137,7 @@ EventListenerInfo::GetJSVal(JSContext* aCx,
nsCOMPtr<JSEventHandler> jsHandler = do_QueryInterface(mListener);
if (jsHandler && jsHandler->GetTypedEventHandler().HasEventHandler()) {
JS::Handle<JSObject*> handler =
jsHandler->GetTypedEventHandler().Ptr()->Callable();
jsHandler->GetTypedEventHandler().Ptr()->CallableOrNull();
if (handler) {
aAc.emplace(aCx, handler);
aJSVal.setObject(*handler);
@@ -376,12 +376,13 @@ EventListenerService::NotifyAboutMainThreadListenerChangeInternal(dom::EventTarg
&EventListenerService::NotifyPendingChanges));
}
RefPtr<EventListenerChange> changes = mPendingListenerChangesSet.Get(aTarget);
if (!changes) {
changes = new EventListenerChange(aTarget);
mPendingListenerChanges->AppendElement(changes, false);
mPendingListenerChangesSet.Put(aTarget, changes);
}
RefPtr<EventListenerChange> changes =
mPendingListenerChangesSet.LookupForAdd(aTarget).OrInsert(
[this, aTarget] () {
EventListenerChange* c = new EventListenerChange(aTarget);
mPendingListenerChanges->AppendElement(c, false);
return c;
});
changes->AddChangedListenerName(aName);
}
+2 -7
View File
@@ -4366,13 +4366,8 @@ EventStateManager::GetWrapperByEventID(WidgetMouseEvent* aEvent)
}
return mMouseEnterLeaveHelper;
}
RefPtr<OverOutElementsWrapper> helper;
if (!mPointersEnterLeaveHelper.Get(pointer->pointerId, getter_AddRefs(helper))) {
helper = new OverOutElementsWrapper();
mPointersEnterLeaveHelper.Put(pointer->pointerId, helper);
}
return helper;
return mPointersEnterLeaveHelper.LookupForAdd(pointer->pointerId).OrInsert(
[] () { return new OverOutElementsWrapper(); });
}
/* static */ void
+8
View File
@@ -884,6 +884,10 @@ IMEContentObserver::CharacterDataWillChange(nsIDocument* aDocument,
{
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
"character data changed for non-text node");
if (!aContent->IsNodeOfType(nsINode::eTEXT)) {
return; // Ignore if it's a comment node or something other invisible data
// node.
}
MOZ_ASSERT(mPreCharacterDataChangeLength < 0,
"CharacterDataChanged() should've reset "
"mPreCharacterDataChangeLength");
@@ -903,6 +907,10 @@ IMEContentObserver::CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
CharacterDataChangeInfo* aInfo)
{
if (!aContent->IsNodeOfType(nsINode::eTEXT)) {
return; // Ignore if it's a comment node or something other invisible data
// node.
}
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
"character data changed for non-text node");
+40 -1
View File
@@ -772,6 +772,21 @@ GetFileHandleThreadPoolFor(FileHandleStorage aStorage)
}
}
nsresult ClampResultCode(nsresult aResultCode) {
if (NS_SUCCEEDED(aResultCode) ||
NS_ERROR_GET_MODULE(aResultCode) == NS_ERROR_MODULE_DOM_FILEHANDLE) {
return aResultCode;
}
NS_WARNING(nsPrintfCString("Converting non-filehandle error code (0x%" PRIX32
") to "
"NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR",
static_cast<uint32_t>(aResultCode))
.get());
return NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR;
}
} // namespace
/*******************************************************************************
@@ -2092,7 +2107,8 @@ NormalFileHandleOp::SendFailureResult(nsresult aResultCode)
if (!IsActorDestroyed()) {
result =
PBackgroundFileRequestParent::Send__delete__(this, aResultCode);
PBackgroundFileRequestParent::Send__delete__(
this, ClampResultCode(aResultCode));
}
DEBUGONLY(mResponseSent = true;)
@@ -2254,6 +2270,10 @@ CopyFileHandleOp::DoFileWork(FileHandle* aFileHandle)
mOwningThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
} while (true);
if (mOffset < mSize) {
// end-of-file reached
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(mOffset == mSize);
if (mRead) {
@@ -2578,6 +2598,25 @@ TruncateOp::DoFileWork(FileHandle* aFileHandle)
nsCOMPtr<nsISeekableStream> sstream = do_QueryInterface(mFileStream);
MOZ_ASSERT(sstream);
if (mParams.offset()) {
nsCOMPtr<nsIFileMetadata> fileMetadata = do_QueryInterface(mFileStream);
MOZ_ASSERT(fileMetadata);
int64_t size;
nsresult rv = fileMetadata->GetSize(&size);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
MOZ_ASSERT(size >= 0);
if (mParams.offset() > static_cast<uint64_t>(size)) {
// Cannot extend the size of a file through truncate.
return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
}
}
// XXX If we allowed truncate to extend the file size, we would to ensure that
// the quota limit is checked, e.g. by making FileQuotaStream override Seek.
nsresult rv = sstream->Seek(nsISeekableStream::NS_SEEK_SET, mParams.offset());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
+6 -9
View File
@@ -110,15 +110,12 @@ DocAllResultMatch(Element* aElement, int32_t aNamespaceID, nsIAtom* aAtom,
nsContentList*
HTMLAllCollection::GetDocumentAllList(const nsAString& aID)
{
if (nsContentList* docAllList = mNamedMap.GetWeak(aID)) {
return docAllList;
}
nsCOMPtr<nsIAtom> id = NS_Atomize(aID);
RefPtr<nsContentList> docAllList =
new nsContentList(mDocument, DocAllResultMatch, nullptr, nullptr, true, id);
mNamedMap.Put(aID, docAllList);
return docAllList;
return mNamedMap.LookupForAdd(aID).OrInsert(
[this, &aID] () {
nsCOMPtr<nsIAtom> id = NS_Atomize(aID);
return new nsContentList(mDocument, DocAllResultMatch, nullptr,
nullptr, true, id);
});
}
void
-35
View File
@@ -276,41 +276,6 @@ HTMLFormElement::Submit()
return rv.StealNSResult();
}
// https://html.spec.whatwg.org/multipage/forms.html#dom-form-requestsubmit
void
HTMLFormElement::RequestSubmit(nsGenericHTMLElement* aSubmitter,
ErrorResult& aRv) {
// 1. If submitter is not null, then:
if (aSubmitter) {
nsCOMPtr<nsIFormControl> fc = do_QueryObject(aSubmitter);
// 1.1. If submitter is not a submit button, then throw a TypeError.
if (!fc || !fc->IsSubmitControl()) {
aRv.ThrowTypeError<MSG_NOT_SUBMIT_BUTTON>();
return;
}
// 1.2. If submitter's form owner is not this form element, then throw a
// "NotFoundError" DOMException.
if (fc->GetFormElement() != this) {
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return;
}
}
// 2. Otherwise, set submitter to this form element.
// 3. Submit this form element, from submitter.
// We go through the presShell here for the corner case a submit event
// is pending while the window is being destroyed.
InternalFormEvent event(true, eFormSubmit);
event.mOriginator = aSubmitter;
nsEventStatus status = nsEventStatus_eIgnore;
nsCOMPtr<nsIPresShell> presShell = GetComposedDoc()->GetShell();
if (MOZ_LIKELY(presShell)) {
presShell->HandleDOMEventWithTarget(this, &event, &status);
}
}
NS_IMETHODIMP
HTMLFormElement::Reset()
{
-13
View File
@@ -391,19 +391,6 @@ public:
void Submit(ErrorResult& aRv);
/**
* Requests to submit the form. Unlike submit(), this method includes
* interactive constraint validation and firing a submit event,
* either of which can cancel submission.
*
* @param aSubmitter The submitter argument can be used to point to a specific
* submit button.
* @param aRv An ErrorResult.
* @see
* https://html.spec.whatwg.org/multipage/forms.html#dom-form-requestsubmit
*/
void RequestSubmit(nsGenericHTMLElement* aSubmitter, ErrorResult& aRv);
// XPCOM Reset() is OK
bool CheckValidity()
+8
View File
@@ -5093,6 +5093,14 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
uint8_t oldType = mType;
MOZ_ASSERT(oldType != aNewType);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
// Input element can represent very different kinds of UIs, and we may
// need to flush styling even when focusing the already focused input
// element.
fm->NeedsFlushBeforeEventHandling(this);
}
if (aNewType == NS_FORM_INPUT_FILE || oldType == NS_FORM_INPUT_FILE) {
// Strictly speaking, we only need to clear files on going _to_ or _from_
// the NS_FORM_INPUT_FILE type, not both, since we'll never confuse values
+4
View File
@@ -3977,6 +3977,10 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
NotifyOwnerDocumentActivityChanged();
UpdateAudioChannelPlayingState();
if (mPausedForInactiveDocumentOrChannel) {
mDecoder->Suspend();
}
if (!mPaused) {
SetPlayedOrSeeked(true);
if (!mPausedForInactiveDocumentOrChannel) {
+52 -19
View File
@@ -105,6 +105,22 @@ namespace indexedDB {
[1, 2] // 0x60 bf f0 0 0 0 0 0 0 0x10 c0
[[]] // 0x80
*/
// |aPos| should point to the type indicator.
// The returned length doesn't include the type indicator
// or the terminator.
static size_t LengthOfEncodedBinary(const unsigned char* aPos,
const unsigned char* aEnd) {
MOZ_ASSERT(*aPos % Key::eMaxType == Key::eBinary, "Don't call me!");
auto iter = ++aPos;
for (; iter < aEnd && *iter != Key::eTerminator; ++iter) {
if (*iter & 0x80) {
iter++;
}
}
return iter - aPos;
}
nsresult
Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const
{
@@ -129,11 +145,16 @@ Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const
bool canShareBuffers = true;
while (it < end) {
auto type = *it % eMaxType;
if (type == eTerminator || type == eArray) {
if (type == eTerminator) {
it++;
} else if (type == eFloat || type == eDate) {
it++;
it += std::min(sizeof(uint64_t), size_t(end - it));
} else if (type == eBinary) {
// skip all binary data
auto binaryLength = LengthOfEncodedBinary(it, end);
it++;
it += binaryLength;
} else {
// We have a string!
canShareBuffers = false;
@@ -155,9 +176,7 @@ Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const
return NS_ERROR_OUT_OF_MEMORY;
}
while (start < it) {
*(buffer++) = *(start++);
}
std::copy(start, it, buffer);
}
// Now continue decoding
@@ -166,24 +185,38 @@ Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const
uint32_t oldLen = aTarget.mBuffer.Length();
auto type = *it % eMaxType;
if (type == eTerminator || type == eArray) {
// Copy array TypeID and terminator from raw key
if (!aTarget.mBuffer.GetMutableData(&buffer, oldLen + 1)) {
return NS_ERROR_OUT_OF_MEMORY;
}
*(buffer + oldLen) = *(it++);
} else if (type == eFloat || type == eDate) {
// Copy number from raw key
if (!aTarget.mBuffer.GetMutableData(&buffer,
oldLen + 1 + sizeof(uint64_t))) {
return NS_ERROR_OUT_OF_MEMORY;
// Note: Do not modify |it| before calling |updateBufferAndIter|;
// |byteCount| doesn't include the type indicator
auto updateBufferAndIter = [&](size_t byteCount) -> bool {
if (!aTarget.mBuffer.GetMutableData(&buffer, oldLen + 1 + byteCount)) {
return false;
}
buffer += oldLen;
*(buffer++) = *(it++);
const size_t byteCount = std::min(sizeof(uint64_t), size_t(end - it));
for (size_t count = 0; count < byteCount; count++) {
*(buffer++) = (*it++);
// should also copy the type indicator at the begining
std::copy_n(it, byteCount + 1, buffer);
it += (byteCount + 1);
return true;
};
if (type == eTerminator) {
// Copy array TypeID and terminator from raw key
if (!updateBufferAndIter(0)) {
return NS_ERROR_OUT_OF_MEMORY;
}
} else if (type == eFloat || type == eDate) {
// Copy number from raw key
const size_t byteCount = std::min(sizeof(uint64_t), size_t(end - it - 1));
if (!updateBufferAndIter(byteCount)) {
return NS_ERROR_OUT_OF_MEMORY;
}
} else if (type == eBinary) {
// skip all binary data
auto binaryLength = LengthOfEncodedBinary(it, end);
if (!updateBufferAndIter(binaryLength)) {
return NS_ERROR_OUT_OF_MEMORY;
}
} else {
// Decode string and reencode
+11 -51
View File
@@ -371,9 +371,6 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
case TrackType::kVideoTrack: {
// Decoders use the layers backend to decide if they can use hardware decoding,
// so specify LAYERS_NONE if we want to forcibly disable it.
using Option = CreateDecoderParams::Option;
using OptionSet = CreateDecoderParams::OptionSet;
data.mDecoder = mOwner->mPlatform->CreateDecoder({
ownerData.mInfo
? *ownerData.mInfo->GetAsVideoInfo()
@@ -386,10 +383,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
mOwner->mCrashHelper,
#endif
ownerData.mIsBlankDecode,
&result,
OptionSet(ownerData.mHardwareDecodingDisabled
? Option::HardwareDecoderNotAllowed
: Option::Default)
&result
});
break;
}
@@ -927,8 +921,6 @@ MediaFormatReader::NotifyNewOutput(TrackType aTrack, MediaData* aSample)
decoder.mOutput.AppendElement(aSample);
decoder.mNumSamplesOutput++;
decoder.mNumOfConsecutiveError = 0;
// We have decoded our first frame, we can now start to skip future errors.
decoder.mFirstFrameTime.reset();
ScheduleUpdate(aTrack);
}
@@ -1423,7 +1415,7 @@ MediaFormatReader::Update(TrackType aTrack)
RefPtr<MediaData> output = decoder.mOutput[0];
decoder.mOutput.RemoveElementAt(0);
decoder.mSizeOfQueue -= 1;
decoder.mLastDecodedSampleTime =
decoder.mLastSampleTime =
Some(TimeInterval(TimeUnit::FromMicroseconds(output->mTime),
TimeUnit::FromMicroseconds(output->GetEndTime())));
decoder.mNumSamplesOutputTotal++;
@@ -1471,14 +1463,14 @@ MediaFormatReader::Update(TrackType aTrack)
LOG("Rejecting %s promise: EOS", TrackTypeToStr(aTrack));
decoder.RejectPromise(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
} else if (decoder.mWaitingForData) {
if (wasDraining && decoder.mLastDecodedSampleTime &&
if (wasDraining && decoder.mLastSampleTime &&
!decoder.mNextStreamSourceID) {
// We have completed draining the decoder following WaitingForData.
// Set up the internal seek machinery to be able to resume from the
// last sample decoded.
LOG("Seeking to last sample time: %lld",
decoder.mLastDecodedSampleTime.ref().mStart.ToMicroseconds());
InternalSeek(aTrack, InternalSeekTarget(decoder.mLastDecodedSampleTime.ref(), true));
decoder.mLastSampleTime.ref().mStart.ToMicroseconds());
InternalSeek(aTrack, InternalSeekTarget(decoder.mLastSampleTime.ref(), true));
}
if (!decoder.mReceivedNewData) {
LOG("Rejecting %s promise: WAITING_FOR_DATA", TrackTypeToStr(aTrack));
@@ -1514,52 +1506,24 @@ MediaFormatReader::Update(TrackType aTrack)
if (decoder.mError && !decoder.HasFatalError()) {
decoder.mDecodePending = false;
MOZ_RELEASE_ASSERT(!decoder.HasInternalSeekPending(),
"No error can occur while an internal seek is pending");
nsCString error;
bool firstFrameDecodingFailedWithHardware =
decoder.mFirstFrameTime &&
decoder.mError.ref() == NS_ERROR_DOM_MEDIA_DECODE_ERR &&
decoder.mDecoder && decoder.mDecoder->IsHardwareAccelerated(error) &&
!decoder.mHardwareDecodingDisabled;
bool needsNewDecoder =
decoder.mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER ||
firstFrameDecodingFailedWithHardware;
bool needsNewDecoder = decoder.mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER;
if (!needsNewDecoder && ++decoder.mNumOfConsecutiveError > decoder.mMaxConsecutiveError) {
NotifyError(aTrack, decoder.mError.ref());
return;
}
if (firstFrameDecodingFailedWithHardware) {
decoder.mHardwareDecodingDisabled = true;
}
decoder.mError.reset();
LOG("%s decoded error count %d", TrackTypeToStr(aTrack),
decoder.mNumOfConsecutiveError);
if (needsNewDecoder) {
LOG("Error: Need new decoder");
decoder.ShutdownDecoder();
}
if (decoder.mFirstFrameTime) {
TimeInterval seekInterval = TimeInterval(decoder.mFirstFrameTime.ref(),
decoder.mFirstFrameTime.ref());
InternalSeek(aTrack, InternalSeekTarget(seekInterval, false));
return;
}
media::TimeUnit nextKeyframe;
if (aTrack == TrackType::kVideoTrack && !decoder.HasInternalSeekPending() &&
NS_SUCCEEDED(decoder.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe)) &&
!nextKeyframe.IsInfinite()) {
SkipVideoDemuxToNextKeyFrame(decoder.mLastDecodedSampleTime.refOr(TimeInterval()).Length());
NS_SUCCEEDED(decoder.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe))) {
if (needsNewDecoder) {
decoder.ShutdownDecoder();
}
SkipVideoDemuxToNextKeyFrame(decoder.mLastSampleTime.refOr(TimeInterval()).Length());
return;
} else if (aTrack == TrackType::kAudioTrack) {
decoder.Flush();
} else {
// We can't recover from this error.
NotifyError(aTrack, NS_ERROR_DOM_MEDIA_FATAL_ERR);
}
}
@@ -1700,7 +1664,6 @@ MediaFormatReader::ResetDecode(TrackSet aTracks)
if (HasVideo() && aTracks.contains(TrackInfo::kVideoTrack)) {
mVideo.ResetDemuxer();
mVideo.mFirstFrameTime = Some(media::TimeUnit());
Reset(TrackInfo::kVideoTrack);
if (mVideo.HasPromise()) {
mVideo.RejectPromise(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
@@ -1709,7 +1672,6 @@ MediaFormatReader::ResetDecode(TrackSet aTracks)
if (HasAudio() && aTracks.contains(TrackInfo::kAudioTrack)) {
mAudio.ResetDemuxer();
mVideo.mFirstFrameTime = Some(media::TimeUnit());
Reset(TrackInfo::kAudioTrack);
if (mAudio.HasPromise()) {
mAudio.RejectPromise(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
@@ -2068,7 +2030,6 @@ MediaFormatReader::OnVideoSeekCompleted(media::TimeUnit aTime)
LOGV("Video seeked to %lld", aTime.ToMicroseconds());
mVideo.mSeekRequest.Complete();
mVideo.mFirstFrameTime = Some(aTime);
mPreviousDecodedKeyframeTime_us = sNoPreviousDecodedKeyframe;
SetVideoDecodeThreshold();
@@ -2150,7 +2111,6 @@ MediaFormatReader::OnAudioSeekCompleted(media::TimeUnit aTime)
MOZ_ASSERT(OnTaskQueue());
LOGV("Audio seeked to %lld", aTime.ToMicroseconds());
mAudio.mSeekRequest.Complete();
mAudio.mFirstFrameTime = Some(aTime);
mPendingSeekTime.reset();
mSeekPromise.Resolve(aTime, __func__);
}
+3 -11
View File
@@ -235,7 +235,6 @@ private:
, mDrainComplete(false)
, mNumOfConsecutiveError(0)
, mMaxConsecutiveError(aNumOfMaxError)
, mFirstFrameTime(Some(media::TimeUnit()))
, mNumSamplesInput(0)
, mNumSamplesOutput(0)
, mNumSamplesOutputTotal(0)
@@ -244,7 +243,6 @@ private:
, mIsHardwareAccelerated(false)
, mLastStreamSourceID(UINT32_MAX)
, mIsBlankDecode(false)
, mHardwareDecodingDisabled(false)
{}
MediaFormatReader* mOwner;
@@ -318,11 +316,6 @@ private:
uint32_t mNumOfConsecutiveError;
uint32_t mMaxConsecutiveError;
// Set when we haven't yet decoded the first frame.
// Cleared once the first frame has been decoded.
// This is used to determine, upon error, if we should try again to decode
// the frame, or skip to the next keyframe.
Maybe<media::TimeUnit> mFirstFrameTime;
Maybe<MediaResult> mError;
bool HasFatalError() const
@@ -348,8 +341,8 @@ private:
// Used for internal seeking when a change of stream is detected or when
// encountering data discontinuity.
Maybe<InternalSeekTarget> mTimeThreshold;
// Time of last decoded sample returned.
Maybe<media::TimeInterval> mLastDecodedSampleTime;
// Time of last sample returned.
Maybe<media::TimeInterval> mLastSampleTime;
// Decoded samples returned my mDecoder awaiting being returned to
// state machine upon request.
@@ -412,7 +405,7 @@ private:
mDraining = false;
mDrainComplete = false;
mTimeThreshold.reset();
mLastDecodedSampleTime.reset();
mLastSampleTime.reset();
mOutput.Clear();
mNumSamplesInput = 0;
mNumSamplesOutput = 0;
@@ -444,7 +437,6 @@ private:
Maybe<media::TimeUnit> mFirstDemuxedSampleTime;
// Use BlankDecoderModule or not.
bool mIsBlankDecode;
bool mHardwareDecodingDisabled;
};
-1
View File
@@ -7,7 +7,6 @@
#define GMP_DEVICE_BINDING_h_
#include <string>
#include <cstdint>
namespace mozilla {
namespace gmp {
@@ -963,7 +963,7 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
// 1. Update the duration attribute if it currently equals NaN.
// Those steps are performed by the MediaSourceDecoder::SetInitialDuration
AbstractThread::MainThread()->Dispatch(NewRunnableMethod<int64_t>
(mParentDecoder,
(mParentDecoder.get(),
&MediaSourceDecoder::SetInitialDuration,
duration ? duration : -1));
@@ -10,7 +10,6 @@
#include "ImageContainer.h"
#include "MediaDecoderReader.h"
#include "MediaInfo.h"
#include "mozilla/EnumSet.h"
#include "mozilla/MozPromise.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/KnowsCompositor.h"
@@ -48,13 +47,6 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
: mConfig(aConfig)
{}
enum class Option
{
Default,
HardwareDecoderNotAllowed,
};
using OptionSet = EnumSet<Option>;
template <typename T1, typename... Ts>
CreateDecoderParams(const TrackInfo& aConfig, T1&& a1, Ts&&... args)
: mConfig(aConfig)
@@ -93,7 +85,6 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
RefPtr<GMPCrashHelper> mCrashHelper;
#endif
bool mUseBlankDecoder = false;
OptionSet mOptions = OptionSet(Option::Default);
private:
void Set(TaskQueue* aTaskQueue) { mTaskQueue = aTaskQueue; }
@@ -105,7 +96,6 @@ private:
void Set(GMPCrashHelper* aCrashHelper) { mCrashHelper = aCrashHelper; }
#endif
void Set(bool aUseBlankDecoder) { mUseBlankDecoder = aUseBlankDecoder; }
void Set(OptionSet aOptions) { mOptions = aOptions; }
void Set(layers::KnowsCompositor* aKnowsCompositor) { mKnowsCompositor = aKnowsCompositor; }
template <typename T1, typename T2, typename... Ts>
void Set(T1&& a1, T2&& a2, Ts&&... args)
@@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "VPXDecoder.h"
#include "mp4_demuxer/BitReader.h"
#include "gfx2DGlue.h"
#include "nsError.h"
#include "TimeUnits.h"
@@ -384,32 +383,5 @@ VPXDecoder::GetFrameSize(Span<const uint8_t> aBuffer, Codec aCodec)
return nsIntSize(si.w, si.h);
}
/* static */
int
VPXDecoder::GetVP9Profile(Span<const uint8_t> aBuffer)
{
if (aBuffer.Length() < 2) {
// Can't be good.
return -1;
}
mp4_demuxer::BitReader br(aBuffer.Elements(), aBuffer.Length() * 8);
uint32_t frameMarker = br.ReadBits(2); // frame_marker
if (frameMarker != 2) {
// That's not a valid vp9 header.
return -1;
}
uint32_t profile = br.ReadBits(1); // profile_low_bit
profile |= br.ReadBits(1) << 1; // profile_high_bit
if (profile == 3) {
profile += br.ReadBits(1); // reserved_zero
if (profile > 3) {
// reserved_zero wasn't zero.
return -1;
}
}
return profile;
}
} // namespace mozilla
#undef LOG
@@ -53,10 +53,6 @@ public:
// Return the frame dimensions for a sample for the specified codec.
static nsIntSize GetFrameSize(Span<const uint8_t> aBuffer, Codec aCodec);
// Return the VP9 profile as per https://www.webmproject.org/vp9/profiles/
// Return negative value if error.
static int GetVP9Profile(Span<const uint8_t> aBuffer);
private:
void ProcessDecode(MediaRawData* aSample);
MediaResult DoDecode(MediaRawData* aSample);
@@ -40,7 +40,11 @@ AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig,
, mMaxRefFrames(mp4_demuxer::H264::ComputeMaxRefFrames(aConfig.mExtraData))
, mImageContainer(aImageContainer)
, mIsShutDown(false)
#ifdef MOZ_WIDGET_UIKIT
, mUseSoftwareImages(true)
#else
, mUseSoftwareImages(false)
#endif
, mIsFlushing(false)
, mMonitor("AppleVideoDecoder")
, mFormat(nullptr)
@@ -352,6 +356,7 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage,
// Unlock the returned image data.
CVPixelBufferUnlockBaseAddress(aImage, kCVPixelBufferLock_ReadOnly);
} else {
#ifndef MOZ_WIDGET_UIKIT
IOSurfacePtr surface = MacIOSurfaceLib::CVPixelBufferGetIOSurface(aImage);
MOZ_ASSERT(surface, "Decoder didn't return an IOSurface backed buffer");
@@ -368,6 +373,9 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage,
aFrameRef.is_sync_point,
aFrameRef.decode_timestamp.ToMicroseconds(),
visible);
#else
MOZ_ASSERT_UNREACHABLE("No MacIOSurface on iOS");
#endif
}
if (!data) {
+5 -6
View File
@@ -91,12 +91,11 @@ WMFDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
return nullptr;
}
nsAutoPtr<WMFVideoMFTManager> manager(new WMFVideoMFTManager(
aParams.VideoConfig(),
aParams.mKnowsCompositor,
aParams.mImageContainer,
sDXVAEnabled && !aParams.mOptions.contains(
CreateDecoderParams::Option::HardwareDecoderNotAllowed)));
nsAutoPtr<WMFVideoMFTManager> manager(
new WMFVideoMFTManager(aParams.VideoConfig(),
aParams.mKnowsCompositor,
aParams.mImageContainer,
sDXVAEnabled));
if (!manager->Init()) {
return nullptr;
+1 -16
View File
@@ -576,16 +576,6 @@ WMFVideoMFTManager::Input(MediaRawData* aSample)
return E_FAIL;
}
if (mStreamType == VP9 && aSample->mKeyframe) {
// Check the VP9 profile. the VP9 MFT can only handle correctly profile 0
// and 2 (yuv420 8/10/12 bits)
int profile =
VPXDecoder::GetVP9Profile(MakeSpan(aSample->Data(), aSample->Size()));
if (profile != 0 && profile != 2) {
return E_FAIL;
}
}
HRESULT hr = mDecoder->CreateInputSample(aSample->Data(),
uint32_t(aSample->Size()),
aSample->mTime,
@@ -1000,12 +990,7 @@ WMFVideoMFTManager::Output(int64_t aStreamOffset,
aOutData = frame;
// Set the potentially corrected pts and duration.
aOutData->mTime = pts.ToMicroseconds();
// The VP9 decoder doesn't provide a valid duration. AS VP9 doesn't have a
// concept of pts vs dts and have no latency. We can as such use the last
// known input duration.
aOutData->mDuration = (mStreamType == VP9 && duration == media::TimeUnit())
? mLastDuration
: duration.ToMicroseconds();
aOutData->mDuration = duration.ToMicroseconds();
if (mNullOutputCount) {
mGotValidOutputAfterNullOutput = true;
-39
View File
@@ -100,45 +100,6 @@ public:
uint32_t mChunksToProcess = 0;
};
/* static */ already_AddRefed<AnalyserNode>
AnalyserNode::Create(AudioContext& aAudioContext,
const AnalyserOptions& aOptions,
ErrorResult& aRv)
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
RefPtr<AnalyserNode> analyserNode = new AnalyserNode(&aAudioContext);
analyserNode->Initialize(aOptions, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
analyserNode->SetFftSize(aOptions.mFftSize, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
analyserNode->SetMinDecibels(aOptions.mMinDecibels, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
analyserNode->SetMaxDecibels(aOptions.mMaxDecibels, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
analyserNode->SetSmoothingTimeConstant(aOptions.mSmoothingTimeConstant, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
return analyserNode.forget();
}
AnalyserNode::AnalyserNode(AudioContext* aContext)
: AudioNode(aContext,
1,
+4 -15
View File
@@ -14,26 +14,16 @@ namespace mozilla {
namespace dom {
class AudioContext;
struct AnalyserOptions;
class AnalyserNode final : public AudioNode
{
public:
static already_AddRefed<AnalyserNode>
Create(AudioContext& aAudioContext, const AnalyserOptions& aOptions,
ErrorResult& aRv);
explicit AnalyserNode(AudioContext* aContext);
NS_DECL_ISUPPORTS_INHERITED
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<AnalyserNode>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const AnalyserOptions& aOptions, ErrorResult& aRv)
{
return Create(aAudioContext, aOptions, aRv);
}
void GetFloatFrequencyData(const Float32Array& aArray);
void GetByteFrequencyData(const Uint8Array& aArray);
void GetFloatTimeDomainData(const Float32Array& aArray);
@@ -71,9 +61,10 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
private:
~AnalyserNode() = default;
protected:
~AnalyserNode() {}
private:
friend class AnalyserNodeEngine;
void AppendChunk(const AudioChunk& aChunk);
bool AllocateBuffer();
@@ -82,8 +73,6 @@ private:
void GetTimeDomainData(float* aData, size_t aLength);
private:
explicit AnalyserNode(AudioContext* aContext);
FFTBlock mAnalysisBlock;
nsTArray<AudioChunk> mChunks;
double mMinDecibels;
-18
View File
@@ -178,24 +178,6 @@ AudioBuffer::~AudioBuffer()
mozilla::DropJSObjects(this);
}
/* static */ already_AddRefed<AudioBuffer>
AudioBuffer::Constructor(const GlobalObject& aGlobal,
AudioContext& aAudioContext,
const AudioBufferOptions& aOptions,
ErrorResult& aRv)
{
if (!aOptions.mNumberOfChannels) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
float sampleRate = aOptions.mSampleRate.WasPassed()
? aOptions.mSampleRate.Value()
: aAudioContext.SampleRate();
return Create(&aAudioContext, aOptions.mNumberOfChannels, aOptions.mLength,
sampleRate, aRv);
}
void
AudioBuffer::ClearJSChannels()
{
+1 -5
View File
@@ -24,7 +24,6 @@ class ThreadSharedFloatArrayBufferList;
namespace dom {
struct AudioBufferOptions;
class AudioContext;
/**
@@ -57,10 +56,6 @@ public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AudioBuffer)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioBuffer)
static already_AddRefed<AudioBuffer>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const AudioBufferOptions& aOptions, ErrorResult& aRv);
nsPIDOMWindowInner* GetParentObject() const
{
nsCOMPtr<nsPIDOMWindowInner> parentObject = do_QueryReferent(mOwnerWindow);
@@ -139,3 +134,4 @@ protected:
} // namespace mozilla
#endif
+2 -22
View File
@@ -607,30 +607,10 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
mStream->AddMainThreadListener(this);
}
/* static */ already_AddRefed<AudioBufferSourceNode>
AudioBufferSourceNode::Create(JSContext* aCx, AudioContext& aAudioContext,
const AudioBufferSourceOptions& aOptions,
ErrorResult& aRv)
AudioBufferSourceNode::~AudioBufferSourceNode()
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
RefPtr<AudioBufferSourceNode> audioNode = new AudioBufferSourceNode(&aAudioContext);
if (aOptions.mBuffer.WasPassed()) {
MOZ_ASSERT(aCx);
audioNode->SetBuffer(aCx, aOptions.mBuffer.Value());
}
audioNode->Detune()->SetValue(aOptions.mDetune);
audioNode->SetLoop(aOptions.mLoop);
audioNode->SetLoopEnd(aOptions.mLoopEnd);
audioNode->SetLoopStart(aOptions.mLoopStart);
audioNode->PlaybackRate()->SetValue(aOptions.mPlaybackRate);
return audioNode.forget();
}
void
AudioBufferSourceNode::DestroyMediaStream()
{
+8 -16
View File
@@ -12,16 +12,13 @@
namespace mozilla {
namespace dom {
struct AudioBufferSourceOptions;
class AudioParam;
class AudioBufferSourceNode final : public AudioNode
, public MainThreadMediaStreamListener
class AudioBufferSourceNode final : public AudioNode,
public MainThreadMediaStreamListener
{
public:
static already_AddRefed<AudioBufferSourceNode>
Create(JSContext* aCx, AudioContext& aAudioContext,
const AudioBufferSourceOptions& aOptions, ErrorResult& aRv);
explicit AudioBufferSourceNode(AudioContext* aContext);
void DestroyMediaStream() override;
@@ -36,13 +33,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioBufferSourceNode, AudioNode)
static already_AddRefed<AudioBufferSourceNode>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const AudioBufferSourceOptions& aOptions, ErrorResult& aRv)
{
return Create(aGlobal.Context(), aAudioContext, aOptions, aRv);
}
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void Start(double aWhen, double aOffset,
@@ -108,10 +98,10 @@ public:
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
private:
explicit AudioBufferSourceNode(AudioContext* aContext);
~AudioBufferSourceNode() = default;
protected:
virtual ~AudioBufferSourceNode();
private:
friend class AudioBufferSourceNodeEngine;
// START is sent during Start().
// STOP is sent during Stop().
@@ -139,6 +129,7 @@ private:
void SendBufferParameterToStream(JSContext* aCx);
void SendOffsetAndDurationParametersToStream(AudioNodeStream* aStream);
private:
double mLoopStart;
double mLoopEnd;
double mOffset;
@@ -154,3 +145,4 @@ private:
} // namespace mozilla
#endif
+166 -49
View File
@@ -11,26 +11,10 @@
#include "mozilla/OwningNonNull.h"
#include "mozilla/dom/AnalyserNode.h"
#include "mozilla/dom/AnalyserNodeBinding.h"
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
#include "mozilla/dom/AudioContextBinding.h"
#include "mozilla/dom/BiquadFilterNodeBinding.h"
#include "mozilla/dom/ChannelMergerNodeBinding.h"
#include "mozilla/dom/ChannelSplitterNodeBinding.h"
#include "mozilla/dom/ConvolverNodeBinding.h"
#include "mozilla/dom/DelayNodeBinding.h"
#include "mozilla/dom/DynamicsCompressorNodeBinding.h"
#include "mozilla/dom/GainNodeBinding.h"
#include "mozilla/dom/IIRFilterNodeBinding.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/MediaElementAudioSourceNodeBinding.h"
#include "mozilla/dom/MediaStreamAudioSourceNodeBinding.h"
#include "mozilla/dom/OfflineAudioContextBinding.h"
#include "mozilla/dom/OscillatorNodeBinding.h"
#include "mozilla/dom/PannerNodeBinding.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/StereoPannerNodeBinding.h"
#include "mozilla/dom/WaveShaperNodeBinding.h"
#include "AudioBuffer.h"
#include "AudioBufferSourceNode.h"
@@ -261,9 +245,13 @@ bool AudioContext::CheckClosed(ErrorResult& aRv)
already_AddRefed<AudioBufferSourceNode>
AudioContext::CreateBufferSource(ErrorResult& aRv)
{
return AudioBufferSourceNode::Create(nullptr, *this,
AudioBufferSourceOptions(),
aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<AudioBufferSourceNode> bufferNode =
new AudioBufferSourceNode(this);
return bufferNode.forget();
}
already_AddRefed<ConstantSourceNode>
@@ -315,8 +303,18 @@ bool IsValidBufferSize(uint32_t aBufferSize) {
already_AddRefed<MediaStreamAudioDestinationNode>
AudioContext::CreateMediaStreamDestination(ErrorResult& aRv)
{
return MediaStreamAudioDestinationNode::Create(*this, AudioNodeOptions(),
aRv);
if (mIsOffline) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<MediaStreamAudioDestinationNode> node =
new MediaStreamAudioDestinationNode(this);
return node.forget();
}
already_AddRefed<ScriptProcessorNode>
@@ -346,93 +344,181 @@ AudioContext::CreateScriptProcessor(uint32_t aBufferSize,
already_AddRefed<AnalyserNode>
AudioContext::CreateAnalyser(ErrorResult& aRv)
{
return AnalyserNode::Create(*this, AnalyserOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<AnalyserNode> analyserNode = new AnalyserNode(this);
return analyserNode.forget();
}
already_AddRefed<StereoPannerNode>
AudioContext::CreateStereoPanner(ErrorResult& aRv)
{
return StereoPannerNode::Create(*this, StereoPannerOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<StereoPannerNode> stereoPannerNode = new StereoPannerNode(this);
return stereoPannerNode.forget();
}
already_AddRefed<MediaElementAudioSourceNode>
AudioContext::CreateMediaElementSource(HTMLMediaElement& aMediaElement,
ErrorResult& aRv)
{
MediaElementAudioSourceOptions options;
options.mMediaElement = aMediaElement;
if (mIsOffline) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
return MediaElementAudioSourceNode::Create(*this, options, aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<DOMMediaStream> stream =
aMediaElement.CaptureAudio(aRv, mDestination->Stream()->Graph());
if (aRv.Failed()) {
return nullptr;
}
return MediaElementAudioSourceNode::Create(this, stream, aRv);
}
already_AddRefed<MediaStreamAudioSourceNode>
AudioContext::CreateMediaStreamSource(DOMMediaStream& aMediaStream,
ErrorResult& aRv)
{
MediaStreamAudioSourceOptions options;
options.mMediaStream = aMediaStream;
if (mIsOffline) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
return MediaStreamAudioSourceNode::Create(*this, options, aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
return MediaStreamAudioSourceNode::Create(this, &aMediaStream, aRv);
}
already_AddRefed<GainNode>
AudioContext::CreateGain(ErrorResult& aRv)
{
return GainNode::Create(*this, GainOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<GainNode> gainNode = new GainNode(this);
return gainNode.forget();
}
already_AddRefed<WaveShaperNode>
AudioContext::CreateWaveShaper(ErrorResult& aRv)
{
return WaveShaperNode::Create(*this, WaveShaperOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<WaveShaperNode> waveShaperNode = new WaveShaperNode(this);
return waveShaperNode.forget();
}
already_AddRefed<DelayNode>
AudioContext::CreateDelay(double aMaxDelayTime, ErrorResult& aRv)
{
DelayOptions options;
options.mMaxDelayTime = aMaxDelayTime;
return DelayNode::Create(*this, options, aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
if (aMaxDelayTime > 0. && aMaxDelayTime < 180.) {
RefPtr<DelayNode> delayNode = new DelayNode(this, aMaxDelayTime);
return delayNode.forget();
}
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
already_AddRefed<PannerNode>
AudioContext::CreatePanner(ErrorResult& aRv)
{
return PannerNode::Create(*this, PannerOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<PannerNode> pannerNode = new PannerNode(this);
mPannerNodes.PutEntry(pannerNode);
return pannerNode.forget();
}
already_AddRefed<ConvolverNode>
AudioContext::CreateConvolver(ErrorResult& aRv)
{
return ConvolverNode::Create(nullptr, *this, ConvolverOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<ConvolverNode> convolverNode = new ConvolverNode(this);
return convolverNode.forget();
}
already_AddRefed<ChannelSplitterNode>
AudioContext::CreateChannelSplitter(uint32_t aNumberOfOutputs, ErrorResult& aRv)
{
ChannelSplitterOptions options;
options.mNumberOfOutputs = aNumberOfOutputs;
return ChannelSplitterNode::Create(*this, options, aRv);
if (aNumberOfOutputs == 0 ||
aNumberOfOutputs > WebAudioUtils::MaxChannelCount) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<ChannelSplitterNode> splitterNode =
new ChannelSplitterNode(this, aNumberOfOutputs);
return splitterNode.forget();
}
already_AddRefed<ChannelMergerNode>
AudioContext::CreateChannelMerger(uint32_t aNumberOfInputs, ErrorResult& aRv)
{
ChannelMergerOptions options;
options.mNumberOfInputs = aNumberOfInputs;
return ChannelMergerNode::Create(*this, options, aRv);
if (aNumberOfInputs == 0 ||
aNumberOfInputs > WebAudioUtils::MaxChannelCount) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<ChannelMergerNode> mergerNode =
new ChannelMergerNode(this, aNumberOfInputs);
return mergerNode.forget();
}
already_AddRefed<DynamicsCompressorNode>
AudioContext::CreateDynamicsCompressor(ErrorResult& aRv)
{
return DynamicsCompressorNode::Create(*this, DynamicsCompressorOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<DynamicsCompressorNode> compressorNode =
new DynamicsCompressorNode(this);
return compressorNode.forget();
}
already_AddRefed<BiquadFilterNode>
AudioContext::CreateBiquadFilter(ErrorResult& aRv)
{
return BiquadFilterNode::Create(*this, BiquadFilterOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<BiquadFilterNode> filterNode =
new BiquadFilterNode(this);
return filterNode.forget();
}
already_AddRefed<IIRFilterNode>
@@ -440,16 +526,47 @@ AudioContext::CreateIIRFilter(const mozilla::dom::binding_detail::AutoSequence<d
const mozilla::dom::binding_detail::AutoSequence<double>& aFeedback,
mozilla::ErrorResult& aRv)
{
IIRFilterOptions options;
options.mFeedforward = aFeedforward;
options.mFeedback = aFeedback;
return IIRFilterNode::Create(*this, options, aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
if (aFeedforward.Length() == 0 || aFeedforward.Length() > 20) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
if (aFeedback.Length() == 0 || aFeedback.Length() > 20) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
bool feedforwardAllZeros = true;
for (size_t i = 0; i < aFeedforward.Length(); ++i) {
if (aFeedforward.Elements()[i] != 0.0) {
feedforwardAllZeros = false;
}
}
if (feedforwardAllZeros || aFeedback.Elements()[0] == 0.0) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
RefPtr<IIRFilterNode> filterNode =
new IIRFilterNode(this, aFeedforward, aFeedback);
return filterNode.forget();
}
already_AddRefed<OscillatorNode>
AudioContext::CreateOscillator(ErrorResult& aRv)
{
return OscillatorNode::Create(*this, OscillatorOptions(), aRv);
if (CheckClosed(aRv)) {
return nullptr;
}
RefPtr<OscillatorNode> oscillatorNode =
new OscillatorNode(this);
return oscillatorNode.forget();
}
already_AddRefed<PeriodicWave>
+2 -2
View File
@@ -316,8 +316,6 @@ public:
IMPL_EVENT_HANDLER(mozinterruptbegin)
IMPL_EVENT_HANDLER(mozinterruptend)
bool CheckClosed(ErrorResult& aRv);
private:
void DisconnectFromWindow();
void RemoveFromDecodeQueue(WebAudioDecodeJob* aDecodeJob);
@@ -328,6 +326,8 @@ private:
friend struct ::mozilla::WebAudioDecodeJob;
bool CheckClosed(ErrorResult& aRv);
nsTArray<MediaStream*> GetAllStreams() const;
private:
-22
View File
@@ -71,28 +71,6 @@ AudioNode::~AudioNode()
}
}
void
AudioNode::Initialize(const AudioNodeOptions& aOptions, ErrorResult& aRv)
{
if (aOptions.mChannelCount.WasPassed()) {
SetChannelCount(aOptions.mChannelCount.Value(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
}
if (aOptions.mChannelCountMode.WasPassed()) {
SetChannelCountModeValue(aOptions.mChannelCountMode.Value(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
}
if (aOptions.mChannelInterpretation.WasPassed()) {
SetChannelInterpretationValue(aOptions.mChannelInterpretation.Value());
}
}
size_t
AudioNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
-3
View File
@@ -250,9 +250,6 @@ private:
bool DisconnectFromOutputIfConnected(uint32_t aOutputIndex, uint32_t aInputIndex);
protected:
// Helper for the Constructors for nodes.
void Initialize(const AudioNodeOptions& aOptions, ErrorResult& aRv);
// Helpers for sending different value types to streams
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
void SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue);
+1 -22
View File
@@ -262,29 +262,8 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
aContext->Graph());
}
/* static */ already_AddRefed<BiquadFilterNode>
BiquadFilterNode::Create(AudioContext& aAudioContext,
const BiquadFilterOptions& aOptions,
ErrorResult& aRv)
BiquadFilterNode::~BiquadFilterNode()
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
RefPtr<BiquadFilterNode> audioNode = new BiquadFilterNode(&aAudioContext);
audioNode->Initialize(aOptions, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
audioNode->SetType(aOptions.mType);
audioNode->Q()->SetValue(aOptions.mQ);
audioNode->Detune()->SetValue(aOptions.mDetune);
audioNode->Frequency()->SetValue(aOptions.mFrequency);
audioNode->Gain()->SetValue(aOptions.mGain);
return audioNode.forget();
}
size_t
+5 -14
View File
@@ -14,25 +14,15 @@ namespace mozilla {
namespace dom {
class AudioContext;
struct BiquadFilterOptions;
class BiquadFilterNode final : public AudioNode
{
public:
static already_AddRefed<BiquadFilterNode>
Create(AudioContext& aAudioContext, const BiquadFilterOptions& aOptions,
ErrorResult& aRv);
explicit BiquadFilterNode(AudioContext* aContext);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BiquadFilterNode, AudioNode)
static already_AddRefed<BiquadFilterNode>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const BiquadFilterOptions& aOptions, ErrorResult& aRv)
{
return Create(aAudioContext, aOptions, aRv);
}
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
BiquadFilterType Type() const
@@ -73,10 +63,10 @@ public:
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
private:
explicit BiquadFilterNode(AudioContext* aContext);
~BiquadFilterNode() = default;
protected:
virtual ~BiquadFilterNode();
private:
BiquadFilterType mType;
RefPtr<AudioParam> mFrequency;
RefPtr<AudioParam> mDetune;
@@ -88,3 +78,4 @@ private:
} // namespace mozilla
#endif
+2 -23
View File
@@ -74,30 +74,8 @@ ChannelMergerNode::ChannelMergerNode(AudioContext* aContext,
aContext->Graph());
}
/* static */ already_AddRefed<ChannelMergerNode>
ChannelMergerNode::Create(AudioContext& aAudioContext,
const ChannelMergerOptions& aOptions,
ErrorResult& aRv)
ChannelMergerNode::~ChannelMergerNode()
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
if (aOptions.mNumberOfInputs == 0 ||
aOptions.mNumberOfInputs > WebAudioUtils::MaxChannelCount) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
RefPtr<ChannelMergerNode> audioNode =
new ChannelMergerNode(&aAudioContext, aOptions.mNumberOfInputs);
audioNode->Initialize(aOptions, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
return audioNode.forget();
}
JSObject*
@@ -108,3 +86,4 @@ ChannelMergerNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
} // namespace dom
} // namespace mozilla
+6 -15
View File
@@ -12,24 +12,15 @@ namespace mozilla {
namespace dom {
class AudioContext;
struct ChannelMergerOptions;
class ChannelMergerNode final : public AudioNode
{
public:
static already_AddRefed<ChannelMergerNode>
Create(AudioContext& aAudioContext, const ChannelMergerOptions& aOptions,
ErrorResult& aRv);
ChannelMergerNode(AudioContext* aContext,
uint16_t aInputCount);
NS_DECL_ISUPPORTS_INHERITED
static already_AddRefed<ChannelMergerNode>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const ChannelMergerOptions& aOptions, ErrorResult& aRv)
{
return Create(aAudioContext, aOptions, aRv);
}
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
uint16_t NumberOfInputs() const override { return mInputCount; }
@@ -44,11 +35,10 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
private:
ChannelMergerNode(AudioContext* aContext,
uint16_t aInputCount);
~ChannelMergerNode() = default;
protected:
virtual ~ChannelMergerNode();
private:
const uint16_t mInputCount;
};
@@ -56,3 +46,4 @@ private:
} // namespace mozilla
#endif
+2 -23
View File
@@ -65,30 +65,8 @@ ChannelSplitterNode::ChannelSplitterNode(AudioContext* aContext,
aContext->Graph());
}
/* static */ already_AddRefed<ChannelSplitterNode>
ChannelSplitterNode::Create(AudioContext& aAudioContext,
const ChannelSplitterOptions& aOptions,
ErrorResult& aRv)
ChannelSplitterNode::~ChannelSplitterNode()
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
if (aOptions.mNumberOfOutputs == 0 ||
aOptions.mNumberOfOutputs > WebAudioUtils::MaxChannelCount) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return nullptr;
}
RefPtr<ChannelSplitterNode> audioNode =
new ChannelSplitterNode(&aAudioContext, aOptions.mNumberOfOutputs);
audioNode->Initialize(aOptions, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
return audioNode.forget();
}
JSObject*
@@ -99,3 +77,4 @@ ChannelSplitterNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProt
} // namespace dom
} // namespace mozilla
+6 -15
View File
@@ -12,24 +12,15 @@ namespace mozilla {
namespace dom {
class AudioContext;
struct ChannelSplitterOptions;
class ChannelSplitterNode final : public AudioNode
{
public:
static already_AddRefed<ChannelSplitterNode>
Create(AudioContext& aAudioContext, const ChannelSplitterOptions& aOptions,
ErrorResult& aRv);
ChannelSplitterNode(AudioContext* aContext,
uint16_t aOutputCount);
NS_DECL_ISUPPORTS_INHERITED
static already_AddRefed<ChannelSplitterNode>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const ChannelSplitterOptions& aOptions, ErrorResult& aRv)
{
return Create(aAudioContext, aOptions, aRv);
}
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
uint16_t NumberOfOutputs() const override { return mOutputCount; }
@@ -44,11 +35,10 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
private:
ChannelSplitterNode(AudioContext* aContext,
uint16_t aOutputCount);
~ChannelSplitterNode() = default;
protected:
virtual ~ChannelSplitterNode();
private:
const uint16_t mOutputCount;
};
@@ -56,3 +46,4 @@ private:
} // namespace mozilla
#endif
+2 -27
View File
@@ -203,34 +203,8 @@ ConvolverNode::ConvolverNode(AudioContext* aContext)
aContext->Graph());
}
/* static */ already_AddRefed<ConvolverNode>
ConvolverNode::Create(JSContext* aCx, AudioContext& aAudioContext,
const ConvolverOptions& aOptions,
ErrorResult& aRv)
ConvolverNode::~ConvolverNode()
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
RefPtr<ConvolverNode> audioNode = new ConvolverNode(&aAudioContext);
audioNode->Initialize(aOptions, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
// This must be done before setting the buffer.
audioNode->SetNormalize(!aOptions.mDisableNormalization);
if (aOptions.mBuffer.WasPassed()) {
MOZ_ASSERT(aCx);
audioNode->SetBuffer(aCx, aOptions.mBuffer.Value(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
}
return audioNode.forget();
}
size_t
@@ -317,3 +291,4 @@ ConvolverNode::SetNormalize(bool aNormalize)
} // namespace dom
} // namespace mozilla
+6 -17
View File
@@ -12,26 +12,14 @@
namespace mozilla {
namespace dom {
class AudioContext;
struct ConvolverOptions;
class ConvolverNode final : public AudioNode
{
public:
static already_AddRefed<ConvolverNode>
Create(JSContext* aCx, AudioContext& aAudioContext,
const ConvolverOptions& aOptions, ErrorResult& aRv);
explicit ConvolverNode(AudioContext* aContext);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ConvolverNode, AudioNode);
static already_AddRefed<ConvolverNode>
Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
const ConvolverOptions& aOptions, ErrorResult& aRv)
{
return Create(aGlobal.Context(), aAudioContext, aOptions, aRv);
}
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
AudioBuffer* GetBuffer(JSContext* aCx) const
@@ -39,7 +27,7 @@ public:
return mBuffer;
}
void SetBuffer(JSContext* aCx, AudioBuffer* aBuffer, ErrorResult& aRv);
void SetBuffer(JSContext* aCx, AudioBuffer* aBufferi, ErrorResult& aRv);
bool Normalize() const
{
@@ -73,10 +61,10 @@ public:
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
private:
explicit ConvolverNode(AudioContext* aContext);
~ConvolverNode() = default;
protected:
virtual ~ConvolverNode();
private:
RefPtr<AudioBuffer> mBuffer;
bool mNormalize;
};
@@ -86,3 +74,4 @@ private:
} //end namespace mozilla
#endif
+1 -23
View File
@@ -205,30 +205,8 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
aContext->Graph());
}
/* static */ already_AddRefed<DelayNode>
DelayNode::Create(AudioContext& aAudioContext,
const DelayOptions& aOptions,
ErrorResult& aRv)
DelayNode::~DelayNode()
{
if (aAudioContext.CheckClosed(aRv)) {
return nullptr;
}
if (aOptions.mMaxDelayTime <= 0. || aOptions.mMaxDelayTime >= 180.) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
RefPtr<DelayNode> audioNode = new DelayNode(&aAudioContext,
aOptions.mMaxDelayTime);
audioNode->Initialize(aOptions, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
audioNode->DelayTime()->SetValue(aOptions.mDelayTime);
return audioNode.forget();
}
size_t
Loaded 100 of 2737 files, more files were not shown because too many files have changed in this diff. Show more