Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2js: deferred parts contain repeated type rules #41980

Open
rakudrama opened this issue May 20, 2020 · 1 comment
Open

dart2js: deferred parts contain repeated type rules #41980

rakudrama opened this issue May 20, 2020 · 1 comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dart2js

Comments

@rakudrama
Copy link
Member

I noticed that small deferred loaded parts all contain the same set of duplicate rules:

  H._Universe_addRules(init.typeUniverse, JSON.parse('{"AnimationPlaybackEvent":"Event2","AnalyserNode":"AudioNode","ConstantSourceNode":"AudioScheduledSourceNode","AudioContext":"BaseAudioContext","AnimateElement":"SvgElement","AnimationElement":"SvgElement","TSpanElement":"TextContentElement","TextPositioningElement":"TextContentElement","ClipPathElement":"GraphicsElement","LinearGradientElement":"_GradientElement","CircleElement":"GeometryElement","OpenDBRequest":"Request1","BatteryManager":"EventTarget","_ResourceProgressEvent":"ProgressEvent","BRElement":"HtmlElement","_DocumentType":"Node0","XmlDocument":"Document","PerformanceLongTaskTiming":"PerformanceEntry","AbortPaymentEvent":"ExtendableEvent","ShadowRoot":"DocumentFragment","DedicatedWorkerGlobalScope":"WorkerGlobalScope","MidiInput":"MidiPort","AbsoluteOrientationSensor":"Sensor","OrientationSensor":"Sensor","HttpRequestUpload":"HttpRequestEventTarget","HtmlFormControlsCollection":"HtmlCollection","CssCharsetRule":"CssRule","CssStyleSheet":"StyleSheet","Comment":"CharacterData","CanvasCaptureMediaStreamTrack":"MediaStreamTrack","CDataSection":"Text","BackgroundFetchFailEvent":"BackgroundFetchEvent","AudioElement":"MediaElement"}'));

Obviously, these rules should not be redefined by each part.

/cc @fishythefish

@rakudrama rakudrama added web-dart2js area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels May 20, 2020
@fishythefish
Copy link
Member

I don't think we ever check that each class is added to the global ruleset only once. Each fragment adds all the classes (that need rules) from its libraries. If each class belongs to only one fragment, then there should be no duplication, but it looks like a bunch of dart:html classes are being attributed to multiple fragments (possibly because the fragments all point to the dart:html library).

If a library is shared by multiple fragments, whichever output unit is loaded first will need to inject the rules, but I don't think there's always a canonical choice for which fragment to pick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dart2js
Projects
None yet
Development

No branches or pull requests

2 participants