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

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

Issue 10917285: Stub implementation of patch invariants for the patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Leftovers from rebase. Created 8 years, 3 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
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index df90a41abb664d04f899473bd463d5e82376c704..a14145491ee3dad5b0c946fb098061835c3e1dfa 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -39,12 +39,17 @@ class ItemCompilationContext {
class WorkItem {
final ItemCompilationContext compilationContext;
+ /**
+ * Invariant: [element] must be the declaration element.
ahe 2012/09/18 11:25:54 This is not a documentation comment.
Johnni Winther 2012/09/20 08:12:23 Done.
+ */
final Element element;
TreeElements resolutionTree;
bool allowSpeculativeOptimization = true;
List<HTypeGuard> guards = const <HTypeGuard>[];
- WorkItem(this.element, this.resolutionTree, this.compilationContext);
+ WorkItem(this.element, this.resolutionTree, this.compilationContext) {
+ assert(element.isDeclaration);
+ }
bool isAnalyzed() => resolutionTree !== null;
@@ -609,11 +614,12 @@ class Compiler implements DiagnosticListener {
assert(phase == PHASE_RECOMPILING);
while (!world.recompilationCandidates.isEmpty()) {
WorkItem work = world.recompilationCandidates.next();
- CodeBuffer oldCode = world.universe.generatedCode[work.element];
- world.universe.generatedCode.remove(work.element);
- world.universe.generatedBailoutCode.remove(work.element);
- withCurrentElement(work.element, () => work.run(this, world));
- CodeBuffer newCode = world.universe.generatedCode[work.element];
+ Element element = work.element;
+ CodeBuffer oldCode = world.universe.generatedCode[element];
+ world.universe.generatedCode.remove(element);
+ world.universe.generatedBailoutCode.remove(element);
+ withCurrentElement(element, () => work.run(this, world));
+ CodeBuffer newCode = world.universe.generatedCode[element];
if (REPORT_PASS2_OPTIMIZATIONS && newCode != oldCode) {
log("Pass 2 optimization:");
log("Before:\n$oldCode");
@@ -671,6 +677,7 @@ class Compiler implements DiagnosticListener {
}
TreeElements analyzeElement(Element element) {
+ assert(element.isDeclaration);
TreeElements elements = enqueuer.resolution.getCachedElements(element);
if (elements !== null) return elements;
final int allowed = ElementCategory.VARIABLE | ElementCategory.FUNCTION
@@ -714,6 +721,7 @@ class Compiler implements DiagnosticListener {
'Internal error: unresolved element: $element.');
}
result = analyzeElement(element);
+ assert(element.isDeclaration);
enqueuer.resolution.resolvedElements[element] = result;
return result;
}

Powered by Google App Engine
This is Rietveld 408576698