Skip to content

Commit

Permalink
Version 3.2.0-36.0.dev
Browse files Browse the repository at this point in the history
Merge 37fba7b into dev
  • Loading branch information
Dart CI committed Aug 4, 2023
2 parents eb76707 + 37fba7b commit 5573a23
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pkg/compiler/lib/src/deferred_load/deferred_load.dart
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ class DeferredLoadTask extends CompilerTask {
int nextDeferId = 0;
Set<String> usedImportNames = {};
for (ImportEntity import in allDeferredImports) {
String result = computeImportDeferName(import, compiler);
if (useIds) {
importDeferName[import] = (++nextDeferId).toString();
} else {
String result = computeImportDeferName(import, compiler);
// Note: tools that process the json file to build multi-part initial load
// bundles depend on the fact that makeUnique appends only digits, or a
// period followed by digits.
Expand Down
2 changes: 1 addition & 1 deletion pkg/compiler/lib/src/js_backend/namer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ abstract class ModularNamer {
return 'c\$${target.nestingLevel}';
}

late final Set<String> _jsVariableReservedCache = {
static final Set<String> _jsVariableReservedCache = {
...javaScriptKeywords,
...reservedPropertySymbols,
...reservedGlobalSymbols,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,14 +638,21 @@ class FragmentMerger {
/// Returns a json-style map for describing what files that are loaded by a
/// given deferred import.
/// The mapping is structured as:
/// library uri -> {"name": library name, "files": (prefix -> list of files)}
/// library uri -> {
/// "name": library name,
/// "imports": (loadId -> list of files),
/// "importPrefixToLoadId": (prefix -> loadId)
/// }
///
/// Where
///
/// - <library uri> is the import uri of the library making a deferred
/// import.
/// - <library name> is the name of the library, or "<unnamed>" if it is
/// unnamed.
/// - <prefix> is the `as` prefix used for a given deferred import.
/// - <loadId> is the unique ID assigned by the compiler for each
/// <library uri>/<prefix> pair.
/// - <list of files> is a list of the filenames the must be loaded when that
/// import is loaded.
/// TODO(joshualitt): the library name is unused and should be removed. This
Expand All @@ -666,13 +673,19 @@ class FragmentMerger {

Map<String, dynamic> libraryMap = mapping.putIfAbsent(
description.importingUri,
() => {"name": getName(description.importingLibrary), "imports": {}});
() => {
'name': getName(description.importingLibrary),
'imports': {},
'importPrefixToLoadId': {},
});

List<String> partFileNames = fragments
.map((fragment) =>
deferredPartFileName(_options, fragment.canonicalOutputUnit.name))
.toList();
(libraryMap["imports"] as Map)[importDeferName] = partFileNames;
(libraryMap['imports'] as Map)[importDeferName] = partFileNames;
(libraryMap['importPrefixToLoadId'] as Map)[import.name] =
importDeferName;
});
return mapping;
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/compiler/lib/src/ssa/codegen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import 'nodes.dart';
import 'variable_allocator.dart';

abstract class CodegenPhase {
String get name => '$runtimeType';
String get name;
void visitGraph(HGraph graph);
}

Expand Down
42 changes: 34 additions & 8 deletions pkg/compiler/lib/src/ssa/codegen_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ bool canUseAliasedSuperMember(MemberEntity member, Selector selector) {
/// - Combine read/modify/write sequences into HReadModifyWrite instructions to
/// simplify codegen of expressions like `a.x += y`.
class SsaInstructionSelection extends HBaseVisitor<HInstruction?>
with CodegenPhase {
implements CodegenPhase {
@override
String get name => 'SsaInstructionSelection';

final JClosedWorld _closedWorld;
final CompilerOptions _options;
late final HGraph graph;
Expand Down Expand Up @@ -484,7 +487,10 @@ class SsaInstructionSelection extends HBaseVisitor<HInstruction?>

/// Remove [HTypeKnown] instructions from the graph, to make codegen analysis
/// easier.
class SsaTypeKnownRemover extends HBaseVisitor<void> with CodegenPhase {
class SsaTypeKnownRemover extends HBaseVisitor<void> implements CodegenPhase {
@override
String get name => 'SsaTypeKnownRemover';

@override
void visitGraph(HGraph graph) {
// Visit bottom-up to visit uses before instructions and capture refined
Expand Down Expand Up @@ -517,7 +523,10 @@ class SsaTypeKnownRemover extends HBaseVisitor<void> with CodegenPhase {
/// Remove [HPrimitiveCheck] instructions from the graph in '--trust-primitives'
/// mode.
class SsaTrustedPrimitiveCheckRemover extends HBaseVisitor<void>
with CodegenPhase {
implements CodegenPhase {
@override
String get name => 'SsaTrustedPrimitiveCheckRemover';

final CompilerOptions _options;

SsaTrustedPrimitiveCheckRemover(this._options);
Expand Down Expand Up @@ -552,7 +561,11 @@ class SsaTrustedPrimitiveCheckRemover extends HBaseVisitor<void>
}

/// Remove trusted late variable checks.
class SsaTrustedLateCheckRemover extends HBaseVisitor<void> with CodegenPhase {
class SsaTrustedLateCheckRemover extends HBaseVisitor<void>
implements CodegenPhase {
@override
String get name => 'SsaInstructionSelection';

final AbstractValueDomain _abstractValueDomain;

SsaTrustedLateCheckRemover(this._abstractValueDomain);
Expand Down Expand Up @@ -609,7 +622,10 @@ class SsaTrustedLateCheckRemover extends HBaseVisitor<void> with CodegenPhase {
/// -->
/// b.y = a.x = v;
class SsaAssignmentChaining extends HBaseVisitor<HInstruction?>
with CodegenPhase {
implements CodegenPhase {
@override
String get name => 'SsaAssignmentChaining';

final JClosedWorld _closedWorld;

SsaAssignmentChaining(this._closedWorld);
Expand Down Expand Up @@ -775,7 +791,10 @@ class SsaAssignmentChaining extends HBaseVisitor<HInstruction?>
/// t2 = add(t0, t1);
/// t0 and t1 would be marked and the resulting code would then be:
/// t2 = add(4, 3);
class SsaInstructionMerger extends HBaseVisitor<void> with CodegenPhase {
class SsaInstructionMerger extends HBaseVisitor<void> implements CodegenPhase {
@override
String get name => 'SsaInstructionMerger';

final AbstractValueDomain _abstractValueDomain;

/// List of [HInstruction] that the instruction merger expects in
Expand Down Expand Up @@ -1109,7 +1128,10 @@ class SsaInstructionMerger extends HBaseVisitor<void> with CodegenPhase {
/// Detect control flow arising from short-circuit logical and
/// conditional operators, and prepare the program to be generated
/// using these operators instead of nested ifs and boolean variables.
class SsaConditionMerger extends HGraphVisitor with CodegenPhase {
class SsaConditionMerger extends HGraphVisitor implements CodegenPhase {
@override
String get name => 'SsaConditionMerger';

Set<HInstruction> generateAtUseSite;
Set<HIf> controlFlowOperators;

Expand Down Expand Up @@ -1285,7 +1307,11 @@ class SsaConditionMerger extends HGraphVisitor with CodegenPhase {
/// Insert 'caches' for whole-function region-constants when the local minified
/// name would be shorter than repeated references. These are caches for 'this'
/// and constant values.
class SsaShareRegionConstants extends HBaseVisitor<void> with CodegenPhase {
class SsaShareRegionConstants extends HBaseVisitor<void>
implements CodegenPhase {
@override
String get name => 'SsaShareRegionConstants';

SsaShareRegionConstants();

@override
Expand Down
8 changes: 7 additions & 1 deletion pkg/compiler/lib/src/ssa/variable_allocator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class LiveEnvironment {
/// the graph post-dominator tree to find the last uses of an
/// instruction, and computes the liveIns of each basic block.
class SsaLiveIntervalBuilder extends HBaseVisitor<void> with CodegenPhase {
@override
String get name => 'SsaLiveIntervalBuilder';

final Set<HInstruction> generateAtUseSite;
final Set<HIf> controlFlowOperators;

Expand Down Expand Up @@ -556,7 +559,10 @@ class VariableNamer {
/// instruction, it frees the names of the inputs that die at that
/// instruction, and allocates a name to the instruction. For each phi,
/// it adds a copy to the CopyHandler of the corresponding predecessor.
class SsaVariableAllocator extends HBaseVisitor<void> with CodegenPhase {
class SsaVariableAllocator extends HBaseVisitor<void> implements CodegenPhase {
@override
String get name => 'SsaVariableAllocator';

final ModularNamer _namer;
final Map<HBasicBlock, LiveEnvironment> liveInstructions;
final Map<HInstruction, LiveInterval> liveIntervals;
Expand Down
3 changes: 3 additions & 0 deletions pkg/compiler/test/dump_info/data/deferred/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
"lib": [
"out_1.part.js"
]
},
"importPrefixToLoadId": {
"lib": "lib"
}
}
}],
Expand Down
3 changes: 3 additions & 0 deletions pkg/compiler/test/dump_info/data/deferred_future/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
"lib1": [
"out_1.part.js"
]
},
"importPrefixToLoadId": {
"lib1": "lib1"
}
}
}],
Expand Down
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 2
PATCH 0
PRERELEASE 35
PRERELEASE 36
PRERELEASE_PATCH 0

0 comments on commit 5573a23

Please sign in to comment.