[L] Change in dart/sdk[main]: [record_use] Support `double` constants

0 views
Skip to first unread message

Daco Harkes (Gerrit)

unread,
Mar 13, 2026, 12:33:58 PMMar 13
to Sigmund Cherem, Nate Biggs, Commit Queue, Alexander Markov, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Sigmund Cherem

Daco Harkes added 1 comment

File pkg/compiler/test/record_use/data/lib/double_constants_js.dart
Line 18, Patchset 5 (Latest): // 9223372036854775807 (Int64.MAX).
Daco Harkes . unresolved

@sig...@google.com We have some funky behavior for dart2js. Is this expected?

For the large ints, the compiler refuses for to compile. But for these values it does something weird.

Open in Gerrit

Related details

Attention is currently required from:
  • Sigmund Cherem
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ic8c95094343d6d1fed3a37b0772269a8232bc205
Gerrit-Change-Number: 487860
Gerrit-PatchSet: 5
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Sigmund Cherem <sig...@google.com>
Gerrit-CC: Alexander Markov <alexm...@google.com>
Gerrit-CC: Nate Biggs <nate...@google.com>
Gerrit-Attention: Sigmund Cherem <sig...@google.com>
Gerrit-Comment-Date: Fri, 13 Mar 2026 16:33:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Sigmund Cherem (Gerrit)

unread,
Mar 13, 2026, 12:58:07 PMMar 13
to Daco Harkes, Sigmund Cherem, Nate Biggs, Commit Queue, Alexander Markov, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Daco Harkes

Sigmund Cherem voted and added 1 comment

Votes added by Sigmund Cherem

Code-Review+1

1 comment

File pkg/compiler/test/record_use/data/lib/double_constants_js.dart
Line 18, Patchset 5 (Latest): // 9223372036854775807 (Int64.MAX).
Daco Harkes . unresolved

@sig...@google.com We have some funky behavior for dart2js. Is this expected?

For the large ints, the compiler refuses for to compile. But for these values it does something weird.

Sigmund Cherem

Yes!

dart2js maps all numbers to JS numbers, which have 53-bit of precision. In dart2js our int implementation is a subtype of double. That's why you can use `1.0 == 1` to test whether you are running in a JS backend vs dart2wasm or the VM. We map any number whose floor equal to itself to the `int` type.

Check out this article that shares a lot more details: https://dart.dev/resources/language/number-representation

Open in Gerrit

Related details

Attention is currently required from:
  • Daco Harkes
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ic8c95094343d6d1fed3a37b0772269a8232bc205
Gerrit-Change-Number: 487860
Gerrit-PatchSet: 5
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Sigmund Cherem <sig...@google.com>
Gerrit-CC: Alexander Markov <alexm...@google.com>
Gerrit-CC: Nate Biggs <nate...@google.com>
Gerrit-Attention: Daco Harkes <dacoh...@google.com>
Gerrit-Comment-Date: Fri, 13 Mar 2026 16:58:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Daco Harkes <dacoh...@google.com>
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
Mar 17, 2026, 4:46:50 AMMar 17
to Daco Harkes, Sigmund Cherem, Nate Biggs, Alexander Markov, dart2js-te...@google.com, rev...@dartlang.org

Commit Queue submitted the change

Unreviewed changes

5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Change information

Commit message:
[record_use] Support `double` constants

Quirks:
- JS backend compiles some values to ints instead of doubles.

Closes: https://github.com/dart-lang/native/issues/3221

TEST=pkg/compiler/test/record_use/record_use_test.dart
TEST=pkg/dart2wasm/test/record_use_test.dart
TEST=pkg/vm/test/transformations/record_use_test.dart
Change-Id: Ic8c95094343d6d1fed3a37b0772269a8232bc205
Cq-Include-Trybots: luci.dart.try:dart2wasm-asserts-linux-chrome-try,dart2wasm-asserts-minified-linux-d8-try,dart2wasm-linux-chrome-try,dart2wasm-linux-d8-try,dart2wasm-linux-firefox-try,dart2wasm-linux-jscm-chrome-try,dart2wasm-linux-optimized-jsc-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try,dart2js-canary-linux-try,dart2js-hostasserts-linux-d8-try,dart2js-linux-chrome-try,dart2js-linux-firefox-try,dart2js-mac-chrome-try,dart2js-mac-safari-try,dart2js-minified-csp-linux-chrome-try,dart2js-minified-linux-d8-try,dart2js-unit-linux-x64-release-try,dart2js-win-chrome-try
Reviewed-by: Sigmund Cherem <sig...@google.com>
Files:
  • M DEPS
  • M pkg/compiler/lib/src/universe/recorded_use.dart
  • A pkg/compiler/test/record_use/data/lib/double_constants_js.dart
  • A pkg/compiler/test/record_use/data/lib/double_constants_js.dart.json.expect
  • M pkg/compiler/test/record_use/record_use_test.dart
  • M pkg/vm/lib/transformations/record_use/record_use.dart
  • A pkg/vm/testcases/transformations/record_use/lib/double_constants.dart
  • A pkg/vm/testcases/transformations/record_use/lib/double_constants.dart.aot.expect
  • A pkg/vm/testcases/transformations/record_use/lib/double_constants.dart.json.expect
  • A pkg/vm/testcases/transformations/record_use/lib/double_constants_js_divergent.dart
  • A pkg/vm/testcases/transformations/record_use/lib/double_constants_js_divergent.dart.aot.expect
  • A pkg/vm/testcases/transformations/record_use/lib/double_constants_js_divergent.dart.json.expect
Change size: L
Delta: 12 files changed, 475 insertions(+), 10 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Sigmund Cherem
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ic8c95094343d6d1fed3a37b0772269a8232bc205
Gerrit-Change-Number: 487860
Gerrit-PatchSet: 7
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Sigmund Cherem <sig...@google.com>
Gerrit-CC: Alexander Markov <alexm...@google.com>
Gerrit-CC: Nate Biggs <nate...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages