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

Unified Diff: frog/leg/ssa/types.dart

Issue 9873021: Move frog/leg to lib/compiler/implementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « frog/leg/ssa/tracer.dart ('k') | frog/leg/ssa/validate.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/types.dart
===================================================================
--- frog/leg/ssa/types.dart (revision 5925)
+++ frog/leg/ssa/types.dart (working copy)
@@ -1,66 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase {
-
- final Map<int, HInstruction> workmap;
- final List<int> worklist;
- final Compiler compiler;
- final String name = 'type propagator';
-
- SsaTypePropagator(Compiler this.compiler)
- : workmap = new Map<int, HInstruction>(),
- worklist = new List<int>();
-
- void visitGraph(HGraph graph) {
- visitDominatorTree(graph);
- processWorklist();
- }
-
- visitBasicBlock(HBasicBlock block) {
- if (block.isLoopHeader()) {
- block.forEachPhi((HPhi phi) {
- phi.setInitialTypeForLoopPhi();
- addToWorkList(phi);
- });
- } else {
- block.forEachPhi((HPhi phi) {
- if (phi.updateType()) addUsersAndInputsToWorklist(phi);
- });
- }
-
- HInstruction instruction = block.first;
- while (instruction !== null) {
- if (instruction.updateType()) addUsersAndInputsToWorklist(instruction);
- instruction = instruction.next;
- }
- }
-
- void processWorklist() {
- while (!worklist.isEmpty()) {
- int id = worklist.removeLast();
- HInstruction instruction = workmap[id];
- assert(instruction !== null);
- workmap.remove(id);
- if (instruction.updateType()) addUsersAndInputsToWorklist(instruction);
- }
- }
-
- void addUsersAndInputsToWorklist(HInstruction instruction) {
- for (int i = 0, length = instruction.usedBy.length; i < length; i++) {
- addToWorkList(instruction.usedBy[i]);
- }
- for (int i = 0, length = instruction.inputs.length; i < length; i++) {
- addToWorkList(instruction.inputs[i]);
- }
- }
-
- void addToWorkList(HInstruction instruction) {
- final int id = instruction.id;
- if (!workmap.containsKey(id)) {
- worklist.add(id);
- workmap[id] = instruction;
- }
- }
-}
« no previous file with comments | « frog/leg/ssa/tracer.dart ('k') | frog/leg/ssa/validate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698