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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_fragment.dart

Issue 1375213003: dart2js cps: Maintain parent pointers instead of recomputing them. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 5 years, 2 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library cps_ir.cps_fragment; 5 library cps_ir.cps_fragment;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import '../constants/values.dart'; 8 import '../constants/values.dart';
9 import '../universe/selector.dart' show Selector; 9 import '../universe/selector.dart' show Selector;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 /// 76 ///
77 /// Afterwards the fragment is closed and cannot be extended until a new 77 /// Afterwards the fragment is closed and cannot be extended until a new
78 /// [context] is set. 78 /// [context] is set.
79 void put(Expression node) { 79 void put(Expression node) {
80 assert(root == null || context != null); // We must put the node somewhere. 80 assert(root == null || context != null); // We must put the node somewhere.
81 if (root == null) { 81 if (root == null) {
82 root = node; 82 root = node;
83 } 83 }
84 if (context != null) { 84 if (context != null) {
85 context.body = node; 85 context.body = node;
86 node.parent = context;
86 } 87 }
87 context = null; 88 context = null;
88 } 89 }
89 90
90 /// Bind a primitive. Returns the same primitive for convenience. 91 /// Bind a primitive. Returns the same primitive for convenience.
91 Primitive letPrim(Primitive prim) { 92 Primitive letPrim(Primitive prim) {
92 assert(prim != null); 93 assert(prim != null);
93 LetPrim let = new LetPrim(prim); 94 LetPrim let = new LetPrim(prim);
94 put(let); 95 put(let);
95 context = let; 96 context = let;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void setMutable(MutableVariable variable, Primitive value) { 291 void setMutable(MutableVariable variable, Primitive value) {
291 letPrim(new SetMutable(variable, value)); 292 letPrim(new SetMutable(variable, value));
292 } 293 }
293 294
294 /// Declare a new mutable variable. 295 /// Declare a new mutable variable.
295 void letMutable(MutableVariable variable, Primitive initialValue) { 296 void letMutable(MutableVariable variable, Primitive initialValue) {
296 LetMutable let = new LetMutable(variable, initialValue); 297 LetMutable let = new LetMutable(variable, initialValue);
297 put(let); 298 put(let);
298 context = let; 299 context = let;
299 } 300 }
301
302 void insertBelow(InteriorNode node) {
303 assert(isOpen);
304 if (isEmpty) return;
305 Expression child = node.body;
306 node.body = root;
307 root.parent = node;
308 context.body = child;
309 child.parent = context;
310 root = context = null;
311 }
312
313 void insertAbove(InteriorExpression node) {
314 insertBelow(node.parent);
315 }
300 } 316 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698