This adds `NativeObject::getLastProperty`. The similar `lastProperty` method returning
a Shape* still exists, at some point we will probably have to replace that with `shape`.
Depends on D112715
Differential Revision: https://phabricator.services.mozilla.com/D112716
Also changes `ShapeProperty(shape)` to `shape->property()` so that we don't have
to make `ShapeProperty` a friend class of `Shape`.
Depends on D112712
Differential Revision: https://phabricator.services.mozilla.com/D112713
I noticed this assertion that's no longer valid because getter/setter properties
now also go through addProperty. It's not an actual problem because we never call
this overload for getter/setter properties.
We could change the assertion to check for custom-data-properties, but that's
already asserted by addPropertyInternal that we end up calling.
Depends on D112707
Differential Revision: https://phabricator.services.mozilla.com/D112708
This is a diagnostic patch to help catch misuse of the two phase initialization
of ScriptSourceObject. One potential enhancement would be to make this
modification debug only.
Differential Revision: https://phabricator.services.mozilla.com/D107565
Cranelift uses global.isConstant() for determining if the global is mutable or not.
This isn't correct, and causes a spec-test failure when the global is an import.
Differential Revision: https://phabricator.services.mozilla.com/D111455
The i16x8.widen_XX and i32x4.widen_XX instructions were renamed to use
the word 'extend' instead of 'widen'. This commit updates the tests so they
pass with the new wat version.
Differential Revision: https://phabricator.services.mozilla.com/D111307
This commit updates the pinned version of the spec repo to the latest
version. This allows us to remove the separate reftypes/bulk-memory
repo's, as they are no merged in 'spec'.
Differential Revision: https://phabricator.services.mozilla.com/D111228
When the flushing of the buffer before the prologue was inserted (bug
1350550), a flush was also added before the secondary unchecked call
entry prologue. But this flush causes code bloat on ARM and ARM64 (as
explained in a comment in the code) and it is not necessary because
the pool will never need to be spilled until after the prologue code
has been emitted completely: we know what's in the pool and we know no
references into the pool will go out of range until later.
So remove the flush and add an assertion that checks this assumption,
resulting in tighter code in the prologue.
Differential Revision: https://phabricator.services.mozilla.com/D112243
It turns out that WasmCheckedTailEntryOffset -- which defines an entry
point for a jump from a trampoline that needs to perform a signature
check but has already allocated a frame header, and which may require
some nop-fill in the function prologue so as to place the entry point
at a constant offset -- only needs to be large enough to accomodate
every possible callable prologue (architecture-dependent). The value
can therefore be made smaller than it currently is on x86, x64, arm,
and arm64, leading to more compact prologues on those platforms,
conserving code size.
In addition, the code in GenerateFunctionPrologue and associated
functions that uses this constant can be tidied up a little bit and
commented better.
Differential Revision: https://phabricator.services.mozilla.com/D112173
At the same time, the initialization and storage of private methods is changed
to what the PrivateOpEmitter expects.
There are some barely-observable differences in behavior, resulting in two jit-test changes:
* fields/bug1683784.js - An error message changed. Not really better or worse.
* js/src/jit-test/tests/parser/script-source-extent.js - The debugger is able
to observe initializers as individual scripts. We are no longer using
initializers for private methods that can be optimized, and the debugger
therefore observes the change. I adjusted the test to expect the new
behavior.
All js/src/tests pass.
Depends on D108300
Differential Revision: https://phabricator.services.mozilla.com/D108301
The diff is a mess, but this is very straightforward--we have a combination of
if-statements and a switch that could just be a single switch.
Depends on D108295
Differential Revision: https://phabricator.services.mozilla.com/D108296
In order to correctly support this with the optimized storage for methods we
would need new bytecode like GetAliasedVar which is able to traverse
non-EnvironmentObject environments like DebugEnvironmentProxy.
Unfortunately, for safety this means we will ultimately disable this for a number of
different private field and accessor invocations.
Differential Revision: https://phabricator.services.mozilla.com/D109402
By storing NameLocations we also get a BindingKind, which allows us to disambiguate between
PrivateMethods and Synthetics.
Differential Revision: https://phabricator.services.mozilla.com/D109401
This would cause private methods to be marked as such on scopes, except that
the parser still declares them as `DeclarationKind::Synthetic` for now.
Depends on D108293
Differential Revision: https://phabricator.services.mozilla.com/D108294
This affects bytecode, as Synthetic bindings do not get TDZ checks.
This patch also tightens up some assertions when creating ScopeData. There are
several methods that create ScopeData, and they had gotten out of sync. The
assertions check that the ScopeData is not silently dropping bindings that were
present in ParseContext::Scope::declared_.
Depends on D108292
Differential Revision: https://phabricator.services.mozilla.com/D108293
This is currently used only by the bindings in a ClassBodyScope.
The behavior of these bindings is like Var bindings. There is no longer a TDZ
check, and we don't bother marking them as Uninitialized. So the special case
introduced in bug 1683746, peeking at the binding name to see if we should skip
the TDZ check, is no longer needed.
Depends on D108290
Differential Revision: https://phabricator.services.mozilla.com/D108291
This adds a hasPrivateBrand bit to the MemberInitializers struct in the
stencil. It is necessary to persist this bit across compilation units because
emitInitializeInstanceMembers can be called in direct eval code inside a
derived-class constructor.
Since .privateBrand is currently a `let` binding, this currently emits an
unnecessary CheckAliasedLexical instruction in the constructor for each class
that has nonstatic private methods. We'll eliminate these later on.
Depends on D108289
Differential Revision: https://phabricator.services.mozilla.com/D108290
Not every class gets this special binding. It will be needed for all classes
that have any nonstatic private methods, getters, or setters. With this patch,
we create a .privateBrand binding in the scopes for such classes, and populate
it with a symbol when initializing the class. However, it is not yet being used
anywhere; the constructor does not yet stamp instances with the private brand.
Depends on D108288
Differential Revision: https://phabricator.services.mozilla.com/D108289
It is a copy of BlockLexicalEnvironmentObject. Note that
- ClassBodyScope is *not* a LexicalScope, BUT
- ClassBodyLexicalEnvironmentObject *is* a LexicalEnvironmentObject
This is strictly a matter of how much implementation is shared. The word
"Lexical" in LexicalEnvironmentObject, and to some extent throughout
SpiderMonkey, is alas already pretty meaningless. In the language
specification, all environments are lexical environments.
Depends on D108286
Differential Revision: https://phabricator.services.mozilla.com/D108287
Note: This revision will have to be folded with Parts 3 and 4 before landing, as
the op PushLexicalEnv breaks here, and is replaced with PushClassBodyEnv in Part 4.
Depends on D108283
Differential Revision: https://phabricator.services.mozilla.com/D108284
Use the existing intrinsic function call processing of self-hosting, the BCE
can also resolve _SetIsInlinableLargeFunction. To do this, we also track the
latest top-level FunctionBox that was processed to allow easily updating
flags without a dedicated hashmap. This change lets us make the flag
immutable now.
Differential Revision: https://phabricator.services.mozilla.com/D112411
Currently when resuing the leftmost leaf's buffer we have duplicate code to run
the traversal up until we reach the leftmost rope, because the left child has
been already been processed as a sepcial case. This removes this and checks a
flag in the main traversal code to handle this situation.
Differential Revision: https://phabricator.services.mozilla.com/D112391
I found it confusing using |this| in a method that operated on a many different
nodes. This makes it static and passes the root as a named parameter so it's
clearer what's going on.
Differential Revision: https://phabricator.services.mozilla.com/D112389
As an intermediate step to allow mach commands as standalone functions, the MachCommandBase
subclass instance that currently corresponds to self has to be made available as a separate
argument (named command_context).
Differential Revision: https://phabricator.services.mozilla.com/D109650
Cranelift tier-3 compile failed on buildbot due to a disabled feature
that exposed a private field as unused. Make the field conditional on
the feature.
Differential Revision: https://phabricator.services.mozilla.com/D112467
Currently when resuing the leftmost leaf's buffer we have duplicate code to run
the traversal up until we reach the leftmost rope, because the left child has
been already been processed as a sepcial case. This removes this and checks a
flag in the main traversal code to handle this situation.
Differential Revision: https://phabricator.services.mozilla.com/D112391
I found it confusing using |this| in a method that operated on a many different
nodes. This makes it static and passes the root as a named parameter so it's
clearer what's going on.
Differential Revision: https://phabricator.services.mozilla.com/D112389
The iterator is based on Shape::Range, but is a bit more ergonomic and doesn't expose
the property's Shape. This means when we change the shape's property representation
later on we only have to change the iterator implementation.
Also start using `shape()` instead of `lastProperty()` because `lastProperty` will
either be removed or changed in the future, to decouple shapes and properties more.
The code generated by Clang for some of these functions looks good: the compiler
is able to optimize away the iterator and ShapePropertyWithKey code.
Differential Revision: https://phabricator.services.mozilla.com/D112329
The features rewrite got the names of the Firefox wasm prefs wrong, they
all have a wasm_ prefix that got chopped off. This puts it back.
It sucks that we don't have meaningful test cases for this. A manual
test case (see bug) is easy, but how to automate it?
Differential Revision: https://phabricator.services.mozilla.com/D112325