Commit Graph

2576 Commits

Author SHA1 Message Date
Mike Welsh b99b9efe5d scanner: Switch to clap 3.0 2020-08-14 14:12:08 -07:00
Mike Welsh f195d254ec exporter: Switch to clap 3.0 2020-08-14 14:12:08 -07:00
Mike Welsh 1a267cfa85 core: Add git revision to version info 2020-08-14 14:12:08 -07:00
Mike Welsh e49332c43c desktop: Switch to clap 3.0.0-beta1
Prepare for next major release of clap.
Dump structopt, which has been merged into clap.
2020-08-14 14:12:08 -07:00
JustinCB a2968d6fd0 web: Change polyfills to single true/false setting 2020-08-13 00:46:58 -07:00
JustinCB f8c40569be i18n: Add Settings Saved to locales 2020-08-13 00:41:23 -07:00
Albert Safin e03373bceb avm1: parseInt 2020-08-13 00:40:20 -07:00
Mike Welsh cbd448522a chore: Allow unknown clippy lints
same_item_push was added on nightly, but is currently throwing
a false negative. I added an allow for it, but this causes a
warning on stable for an unknown lints, so allow unknown lints for
now.
2020-08-12 23:51:12 -07:00
Mike Welsh 6c89869210 chore: Fix clippy lints 2020-08-12 19:04:14 -07:00
JustinCB 5f3aeb91ed chore: Run npm audit fix 2020-08-12 18:55:13 -07:00
dependabot-preview[bot] 9b6dd45439 build(deps): bump smallvec from 1.4.1 to 1.4.2
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.1...v1.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-12 11:13:33 -07:00
David Wendt 825eb34c67 avm1: `Button` should not hold write locks on itself when instantiating children.
This fixes a bug where a nested textfield within a button with variable linkages would panic in Ruffle.
2020-08-12 11:08:27 -07:00
David Wendt 354b194b69 avm1: Add test for nested text fields in buttons. 2020-08-12 11:08:27 -07:00
dependabot-preview[bot] a96219edbd build(deps): bump serde from 1.0.114 to 1.0.115
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.114 to 1.0.115.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.114...v1.0.115)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-10 16:39:16 -07:00
David Wendt c2cdc302c3 Remove further unnecessary primitive comparison checks 2020-08-10 16:38:04 -07:00
David Wendt 993f56798e Extract all of the numerical conversions into a separate module and leverage them where appropriate in AVM2 2020-08-10 16:38:04 -07:00
David Wendt 566b262d60 Move all our custom object implementations into a separate module, and use a macro to implement them. 2020-08-10 16:38:04 -07:00
David Wendt 5bcd1be270 Remove another instance of `abs` for zero-checks. 2020-08-10 16:38:04 -07:00
David Wendt 2f55c08e37 `pushbyte` should generate signed integers rather than `Number`s. 2020-08-10 16:38:04 -07:00
David Wendt 7f479f24b9 Adjust `coerce_to_string` to be less silly. 2020-08-10 16:38:04 -07:00
David Wendt a12f51903f Non-finite covers everything here. 2020-08-10 16:38:04 -07:00
David Wendt 2e8acfe6f7 Apparantly, Rust already does not care about negative zero, so we don't need to, either. 2020-08-10 16:38:04 -07:00
David Wendt 1bb6f84beb Avoid hitting `coerce_to_number` for integer comparison cases. 2020-08-10 16:38:04 -07:00
David Wendt 4e92352813 Don't promote to `f64` in strict-equality comparisons if we can promote to `i64` instead. 2020-08-10 16:38:04 -07:00
David Wendt a211698464 Handle strict and abstract equality of our various number subtypes as if they were all the same type.
ECMA-262 3rd ed. doesn't mention anything about different number types, so the standard as-if rule applies. If we are going to distinguish number types, we have to treat them as if they were the same type, promoting to `f64` as necessary to facilitate the conversion. I took a cursory look at an ECMA-262 4th ed. draft and it appears to do the same, although it calls everything `GeneralNumber` and has some really confusing psuedo-Pascal syntax for some reason.

