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

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

Issue 10383065: Start creating a MemberSet abstraction, and use it to fold getters/setters into field accesses. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/tracer.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface OptimizationPhase { 5 interface OptimizationPhase {
6 String get name(); 6 String get name();
7 void visitGraph(HGraph graph); 7 void visitGraph(HGraph graph);
8 } 8 }
9 9
10 class SsaOptimizerTask extends CompilerTask { 10 class SsaOptimizerTask extends CompilerTask {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return node; 546 return node;
547 } 547 }
548 548
549 HInstruction visitTypeConversion(HTypeConversion node) { 549 HInstruction visitTypeConversion(HTypeConversion node) {
550 HInstruction value = node.inputs[0]; 550 HInstruction value = node.inputs[0];
551 // If the union of the types is still the input type then 551 // If the union of the types is still the input type then
552 // no conversion is required. 552 // no conversion is required.
553 HType combinedType = value.propagatedType.union(node.propagatedType); 553 HType combinedType = value.propagatedType.union(node.propagatedType);
554 return (combinedType == value.propagatedType) ? value : node; 554 return (combinedType == value.propagatedType) ? value : node;
555 } 555 }
556
557 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
558 HInstruction receiver = node.inputs[0];
559 if (!receiver.propagatedType.isUseful()) return node;
560 Type type = receiver.propagatedType.computeType(compiler);
561 if (type === null) return node;
562 if (!compiler.world.isOnlyFields(type, node.name)) return node;
563 return new HFieldGet(node.name, node.inputs[0]);
564 }
565
566 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
567 HInstruction receiver = node.inputs[0];
568 if (!receiver.propagatedType.isUseful()) return node;
569 Type type = receiver.propagatedType.computeType(compiler);
570 if (type === null) return node;
571 if (!compiler.world.isOnlyFields(type, node.name)) return node;
572 return new HFieldSet(node.name, node.inputs[0], node.inputs[1]);
573 }
556 } 574 }
557 575
558 class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase { 576 class SsaCheckInserter extends HBaseVisitor implements OptimizationPhase {
559 final String name = "SsaCheckInserter"; 577 final String name = "SsaCheckInserter";
560 Element lengthInterceptor; 578 Element lengthInterceptor;
561 579
562 SsaCheckInserter(Compiler compiler) { 580 SsaCheckInserter(Compiler compiler) {
563 SourceString lengthString = const SourceString('length'); 581 SourceString lengthString = const SourceString('length');
564 lengthInterceptor = 582 lengthInterceptor =
565 compiler.builder.interceptors.getStaticGetInterceptor(lengthString); 583 compiler.builder.interceptors.getStaticGetInterceptor(lengthString);
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 // the if block terminates. So any use of the instruction 1106 // the if block terminates. So any use of the instruction
1089 // after the join block should be changed to the new 1107 // after the join block should be changed to the new
1090 // instruction. 1108 // instruction.
1091 changeUsesDominatedBy(ifUser.joinBlock, input, convertedType); 1109 changeUsesDominatedBy(ifUser.joinBlock, input, convertedType);
1092 } 1110 }
1093 // TODO(ngeoffray): Also change uses for the then block on a HType 1111 // TODO(ngeoffray): Also change uses for the then block on a HType
1094 // that knows it is not of a specific Type. 1112 // that knows it is not of a specific Type.
1095 } 1113 }
1096 } 1114 }
1097 } 1115 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698