Граф коммитов

87157 Коммитов

Автор SHA1 Сообщение Дата
Iain Ireland 63c2e34e0d Bug 1779849: Remove FlatStringReader r=mgaudet
Another change made to support early errors in V8.

Differential Revision: https://phabricator.services.mozilla.com/D152909
2022-08-03 18:06:51 +00:00
Iain Ireland dfffd501b8 Bug 1779849: Update RegExpFlags r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152908
2022-08-03 18:06:51 +00:00
Iain Ireland a0115ea461 Bug 1779849: Update RegExpStack code r=mgaudet
While refactoring this code, upstream V8 removed their own need to have `Isolate` as a friend class of `RegExpStack`. We need to be able to reach inside RegExpStack for a couple of reasons, so we use `ExternalReference`, which is still a friend class (to support ExternalReference::TopOfRegExpStack, which is used in V8's macroassembler code).

Since ExternalReference already exists, I'm also using it for the memory accounting code.

Differential Revision: https://phabricator.services.mozilla.com/D152907
2022-08-03 18:06:50 +00:00
Iain Ireland 21042cf261 Bug 1779849: Refactor InitializeNamedCaptures r=mgaudet
While adding support for syntax-parsing / early errors, V8 pushed the allocation of the named capture array one level outward, which lets us skip the creation of the FixedArray completely.

The awkward sorting requirement is also present in V8: compare https://github.com/v8/v8/blob/main/src/regexp/regexp.cc#L507-L508.

Differential Revision: https://phabricator.services.mozilla.com/D152906
2022-08-03 18:06:50 +00:00
Iain Ireland 3e3cb10c55 Bug 1779849: Implement CheckCharacterInRangeArray r=mgaudet
IsCharacterInRangeArray is translated from the version in `imported/regexp-macro-assembler.h`, with more comments and adjustments to make callWithABI work.

Differential Revision: https://phabricator.services.mozilla.com/D152905
2022-08-03 18:06:49 +00:00
Iain Ireland ab543ce05d Bug 1779849: Refactor ByteArray r=mgaudet
Preparing for the next patch

Depends on D152903

Differential Revision: https://phabricator.services.mozilla.com/D152904
2022-08-03 18:06:49 +00:00
Iain Ireland 40a48fbe69 Bug 1779849: Use enum class in CheckSpecialCharacterClass r=mgaudet
V8 added an enum class instead of using raw chars.

Drive-by: Mark CanReadUnaligned as const.

Depends on D152902

Differential Revision: https://phabricator.services.mozilla.com/D152903
2022-08-03 18:06:48 +00:00
Iain Ireland d92a549c40 Bug 1779849: Re-import irregexp r=mgaudet
This patch was generated by running import-irregexp.py.

Depends on D152901

Differential Revision: https://phabricator.services.mozilla.com/D152902
2022-08-03 18:06:47 +00:00
Iain Ireland 9fe3a2254b Bug 1779849: Update import-irregexp.py r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152901
2022-08-03 18:06:47 +00:00
Sandor Molnar 3b83d6b45f Backed out 5 changesets (bug 1782771) for causing assertion failures in js/src/builtin/String.cpp CLOSED TREE
Backed out changeset 52d2623e6704 (bug 1782771)
Backed out changeset 7dfac88ea495 (bug 1782771)
Backed out changeset 9b75089ec05e (bug 1782771)
Backed out changeset f1dd237d41ef (bug 1782771)
Backed out changeset 939921da7183 (bug 1782771)
2022-08-03 20:59:27 +03:00
André Bargull a00a0f2147 Bug 1782771 - Part 5: Fold min(x, min(x, y)) and max(x, max(x, y)). r=jandem
Improves `s.substring(1)` from:
```
10 constant 0x1
29 minmax constant10:Int32 stringlength27:Int32
30 minmax minmax29:Int32 stringlength27:Int32
31 minmax minmax29:Int32 stringlength27:Int32
32 sub minmax31:Int32 minmax30:Int32 [int32]
33 substr tostring26:String minmax30:Int32 sub32:Int32
```

to:
```
10 constant 0x1
29 minmax constant10:Int32 stringlength27:Int32
30 sub stringlength27:Int32 minmax29:Int32 [int32]
31 substr tostring26:String minmax29:Int32 sub30:Int32
```

Differential Revision: https://phabricator.services.mozilla.com/D153493
2022-08-03 17:12:07 +00:00
André Bargull 9376a362cd Bug 1782771 - Part 4: Avoid phi nodes in String.prototype.substr. r=jandem
Improves `s.substr(0, 3)` from:
```
10 constant 0x0
11 constant 0x3
32 minmax constant11:Int32 stringlength28:Int32
33 compare minmax32:Int32 constant10:Int32 Le
34 test compare33:Bool block10 block11
35 constant string 3df1f0729800
37 substr tostring27:String constant10:Int32 minmax32:Int32
39 phi constant35:String substr37:String
```

to:
```
10 constant 0x0
11 constant 0x3
32 minmax constant11:Int32 stringlength28:Int32
33 substr tostring27:String constant10:Int32 minmax32:Int32
```

Differential Revision: https://phabricator.services.mozilla.com/D153492
2022-08-03 17:12:07 +00:00
André Bargull 25b495c259 Bug 1782771 - Part 3: Use Math.min/max in String.prototype.substring. r=jandem
Improves `s.substring(0, 3)` from:
```
10 constant 0x0
11 constant 0x3
31 minmax constant11:Int32 stringlength28:Int32
32 compare constant10:Int32 minmax31:Int32 Lt
33 test compare32:Bool block9 block10
36 phi minmax31:Int32 constant10:Int32
37 phi constant10:Int32 minmax31:Int32
38 sub phi37:Int32 phi36:Int32 [int32]
39 substr tostring27:String phi36:Int32 sub38:Int32
```

to:
```
10 constant 0x0
11 constant 0x3
31 minmax constant11:Int32 stringlength28:Int32
32 substr tostring27:String constant10:Int32 minmax31:Int32
```

Differential Revision: https://phabricator.services.mozilla.com/D153491
2022-08-03 17:12:06 +00:00
André Bargull dbbc66e262 Bug 1782771 - Part 2: Fold min(x, min(y, z)) to min(c, z) with compile-time constant c=min(x, y). r=jandem
Improves `s.slice(0, 3)` from:
```
10 constant 0x0
11 constant 0x3
34 minmax constant11:Int32 stringlength28:Int32
36 minmax minmax34:Int32 constant10:Int32
37 substr tostring27:String constant10:Int32 minmax36:Int32
```

to:
```
10 constant 0x0
11 constant 0x3
34 minmax constant11:Int32 stringlength28:Int32
36 substr tostring27:String constant10:Int32 minmax34:Int32
```

Differential Revision: https://phabricator.services.mozilla.com/D153490
2022-08-03 17:12:06 +00:00
André Bargull 1034d4c9d2 Bug 1782771 - Part 1: Handle string length when folding MMinMax. r=jandem
The change removes a MMinMax in `s.substring(0, 3)`:
```
10 constant 0x0
11 constant 0x3
31 minmax constant10:Int32 stringlength28:Int32
32 minmax constant11:Int32 stringlength28:Int32
33 compare minmax31:Int32 minmax32:Int32 Lt
34 test compare33:Bool block9 block10
37 phi minmax32:Int32 minmax31:Int32
38 phi minmax31:Int32 minmax32:Int32
39 sub phi38:Int32 phi37:Int32 [int32]
40 substr tostring27:String phi37:Int32 sub39:Int32
```

After:
```
10 constant 0x0
11 constant 0x3
31 minmax constant11:Int32 stringlength28:Int32
32 compare constant10:Int32 minmax31:Int32 Lt
33 test compare32:Bool block9 block10
36 phi minmax31:Int32 constant10:Int32
37 phi constant10:Int32 minmax31:Int32
38 sub phi37:Int32 phi36:Int32 [int32]
39 substr tostring27:String phi36:Int32 sub38:Int32
```

More improvements for `s.slice(0, 3)`:
```
10 constant 0x0
11 constant 0x3
32 minmax constant10:Int32 stringlength28:Int32
35 minmax constant11:Int32 stringlength28:Int32
37 sub minmax35:Int32 minmax32:Int32 [int32]
38 minmax sub37:Int32 constant10:Int32
39 substr tostring27:String minmax32:Int32 minmax38:Int32
```

After:
```
10 constant 0x0
11 constant 0x3
34 minmax constant11:Int32 stringlength28:Int32
36 minmax minmax34:Int32 constant10:Int32
37 substr tostring27:String constant10:Int32 minmax36:Int32
```

Differential Revision: https://phabricator.services.mozilla.com/D153489
2022-08-03 17:12:05 +00:00
Fabrice Desré c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Nicolas B. Pierron 1a77783e9e Bug 1782124 - Avoid non-aligned write of int32 values. r=jandem
This patch changes the x86/x64 backend to:
 - avoid unaligned write of int32_t, unaligned read of uintptr_t values.
 - replace typed pointer arithmetic by byte offsets only.
 - add comments with opcode when patching assembly.

Differential Revision: https://phabricator.services.mozilla.com/D153597
2022-08-03 16:32:25 +00:00
Andreea Pavel 3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Jan de Mooij 8164444233 Bug 1782487 part 3 - Add some tests. r=jonco
This also adds testing functions to allocate and check objects with many reserved slots.

Depends on D153437

Differential Revision: https://phabricator.services.mozilla.com/D153438
2022-08-03 11:03:57 +00:00
Jan de Mooij 1d6aa9252f Bug 1782487 part 2 - Free dictionary slots if possible after densifying or removing properties. r=jonco
Dictionary slots currently never shrink: when removing properties we put the slots
on the dictionary free list. If we know there are no slotful properties left, however,
we can free the slots and reset the free list.

This is mostly nice for densifying because we can usually free all slots in that case.

The patch also fixes a minor issue in `NativeObject::shrinkSlots`, because this code
is now used for dictionary objects for the first time.

Differential Revision: https://phabricator.services.mozilla.com/D153437
2022-08-03 11:03:57 +00:00
Jan de Mooij a1d68e44d2 Bug 1782487 part 1 - Only densify sparse elements if the added property uses the last slot. r=jonco
The power-of-two heuristic in `maybeDensifySparseElements` doesn't work well if
we're getting slots from the slot free list, because in that case the slot span
can be the same power-of-two for a long time and adding elements becomes
quadratic.

This patch avoids the problem by only trying to densify if we're using the last
slot. That still handles the common initialization pattern this code was written
to handle.

Differential Revision: https://phabricator.services.mozilla.com/D153436
2022-08-03 11:03:56 +00:00
André Bargull 9179c28d4c Bug 1782212 - Part 28: Add curly brackets to js/src/builtin/intl/RelativeTimeFormat.js. r=tcampbell
Depends on D153198

Differential Revision: https://phabricator.services.mozilla.com/D153199
2022-08-03 06:38:06 +00:00
André Bargull ef19b33034 Bug 1782212 - Part 27: Add curly brackets to js/src/builtin/intl/PluralRules.js. r=tcampbell
Depends on D153197

Differential Revision: https://phabricator.services.mozilla.com/D153198
2022-08-03 06:38:05 +00:00
André Bargull 63447aaa39 Bug 1782212 - Part 26: Add curly brackets to js/src/builtin/intl/NumberFormat.js. r=tcampbell
Depends on D153196

Differential Revision: https://phabricator.services.mozilla.com/D153197
2022-08-03 06:38:05 +00:00
André Bargull e1c8a2e34b Bug 1782212 - Part 25: Add curly brackets to js/src/builtin/intl/ListFormat.js. r=tcampbell
Depends on D153195

Differential Revision: https://phabricator.services.mozilla.com/D153196
2022-08-03 06:38:05 +00:00
André Bargull d7e10cb86f Bug 1782212 - Part 24: Add curly brackets to js/src/builtin/intl/DisplayNames.js. r=tcampbell
Depends on D153194

Differential Revision: https://phabricator.services.mozilla.com/D153195
2022-08-03 06:38:04 +00:00
André Bargull fbf760df59 Bug 1782212 - Part 23: Add curly brackets to js/src/builtin/intl/DateTimeFormat.js. r=tcampbell
Depends on D153193

Differential Revision: https://phabricator.services.mozilla.com/D153194
2022-08-03 06:38:04 +00:00
André Bargull f5d3a8e42e Bug 1782212 - Part 22: Add curly brackets to js/src/builtin/intl/CommonFunctions.js. r=tcampbell
Depends on D153192

Differential Revision: https://phabricator.services.mozilla.com/D153193
2022-08-03 06:38:03 +00:00
André Bargull 2eb854d92b Bug 1782212 - Part 21: Add curly brackets to js/src/builtin/intl/Collator.js. r=tcampbell
Depends on D153191

Differential Revision: https://phabricator.services.mozilla.com/D153192
2022-08-03 06:38:03 +00:00
André Bargull bcea6ca1f5 Bug 1782212 - Part 20: Add curly brackets to js/src/builtin/Weak{Map,Set}.js. r=tcampbell
Depends on D153190

Differential Revision: https://phabricator.services.mozilla.com/D153191
2022-08-03 06:38:02 +00:00
André Bargull 355e747ac2 Bug 1782212 - Part 19: Add curly brackets to js/src/builtin/Utilities.js. r=tcampbell
Depends on D153189

Differential Revision: https://phabricator.services.mozilla.com/D153190
2022-08-03 06:38:02 +00:00
André Bargull 49737e1f39 Bug 1782212 - Part 18: Add curly brackets to js/src/builtin/TypedArray.js. r=tcampbell
Depends on D153188

Differential Revision: https://phabricator.services.mozilla.com/D153189
2022-08-03 06:38:01 +00:00
André Bargull 59be25eb8a Bug 1782212 - Part 17: Add curly brackets to js/src/builtin/Tuple.js. r=tcampbell
Depends on D153187

Differential Revision: https://phabricator.services.mozilla.com/D153188
2022-08-03 06:38:01 +00:00
André Bargull bd647c99ee Bug 1782212 - Part 16: Add curly brackets to js/src/builtin/String.js. r=tcampbell
Depends on D153186

Differential Revision: https://phabricator.services.mozilla.com/D153187
2022-08-03 06:38:01 +00:00
André Bargull d4ffe29084 Bug 1782212 - Part 15: Add curly brackets to js/src/builtin/Sorting.js. r=tcampbell
Depends on D153185

Differential Revision: https://phabricator.services.mozilla.com/D153186
2022-08-03 06:38:00 +00:00
André Bargull 95e47ec62a Bug 1782212 - Part 14: Add curly brackets to js/src/builtin/Set.js. r=tcampbell
Depends on D153184

Differential Revision: https://phabricator.services.mozilla.com/D153185
2022-08-03 06:38:00 +00:00
André Bargull fb677234cb Bug 1782212 - Part 13: Add curly brackets to js/src/builtin/RegExp{Global,Local}ReplaceOpt.h.js. r=tcampbell
Depends on D153183

Differential Revision: https://phabricator.services.mozilla.com/D153184
2022-08-03 06:38:00 +00:00
André Bargull e4d9308295 Bug 1782212 - Part 12: Add curly brackets to js/src/builtin/RegExp.js. r=tcampbell
Depends on D153182

Differential Revision: https://phabricator.services.mozilla.com/D153183
2022-08-03 06:37:59 +00:00
André Bargull 325d6b1e01 Bug 1782212 - Part 11: Add curly brackets to js/src/builtin/Reflect.js. r=tcampbell
Depends on D153181

Differential Revision: https://phabricator.services.mozilla.com/D153182
2022-08-03 06:37:59 +00:00
André Bargull 8d0fe19591 Bug 1782212 - Part 10: Add curly brackets to js/src/builtin/Promise.js. r=tcampbell
Depends on D153180

Differential Revision: https://phabricator.services.mozilla.com/D153181
2022-08-03 06:37:59 +00:00
André Bargull d058fe8e60 Bug 1782212 - Part 9: Add curly brackets to js/src/builtin/Object.js. r=tcampbell
Depends on D153179

Differential Revision: https://phabricator.services.mozilla.com/D153180
2022-08-03 06:37:58 +00:00
André Bargull f548ab585c Bug 1782212 - Part 8: Add curly brackets to js/src/builtin/Number.js. r=tcampbell
Depends on D153178

Differential Revision: https://phabricator.services.mozilla.com/D153179
2022-08-03 06:37:58 +00:00
André Bargull f3ff89549c Bug 1782212 - Part 7: Add curly brackets to js/src/builtin/Map.js. r=tcampbell
Depends on D153177

Differential Revision: https://phabricator.services.mozilla.com/D153178
2022-08-03 06:37:57 +00:00
André Bargull 276559e0ef Bug 1782212 - Part 6: Add curly brackets to js/src/builtin/Iterator.js. r=tcampbell
Depends on D153176

Differential Revision: https://phabricator.services.mozilla.com/D153177
2022-08-03 06:37:57 +00:00
André Bargull 6053c4b980 Bug 1782212 - Part 5: Add curly brackets to js/src/builtin/Generator.js. r=tcampbell
Depends on D153175

Differential Revision: https://phabricator.services.mozilla.com/D153176
2022-08-03 06:37:57 +00:00
André Bargull 99cb2c8886 Bug 1782212 - Part 4: Add curly brackets to js/src/builtin/Function.js. r=tcampbell
Depends on D153174

Differential Revision: https://phabricator.services.mozilla.com/D153175
2022-08-03 06:37:56 +00:00
André Bargull 3870aec1f8 Bug 1782212 - Part 3: Add curly brackets to js/src/builtin/Error.js. r=tcampbell
Depends on D153173

Differential Revision: https://phabricator.services.mozilla.com/D153174
2022-08-03 06:37:56 +00:00
André Bargull fa28a1854b Bug 1782212 - Part 2: Add curly brackets to js/src/builtin/Date.js. r=tcampbell
Depends on D153172

Differential Revision: https://phabricator.services.mozilla.com/D153173
2022-08-03 06:37:55 +00:00
André Bargull 3d398cf0af Bug 1782212 - Part 1: Add curly brackets to js/src/builtin/Array.js. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D153172
2022-08-03 06:37:55 +00:00
Marian-Vasile Laza 586beba31b Merge mozilla-central to autoland. a=merge CLOSED TREE 2022-08-03 01:27:01 +03:00
Yury Delendik a0e810cfbd Bug 1782316 - Allow nullable references in call_ref. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D153289
2022-08-02 20:55:25 +00:00
criss d6d168e329 Backed out changeset 6409e37a1834 (bug 1776658) for causing assertion failures on Value.h . CLOSED TREE 2022-08-03 00:03:29 +03:00
Kris Maglione 372e3c54a2 Bug 1776658: Update some setNumber callers. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152822
2022-08-02 20:01:39 +00:00
Marian-Vasile Laza 8853f9db9f Merge autoland to mozilla-central. a=merge 2022-08-03 00:43:06 +03:00
André Bargull 7e937f10b1 Bug 1062893: Add recover support for MCompare. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D153484
2022-08-02 17:55:26 +00:00
Jon Coppeard f6eb8c21a5 Bug 1782686 - Document arguments to embedding module hooks r=arai
Differential Revision: https://phabricator.services.mozilla.com/D153464
2022-08-02 15:32:36 +00:00
Jon Coppeard d3bd76a3c1 Bug 1782713 - Remove FinishDynamicModuleImport_NoTLA and related defintions r=yulia
Depends on D153464

Differential Revision: https://phabricator.services.mozilla.com/D153465
2022-08-02 14:08:46 +00:00
Tooru Fujisawa 0216ea137e Bug 1782166 - Part 2: Add more info in JSScript::dump. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D153221
2022-08-02 13:56:28 +00:00
Tooru Fujisawa 4205ce4b9c Bug 1782166 - Part 1: Add JSScript::dump and move shell dis() function implementation into it. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D153220
2022-08-02 13:56:27 +00:00
Matthew Gaudet 2f565b1ae6 Bug 1782271 - Remove Warp async and generator options r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D153231
2022-08-02 13:41:01 +00:00
Jan de Mooij ff8dff26c3 Bug 1774178 - Add test. r=nika,iain
Differential Revision: https://phabricator.services.mozilla.com/D152395
2022-08-02 13:23:58 +00:00
Jan de Mooij 420304b600 Bug 1774178 - Add a pref to disable Spectre mitigations for Fission content processes. r=nika,tjr,iain
These flags are usually initialized very early on, but because child processes are
pre-allocated and then later specialized for a specific process type, we need to
reset them later. This patch adds a new API for this that has some extra assertions.

Differential Revision: https://phabricator.services.mozilla.com/D152373
2022-08-02 13:23:58 +00:00
Matthew Gaudet 1db7a45b4f Bug 1782267 - Modernize typedefs in ShadowRealm code r=jandem
Depends on D153228

Differential Revision: https://phabricator.services.mozilla.com/D153229
2022-08-02 13:21:52 +00:00
Matthew Gaudet 51e59d65d5 Bug 1782267 - Modernize typedefs in WrappedFunctionObject code r=jandem
Depends on D153227

Differential Revision: https://phabricator.services.mozilla.com/D153228
2022-08-02 13:21:51 +00:00
Matthew Gaudet 11c3d438fc Bug 1782267 - Fix comment around WrappedFunction prototype r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D153227
2022-08-02 13:21:47 +00:00
Mohamed Atef dc4af7919e Bug 1341943: Do not emit JSOp::RetRval for arrow function with expression body. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D153342
2022-08-02 11:49:21 +00:00
Julian Seward 8ec529562a Bug 1782490 - Fix vague/misleading names in BacktrackingAllocator.cpp. r=jandem.
BacktrackingAllocator.{h,cpp} contain a few functions whose names are vague or
misleading or both.  This patch renames four such functions.  There is no
functional change.

BacktrackingAllocator::splitAndRequeueBundles
  -> BacktrackingAllocator::updateVirtualRegisterListsThenRequeueBundles

BacktrackingAllocator::resolveControlFlow
  -> BacktrackingAllocator::createMoveGroupsFromLiveRangeTransitions

BacktrackingAllocator::reifyAllocations
  -> BacktrackingAllocator::installAllocationsInLIR

LiveRange::distributeUses
  -> LiveRange::tryToMoveDefAndUsesInto

Differential Revision: https://phabricator.services.mozilla.com/D153348
2022-08-02 10:43:32 +00:00
Jon Coppeard 26490d4e4f Bug 1770768 - Part 6: Calculate balanced heap limits r=sfink
This patch adds the calculation of the heap limit based on the formula from the paper.

Differential Revision: https://phabricator.services.mozilla.com/D152867
2022-08-02 10:05:06 +00:00
Jon Coppeard 6a736bc9ba Bug 1770768 - Part 5: Calculate the allocation rate r=sfink
Calculate the allocation rate per zone. This requires remembering the previous
heap size and also tracking the amouth of memory freed in the mean time.

This uses an exponential moving average to smooth the result but with a much
lower factor, so that the allocation rate decays slowly when a zone stops
allocating.

Differential Revision: https://phabricator.services.mozilla.com/D152866
2022-08-02 10:05:06 +00:00
Jon Coppeard ca53bac91e Bug 1770768 - Part 4: Calculate the garbage collection rate r=sfink
This estimates the collection rate per zone based on GC time (including
off-thread sweeping) and zone size pre-GC. The result is smoothed using an
exponential moving average.

We don't have per-zone time information for main thread GC time, so we estimate
proportionally based on the zone's initial size. The patch records per-zone
sweeping time and includes that in the calculation. Compacting time is not
included since that is relatively rare and will skew the result.

Differential Revision: https://phabricator.services.mozilla.com/D152865
2022-08-02 10:05:05 +00:00
Jon Coppeard 0ebad143ef Bug 1770768 - Part 3: Add browser prefs for the new GC parameters r=mccr8,sfink
Differential Revision: https://phabricator.services.mozilla.com/D152864
2022-08-02 10:05:05 +00:00
Jon Coppeard d5ad2725fb Bug 1770768 - Part 2: Add a GC parameter for the heap growth factor used when balanced heap limits are enabled r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D152863
2022-08-02 10:05:05 +00:00
Jon Coppeard 9d60e6b077 Bug 1770768 - Part 1: Add a GC parameter to enable or disable balanced heap limits r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D152862
2022-08-02 10:05:04 +00:00
Jon Coppeard cb16796396 Bug 1782496 - Handle uncatchable exceptions during module evaluation r=yulia
This makes sure we still set the module state to evaluated when there's an
uncatchable exception. The module's error will be set to undefined, which is
not great but it will probably never be used in this case.

Differential Revision: https://phabricator.services.mozilla.com/D153372
2022-08-02 08:36:19 +00:00
Andreea Pavel 89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré 0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Jon Coppeard af3d337432 Bug 1782539 - Remove unnecessary heap limit update after setting performance hint r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D153357
2022-08-01 18:04:15 +00:00
Jan de Mooij daa9fa5186 Bug 1782188 - Use more reliable endStackAddress when profiling JIT/Wasm frames. r=iain
We were using the activation's exitFP for this, but that value isn't cleared
when we return to JIT code from C++ so we could use stale values if we're in JIT
code (or used `callWithABI` calls without an exit frame). This could result in
unsymbolicated frames or missing frames in profiles.

This patch changes the JIT and Wasm frame iterators to set `endStackAddress` from
their constructor. In the outer iterator we then keep track of the first value for
the current activation and use that instead of the activation's exitFP.

Adds an assertion to the single-step callback to check `frame.endStackAddress >= state.sp`
in simulator builds. This failed on many jit-tests before this patch and passes now.

Differential Revision: https://phabricator.services.mozilla.com/D153214
2022-08-01 11:10:52 +00:00
Jon Coppeard 6708a04f45 Bug 1780547 - Reduce the length of time the gecko profiler is suppressed for while collecting the nursery r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D153222
2022-08-01 08:58:34 +00:00
Mohamed Atef ab1c706183 Bug 1481695: Change the arguments number mismatch for self-hosted built-ins from runtime error to assertion. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D153302
2022-07-31 14:41:05 +00:00
Tooru Fujisawa 287c234f6b Bug 1781641 - Add JS::NativeStackBase, JS::NativeStackSize, and JS::NativeStackLimit. r=bthrall
Depends on D152783

Differential Revision: https://phabricator.services.mozilla.com/D152854
2022-07-30 04:45:22 +00:00
Tooru Fujisawa fa7764a2a3 Bug 1781008 - Part 5: Use JSContext-free variant of AutoCheckRecursionLimit in frontend. r=bthrall
Depends on D152782

Differential Revision: https://phabricator.services.mozilla.com/D152783
2022-07-30 04:45:22 +00:00
Tooru Fujisawa 7ed1d2a8c0 Bug 1781008 - Part 4: Wrap WASI recursion check with JSContext and ErrorContext functions. r=bthrall
WASI uses extra JSContext fields to track the recursion depth.
Given WASI doesn't support thread, move it to JSContext and
MainThreadErrorContext.

Depends on D152781

Differential Revision: https://phabricator.services.mozilla.com/D152782
2022-07-30 04:45:21 +00:00
Tooru Fujisawa 42ee91dbc3 Bug 1781008 - Part 3: Use ErrorContext instead of JSContext for error reporting in AutoCheckRecursionLimit in frontend. r=bthrall
Depends on D152780

Differential Revision: https://phabricator.services.mozilla.com/D152781
2022-07-30 04:45:21 +00:00
Tooru Fujisawa 4e01ceaa57 Bug 1781008 - Part 2: Add BytecodeEmitter::ec. r=bthrall
Depends on D152779

Differential Revision: https://phabricator.services.mozilla.com/D152780
2022-07-30 04:45:20 +00:00
Tooru Fujisawa 8eeff3558b Bug 1781008 - Part 1: Move ReportOverRecursed implementation to JSContext and ErrorContext. r=bthrall
Depends on D152778

Differential Revision: https://phabricator.services.mozilla.com/D152779
2022-07-30 04:45:20 +00:00
Tooru Fujisawa 49dd57b229 Bug 1781183 - Part 7: Pass stack limit to AutoCheckRecursionLimit. r=bthrall
Depends on D152777

Differential Revision: https://phabricator.services.mozilla.com/D152778
2022-07-30 04:45:19 +00:00
Tooru Fujisawa 0a826d06c2 Bug 1781183 - Part 6: Remove redundant field from FoldVisitor. r=bthrall
FoldVisitor is subclass of RewritingParseNodeVisitor, which has
JSContext* field. and FoldVisitor doesn't have to have the same field.

Depends on D152776

Differential Revision: https://phabricator.services.mozilla.com/D152777
2022-07-30 04:45:19 +00:00
Tooru Fujisawa 1c30142b79 Bug 1781183 - Part 5: Add BytecodeEmitter::stackLimit. r=bthrall
Depends on D152775

Differential Revision: https://phabricator.services.mozilla.com/D152776
2022-07-30 04:45:19 +00:00
Tooru Fujisawa 8520999b66 Bug 1781183 - Part 4: Simplify BytecodeEmitter constructor. r=bthrall
`parent` parameter is used only internally.
Remove `parent` parameter from public methods.

This simplifies the stack limit parameter in the next patch.

Depends on D152774

Differential Revision: https://phabricator.services.mozilla.com/D152775
2022-07-30 04:45:18 +00:00
Tooru Fujisawa 9c8206ed56 Bug 1781183 - Part 3: Add ParserBase::stackLimit_. r=bthrall
Depends on D152773

Differential Revision: https://phabricator.services.mozilla.com/D152774
2022-07-30 04:45:18 +00:00
Tooru Fujisawa 278dbb2e5f Bug 1781183 - Part 2: Add JSContext::stackLimitForCurrentPrincipal. r=bthrall
Move the stack limit calculation around principal into `JSContext` method,
so that some consumer can pre-calculate it and feed it to
`AutoCheckRecursionLimit`.

Depends on D152772

Differential Revision: https://phabricator.services.mozilla.com/D152773
2022-07-30 04:45:18 +00:00
Tooru Fujisawa c25a4682b8 Bug 1781183 - Part 1: Add uintptr_t variant methods to AutoCheckRecursionLimit. r=bthrall
Instead of using `JSContext*` to calculate the stack limit internally,
receive the stack limit as parameter.

Differential Revision: https://phabricator.services.mozilla.com/D152772
2022-07-30 04:45:17 +00:00
Shelly Lin 303dfb188c Bug 1577383 - Implement async iterable declaration in WebIDL. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D142527
2022-07-29 14:06:31 +00:00
André Bargull 440ca8257a Bug 1782190: Remove no longer used eslint definitions for js-shell module loader. r=jonco
The shell module loader was rewritten to C++ in bug 1637529.

"jsrtfuzzing-example.js" was changed to appease prettier, now that it's enabled.

Differential Revision: https://phabricator.services.mozilla.com/D153151
2022-07-29 09:44:27 +00:00
Jan de Mooij bbd9f0ee44 Bug 1782095 part 4 - Remove freeLists argument from refillFreeListAndAllocate. r=jonco
Depends on D153145

Differential Revision: https://phabricator.services.mozilla.com/D153146
2022-07-29 08:03:19 +00:00
Jan de Mooij cfb330413f Bug 1782095 part 3 - Remove JSContext::tenuredAllocsSinceMinorGC_. r=jonco
It's now simpler to use the counter on the zone directly. It also no longer needs
to be an atomic because we only get/set it on the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D153145
2022-07-29 08:03:18 +00:00
Jan de Mooij 2b91483487 Bug 1782095 part 2 - Remove JSContext::freeLists_. r=jonco
We needed this to support off-thread atom allocation, but we no longer do that
since Stencil.

Depends on D153143

Differential Revision: https://phabricator.services.mozilla.com/D153144
2022-07-29 08:03:18 +00:00
Jan de Mooij 1e6378bece Bug 1782095 part 1 - Remove unused isAtomsZone argument from JSContext::setZone. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D153143
2022-07-29 08:03:17 +00:00
Doug Thayer 557de269a9 Bug 1779807 - Consume SIMD::memchr64 for array includes/indexof r=iain
This improved the time for a contrived benchmark. I don't know if we want
to invest more time into benchmarking - I feel pretty strongly that this will
be an improvement across most use cases, just judging from the more in-depth
benchmarking of the string functions. The benchmark I did was basically as
follows:

make N arrays
make N objects
for i,j in 0..N,0..N
    if (hash(i,j) % K == 0)
        arrays[i].push(objects[j])

start performance timer
for i,j in 0..N,0..N
    if arrays[i].includes(objects[j])
        matches++

report matches and performance timings

And our times were basically equal for small N, and up to 3 times faster
for large N - so, basically what we would hope for.

Differential Revision: https://phabricator.services.mozilla.com/D152298
2022-07-29 03:26:07 +00:00
Tooru Fujisawa 1e6d15c3d9 Bug 1781778 - Bump jsparagus for bug 1609432. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D152892
2022-07-29 02:06:08 +00:00
Marian-Vasile Laza bda5f100eb Backed out 14 changesets (bug 1779849) for causing bustages on regexp-parser.cc. CLOSED TREE
Backed out changeset 69a78412194b (bug 1779849)
Backed out changeset d1ddb86cdc6a (bug 1779849)
Backed out changeset 9919b609e5d7 (bug 1779849)
Backed out changeset 75212f888b5a (bug 1779849)
Backed out changeset 840e3af05207 (bug 1779849)
Backed out changeset 9e3f9d515858 (bug 1779849)
Backed out changeset 008122739ae2 (bug 1779849)
Backed out changeset 8b8d3b8878ba (bug 1779849)
Backed out changeset 57b286f00f95 (bug 1779849)
Backed out changeset 3033b570519b (bug 1779849)
Backed out changeset a1f9a779d2ee (bug 1779849)
Backed out changeset ff553a05e4e9 (bug 1779849)
Backed out changeset 9f06b26b8616 (bug 1779849)
Backed out changeset 271ae05d539d (bug 1779849)
2022-07-29 00:56:25 +03:00
Marian-Vasile Laza 5ff2695968 Merge mozilla-central to autoland. a=merge CLOSED TREE 2022-07-29 00:54:50 +03:00
Marian-Vasile Laza 4a15041348 Merge autoland to mozilla-central. a=merge 2022-07-29 00:52:31 +03:00
Iain Ireland 06f1fbef08 Bug 1779849: Remove dead shim code r=mgaudet
Depends on D152913

Differential Revision: https://phabricator.services.mozilla.com/D152914
2022-07-28 18:58:35 +00:00
Iain Ireland d83829e9a4 Bug 1779849: Update stack overflow detection r=mgaudet
V8 rewrote some stack overflow code to fix their equivalent of bug 1775005. These changes support that fix.

Differential Revision: https://phabricator.services.mozilla.com/D152913
2022-07-28 18:58:34 +00:00
Iain Ireland ff050117a6 Bug 1779849: Support zone allocation for SmallVec r=mgaudet
`Zone` is the V8 equivalent of LifoAlloc. A zone-allocated SmallVec is used in `regexp-parser.cc`.

Differential Revision: https://phabricator.services.mozilla.com/D152912
2022-07-28 18:58:34 +00:00
Iain Ireland 6516526ee0 Bug 1779849: Miscellaneous shim changes r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152911
2022-07-28 18:58:34 +00:00
Iain Ireland 1667271951 Bug 1779849: Move definitions into base namespace r=mgaudet
A bunch of code was moved upstream from the `v8::internal` namespace into the `v8::base` namespace. Adjust accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D152910
2022-07-28 18:58:33 +00:00
Iain Ireland 08559e53cf Bug 1779849: Remove FlatStringReader r=mgaudet
Another change made to support early errors in V8.

Differential Revision: https://phabricator.services.mozilla.com/D152909
2022-07-28 18:58:33 +00:00
Iain Ireland 3eb3387c38 Bug 1779849: Update RegExpFlags r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152908
2022-07-28 18:58:33 +00:00
Iain Ireland 6c27290bd4 Bug 1779849: Update RegExpStack code r=mgaudet
While refactoring this code, upstream V8 removed their own need to have `Isolate` as a friend class of `RegExpStack`. We need to be able to reach inside RegExpStack for a couple of reasons, so we use `ExternalReference`, which is still a friend class (to support ExternalReference::TopOfRegExpStack, which is used in V8's macroassembler code).

Since ExternalReference already exists, I'm also using it for the memory accounting code.

Differential Revision: https://phabricator.services.mozilla.com/D152907
2022-07-28 18:58:32 +00:00
Iain Ireland 74c41ffe8a Bug 1779849: Refactor InitializeNamedCaptures r=mgaudet
While adding support for syntax-parsing / early errors, V8 pushed the allocation of the named capture array one level outward, which lets us skip the creation of the FixedArray completely.

The awkward sorting requirement is also present in V8: compare https://github.com/v8/v8/blob/main/src/regexp/regexp.cc#L507-L508.

Differential Revision: https://phabricator.services.mozilla.com/D152906
2022-07-28 18:58:32 +00:00
Iain Ireland a0c14a2de5 Bug 1779849: Implement CheckCharacterInRangeArray r=mgaudet
IsCharacterInRangeArray is translated from the version in `imported/regexp-macro-assembler.h`, with more comments and adjustments to make callWithABI work.

Differential Revision: https://phabricator.services.mozilla.com/D152905
2022-07-28 18:58:31 +00:00
Iain Ireland d31184aea9 Bug 1779849: Refactor ByteArray r=mgaudet
Preparing for the next patch

Depends on D152903

Differential Revision: https://phabricator.services.mozilla.com/D152904
2022-07-28 18:58:31 +00:00
Iain Ireland ade1bfa8fb Bug 1779849: Use enum class in CheckSpecialCharacterClass r=mgaudet
V8 added an enum class instead of using raw chars.

Drive-by: Mark CanReadUnaligned as const.

Depends on D152902

Differential Revision: https://phabricator.services.mozilla.com/D152903
2022-07-28 18:58:31 +00:00
Iain Ireland a1e55c9f5a Bug 1779849: Re-import irregexp r=mgaudet
This patch was generated by running import-irregexp.py.

Depends on D152901

Differential Revision: https://phabricator.services.mozilla.com/D152902
2022-07-28 18:58:30 +00:00
Iain Ireland 9e068493ac Bug 1779849: Update import-irregexp.py r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152901
2022-07-28 18:58:30 +00:00
Jan de Mooij 81f27884d9 Bug 1782003 - Set lastProfilingFrame correctly in GeckoProfilerRuntime::enable. r=iain
If the top activation is a C++ interpreter activation, the code would incorrectly use
`nullptr` as `lastProfilingFrame` for the first `JitActivation`.

Differential Revision: https://phabricator.services.mozilla.com/D153061
2022-07-28 16:47:16 +00:00
Ryan Hunt 65beececbc Bug 1774829 - wasm: Update tests for removing runtime types. r=yury
This commit updates our test suite for the change to
remove runtime types.

Differential Revision: https://phabricator.services.mozilla.com/D151406
2022-07-28 15:25:43 +00:00
Ryan Hunt fa6c22769d Bug 1774829 - wasm: Update to latest text format version that removes runtime types. r=yury
This commit updates our decoding/validation for the removal of runtime
types. This means that instructions that produce rtt values are now
removed. Instructions that consumed rtt values, such as struct.new_with_rtt
are renamed and no longer take rtt values. There is no agreed upon
spec for the renames, but the validation of the instructions is generally
agreed upon.

Most churn comes from the removal of ValType::Rtt. Tests are updated in
a later commit.

This commit depends on a pending change in upstream wasm-tools [1]. A
commit to update our vendored version will be added before this lands.

[1] https://github.com/bytecodealliance/wasm-tools/pull/677

Differential Revision: https://phabricator.services.mozilla.com/D151405
2022-07-28 15:25:43 +00:00
Ryan Hunt 214a1d40fc Bug 1774829 - wasm: Vendor latest wast crate. r=yury,glandium,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D151738
2022-07-28 15:25:42 +00:00
Jon Coppeard c7b9bb7b6c Bug 1782067 - Assert we handled all nursery GC thing kinds in TenuringTracer::traverse r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D153092
2022-07-28 15:08:02 +00:00
Ryan Hunt cafcea1ef2 Bug 1777604 - wasm: Move membarrier call to separate functions. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D152305
2022-07-28 13:27:02 +00:00
Ryan Hunt 55aaf02a12 Bug 1777604 - wasm: Perform a pipeline flush while creating a module object. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D152304
2022-07-28 13:27:02 +00:00
Gerald Squelart 159d4fe860 Bug 1774329 - Remove whitespaces in gc stats' JSONPrinter - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D152605
2022-07-28 12:41:55 +00:00
Emilio Cobos Álvarez 468c70f60e Bug 1781724 - Fix JSString::encodeUTF8Partial with some ropes. r=anba
We can't exit early if src.IsEmpty() if the stack is non-empty.

Differential Revision: https://phabricator.services.mozilla.com/D152899
2022-07-28 09:36:51 +00:00
Jon Coppeard 2e57400aee Bug 1779421 - Part 3: Add tests for expected module status and async evaluating state r=yulia
This adds a shell function 'clearModules' to clear all loaded modules, so that
tests can be insulated from one another.

Depends on D151834

Differential Revision: https://phabricator.services.mozilla.com/D151835
2022-07-28 09:08:28 +00:00
Jon Coppeard 79329cabf0 Bug 1779421 - Part 2: Fix reset of post order counter r=yulia
Adding tests (see next patch) revealed an off-by-one bug resetting the async
evaluation post order counter.

Differential Revision: https://phabricator.services.mozilla.com/D151834
2022-07-28 09:08:27 +00:00
Jon Coppeard 3256f27c2f Bug 1779421 - Part 1: Rework module AsyncEvaluation field to match the spec r=yulia
As per the lastest spec this now stays true after evaluation.

This patch keeps a very similar implemenatation and resets the field after
evaluation, except that we now report this special value as true rather than
false. We assert if we try and use get the sort order after this has happened.

We also reset the runtime counter in the same way as before.

Differential Revision: https://phabricator.services.mozilla.com/D151833
2022-07-28 09:08:27 +00:00
Jan de Mooij 313a876ba3 Bug 1781242 part 10 - Mark JitContext MOZ_RAII, update a comment. r=iain
Depends on D152850

Differential Revision: https://phabricator.services.mozilla.com/D152851
2022-07-28 07:00:57 +00:00
Jan de Mooij 9e02d6347a Bug 1781242 part 9 - Store CompileRealm and CompileRuntime in the MacroAssembler. r=iain
This lets us replace relatively slow TLS lookups with a simple dereference.

This also removes the realm from `JitContext`. The runtime still has a few uses
in the MIR backend.

Depends on D152849

Differential Revision: https://phabricator.services.mozilla.com/D152850
2022-07-28 07:00:56 +00:00
Jan de Mooij ef28bd860c Bug 1781242 part 8 - Remove allocator from JitContext. r=iain
Depends on D152848

Differential Revision: https://phabricator.services.mozilla.com/D152849
2022-07-28 07:00:56 +00:00
Jan de Mooij c72a9f5100 Bug 1781242 part 7 - Remove Wasm-specific MacroAssembler constructor. r=iain
`MacroAssembler` now has a single constructor, instead of three different ones
before this patch stack.

Depends on D152847

Differential Revision: https://phabricator.services.mozilla.com/D152848
2022-07-28 07:00:56 +00:00
Jan de Mooij 83713580c5 Bug 1781242 part 6 - Always pass TempAllocator to MacroAssembler. r=iain
This follows the Wasm code and prepares for (a) removing the second `MacroAssembler`
constructor and (b) removing the allocator from `JitContext`.

Depends on D152846

Differential Revision: https://phabricator.services.mozilla.com/D152847
2022-07-28 07:00:55 +00:00
Jan de Mooij b589c33189 Bug 1781242 part 5 - Remove arm32/arm64 assembler buffer id. r=iain
This removes some old code to tag debug spew with an ID per assembler, based on a
counter stored in `JitContext`. Usually there's only one assembler per `JitContext` and
we were also not using this for Wasm compilations (it always used id 0), so this
patch removes it.

Depends on D152766

Differential Revision: https://phabricator.services.mozilla.com/D152846
2022-07-28 07:00:55 +00:00
Jan de Mooij 0930ca4c5c Bug 1781242 part 4 - Remove AutoJitContextAlloc.h and some references. r=iain
The `initWithAllocator` methods aren't doing much these days, so this
patch removes them too.

Differential Revision: https://phabricator.services.mozilla.com/D152766
2022-07-28 07:00:54 +00:00
Jan de Mooij 5415f259cc Bug 1781242 part 3 - Ensure JitContext always has an allocator. r=iain
With this patch we always pass a non-null allocator to the `JitContext` constructor,
and then never change it. Use references instead of pointers to make this clearer.

This lets us clean up more code: `AutoJitContextAlloc` can be removed and the
`MacroAssembler` no longer needs the constructor to optionally instantiate that
class.

Differential Revision: https://phabricator.services.mozilla.com/D152765
2022-07-28 07:00:54 +00:00
Jan de Mooij 36620a0954 Bug 1781242 part 2 - Remove MacroAssembler::jitContext. r=iain
One of the `MacroAssembler` constructors instantiates a `JitContext` lazily, but
it's simpler to require the callers to create a `JitContext`.

Differential Revision: https://phabricator.services.mozilla.com/D152763
2022-07-28 07:00:53 +00:00
Jan de Mooij 57a93481e8 Bug 1781242 part 1 - Remove support for nested JitContexts. r=iain
A long time ago, `JitContext` was also used for entering JIT code, but now we only
use it for the compiler backend where we don't need to support nesting.

This requires some minor changes to avoid having multiple active contexts on the
stack, but makes it easier to reason about.

Differential Revision: https://phabricator.services.mozilla.com/D152762
2022-07-28 07:00:53 +00:00
Steve Fink 07e0016fe5 Bug 1774733 - Allow AllocPolicy to determine Vector growth policy, and be aggressive about StringBuilder allocation strategy to reduce memcpy'ing. r=jandem
Condition computeGrowth behavior on existence of AP::computeGrowth<S> method

Differential Revision: https://phabricator.services.mozilla.com/D151674
2022-07-27 22:59:51 +00:00
Yury Delendik eccaaac4fa Bug 1780814 - Add fast path for same-instance call_ref. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D152821
2022-07-27 22:45:40 +00:00
Ryan Hunt 5b07c7d827 Bug 1781425 - wasm: Remove baldrdash. r=jseward,supply-chain-reviewers
The baldrdash integration of Cranelift is agreed between SM and CL
to be the wrong shape. Our import of the code base is also old and
causes difficulties for us when upgrading some crates (see bug
1774829). We should remove it for now to unblock bug 1774829.

Differential Revision: https://phabricator.services.mozilla.com/D152806
2022-07-27 22:30:17 +00:00
Abhishek Sharma 0b70700d85 Bug 1467200 - Refactor storeCallBoolResult to use convertBoolToInt32 r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D152594
2022-07-27 16:36:36 +00:00
André Bargull ae06348ed9 Bug 1780545 - Part 5: Update test262 exclusions. r=dminor
These tests were actually removed when updating test262 in part 4.

Depends on D152858

Differential Revision: https://phabricator.services.mozilla.com/D152859
2022-07-27 13:58:25 +00:00
André Bargull ee32c10f94 Bug 1780545 - Part 4: Update test262. r=dminor
Update test262 to import changed tests for parts 1-3.

Depends on D152391

Differential Revision: https://phabricator.services.mozilla.com/D152858
2022-07-27 13:58:24 +00:00
André Bargull 02a1007eb9 Bug 1780545 - Part 3: Remove range checks from Intl.DateTimeFormat. r=dminor
Remove range check per <https://github.com/tc39/ecma402/pull/701>.

Differential Revision: https://phabricator.services.mozilla.com/D152391
2022-07-27 13:58:24 +00:00
André Bargull ce2f4684c8 Bug 1780545 - Part 2: Remove range checks from Intl.NumberFormat. r=dminor
`Intl.NumberFormat` changes for <https://github.com/tc39/proposal-intl-numberformat-v3/pull/100>.

`DecimalNumber` can be further simplified once there's a concrete proposal for
<https://github.com/tc39/proposal-intl-numberformat-v3/issues/98>. For now it's
left as-is, because it provides methods for extracting the exponent and the
number of significand digits of a decimal number, which we may need in the
future.

Differential Revision: https://phabricator.services.mozilla.com/D152389
2022-07-27 13:58:24 +00:00
André Bargull f0f6f0ad4e Bug 1780545 - Part 1: Remove range checks from Intl.PluralRules. r=dminor
`Intl.PluralRules` changes for <https://github.com/tc39/proposal-intl-numberformat-v3/pull/100>.

Differential Revision: https://phabricator.services.mozilla.com/D152388
2022-07-27 13:58:23 +00:00
Yury Delendik 4fab1299a3 Bug 1762409 - Remove wormhole instructions. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D152118
2022-07-26 22:39:37 +00:00
Mark Banner 58566a1db9 Bug 1777268 - Support structuredClone in the system global by default. r=webcompat-reviewers,twisniewski,kmag
Differential Revision: https://phabricator.services.mozilla.com/D152196
2022-07-26 20:13:52 +00:00
Matthew Gaudet 2fa95f0dc6 Bug 1772012 - Add ShadowRealms to fuzz-flags.txt r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152696
2022-07-26 13:38:47 +00:00
André Bargull 60cbb2459a Bug 1768648 - Part 2: Use LCompareAndBranch for Compare_RefOrNull. r=rhunt
Depends on D152631

Differential Revision: https://phabricator.services.mozilla.com/D152632
2022-07-26 12:58:20 +00:00
André Bargull 1b520e0210 Bug 1768648 - Part 1: Compare Compare_RefOrNull as pointers. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D152631
2022-07-26 12:58:19 +00:00
Jan de Mooij 7a3e8cacb7 Bug 1781074 - Remove Value::isNurseryAllocatableGCThing, use isGCThing instead. r=jonco
Most of the GC things typically stored in a `JS::Value` can be nursery allocated now,
so using `isGCThing` should result in more compact code with fewer branches.

Barriers in JIT code are already doing something similar since bug 1636916.

Differential Revision: https://phabricator.services.mozilla.com/D152651
2022-07-26 08:48:29 +00:00
Tooru Fujisawa 0bb31403fd Bug 1781124 - Use static pref for dom.importMaps.enabled in module loader. r=allstarschh
Differential Revision: https://phabricator.services.mozilla.com/D152712
2022-07-26 06:30:46 +00:00
Tooru Fujisawa c7684cf7c3 Bug 1732543 - Part 1: Call onNativeCall for Function.prototype.{call,apply} inside self-hosted JS. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152349
2022-07-26 02:37:51 +00:00
Tooru Fujisawa b598c10c42 Bug 1609432 - Part 5: Call onNativeCall for callContentFunction and constructContentFunction in self-hosted JS. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152347
2022-07-26 02:37:50 +00:00
Tooru Fujisawa 6f15ec4fac Bug 1609432 - Part 4: Add CallReason::CallContent. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152346
2022-07-26 02:37:50 +00:00
Tooru Fujisawa c3c121c7c1 Bug 1609432 - Part 3: Add JSOp::CallContent and JSOp::NewContent. r=jandem
These instructions are for `callContentFunction` and `constructContentFunction`
in self-hosted JS, to notify possible native call to debugger in the later
patches.

Differential Revision: https://phabricator.services.mozilla.com/D152345
2022-07-26 02:37:49 +00:00
Tooru Fujisawa 6772da8761 Bug 1609432 - Part 2: Always use callContentFunction and constructContentFunction for possibly user-provided functions. r=jandem
Use `callContentFunction` even if `this` value is `undefined`.
Use `constructContentFunction` even if `newTarget` value is constructor itself.

Differential Revision: https://phabricator.services.mozilla.com/D152344
2022-07-26 02:37:49 +00:00
smolnar af5711925c Backed out 3 changesets (bug 1779807) for causing SM build failures. CLOSED TREE
Backed out changeset 68e92976dc0f (bug 1779807)
Backed out changeset f11ef6602f59 (bug 1779807)
Backed out changeset faa38e8360b1 (bug 1779807)
2022-07-26 00:44:58 +03:00
Doug Thayer b0e585c357 Bug 1779807 - Consume SIMD::memchr64 for array includes/indexof r=iain
This improved the time for a contrived benchmark. I don't know if we want
to invest more time into benchmarking - I feel pretty strongly that this will
be an improvement across most use cases, just judging from the more in-depth
benchmarking of the string functions. The benchmark I did was basically as
follows:

make N arrays
make N objects
for i,j in 0..N,0..N
    if (hash(i,j) % K == 0)
        arrays[i].push(objects[j])

start performance timer
for i,j in 0..N,0..N
    if arrays[i].includes(objects[j])
        matches++

report matches and performance timings

And our times were basically equal for small N, and up to 3 times faster
for large N - so, basically what we would hope for.

Differential Revision: https://phabricator.services.mozilla.com/D152298
2022-07-25 21:21:38 +00:00
Emilio Cobos Álvarez 42b7f1a58c Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +00:00
Bryan Thrall e1615d73bb Bug 1773324 - Pass ErrorContext down through Smoosh functions r=arai
Differential Revision: https://phabricator.services.mozilla.com/D152458
2022-07-25 18:57:38 +00:00
Bryan Thrall 6cf08032de Bug 1773324 - Remove dead JSContext methods for helper threads r=arai
addPendingCompileError() is replaced by OffThreadErrorContext::reportError().

Differential Revision: https://phabricator.services.mozilla.com/D152191
2022-07-25 18:57:38 +00:00
Bryan Thrall e383aad833 Bug 1773324 - Support off-thread delazification using ErrorContext r=arai
Moving recordErrors in DelazifyTask::Create() to after the allocation of the
task allows us to use the ErrorContext in the task to store the errors instead
of having to move them into the task later, and we only miss the allocation of
the task itself (which wasn't recorded in the errors anyway).

Differential Revision: https://phabricator.services.mozilla.com/D151878
2022-07-25 18:57:37 +00:00
Bryan Thrall f0f1c10999 Bug 1773324 - Clean up unneeded code r=arai
Differential Revision: https://phabricator.services.mozilla.com/D151671
2022-07-25 18:57:37 +00:00
Bryan Thrall a353cfec13 Bug 1773324 - Rename onAllocationOverflow() to match naming of onOutOfMemory() r=arai
Differential Revision: https://phabricator.services.mozilla.com/D151670
2022-07-25 18:57:37 +00:00
Bryan Thrall 9a842ede2c Bug 1773324 - Add ErrorContext::hadErrors() and organize methods r=arai
hadErrors() is more descriptive than `errors().empty()`.

Access to the pending errors list is pushed down to OffThreadErrorContext,
because that's the only context where it is used.

Differential Revision: https://phabricator.services.mozilla.com/D151669
2022-07-25 18:57:36 +00:00
Bryan Thrall 48498bb4b0 Bug 1773324 - Simplify reporting errors to ErrorContext r=arai
At the cost of moving the filled-in CompileError into the allocated space for OffThreadErrorContext.

Differential Revision: https://phabricator.services.mozilla.com/D151668
2022-07-25 18:57:36 +00:00
Bryan Thrall c9608c3249 Bug 1773324 - Rename MainThreadErrorContext r=arai
"GenericErrorContext" hasn't been an appropriate name since 5d4105313417.

Differential Revision: https://phabricator.services.mozilla.com/D151667
2022-07-25 18:57:35 +00:00
Bryan Thrall 76652a56df Bug 1773324 - Move implementations for ErrorContext to their own file r=arai
Differential Revision: https://phabricator.services.mozilla.com/D151612
2022-07-25 18:57:35 +00:00
Bryan Thrall 160d72b8c9 Bug 1773324 - Fix typo r=arai
Differential Revision: https://phabricator.services.mozilla.com/D151611
2022-07-25 18:57:35 +00:00
Bryan Thrall 574a8de705 Bug 1773324 - Access ErrorAllocator via ErrorContext accessor r=arai
This removes a lot of plumbing allocators through function parameters but still
maintains the ErrorContext and allocator as separate concepts.

At this point, there is no need for the type or instances of ErrorContext and
ErrorAllocator to vary independently.

Differential Revision: https://phabricator.services.mozilla.com/D151610
2022-07-25 18:57:34 +00:00
Bryan Thrall c6b87869db Bug 1773324 - Remove template from ErrorAllocator, add ErrorContext::getAllocator(), rename OffThreadErrorContext::linkWithJSContext() r=arai
ErrorAllocator was only ever used with ErrorContext, so no need for templating.

linkWithJSContext() better describes what it is doing, since JSContext needs its
errors_ field filled in, at least until we can replace it with a different
allocator for functions that are called during compilation.

getAllocator() is a convenience so we don't have to add a separate allocator
parameter everywhere we pass an ErrorContext and also need an allocator.

Differential Revision: https://phabricator.services.mozilla.com/D151609
2022-07-25 18:57:34 +00:00
Bryan Thrall a83c42b086 Bug 1773324 - Remove ErrorReporting dependency on JSContext for GC-safe callback r=arai
ReportErrorVA(), ReportErrorNumberVA(), and ReportErrorNumberUCArray(), and
ReportErrorNumberUTF8Array() use JSContext for rooting, so they will have to be
called from the main thread. The only reason to pass ErrorContext to them would
be for consistency with the other error reporting functions.

Differential Revision: https://phabricator.services.mozilla.com/D151608
2022-07-25 18:57:33 +00:00
Bryan Thrall 43ad49bda4 Bug 1773324 - Replace ErrorReporting allocator with ErrorAllocator r=arai
ErrorAllocator is an adapter that allows MallocProvider to delegate
to polymorphic Contexts. MallocProvider provides a well-known interface,
but doesn't support polymorphism, so we resort to templating and adapters
like this.

JS::CharsToNewUTF8CharsZ() needs a definition in CharacterEncoding.cpp,
so for now I explicitly instantiate it for ErrorAllocator<JSContext>.
A better solution would be to move the definition to a header, but that's
a bigger task.

Differential Revision: https://phabricator.services.mozilla.com/D151179
2022-07-25 18:57:33 +00:00
Bryan Thrall 29bcf1e310 Bug 1773324 - Add test covering reporting off-thread compilation errors r=arai
Differential Revision: https://phabricator.services.mozilla.com/D150648
2022-07-25 18:57:33 +00:00
Bryan Thrall 4c2554fef9 Bug 1773324 - Report errors from ParseTask back to JSContext r=arai
OffThreadErrorContext::setAllocator() needs to setOffThreadFrontendErrors on
the JSContext because CompileToStencilTask::parse() uses it to allocate the
CompilationInput.

Differential Revision: https://phabricator.services.mozilla.com/D150647
2022-07-25 18:57:32 +00:00
Bryan Thrall 9e40d20025 Bug 1773324 - Pull OffThreadErrorContext to ParseTask member r=arai
This will allowe us to gather the errors after parsing without
needing a separate OffThreadFrontendErrors member.

Differential Revision: https://phabricator.services.mozilla.com/D150646
2022-07-25 18:57:32 +00:00
Bryan Thrall 7334acea14 Bug 1773324 - Support pending errors in OffThreadErrorContext r=arai
I could get rid of OffThreadErrorContext::cx_ by subclassing from
MallocProvider, but I don't think that would work since
OffThreadErrorContext has a vtable and MallocProvider does a
static_cast to get the client pointer.

OffThreadFrontendErrors moved to ErrorContext.h to avoid
recursive header inclusion.

Differential Revision: https://phabricator.services.mozilla.com/D150645
2022-07-25 18:57:32 +00:00
Bryan Thrall 242e75b195 Bug 1773324 - Pass ErrorContext parameter to CompileModuleToStencil functions r=arai
Fixes jit-test. Probably needs coordination with ESMification efforts.

It looks like JS::CompileModule() would be called from the main thread, so
it should use GeneralErrorContext.

Differential Revision: https://phabricator.services.mozilla.com/D151178
2022-07-25 18:57:31 +00:00
Bryan Thrall 442eab3d26 Bug 1773324 - Intro OffThreadErrorContext for off-thread compilation r=arai
DummyTokenStreams created when handling RegEx should be happening at JS
runtime, so on main thread (unless maybe workers?); so GeneralErrorContext is
appropriate there.

Differential Revision: https://phabricator.services.mozilla.com/D150644
2022-07-25 18:57:31 +00:00
Bryan Thrall 7e781e6879 Bug 1773324 - Plumb ErrorContext parameter out to where main vs. helper thread is known r=arai
Differential Revision: https://phabricator.services.mozilla.com/D150643
2022-07-25 18:57:30 +00:00
Bryan Thrall 0c51815759 Bug 1773324 - Provide Parser ErrorContext as a constructor parameter. r=arai
This allows the Parser creator to provide the ErrorContext appropriate
for the situation (main thread or helper thread). For now, we just use
a flexible implementation.

I think the lifetime of the ErrorContext is the same as the Parser, so
putting the ErrorContext on the stack when the Parser is, too, should be
safe.

Differential Revision: https://phabricator.services.mozilla.com/D150642
2022-07-25 18:57:30 +00:00
Bryan Thrall 89b90a8231 Bug 1773324 - Introduce ErrorContext for handling error reports. r=arai
Temporarily passing JSAllocator* to ExpandErrorArgumentsVA in
ReportCompileWarning(). It is only used for allocation and for AutoSuppressGC.

Differential Revision: https://phabricator.services.mozilla.com/D150641
2022-07-25 18:57:30 +00:00
Bryan Thrall f0995d91f4 Bug 1773324 - Add ErrorReportMixin::getAllocator() r=arai
The type of the allocator will be varying separately from the type of the context.

Differential Revision: https://phabricator.services.mozilla.com/D149997
2022-07-25 18:57:29 +00:00
Bryan Thrall 5c931e7083 Bug 1773324 - Separate use of JSContext for allocation into its own parameter r=arai
Differential Revision: https://phabricator.services.mozilla.com/D149996
2022-07-25 18:57:29 +00:00
Yury Delendik 97917d6e8d Bug 1780928 - Fix WasmOpIter.cpp switch to properly handle CallRef. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D152667
2022-07-25 17:37:17 +00:00
Philip Chimento 769a15c686 Bug 1780857 - Change if to ifdef for DEBUG. (r=jimb) DONTBUILD
The paradigm for DEBUG is that it is defined or not defined, not 1 or 0,
so we have to use ifdef here. Otherwise we get a build error in embedded
SpiderMonkey when DEBUG is not defined.

Differential Revision: https://phabricator.services.mozilla.com/D152556
2022-07-25 09:35:43 +00:00
André Bargull 6dbea1b95a Bug 1780541 - Part 3: Update test262 exclusion list. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152385
2022-07-25 09:26:09 +00:00
André Bargull ea00681010 Bug 1780541 - Part 2: Update test262 July 2022. r=mgaudet
Depends on D152383

Differential Revision: https://phabricator.services.mozilla.com/D152384
2022-07-25 09:26:07 +00:00
André Bargull e9ebe6a934 Bug 1780541 - Part 1: Update list of unsupported features. r=mgaudet
Drive-by fix:
- Reduce code duplication in shell.js files for Temporal tests

Differential Revision: https://phabricator.services.mozilla.com/D152383
2022-07-25 09:26:07 +00:00
Philip Chimento 70a6a99877 Bug 1776254 - Install ProfilingCategoryList.h (r=arai)
When installing embedded SpiderMonkey, we need to install the generated
header ProfilingCategoryList.h into /usr/include/mozjs-___/js/ because
that's where the rest of the SpiderMonkey code expects to find it.
It's not automatically installed already, because it's generated.

Thanks to Arai for the suggestion of where to look.

Differential Revision: https://phabricator.services.mozilla.com/D152549
2022-07-23 01:26:08 +00:00
Yury Delendik 0b5a7f0629 Bug 1774830 - Add call_ref validation and baseline parsing. r=rhunt
- Add simple tests
- Add validation support for call_ref
- Use typeIndex when function references are enabled
- Add a BaseCompiler::callRef

Differential Revision: https://phabricator.services.mozilla.com/D151727
2022-07-22 19:16:22 +00:00
Yury Delendik adac600224 Bug 1774830 - Add masm.wasmCallRef logic. r=rhunt
- Implement MacroAssembler::wasmCallRef
- Extend CalleeDesc and CallSiteDesc
- Add register definition to platforms
- Populate WASM_FUNC_DIRECT_ENTRY_SLOT with funcUncheckedCallEntry address

Tests are provided in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D151772
2022-07-22 19:16:22 +00:00
Yury Delendik 1d6e63dd89 Bug 1774830 - Remove WASM_INSTANCE_OBJ_SLOT from JSFunction. r=rhunt
- Replace all uses of WASM_INSTANCE_OBJ_SLOT, with WASM_INSTANCE_SLOT (which is a Instance* and can access Instance::object_)
- Update JSFunction::trace to trace through WASM_INSTANCE_SLOT, instead of relying on WASM_INSTANCE_OBJ_SLOT

Refactored code is covered by existing tests.

Differential Revision: https://phabricator.services.mozilla.com/D151375
2022-07-22 19:16:21 +00:00
Liu Yu 1dee3b202b Bug 1776825 - [mips64]Fix undeclared identifier 'PoppedFPJitEntry'/'STUB_FRAME_SIZE'. r=jandem
Port D148487,D148779 and bug1772506 to mips64

Differential Revision: https://phabricator.services.mozilla.com/D152492
2022-07-22 14:08:51 +00:00
Liu Yu 15ee4c4c7b Bug 1780723 - [loong64]Add PoppedFPJitEntry and fix some errors. r=jandem
Add PoppedFPJitEntry;
Fix offset when push FrameType and ra in EmitBaselineTailCallVM;
Fix FramePointer in BaselineFrame in generateEnterJIT.

Differential Revision: https://phabricator.services.mozilla.com/D152489
2022-07-22 14:08:51 +00:00
André Bargull 7e46b95f22 Bug 1780025 - Part 13: Add an optional "length" out-param. r=jandem
Depends on D152077

Differential Revision: https://phabricator.services.mozilla.com/D152369
2022-07-22 11:15:20 +00:00
André Bargull 1c0e516341 Bug 1780025 - Part 12: Remove unused jsnum functions. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152077
2022-07-22 11:15:19 +00:00
André Bargull 56afcd9b4d Bug 1780025 - Part 11: Update a comment for NumberToString. r=jandem
`NumberToString` doesn't accept a `base` argument.

Differential Revision: https://phabricator.services.mozilla.com/D152076
2022-07-22 11:15:19 +00:00
André Bargull ff048af37c Bug 1780025 - Part 10: Prefer NumberToCString over JS::NumberToString. r=jandem
This was the only caller to `JS::NumberToString` within SpiderMonkey (ignoring test code).

Differential Revision: https://phabricator.services.mozilla.com/D152075
2022-07-22 11:15:19 +00:00
André Bargull 1541e15bb3 Bug 1780025 - Part 9: Inline NumberToCString into NumberValueToStringBuffer. r=jandem
This avoids another call to `strlen`.

Differential Revision: https://phabricator.services.mozilla.com/D152074
2022-07-22 11:15:18 +00:00
André Bargull c597687ec0 Bug 1780025 - Part 8: Avoid calling strlen after FracNumberToCString. r=jandem
This avoids another call to `strlen`.

Differential Revision: https://phabricator.services.mozilla.com/D152073
2022-07-22 11:15:18 +00:00
André Bargull ba90abb9ab Bug 1780025 - Part 7: Change ToCStringBuf buffer size to only support base 10. r=jandem
No external caller is using `ToCStringBuf` for a different base than base-10.
This allows to change the buffer size to `JS::MaximumNumberToStringLength`, which
is a multiple of 4 resp. 8, which should be more efficiently to stack allocate
than 34 bytes.

Differential Revision: https://phabricator.services.mozilla.com/D152072
2022-07-22 11:15:18 +00:00
André Bargull da7a9df784 Bug 1780025 - Part 6: Remove unused ToCStringBuf::dbuf member. r=jandem
`ToCStringBuf::dbuf` is no longer used after the last part.

Differential Revision: https://phabricator.services.mozilla.com/D152071
2022-07-22 11:15:17 +00:00
André Bargull 95c4782337 Bug 1780025 - Part 5: Inline FracNumberToCStringWithBase into its single caller. r=jandem
This will allow to remove `ToCStringBuf::dbuf` in the next part.

Differential Revision: https://phabricator.services.mozilla.com/D152070
2022-07-22 11:15:17 +00:00
André Bargull 28a6dad109 Bug 1780025 - Part 4: Split the integer and double cases in NumberToStringWithBase. r=jandem
Split both cases in preparation for the next patches.

Drive-by change:
`base = 10` doesn't need to execute the `unsigned(i) < unsigned(base)` and
`unsigned(i) < unsigned(base * base)` cases, because `StaticStrings::hasInt(i)`
covers this case already.

Differential Revision: https://phabricator.services.mozilla.com/D152069
2022-07-22 11:15:16 +00:00
André Bargull 0dc636bec8 Bug 1780025 - Part 3: Add NumberToCString overloads for integers. r=jandem
32-bit integers (signed and unsigned) need less space than provided by
`ToCStringBuf` and don't need any dynamically allocated memory, which avoids
calling `ToCStringBuf`'s out-of-line destructor.

Differential Revision: https://phabricator.services.mozilla.com/D152068
2022-07-22 11:15:16 +00:00
André Bargull 5f4f454ae1 Bug 1780025 - Part 2: Replace NumberToCStringWithBase with NumberToHexCString. r=jandem
`NumberToCStringWithBase` was only ever used with `base = 16`. Adding a dedicated
function for hex-strings enables us to perform more clean-ups in the next patches.

Also change `Int32ToCStringWithBase` to accept signed and unsigned integers. That
way we don't have to convert unsigned integers larger than `UINT32_MAX` to doubles.

Differential Revision: https://phabricator.services.mozilla.com/D152067
2022-07-22 11:15:15 +00:00
André Bargull 75418f8da8 Bug 1780025 - Part 1: Prefer member initialiser instead of a default constructor for ToCStringBuf. r=jandem
And add an assertion to ensure double_conversion and dtoa use the same limits
for the largest string conversion.

Differential Revision: https://phabricator.services.mozilla.com/D152066
2022-07-22 11:15:15 +00:00
Ted Campbell da1dd056ef Bug 1776931 - Use types for SpiderMonkey telemetry. r=jandem,jonco
Similar to Glean FoG, use types for telemetry metrics. For our existing probes,
this is mainly about using TimeDuration directly. The reported values continue
to be unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D150659
2022-07-21 17:51:36 +00:00
Ted Campbell de5f17e93d Bug 1776931 - Add js::Metrics struct and replace addTelemetery calls in JS. r=jandem,jonco
This brings us closer to how both Glean FoG and V8 handle telemetry and lets us
start having better type checking later.

Differential Revision: https://phabricator.services.mozilla.com/D150658
2022-07-21 17:51:35 +00:00
Ted Campbell 321b143919 Bug 1776931 - Add JSMetric enum class for SpiderMonkey telemetry. r=jonco
Replace the JS_TELEMETRY_* enums with a JSMetric enum class. Use this to
generate the XPCJSRuntime mapping automatically.

Differential Revision: https://phabricator.services.mozilla.com/D150657
2022-07-21 17:51:35 +00:00
Ted Campbell bd6d879b19 Bug 1776931 - Refactor GC slice telemetry. r=jonco
Use TimeDuration more directly in the GC slice telemetry statistics. This
prepares for later patches that add more type safety to telemetry. Measured
values are unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D150656
2022-07-21 17:51:35 +00:00
Ted Campbell 64e92a2005 Bug 1776931 - Unify internal and external JS telemetry names. r=jonco
Update JS telemetry names to match the corresponding Firefox probe names to
avoid any confusion. We usually updated these internal names with _2 suffixes
were added, but not always.

Differential Revision: https://phabricator.services.mozilla.com/D150655
2022-07-21 17:51:34 +00:00
Ted Campbell 7754381b4c Bug 1776931 - Remove unused JSTelemetrySender. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D150654
2022-07-21 17:51:34 +00:00
Tooru Fujisawa 091305ae47 Bug 1780517 - Part 3: Do not define undefined in self-hosted intrinsic. r=jandem
Depends on D152390

Differential Revision: https://phabricator.services.mozilla.com/D152392
2022-07-21 14:23:07 +00:00
Tooru Fujisawa 53d2e31ba8 Bug 1780517 - Part 2: Always use undefined instead of void 0 in self-hosted JS. r=jandem
Depends on D152387

Differential Revision: https://phabricator.services.mozilla.com/D152390
2022-07-21 14:23:06 +00:00
Tooru Fujisawa 6fd437cb43 Bug 1780517 - Part 1: Emit JSOP::Undefined for undefined in self-hosted JS. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152387
2022-07-21 14:23:06 +00:00
André Bargull 8c1b284104 Bug 1761989 - Part 6: Remove no longer needed ArrayBuffer reification. r=mgaudet
The ArrayBuffer was only reified for the ArrayBuffer constructor optimisation
in `GetBufferSpeciesConstructor`. `GetBufferSpeciesConstructor` was removed in
part 1, so we no longer need this code, too.

Depends on D152266

Differential Revision: https://phabricator.services.mozilla.com/D152267
2022-07-21 09:38:59 +00:00
André Bargull 5c62576ac6 Bug 1761989 - Part 5: Remove AllocateArrayBuffer. r=mgaudet
Remove AllocateArrayBuffer now that it's just an alias for `maybeCreateArrayBuffer`.

Also replace the no longer needed detached check with a release assertion.

Depends on D152265

Differential Revision: https://phabricator.services.mozilla.com/D152266
2022-07-21 09:38:59 +00:00
André Bargull 938b45a29d Bug 1761989 - Part 4: Remove unused nonDefaultProto argument from maybeCreateArrayBuffer. r=mgaudet
All callers are passing `nullptr` for `nonDefaultProto`.

Depends on D152264

Differential Revision: https://phabricator.services.mozilla.com/D152265
2022-07-21 09:38:59 +00:00
André Bargull cf4fa5e4a2 Bug 1761989 - Part 3: Remove unused ctor argument from AllocateArrayBuffer. r=mgaudet
The caller is always passing `%ArrayBuffer%`, so we can simplify this code a bit.

Depends on D152263

Differential Revision: https://phabricator.services.mozilla.com/D152264
2022-07-21 09:38:58 +00:00
André Bargull 16f0e867b3 Bug 1761989 - Part 2: Update spec step references. r=mgaudet
Depends on D152262

Differential Revision: https://phabricator.services.mozilla.com/D152263
2022-07-21 09:38:58 +00:00
André Bargull f554a1f978 Bug 1761989 - Part 1: Remove species lookup from InitializeTypedArrayFromTypedArray. r=mgaudet
Implement the changes from <https://github.com/tc39/ecma262/issues/2677> and
<https://github.com/tc39/ecma262/pull/2719>.

The next patches will perform further clean-ups.

Differential Revision: https://phabricator.services.mozilla.com/D152262
2022-07-21 09:38:55 +00:00
Barret Rennie 1ded07651e Bug 1779937 - Add mach xpcshell r=ahal,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D151984
2022-07-21 00:47:45 +00:00
Matthew Gaudet 9dc7890396 Bug 1769849 - Improve errors from wrapped functions throwing r=jandem
Conditionally try to extract .name and .message and use in error message.

Differential Revision: https://phabricator.services.mozilla.com/D151850
2022-07-20 20:12:00 +00:00
Matthew Gaudet 43f9e6d9e3 Bug 1769849 - Improve ShadowRealm.evaluate errors r=evilpie
Conditionally attempt to extract .name and .message and use for issuing error.

Differential Revision: https://phabricator.services.mozilla.com/D151849
2022-07-20 20:12:00 +00:00
Iain Ireland ec4e7a60d0 Bug 1779867: Don't reuse input register for GetInlinedArgument on ARM64 r=jandem
We fixed this problem in bug 1697816 for x64 and MIPS. At the time I thought it didn't affect ARM64, but it turns out that in debug builds, [this code](https://searchfox.org/mozilla-central/rev/fa71140041c5401b80a11f099cc0cd0653295e2c/js/src/jit/arm64/MacroAssembler-arm64.cpp#47-55) will clobber the source value if src == dest.

I'm not adding the testcase because it's very fragile: eg removing an unrelated call to `Object.defineProperty` affects how WarpOracle handles GetIntrinsic ICs, which in turn affects register allocation enough to prevent the bug.

Differential Revision: https://phabricator.services.mozilla.com/D152193
2022-07-20 17:10:07 +00:00
Jan de Mooij f10bc46101 Bug 1780155 - Remove unnecessary + 1 in StringBuffer ExtractWellSized. r=sfink
This probably goes back to null-terminated strings.

Differential Revision: https://phabricator.services.mozilla.com/D152146
2022-07-20 12:10:24 +00:00
André Bargull b0971757f4 Bug 1775254 - Part 2: Prefix cmath calls with "std::". r=mgaudet
"jsmath.cpp" includes `<cmath>`, so we should include the "std" namespace.

Differential Revision: https://phabricator.services.mozilla.com/D150792
2022-07-20 05:32:16 +00:00
André Bargull 39b5092b97 Bug 1775254 - Part 1: Avoid large floating point precision errors in js::powi. r=mgaudet
The previous `js::powi` implementation could cause large floating point
precision errors. For example `(-1.00000041289256280663266807096078991889953613281250000) ** -365287834`
returned `3.1456398721089196e-66` instead of `3.1456398910784315e-66`. This is an
error of 35987774 ULP.

Change `js::powi` as follows:
- Optimise only for non-negative exponents.
- Always optimise when the exponent is `<= 4` to match `MPow::foldsTo`.
- When the exponent is `> 4`, only optimise when the base is an integer. Perform
  the whole computation with integer values and when an overflow was detected,
  fallback to `std::pow`.
- In all other cases use `std::pow`.

Differential Revision: https://phabricator.services.mozilla.com/D150791
2022-07-20 05:32:15 +00:00
André Bargull be0dda520f Bug 1780010 - Part 12: Don't pass an explicit string length when the compiler can compute it. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D152108
2022-07-20 05:30:51 +00:00
André Bargull 2d2e10a78d Bug 1780010 - Part 11: Use calloc instead of malloc + memset to zero allocate memory. r=jandem
Noticed because the last part changed `memset` callers.

Depends on D152052

Differential Revision: https://phabricator.services.mozilla.com/D152053
2022-07-20 05:30:51 +00:00
André Bargull 89f22f6cb3 Bug 1780010 - Part 10: Use initialiser syntax instead of memset to zero allocate. r=jandem
Noticed while checking for more `sizeof` uses across the code base.

Depends on D152051

Differential Revision: https://phabricator.services.mozilla.com/D152052
2022-07-20 05:30:50 +00:00
André Bargull 6dad1f49aa Bug 1780010 - Part 9: Replace sizeof with std::size(). r=jandem
Depends on D152049

Differential Revision: https://phabricator.services.mozilla.com/D152051
2022-07-20 05:30:50 +00:00
André Bargull 8a41764bfe Bug 1780010 - Part 8: Replace sizeof with enhanced for-loop. r=jandem
Depends on D152048

Differential Revision: https://phabricator.services.mozilla.com/D152049
2022-07-20 05:30:49 +00:00
André Bargull 5e0d6c962d Bug 1780010 - Part 7: Replace sizeof with std::end(). r=jandem
Depends on D152047

Differential Revision: https://phabricator.services.mozilla.com/D152048
2022-07-20 05:30:49 +00:00
André Bargull 94b670bdb4 Bug 1780010 - Part 6: Replace sizeof with std::string_view for function strings. r=jandem
Adding `StringBuffer::append(std::string_view)` would make this more readable,
but the implicit `std::string_view(char*)` constructor could then lead to adding
implicit `strlen` calls, which we try to avoid.

Differential Revision: https://phabricator.services.mozilla.com/D152047
2022-07-20 05:30:49 +00:00
André Bargull 4368019b3a Bug 1780010 - Part 5: Use string_view in more places. r=jandem
builtin/Object.cpp:
- Using `string_view` avoids the call to `strlen` when `Consume` isn't inlined.

jsapi-tests/testCompileNonSyntactic.cpp:
shell/jsoptparse.cpp:
xpconnect/src/XPCWrappedNativeJSOps.cpp:
- Using `string_view` avoids the `sizeof - 1` pattern.

Depends on D152044

Differential Revision: https://phabricator.services.mozilla.com/D152045
2022-07-20 05:30:48 +00:00
André Bargull 913df26a2a Bug 1780010 - Part 4: Store "Infinity" as string_view in js_strtod. r=jandem
`std::string_view` stores a pointer and its length, so we no longer have to
use two different variables. `std::string_view` methods are also `const_expr`,
so the compiler will inline them at compile-time.

Depends on D152043

Differential Revision: https://phabricator.services.mozilla.com/D152044
2022-07-20 05:30:48 +00:00
André Bargull d20dab86f3 Bug 1780010 - Part 3: Use EqualChars to compare Infinity/NaN for TypedArray indices. r=jandem
Part 1 ensures we generate fast code when comparing against constant `char*`
strings, so we no longer need the more complicated code.

Depends on D152042

Differential Revision: https://phabricator.services.mozilla.com/D152043
2022-07-20 05:30:48 +00:00
André Bargull 5e20c53077 Bug 1780010 - Part 2: Replace ArrayEqual with EqualChars. r=jandem
This makes the code a bit more uniform.

The previous part should make bug 1589591 obsolete, so it seems useful to make
the code more uniform.

Depends on D152040

Differential Revision: https://phabricator.services.mozilla.com/D152042
2022-07-20 05:30:47 +00:00
André Bargull 0a9edde0ca Bug 1780010 - Part 1: Special-case Latin1Char with char comparison in EqualChars. r=jandem
Compilers don't emit `memcmp` when the both inputs aren't exactly the same type.

Differential Revision: https://phabricator.services.mozilla.com/D152040
2022-07-20 05:30:47 +00:00
Tooru Fujisawa a05ed9e41e Bug 1780152 - Update Debugger.Script document to cover breakpoint-not-allowed instructions. r=mgaudet
Depends on D152155

Differential Revision: https://phabricator.services.mozilla.com/D152156
2022-07-19 20:25:39 +00:00
Tooru Fujisawa 4d2074ec2e Bug 1780158 - Exclude JSOp::SetAliasedVar .generator from Debugger.Script.getEffectfulOffsets. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D152155
2022-07-19 20:25:38 +00:00