Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Unified Diff: sdk/lib/_internal/compiler/implementation/enqueue.dart

Issue 11304021: Add NativeEnqueuer to work with the Enqueuer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add --enable-native-live-type-analysis Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/enqueue.dart
diff --git a/sdk/lib/_internal/compiler/implementation/enqueue.dart b/sdk/lib/_internal/compiler/implementation/enqueue.dart
index 7e8e812b56f261e8b5774aa945b7118de00570d9..fe85a35aa0c65fda8a986f3686284064f8b440fb 100644
--- a/sdk/lib/_internal/compiler/implementation/enqueue.dart
+++ b/sdk/lib/_internal/compiler/implementation/enqueue.dart
@@ -41,6 +41,8 @@ class Enqueuer {
bool queueIsClosed = false;
EnqueueTask task;
+ native.NativeEnqueuer nativeEnqueuer; // Set by compiler.
ngeoffray 2012/11/14 21:17:39 Why not by this class?
sra1 2012/11/15 00:09:10 This class has two instances. I can use isResoluti
+
Enqueuer(this.name, this.compiler,
ItemCompilationContext itemCompilationContextCreator())
: this.itemCompilationContextCreator = itemCompilationContextCreator,
@@ -116,6 +118,8 @@ class Enqueuer {
&& library.uri.toString() == 'dart:isolate') {
compiler.enableIsolateSupport(library);
}
+
+ nativeEnqueuer.registerElement(element);
}
/**
@@ -168,7 +172,11 @@ class Enqueuer {
if (universe.generatedCode.containsKey(member)) return;
if (resolvedElements[member] != null) return;
if (!member.isInstanceMember()) return;
ngeoffray 2012/11/14 21:17:39 How about just doing nativeEnqueuer.processInstant
sra1 2012/11/15 00:09:10 I think it will be too complicated. Names need to
- if (member.isField()) return;
+ if (member.isField()) {
+ // Native fields need to go into instanceMembersByName as they are virtual
+ // instantiation points and escape points.
+ if (!member.enclosingElement.isNative()) return;
+ }
String memberName = member.name.slowToString();
Link<Element> members = instanceMembersByName.putIfAbsent(
@@ -204,6 +212,18 @@ class Enqueuer {
if (universe.hasInvokedSetter(member, compiler)) {
return addToWorkList(member);
}
+ } else if (identical(member.kind, ElementKind.FIELD)) {
ahe 2012/11/14 13:51:30 I think we are slowly moving towards using == inst
+ if (member.enclosingElement.isNative()) {
ahe 2012/11/14 13:51:30 Assert the condition instead?
+ // print('process $member');
+ // print(' $memberName: ${instanceMembersByName[memberName]}');
ngeoffray 2012/11/14 21:17:39 Remove debugging code
sra1 2012/11/15 00:09:10 Done.
+ if (universe.hasInvokedGetter(member, compiler) ||
+ universe.hasInvocation(member, compiler)) {
+ nativeEnqueuer.registerFieldLoad(member);
+ }
+ if (universe.hasInvokedSetter(member, compiler)) {
+ nativeEnqueuer.registerFieldStore(member);
+ }
+ }
}
}
@@ -293,7 +313,18 @@ class Enqueuer {
void handleUnseenSelector(SourceString methodName, Selector selector) {
processInstanceMembers(methodName, (Element member) {
if (selector.applies(member, compiler)) {
ngeoffray 2012/11/14 21:17:39 Same comment, nativeEnqueuer.handleUnseenMember.
sra1 2012/11/15 00:09:10 Same response - keep the cross-product as the resp
- addToWorkList(member);
+ // print('unseen $selector add $member ${member.kind}');
+ if (member.isField() && member.enclosingElement.isNative()) {
+ if (selector.isGetter() || selector.isCall()) {
+ nativeEnqueuer.registerFieldLoad(member);
ahe 2012/11/14 13:51:30 Does order matter here?
sra1 2012/11/15 00:09:10 Added comments to answer the questions here.
+ nativeEnqueuer.registerFieldStore(member);
ahe 2012/11/14 13:51:30 Why also store?
sra1 2012/11/15 00:09:10 See new comments.
+ } else {
+ nativeEnqueuer.registerFieldStore(member);
+ nativeEnqueuer.registerFieldLoad(member);
ahe 2012/11/14 13:51:30 Why load?
sra1 2012/11/15 00:09:10 See new comments.
+ }
+ } else {
+ addToWorkList(member);
+ }
return true;
}
return false;

Powered by Google App Engine
This is Rietveld 408576698