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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/cps_ir/constant_propagation.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove ConstExpBuilder. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.optimizers; 5 part of dart2js.optimizers;
6 6
7 /** 7 /**
8 * Propagates constants throughout the IR, and replaces branches with fixed 8 * Propagates constants throughout the IR, and replaces branches with fixed
9 * jumps as well as side-effect free expressions with known constant results. 9 * jumps as well as side-effect free expressions with known constant results.
10 * Should be followed by the [ShrinkingReducer] pass. 10 * Should be followed by the [ShrinkingReducer] pass.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (cell == null || !cell.isConstant) { 72 if (cell == null || !cell.isConstant) {
73 return null; 73 return null;
74 } 74 }
75 75
76 assert(continuation.parameters.length == 1); 76 assert(continuation.parameters.length == 1);
77 77
78 // Set up the replacement structure. 78 // Set up the replacement structure.
79 79
80 dart2js.PrimitiveConstant primitiveConstant = cell.constant; 80 dart2js.PrimitiveConstant primitiveConstant = cell.constant;
81 ConstExp constExp = new PrimitiveConstExp(primitiveConstant); 81 ConstExp constExp = new PrimitiveConstExp(primitiveConstant);
82 Constant constant = new Constant(constExp, primitiveConstant); 82 Constant constant = new Constant(constExp);
83 LetPrim letPrim = new LetPrim(constant); 83 LetPrim letPrim = new LetPrim(constant);
84 InvokeContinuation invoke = 84 InvokeContinuation invoke =
85 new InvokeContinuation(continuation, <Definition>[constant]); 85 new InvokeContinuation(continuation, <Definition>[constant]);
86 86
87 invoke.parent = constant.parent = letPrim; 87 invoke.parent = constant.parent = letPrim;
88 letPrim.body = invoke; 88 letPrim.body = invoke;
89 89
90 // Replace the method invocation. 90 // Replace the method invocation.
91 91
92 InteriorNode parent = node.parent; 92 InteriorNode parent = node.parent;
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 return that; 656 return that;
657 } 657 }
658 658
659 if (this.constant == that.constant) { 659 if (this.constant == that.constant) {
660 return this; 660 return this;
661 } 661 }
662 662
663 return NonConst; 663 return NonConst;
664 } 664 }
665 } 665 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698