I am extremely glad AVM2 does not provide access to 64-bit integer types (for now, at least).
2020-08-10 16:38:04 -07:00
David Wendt f3e47cb596 Further adjustments due to the massive refactor of `Activation`, `AvmX`, and `UpdateContext`. 2020-08-10 16:38:04 -07:00
David Wendt ea4c42a6d1 Split `Value::Number` into separate floating-point, integer, and unsigned representations to match the three numerical classes provided by AS3. 2020-08-10 16:38:04 -07:00
David Wendt a0895e843c Fix `matches!` lint in nightly Rust being tripped. 2020-08-10 16:38:04 -07:00
David Wendt b779dccdc1 Allow objects to provide a coercion hint for cases where a more obvious one is not available. 2020-08-10 16:38:04 -07:00
David Wendt d14fa845c2 Remove `Value::Namespace`.
Namespaces as values adds a bunch of extra special cases to the coercion and equality rules that don't really belong there. Namespace itself just returns it's URI as a string, so we can just make `NamespaceObject` do that and then treat it the same way we treat boxed primitives.
2020-08-10 16:38:04 -07:00
David Wendt e6aac48ae2 Add `NamespaceObject` to hold `Namespace`s.
The reason for this will become very apparent, very shortly.
2020-08-10 16:38:04 -07:00
David Wendt aeb1752d0f `PrimitiveObject`'s `toString` and `valueOf` should always yield their boxed values. 2020-08-10 16:38:04 -07:00
David Wendt 65b4392642 Remove `as_number`.
The only code that used it was the enumeration operations in AVM2.
2020-08-10 16:38:04 -07:00
David Wendt 4906c5a3f1 Remove uses of `as_string` in various places.
These include:

 * Name resolution in `newobject`
 * All runtime & late-bound multinames
 * `Object.hasOwnProperty`
 * `Object.propertyIsEnumerable`
 * `Object.setPropertyIsEnumerable`
2020-08-10 16:38:04 -07:00
David Wendt c040997be2 *Actually* fix the conversion.
So, I overlooked this reading the 1.45 documentation, but the first thing they did is completely change f64 conversions. Apparantly, what I was doing (and what JavaScript spec dictates) is actually considered UB in LLVM, and my ability to actually write a concise wrapping u32 conversion is actually a soundness hole in Rust. Ergo, I'm now emulating the wrapping and sign calculation, which makes this both passing it's tests again and free of soundness holes and UB.
2020-08-10 16:38:04 -07:00
David Wendt 473414e167 Explicitly request `u64` be involved with `u32` coercions.
I don't know why I'm doing this - tests are failing in CI but not locally, and I can only assume that the most obvious conversion is broken in some way on whatever other architecture GitHub Actions uses. This will explicitly mask the integer result as a u64, and then convert it down to u32. A not-broken compiler should treat this code identically.
2020-08-10 16:38:04 -07:00
David Wendt 962f6aa54c Remove `as_object`.
AVM2 is based on ES4, which as far as I'm aware, does not distinguish between "primitive values" and "objects". Thus, it is expedient to interpret any statement requiring something to be an Object to mean "not null or undefined".

Since we internally represent register values with primitive types, it is important that the VM always coerces to object before doing any other sort of type checking. Hence, something like `as_object` is unhelpful as it accidentally enforces a primitive/object distinction that ES4 attempted to remove.
2020-08-10 16:38:04 -07:00
David Wendt 8de063a916 Implement automatic primitive boxing via `coerce_to_object`. 2020-08-10 16:38:04 -07:00
David Wendt f12f67650b Stub all primitive type classes. 2020-08-10 16:38:04 -07:00
David Wendt cb0f1e9099 Add a new object variant for boxed primitives. 2020-08-10 16:38:04 -07:00
David Wendt 6ec1d453b8 Add tests for `greaterequals`, `greaterthan`, `lessequals`, and `lessthan`. 2020-08-10 16:38:04 -07:00
David Wendt b7dfce51b8 Implement `greaterequals`, `greaterthan`, `lessequals`, and `lessthan`. 2020-08-10 16:38:04 -07:00
David Wendt f88f2e225a Add tests for `>`, `<`, `<=`, and `>=`.
Note that this does NOT completely test the full range of if instructions for abstract relational comparison. Notably, the Adobe Animate CC compiler compiles each operator into it's negated equivalent, e.g. `<` becomes `ifnlt`.

I do not know how to get it to emit `ifge` or the like, which differ only by how they handle `NaN`s.
2020-08-10 16:38:04 -07:00
David Wendt 730c47cf29 Implement `ifge`, `ifgt`, `ifle`, `iflt`, `ifnge`, `ifngt`, `ifnle`, and `ifnlt`. 2020-08-10 16:38:04 -07:00
David Wendt 70a27ccb81 Implement ECMA abstract relational comparison 2020-08-10 16:38:04 -07:00
David Wendt 2ef03c6019 Allow no-hint primitive coercion 2020-08-10 16:38:04 -07:00
David Wendt 76ab8570e4 Implement and test `equals`.
The test is also far more in-depth than the `if_eq`/`if_ne` tests, which use the same set of vectors as the strict-equality tests from a while ago. Interestingly, this test passed on first run
2020-08-10 16:38:04 -07:00
David Wendt 5da4e2f118 Test for `iseq` and `isne` 2020-08-10 16:38:04 -07:00
David Wendt 29d5ae9989 Implement `ifeq` and `ifne`. 2020-08-10 16:38:04 -07:00
David Wendt ccc478e7dd Implement ECMA-262 abstract equality. 2020-08-10 16:38:04 -07:00