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

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10537025: Prototype re-compiling methods in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months 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
« no previous file with comments | « no previous file | lib/compiler/implementation/enqueue.dart » ('j') | lib/compiler/implementation/enqueue.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index 077728977bfaf55e1091c1fb3140c7e4f0d21939..170458dd3b1a4d130deff0741087017da8b9399d 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -111,6 +111,8 @@ class Compiler implements DiagnosticListener {
return f();
} catch (CompilerCancelledException ex) {
throw;
+ } catch (Pass2BailoutException ex) {
+ throw;
} catch (var ex) {
unhandledExceptionOnElement(element);
throw;
@@ -130,6 +132,7 @@ class Compiler implements DiagnosticListener {
Backend backend;
ConstantHandler constantHandler;
EnqueueTask enqueuer;
+ int pass = 1;
static final SourceString MAIN = const SourceString('main');
static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
@@ -381,6 +384,24 @@ class Compiler implements DiagnosticListener {
withCurrentElement(work.element, () => work.run(this, world));
}
world.queueIsClosed = true;
+ print("Pass 2 queue length: ${world.queue2.length}");
+ pass = 2;
+ while (!world.queue2.isEmpty()) {
+ WorkItem work = world.queue2.removeLast();
ricow1 2012/06/07 06:35:49 should we remove it from the set as well for consi
Søren Gjesse 2012/06/07 08:06:12 Done in the RecompilationQueue class.
+ var oldCode = world.universe.generatedCode[work.element];
+ world.universe.generatedCode.remove(work.element);
+ try {
+ withCurrentElement(work.element, () => work.run(this, world));
+ } catch (Pass2BailoutException ex) {
+ world.universe.generatedCode[work.element] = oldCode;
+ }
+ var newCode = world.universe.generatedCode[work.element];
+ if (newCode != oldCode) {
+ print("PASS 2 OPTIMIZATION:");
+ print("Before: $oldCode");
+ print("After: $newCode");
+ }
+ }
assert(world.checkNoEnqueuedInvokedInstanceMethods());
world.registerFieldClosureInvocations();
}
@@ -463,6 +484,7 @@ class Compiler implements DiagnosticListener {
if (message.message.kind === MessageKind.METHOD_NOT_FOUND) return;
}
SourceSpan span = spanFromNode(node);
+
reportDiagnostic(span, "${magenta('warning:')} $message", false);
}
@@ -560,6 +582,15 @@ class CompilerCancelledException implements Exception {
}
}
+class Pass2BailoutException implements Exception {
+ final String reason;
+ Pass2BailoutException(this.reason);
+
+ String toString() {
+ return 'Pass 2 not supported: $reason';
+ }
+}
+
class Tracer {
final bool enabled = false;
« no previous file with comments | « no previous file | lib/compiler/implementation/enqueue.dart » ('j') | lib/compiler/implementation/enqueue.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698