relrelb
06fce44665
avm1: Fix performance regression in `BitmapData::pixels_rgba`
...
It was regressed in #4822 when changed to use `flat_map`. But
currently Rust emits suboptimal code for such case. For now use
`Vec::with_capacity` manually to avoid unnecessary re-allocations.
2021-07-24 03:28:35 -07:00
relrelb
2ba103ac3f
web: Bump wasm-bindgen to 0.2.74
...
Also bump its helper crates (js-sys, wasm-bindgen-futures) to the
latest versions, except for web-sys which seems to be locked by wgpu
to one version before the latest (0.3.50).
2021-07-23 22:17:51 -07:00
relrelb
905cfb383a
web: Remove unused `wasm-bindgen-test` dependency
...
It's unclear how/whether it was used at all in the past...
2021-07-23 22:17:51 -07:00
Mike Welsh
8a2298bd8f
chore: Bump mesa-vulkan-drivers version
2021-07-22 00:30:18 -07:00
Aaron Hill
068e06e40f
Add support for image comparison tests
2021-07-21 21:48:24 -07:00
EmperorBale
38ae630aac
tests: Add test for generateRandomBytes
2021-07-21 18:09:21 +02:00
EmperorBale
1dee1e4166
avm2: Implement flash.crypto.generateRandomBytes
2021-07-21 18:09:21 +02:00
Mike Welsh
0bd8349cc9
avm2: AVM2 refactoring
2021-07-20 23:56:39 -07:00
David Wendt
db86ca84b9
avm2: `get_property` does not mutate the underlying object (anymore) so it should not be flagged as mutably borrowing it.
2021-07-20 22:14:05 -04:00
David Wendt
c30014baed
avm2: Remove `ScriptObjectClass` and replace with separately implemented methods on `ClassObject`
2021-07-20 22:12:33 -04:00
David Wendt
4d89341e19
avm2: Cache the instance allocator on class objects
2021-07-20 22:12:33 -04:00
David Wendt
2c927f2b6b
avm2: Make `coerce_to_type` take a class object instead of a multiname.
2021-07-20 22:12:33 -04:00
David Wendt
bd2f758976
avm2: Don't call native initializers when coercing primitives into objects.
...
The former native initializer call was incorrect and would cause spurious coercion failures. Since existing code assumes the error fork of `coerce_to_object` means undefined or null, this was causing coercions and parameter typechecks against primitives to fail in the most general case.
Attempting to fix this by providing the primitive value as native initializer argument instead causes a stack overflow. This is because native initializer arguments still have to be typechecked, and in the most general case this means... coercing the primitive value we're already coercing into an object... into another object. This won't work.
Since primitive initializers aren't going to do anything that native coercions need to care about, I'm just removing the initializer call.
2021-07-20 22:12:32 -04:00
David Wendt
30b4c4386b
avm2: Replace the `call_strict` mechanism with checking to see if free functions are unchecked.
2021-07-20 22:12:32 -04:00
David Wendt
ddd73b3cd6
avm2: Supercalls should fall back to normal receiver access if there is no matching supertrait to use.
2021-07-20 22:12:31 -04:00
David Wendt
e9b9d64cb6
avm2: Rename `StageObject::graphics_of` to just `graphics`
2021-07-20 22:12:30 -04:00
David Wendt
b2c1299f79
tests: Add a test for bare calls on the ES4 class object
2021-07-20 22:12:28 -04:00
David Wendt
7871912d92
avm2: Calling ES4 class objects is treated as a coercion to that type.
2021-07-20 22:12:28 -04:00
David Wendt
ef4b6876db
core: MovieClips should initialize their AVM2 sides by calling `call_native_init`.
2021-07-20 22:12:28 -04:00
David Wendt
b469ef8a3f
avm2: Replace `deriver` language with `allocator` language
2021-07-20 22:12:28 -04:00
David Wendt
8af0481a23
avm2: Retire the use of "constructor" outside of literal reference to class initializer or instance initializer code.
...
Instead, the following terms are used:
* Static classes, to refer to `Class<'gc>`. Shortened to "class" in contexts where this is not ambiguous.
* Class objects, to refer to objects that represent a particular class. Also shortened to "class" in non-ambiguous contexts.
Downstream of this, the `base_constr` (referring to the class that a currently called trait has been pulled from) is now called `subclass_object` and several `TObject` methods have also been renamed.
2021-07-20 22:12:23 -04:00
David Wendt
6d907a0d10
avm2: Rename `ArrayObject::empty_array` to `ArrayObject::empty`.
2021-07-20 22:10:36 -04:00
David Wendt
05b7de7453
avm2: Avoid double iteration in `Names.contains_name`
2021-07-20 22:10:36 -04:00
David Wendt
6e2e686e0d
avm2: Rename `Method::Entry` to `Method::Bytecode`
2021-07-20 22:10:35 -04:00
David Wendt
b049f2e717
avm2: Rename `Method::from_builtin_only` to `Method::from_builtin`
2021-07-20 22:10:35 -04:00
David Wendt
d4fcca9787
avm2: Rename `call_initializer` and `call_native_initializer` to `call_init` and `call_native_init`
2021-07-20 22:10:34 -04:00
David Wendt
f5431a781e
docs: Fix stale comments in avm2
2021-07-20 22:10:34 -04:00
David Wendt
ccfa605260
avm2: Use `extend_from_slice`
2021-07-20 22:10:34 -04:00
David Wendt
a60a499f31
avm2: Rename `resolve_parameter_value` to `resolve_parameter`
2021-07-20 22:10:33 -04:00
David Wendt
9e997e6571
avm2: Split out `Method` and `Executable`'s native fork into `NativeMethod` and `NativeExecutable`, respectively.
...
This also implies renaming the existing type alias of the same name to `NativeMethodImpl`.
2021-07-20 22:10:33 -04:00
David Wendt
c7858f9447
avm2: Simplify/correct the value numerical checks
2021-07-20 22:10:32 -04:00
David Wendt
7dc86fdeb0
swf: Throw an error if an ABC bitstream calls for a parameter with more optional parameters than actual ones.
2021-07-20 22:10:30 -04:00
David Wendt
5018421eef
avm2: Rename `SystemConstructors` to `SystemClasses`
2021-07-20 22:08:27 -04:00
David Wendt
2c2f03ba23
chore: Clippy compliance on Rust nightly
2021-07-20 22:05:37 -04:00
David Wendt
21a994ee8a
tests: Actually run the `istypelate_coerce` test
2021-07-20 22:05:37 -04:00
David Wendt
d0478a1f40
avm2: Allow builtins to also hold parameter type metadata.
...
This is limited by the fact that we currently cannot store type metadata in static tables. I don't think it's necessary to do so as of yet as pretty much every actual parameter type I *could* shove in here turned out to be optional and broke tests if it wasn't. Still, it's probably useful enough for new classes to include.
2021-07-20 22:05:36 -04:00
David Wendt
e38b1bc281
avm2: Make numbers appear to be of any numeric type that can represent them.
...
This also prevents an exception from being fired when testing `undefined` or `null`, which are valid inputs to `istype`.
2021-07-20 22:05:35 -04:00
David Wendt
974fe152ff
avm2: Include the parameter coercions into `op_coerce`
2021-07-20 22:05:34 -04:00
David Wendt
8b48b79f5d
avm2: Make the `pool_` and `table_` functions no longer take a superfluous mutation context.
...
This also adds a new `pool_multiname_static_any` method that treats zero as `*` instead of an error.
2021-07-20 22:05:33 -04:00
David Wendt
2d3ef5493b
tests: Add tests for default parameters, type checks, and implicit typecheck coercions
2021-07-20 22:05:33 -04:00
David Wendt
abc9d0800a
avm2: `undefined` is normalized to `null` for string and object coercions
2021-07-20 22:05:32 -04:00
David Wendt
4122c1b96e
swf: Default method parameters are indexed starting from the first optional parameter, not from zero.
2021-07-20 22:05:29 -04:00
David Wendt
b779804075
avm2: Relax the maximum arguments check for functions called from native code.
2021-07-20 22:02:11 -04:00
David Wendt
ae086d6aa7
avm2: Implement implicit coercion for primitive types
2021-07-20 22:02:10 -04:00
David Wendt
63cf6a7b47
avm2: Implement parameter typechecking for script functions.
...
This commit breaks 15 tests, mostly due to implicit coercion that happens at function call time. This will be implemented shortly.
2021-07-20 22:02:10 -04:00
David Wendt
65ffa0684b
core: Use the new construct pathway for building AVM2 `TextFormat` objects
2021-07-20 22:02:09 -04:00
David Wendt
5c6c3191ef
avm2: Enforce `final` on traits.
2021-07-20 22:02:09 -04:00
David Wendt
7d86c93ddc
Check to make sure that overrides only apply to already-installed properties.
2021-07-20 22:02:08 -04:00
David Wendt
5662527c9e
avm2: Enforce `interface` checks: classes cannot extend interfaces and cannot implement other classes.
2021-07-20 22:02:08 -04:00
David Wendt
7eca7d5331
avm2: Enforce `final` on classes
2021-07-20 22:02:07 -04:00