dart-sdk/sdk/lib
Ömer Sinan Ağacan 8b1aa1860f [dart2wasm] Use single unsigned cmp instead of two cmps when possible
wasm-opt doesn't optimize `0 < x || x > y` when y is known to be
positive (e.g. a positive integer constant), so we do it manually.

We also do it in a few places where `y` is not known to be positive in
the Wasm code, but we know it's always positive, for example when it's a
length.

Example improvement in the wasm-opt output:

```
   (func $_newArrayLengthCheck (;426;) (param $var0 i64) (result i64)
     local.get $var0
     i64.const 2147483647
-    i64.le_s
-    local.get $var0
-    i64.const 0
-    i64.ge_s
-    i32.and
-    i32.eqz
+    i64.gt_u
     if
       i32.const 46
       i32.const 0
@@ -19190,13 +19172,8 @@
               i64.const 97
               i64.sub
               local.tee $var3
-              i64.const 0
-              i64.ge_s
-              local.get $var3
               i64.const 5
-              i64.le_s
-              i32.and
-              i32.eqz
+              i64.gt_u
               if
                 local.get $var0
                 local.get $var6
@@ -19810,10 +19787,10 @@
     global.get $global4
     array.new_fixed $Array<_Type> 2
   )
```

Closes #56083.

Change-Id: Idb1dd0d0809b26be8aec3d082aa341c59e1a353d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373663
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-06-29 08:12:50 +00:00
..
_http [io] Propagate cancellation in _HttpOutgoing.addStream 2024-06-02 20:33:26 +00:00
_internal [dart2wasm] Use single unsigned cmp instead of two cmps when possible 2024-06-29 08:12:50 +00:00
_wasm [dart2wasm] Use single unsigned cmp instead of two cmps when possible 2024-06-29 08:12:50 +00:00
async Don't allow completing a _Future with itself. 2024-05-14 15:44:07 +00:00
cli [vm] Remove dart:cli from dartdoc 2024-02-29 13:57:27 +00:00
collection fix typo "no key was not found" 2024-06-25 15:11:39 +00:00
convert Remove Utf8Decoder._convertIntercepted hook 2023-11-23 12:25:26 +00:00
core Reapply "[js_runtime, js_dev_runtime] Implement microsecond field of DataTime" 2024-05-31 15:42:14 +00:00
developer Update various flutter.dev links to more stable destinations 2024-06-20 19:30:02 +00:00
ffi [vm/ffi] address of operator for FFI leaf calls 2024-04-25 10:06:16 +00:00
html Fix broken links in dart:html package. 2024-04-18 18:10:45 +00:00
indexed_db [sdk/js_interop] Clean up and add a few minimal API docs 2024-02-12 14:44:54 +00:00
internal Reland "Tweak expect.dart library." 2024-04-26 15:28:26 +00:00
io [io,doc]: Point out that exit does not kill child processes. 2024-06-10 22:58:28 +00:00
isolate Refer to unnamed constructors in doc comments with '.new' 2023-10-17 14:42:38 +00:00
js Update JSExport docs to refer to createJSInteropWrapper 2024-02-14 00:36:25 +00:00
js_interop [dart2wasm/ddc/dart2js] Lower Function.toJS and JSExportedDartFunction.toDart 2024-06-26 23:06:36 +00:00
js_interop_unsafe [dart:js_interop/_unsafe] Clean up API docs 2024-02-29 04:15:49 +00:00
js_util [sdk/js_interop] Clean up and add a few minimal API docs 2024-02-12 14:44:54 +00:00
math [sdk/math] Mark Point, Rectangle, and MutableRectangle as legacy 2024-02-14 18:35:17 +00:00
mirrors [vm] Add minimal support for mirrors of extension type members 2023-12-07 21:48:50 +00:00
svg svg: do not rename inherited ListMixin.length= parameter 2024-06-27 17:07:20 +00:00
typed_data Add @Since annotation, correct changelog entry position. 2024-06-20 15:35:56 +00:00
vmservice [VM / vmservice] Run service isolate in sound null safe mode (JIT) 2024-03-13 17:56:49 +00:00
web_audio [sdk/js_interop] Clean up and add a few minimal API docs 2024-02-12 14:44:54 +00:00
web_gl [sdk/js_interop] Clean up and add a few minimal API docs 2024-02-12 14:44:54 +00:00
web_sql [docs] update dart:html template files 2024-01-12 18:17:13 +00:00
libraries.json [dart2wasm] Remove unused JSCM typed data lib 2024-06-25 11:00:49 +00:00
libraries.yaml [dart2wasm] Remove unused JSCM typed data lib 2024-06-25 11:00:49 +00:00
PRESUBMIT.py [build] Python 3.12 compatibility. 2023-12-12 18:19:35 +00:00
vmservice_libraries.json [Core Libraries] Eliminate the fork in the core libraries. 2020-06-16 23:37:36 +00:00
vmservice_libraries.yaml update the tooling to generate libraries.json from libraries.yaml 2021-07-27 23:02:50 +00:00