[L] Change in dart/sdk[main]: [dart2js] Remove `@pragma('dart2js:resource-identifier')`

0 views
Skip to first unread message

Daco Harkes (Gerrit)

unread,
Jan 9, 2026, 5:05:59 AM (2 days ago) Jan 9
to Nate Biggs, Mayank Patke, Commit Queue, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Mayank Patke and Nate Biggs

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Mayank Patke
  • Nate Biggs
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I7e80a54e627b77af16e27464320cf4a9703c05e6
Gerrit-Change-Number: 471720
Gerrit-PatchSet: 4
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Mayank Patke <fishyt...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Mayank Patke <fishyt...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 10:05:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Jan 9, 2026, 12:55:12 PM (2 days ago) Jan 9
to Daco Harkes, Mayank Patke, Commit Queue, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Daco Harkes and Mayank Patke

Nate Biggs voted and added 6 comments

Votes added by Nate Biggs

Code-Review+1

6 comments

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Nate Biggs . resolved

The tenses on a bunch of the members and variables are a little confusing. I left some suggestions below on renames. Mostly focusing on a "verb first" naming scheme.

File pkg/compiler/lib/src/js_backend/annotations.dart
Line 119, Patchset 5 (Latest): typesCheck: {parameterCheck, downcastCheck},
Nate Biggs . unresolved

Jus realized, should we have `recordUse: {noInline}` here? Rather than adding it above in `ir/annotations.dart`.

This keeps all the implied pragmas in one place.

Line 145, Patchset 5 (Latest): 'prefer-inline': tryInline,
Nate Biggs . unresolved

We don't fully know that no one in the community isn't using `resource-identifier`. For backward compatibility it's probably safer to just add an alias here that maps the old pragma name to the new pragma value.

The docs won't mention the old name at all so I wouldn't expect any new users to find the alias. So it would just be precautionary.

