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

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

Issue 1743283002: dart2js cps: Use definitions by default, not references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix doc comments and long lines Created 4 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 unified diff | Download patch
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 dart2js.cps_ir.gvn; 5 library dart2js.cps_ir.gvn;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import '../universe/side_effects.dart'; 8 import '../universe/side_effects.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import 'optimizers.dart' show Pass; 10 import 'optimizers.dart' show Pass;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 }); 396 });
397 } else { 397 } else {
398 effectNumbers = effectsAt[cont]; 398 effectNumbers = effectsAt[cont];
399 assert(effectNumbers != null); 399 assert(effectNumbers != null);
400 } 400 }
401 401
402 return cont.body; 402 return cont.body;
403 } 403 }
404 404
405 void visitInvokeContinuation(InvokeContinuation node) { 405 void visitInvokeContinuation(InvokeContinuation node) {
406 Continuation cont = node.continuation.definition; 406 Continuation cont = node.continuation;
407 if (cont.isRecursive) return; 407 if (cont.isRecursive) return;
408 EffectNumbers join = effectsAt[cont]; 408 EffectNumbers join = effectsAt[cont];
409 if (join == null) { 409 if (join == null) {
410 effectsAt[cont] = effectNumbers.copy(); 410 effectsAt[cont] = effectNumbers.copy();
411 } else { 411 } else {
412 join.join(effectNumberer, effectNumbers); 412 join.join(effectNumberer, effectNumbers);
413 } 413 }
414 } 414 }
415 415
416 void visitBranch(Branch node) { 416 void visitBranch(Branch node) {
417 Continuation trueCont = node.trueContinuation.definition; 417 Continuation trueCont = node.trueContinuation;
418 Continuation falseCont = node.falseContinuation.definition; 418 Continuation falseCont = node.falseContinuation;
419 // Copy the effect number vector once, so the analysis of one branch does 419 // Copy the effect number vector once, so the analysis of one branch does
420 // not influence the other. 420 // not influence the other.
421 effectsAt[trueCont] = effectNumbers; 421 effectsAt[trueCont] = effectNumbers;
422 effectsAt[falseCont] = effectNumbers.copy(); 422 effectsAt[falseCont] = effectNumbers.copy();
423 } 423 }
424 } 424 }
425 425
426 /// Maps vectors to numbers, such that two vectors with the same contents 426 /// Maps vectors to numbers, such that two vectors with the same contents
427 /// map to the same number. 427 /// map to the same number.
428 class GvnTable { 428 class GvnTable {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 @override 610 @override
611 processReference(Reference ref) { 611 processReference(Reference ref) {
612 callback(ref); 612 callback(ref);
613 } 613 }
614 614
615 static void forEach(Primitive node, ReferenceCallback callback) { 615 static void forEach(Primitive node, ReferenceCallback callback) {
616 new InputVisitor(callback).visit(node); 616 new InputVisitor(callback).visit(node);
617 } 617 }
618 } 618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698