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

Side by Side Diff: pkg/compiler/lib/src/ssa/codegen_helpers.dart

Issue 2569733002: Even less reliance on Compiler.closedWorld (Closed)
Patch Set: Updated cf. comments. Created 4 years 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 | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.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 import '../compiler.dart' show Compiler; 5 import '../compiler.dart' show Compiler;
6 import '../constants/values.dart'; 6 import '../constants/values.dart';
7 import '../elements/elements.dart'; 7 import '../elements/elements.dart';
8 import '../js_backend/js_backend.dart'; 8 import '../js_backend/js_backend.dart';
9 import '../types/types.dart'; 9 import '../types/types.dart';
10 import '../universe/selector.dart' show Selector; 10 import '../universe/selector.dart' show Selector;
11 import '../world.dart' show ClosedWorld; 11 import '../world.dart' show ClosedWorld;
12 import 'nodes.dart'; 12 import 'nodes.dart';
13 13
14 /** 14 /**
15 * Replaces some instructions with specialized versions to make codegen easier. 15 * Replaces some instructions with specialized versions to make codegen easier.
16 * Caches codegen information on nodes. 16 * Caches codegen information on nodes.
17 */ 17 */
18 class SsaInstructionSelection extends HBaseVisitor { 18 class SsaInstructionSelection extends HBaseVisitor {
19 final Compiler compiler; 19 final Compiler compiler;
20 final ClosedWorld closedWorld;
20 HGraph graph; 21 HGraph graph;
21 22
22 SsaInstructionSelection(this.compiler); 23 SsaInstructionSelection(this.compiler, this.closedWorld);
23 24
24 JavaScriptBackend get backend => compiler.backend; 25 JavaScriptBackend get backend => compiler.backend;
25 26
26 ClosedWorld get closedWorld => compiler.closedWorld;
27
28 void visitGraph(HGraph graph) { 27 void visitGraph(HGraph graph) {
29 this.graph = graph; 28 this.graph = graph;
30 visitDominatorTree(graph); 29 visitDominatorTree(graph);
31 } 30 }
32 31
33 visitBasicBlock(HBasicBlock block) { 32 visitBasicBlock(HBasicBlock block) {
34 HInstruction instruction = block.first; 33 HInstruction instruction = block.first;
35 while (instruction != null) { 34 while (instruction != null) {
36 HInstruction next = instruction.next; 35 HInstruction next = instruction.next;
37 HInstruction replacement = instruction.accept(this); 36 HInstruction replacement = instruction.accept(this);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 98
100 HInstruction visitInvokeDynamic(HInvokeDynamic node) { 99 HInstruction visitInvokeDynamic(HInvokeDynamic node) {
101 if (node.isInterceptedCall) { 100 if (node.isInterceptedCall) {
102 tryReplaceInterceptorWithDummy(node, node.selector, node.mask); 101 tryReplaceInterceptorWithDummy(node, node.selector, node.mask);
103 } 102 }
104 return node; 103 return node;
105 } 104 }
106 105
107 HInstruction visitInvokeSuper(HInvokeSuper node) { 106 HInstruction visitInvokeSuper(HInvokeSuper node) {
108 if (node.isInterceptedCall) { 107 if (node.isInterceptedCall) {
109 TypeMask mask = node.getDartReceiver(compiler).instructionType; 108 TypeMask mask = node.getDartReceiver(closedWorld).instructionType;
110 tryReplaceInterceptorWithDummy(node, node.selector, mask); 109 tryReplaceInterceptorWithDummy(node, node.selector, mask);
111 } 110 }
112 return node; 111 return node;
113 } 112 }
114 113
115 void tryReplaceInterceptorWithDummy( 114 void tryReplaceInterceptorWithDummy(
116 HInvoke node, Selector selector, TypeMask mask) { 115 HInvoke node, Selector selector, TypeMask mask) {
117 // Calls of the form 116 // Calls of the form
118 // 117 //
119 // a.foo$1(a, x) 118 // a.foo$1(a, x)
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 797 }
799 798
800 // If [thenInput] is defined in the first predecessor, then it is only used 799 // If [thenInput] is defined in the first predecessor, then it is only used
801 // by [phi] and can be generated at use site. 800 // by [phi] and can be generated at use site.
802 if (identical(thenInput.block, end.predecessors[0])) { 801 if (identical(thenInput.block, end.predecessors[0])) {
803 assert(thenInput.usedBy.length == 1); 802 assert(thenInput.usedBy.length == 1);
804 markAsGenerateAtUseSite(thenInput); 803 markAsGenerateAtUseSite(thenInput);
805 } 804 }
806 } 805 }
807 } 806 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698