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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 12035079: Fix braino that lead to dead code that contained a typo. Also add a regression test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/interceptor_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 return graph.thisInstruction; 715 return graph.thisInstruction;
716 } 716 }
717 717
718 Constant constant = new ConstructedConstant( 718 Constant constant = new ConstructedConstant(
719 constantInterceptor.computeType(compiler), <Constant>[]); 719 constantInterceptor.computeType(compiler), <Constant>[]);
720 return graph.addConstant(constant); 720 return graph.addConstant(constant);
721 } 721 }
722 722
723 HInstruction visitOneShotInterceptor(HOneShotInterceptor node) { 723 HInstruction visitOneShotInterceptor(HOneShotInterceptor node) {
724 HInstruction newInstruction = handleInterceptorCall(node); 724 HInstruction newInstruction = handleInterceptorCall(node);
725 if (newInstruction != null) return newInstruction; 725 if (newInstruction != node) return newInstruction;
726 726
727 HInstruction constant = tryComputeConstantInterceptor( 727 HInstruction constant = tryComputeConstantInterceptor(
728 node.inputs[1], node.interceptedClasses); 728 node.inputs[1], node.interceptedClasses);
729 729
730 if (constant == null) return node; 730 if (constant == null) return node;
731 731
732 Selector selector = node.selector; 732 Selector selector = node.selector;
733 // TODO(ngeoffray): make one shot interceptors know whether 733 // TODO(ngeoffray): make one shot interceptors know whether
734 // they have side effects. 734 // they have side effects.
735 if (selector.isGetter()) { 735 if (selector.isGetter()) {
736 HInstruction res = new HInvokeDynamicGetter( 736 HInstruction res = new HInvokeDynamicGetter(
737 selector, node.element, constant, false); 737 selector, node.element, constant, false);
738 res.inputs.add(node.intputs[1]); 738 res.inputs.add(node.inputs[1]);
739 return res; 739 return res;
740 } else if (node.selector.isSetter()) { 740 } else if (node.selector.isSetter()) {
741 HInstruction res = new HInvokeDynamicSetter( 741 HInstruction res = new HInvokeDynamicSetter(
742 selector, node.element, constant, node.inputs[1], false); 742 selector, node.element, constant, node.inputs[1], false);
743 res.inputs.add(node.intputs[2]); 743 res.inputs.add(node.inputs[2]);
744 return res; 744 return res;
745 } else { 745 } else {
746 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs); 746 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs);
747 inputs[0] = constant; 747 inputs[0] = constant;
748 return new HInvokeDynamicMethod(selector, inputs, true); 748 return new HInvokeDynamicMethod(selector, inputs, true);
749 } 749 }
750 } 750 }
751 } 751 }
752 752
753 class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase { 753 class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase {
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 HBasicBlock block = user.block; 1533 HBasicBlock block = user.block;
1534 block.addAfter(user, interceptor); 1534 block.addAfter(user, interceptor);
1535 block.rewrite(user, interceptor); 1535 block.rewrite(user, interceptor);
1536 block.remove(user); 1536 block.remove(user);
1537 1537
1538 // The interceptor will be removed in the dead code elimination 1538 // The interceptor will be removed in the dead code elimination
1539 // phase. Note that removing it here would not work because of how 1539 // phase. Note that removing it here would not work because of how
1540 // the [visitBasicBlock] is implemented. 1540 // the [visitBasicBlock] is implemented.
1541 } 1541 }
1542 } 1542 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/interceptor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698