Line 657, Patchset 5 (Latest): bool methodRecordUses(MemberEntity member) {
Nate Biggs . unresolved

Rename to `shouldRecordMethodUses`

File pkg/compiler/lib/src/ssa/codegen.dart
Line 2386, Patchset 5 (Latest): methodRecordUse = _methodRecordUse(
Nate Biggs . unresolved

rename var here to `recordedMethodUses`

Line 2405, Patchset 5 (Latest): RecordedUse _methodRecordUse(
Nate Biggs . unresolved

`_recordMethodUses`

Open in Gerrit

Related details

Attention is currently required from:
  • Daco Harkes
  • Mayank Patke
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • 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: I7e80a54e627b77af16e27464320cf4a9703c05e6
Gerrit-Change-Number: 471720
Gerrit-PatchSet: 5
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Mayank Patke <fishyt...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Attention: Daco Harkes <dacoh...@google.com>
Gerrit-Attention: Mayank Patke <fishyt...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 17:55:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Daco Harkes (Gerrit)

unread,
Jan 9, 2026, 2:05:46 PM (2 days ago) Jan 9
to Nate Biggs, Mayank Patke, Commit Queue, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Mayank Patke and Nate Biggs

Daco Harkes added 1 comment

File pkg/compiler/lib/src/js_backend/annotations.dart
Line 119, Patchset 5 (Latest): typesCheck: {parameterCheck, downcastCheck},
Nate Biggs . unresolved

Jus realized, should we have `recordUse: {noInline}` here? Rather than adding it above in `ir/annotations.dart`.

This keeps all the implied pragmas in one place.

Daco Harkes

I tried this. However then you get hints because the annotation is converted to both. So then I removed the implied annotation. But then stuff started being inlined. I didn't dig deeper than that and simply reverted. Do you want me to dig into this more?

Open in Gerrit

Related details

Attention is currently required from:
  • Mayank Patke
  • Nate Biggs
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • 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: I7e80a54e627b77af16e27464320cf4a9703c05e6
Gerrit-Change-Number: 471720
Gerrit-PatchSet: 5
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Mayank Patke <fishyt...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Mayank Patke <fishyt...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 19:05:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
satisfied_requirement
open
diffy

Daco Harkes (Gerrit)

unread,
Jan 9, 2026, 2:26:41 PM (2 days ago) Jan 9
to Nate Biggs, Mayank Patke, Commit Queue, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Mayank Patke and Nate Biggs

Daco Harkes voted and added 4 comments

Votes added by Daco Harkes

Commit-Queue+1

4 comments

File pkg/compiler/lib/src/js_backend/annotations.dart
Line 145, Patchset 5: 'prefer-inline': tryInline,
Nate Biggs . resolved

We don't fully know that no one in the community isn't using `resource-identifier`. For backward compatibility it's probably safer to just add an alias here that maps the old pragma name to the new pragma value.

The docs won't mention the old name at all so I wouldn't expect any new users to find the alias. So it would just be precautionary.

Daco Harkes

Done

Line 657, Patchset 5: bool methodRecordUses(MemberEntity member) {
Nate Biggs . resolved

Rename to `shouldRecordMethodUses`

Daco Harkes

Done

File pkg/compiler/lib/src/ssa/codegen.dart
Line 2386, Patchset 5: methodRecordUse = _methodRecordUse(
Nate Biggs . resolved

rename var here to `recordedMethodUses`

Daco Harkes

Done

Line 2405, Patchset 5: RecordedUse _methodRecordUse(
Nate Biggs . resolved

`_recordMethodUses`

Daco Harkes

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Mayank Patke
  • Nate Biggs
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • 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: I7e80a54e627b77af16e27464320cf4a9703c05e6
Gerrit-Change-Number: 471720
Gerrit-PatchSet: 6
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Mayank Patke <fishyt...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Mayank Patke <fishyt...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 19:26:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
satisfied_requirement
open
diffy

Daco Harkes (Gerrit)

unread,
Jan 9, 2026, 3:31:31 PM (2 days ago) Jan 9
to Nate Biggs, Mayank Patke, Commit Queue, dart2js-te...@google.com, rev...@dartlang.org
Attention needed from Mayank Patke and Nate Biggs

Daco Harkes voted and added 2 comments

Votes added by Daco Harkes

Commit-Queue+2

2 comments

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Daco Harkes . resolved

Thanks Nate!

File pkg/compiler/lib/src/js_backend/annotations.dart
Line 119, Patchset 5: typesCheck: {parameterCheck, downcastCheck},
Nate Biggs . resolved

Jus realized, should we have `recordUse: {noInline}` here? Rather than adding it above in `ir/annotations.dart`.

This keeps all the implied pragmas in one place.

Daco Harkes

I tried this. However then you get hints because the annotation is converted to both. So then I removed the implied annotation. But then stuff started being inlined. I didn't dig deeper than that and simply reverted. Do you want me to dig into this more?

Daco Harkes

As discussed offline, leaving a TODO to check this later.

Open in Gerrit

Related details

Attention is currently required from:
  • Mayank Patke
  • Nate Biggs
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • 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: I7e80a54e627b77af16e27464320cf4a9703c05e6
Gerrit-Change-Number: 471720
Gerrit-PatchSet: 6
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Mayank Patke <fishyt...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Mayank Patke <fishyt...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 20:31:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Daco Harkes <dacoh...@google.com>
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
Jan 9, 2026, 3:38:37 PM (2 days ago) Jan 9
to Daco Harkes, Nate Biggs, Mayank Patke, dart2js-te...@google.com, rev...@dartlang.org

Commit Queue submitted the change with unreviewed changes

Unreviewed changes

5 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: pkg/compiler/lib/src/js_backend/annotations.dart
Insertions: 6, Deletions: 2.

@@ -117,6 +117,9 @@
static const Map<PragmaAnnotation, Set<PragmaAnnotation>> implies = {
typesTrust: {parameterTrust, downcastTrust},
typesCheck: {parameterCheck, downcastCheck},
+ // TODO(dacoharkes,natebiggs): Removing `RecordUse` being converted to
+ // noInline and enabling this doesn't work. Why not?
+ // recordUse: {noInline},
};
static const Map<PragmaAnnotation, Set<PragmaAnnotation>> excludes = {
noInline: {tryInline},
@@ -143,6 +146,7 @@
// Aliases
'never-inline': noInline,
'prefer-inline': tryInline,
+ 'resource-identifier': recordUse,
};
}

@@ -361,7 +365,7 @@
String getLoadLibraryPriority(ir.LoadLibrary node);

/// Determines whether [member] is annotated with `RecordUse()`.
- bool methodRecordUses(FunctionEntity member);
+ bool shouldRecordMethodUses(FunctionEntity member);

/// Is this node in a context requesting that the captured stack in a `throw`
/// expression generates extra code to avoid having a runtime helper on the
@@ -654,7 +658,7 @@
}

@override
- bool methodRecordUses(MemberEntity member) {
+ bool shouldRecordMethodUses(MemberEntity member) {
EnumSet<PragmaAnnotation>? annotations = pragmaAnnotations[member];
if (annotations != null) {
if (annotations.contains(PragmaAnnotation.recordUse)) {
```
```
The name of the file: pkg/compiler/lib/src/ssa/codegen.dart
Insertions: 6, Deletions: 6.

@@ -2360,7 +2360,7 @@
);
} else {
StaticUse staticUse;
- Object? methodRecordUse;
+ Object? recordedMethodUses;
if (element is ConstructorEntity) {
CallStructure callStructure = CallStructure.unnamed(
arguments.length,
@@ -2382,8 +2382,8 @@
callStructure,
node.typeArguments,
);
- if (_closedWorld.annotationsData.methodRecordUses(element)) {
- methodRecordUse = _methodRecordUse(
+ if (_closedWorld.annotationsData.shouldRecordMethodUses(element)) {
+ recordedMethodUses = _recordMethodUses(
element,
callStructure,
node.inputs,
@@ -2396,13 +2396,13 @@
push(
js.Call(pop(), arguments, sourceInformation: node.sourceInformation),
);
- if (methodRecordUse != null) {
- push(pop().withAnnotation(methodRecordUse));
+ if (recordedMethodUses != null) {
+ push(pop().withAnnotation(recordedMethodUses));
}
}
}

- RecordedUse _methodRecordUse(
+ RecordedUse _recordMethodUses(
FunctionEntity element,
CallStructure callStructure,
List<HInstruction> arguments,
```

Change information

Commit message:
[dart2js] Remove `@pragma('dart2js:resource-identifier')`

The same functionality is available with `@RecordUse()` now.

This CL renames all the implementation to refer to recorded uses
instead of resource identifiers. These are only renames, there is no
logical change.

This CL keeps the implementation to be the pragma machinery. The
pragmas.md has been updated to reflect that the pragma should not be
used but that `RecordUse()` should be used instead.

This CL does _not_ change the `--write-resources` command-line flag.
We'll decide on some flag that works across all compiler backends in
the future: https://github.com/dart-lang/native/issues/2939.

This CL updates the documentation to talk about `@RecordUse()`.
Change-Id: I7e80a54e627b77af16e27464320cf4a9703c05e6
Cq-Include-Trybots: luci.dart.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-linux-chrome-try,dart2js-unit-linux-x64-release-try,dart2wasm-linux-jscm-chrome-try,dart2wasm-linux-optimized-jsc-try
Reviewed-by: Nate Biggs <nate...@google.com>
Commit-Queue: Daco Harkes <dacoh...@google.com>
Files:
  • M pkg/compiler/doc/pragmas.md
  • A pkg/compiler/doc/record_uses.md
  • D pkg/compiler/doc/resource_identifiers.md
  • M pkg/compiler/lib/compiler_api.dart
  • M pkg/compiler/lib/src/commandline_options.dart
  • M pkg/compiler/lib/src/common/codegen.dart
  • M pkg/compiler/lib/src/dart2js.dart
  • M pkg/compiler/lib/src/ir/annotations.dart
  • M pkg/compiler/lib/src/js_backend/annotations.dart
  • A pkg/compiler/lib/src/js_emitter/record_use_emitter.dart
  • D pkg/compiler/lib/src/js_emitter/resource_info_emitter.dart
  • M pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
  • M pkg/compiler/lib/src/options.dart
  • M pkg/compiler/lib/src/source_file_provider.dart
  • M pkg/compiler/lib/src/ssa/codegen.dart
  • R pkg/compiler/lib/src/universe/recorded_use.dart
  • M pkg/compiler/test/end_to_end/output_type_test.dart
  • M pkg/compiler/test/record_use/record_use_test.dart
Change size: L
Delta: 18 files changed, 178 insertions(+), 372 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Nate Biggs
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: I7e80a54e627b77af16e27464320cf4a9703c05e6
Gerrit-Change-Number: 471720
Gerrit-PatchSet: 7
Gerrit-Owner: Daco Harkes <dacoh...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages