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

Side by Side Diff: dart/frog/leg/ssa/builder.dart

Issue 9836022: No globals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Nicolas' comment by doing horrible things ;-) Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/frog/leg/ssa/closure.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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 Element getEqualsInterceptor() { 105 Element getEqualsInterceptor() {
106 return compiler.findHelper(const SourceString('eq')); 106 return compiler.findHelper(const SourceString('eq'));
107 } 107 }
108 108
109 Element getMapMaker() { 109 Element getMapMaker() {
110 return compiler.findHelper(const SourceString('makeLiteralMap')); 110 return compiler.findHelper(const SourceString('makeLiteralMap'));
111 } 111 }
112 } 112 }
113 113
114 class SsaBuilderTask extends CompilerTask { 114 class SsaBuilderTask extends CompilerTask {
115 final Interceptors interceptors;
116 final Map<Node, ClosureData> closureDataCache;
117
118 String get name() => 'SSA builder';
119
115 SsaBuilderTask(Compiler compiler) 120 SsaBuilderTask(Compiler compiler)
116 : super(compiler), interceptors = new Interceptors(compiler); 121 : interceptors = new Interceptors(compiler),
117 String get name() => 'SSA builder'; 122 closureDataCache = new HashMap<Node, ClosureData>(),
118 Interceptors interceptors; 123 super(compiler);
119 124
120 HGraph build(WorkItem work) { 125 HGraph build(WorkItem work) {
121 return measure(() { 126 return measure(() {
122 FunctionElement element = work.element; 127 FunctionElement element = work.element;
123 HInstruction.idCounter = 0; 128 HInstruction.idCounter = 0;
124 SsaBuilder builder = new SsaBuilder(compiler, work); 129 SsaBuilder builder = new SsaBuilder(compiler, work);
125 HGraph graph; 130 HGraph graph;
126 switch (element.kind) { 131 switch (element.kind) {
127 case ElementKind.GENERATIVE_CONSTRUCTOR: 132 case ElementKind.GENERATIVE_CONSTRUCTOR:
128 graph = compileConstructor(builder, work); 133 graph = compileConstructor(builder, work);
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 HLoopBranch.DO_WHILE_LOOP)); 1252 HLoopBranch.DO_WHILE_LOOP));
1248 1253
1249 conditionBlock.addSuccessor(loopEntryBlock); // The back-edge. 1254 conditionBlock.addSuccessor(loopEntryBlock); // The back-edge.
1250 loopEntryBlock.postProcessLoopHeader(); 1255 loopEntryBlock.postProcessLoopHeader();
1251 1256
1252 endLoop(loopEntryBlock, conditionBlock, jumpHandler, localsHandler); 1257 endLoop(loopEntryBlock, conditionBlock, jumpHandler, localsHandler);
1253 jumpHandler.close(); 1258 jumpHandler.close();
1254 } 1259 }
1255 1260
1256 visitFunctionExpression(FunctionExpression node) { 1261 visitFunctionExpression(FunctionExpression node) {
1257 ClosureData nestedClosureData = closureDataCache[node]; 1262 ClosureData nestedClosureData = compiler.builder.closureDataCache[node];
1258 if (nestedClosureData === null) { 1263 if (nestedClosureData === null) {
1259 // TODO(floitsch): we can only assume that the reason for not having a 1264 // TODO(floitsch): we can only assume that the reason for not having a
1260 // closure data here is, because the function is inside an initializer. 1265 // closure data here is, because the function is inside an initializer.
1261 compiler.unimplemented("Closures inside initializers", node: node); 1266 compiler.unimplemented("Closures inside initializers", node: node);
1262 } 1267 }
1263 assert(nestedClosureData !== null); 1268 assert(nestedClosureData !== null);
1264 assert(nestedClosureData.closureClassElement !== null); 1269 assert(nestedClosureData.closureClassElement !== null);
1265 ClassElement closureClassElement = 1270 ClassElement closureClassElement =
1266 nestedClosureData.closureClassElement; 1271 nestedClosureData.closureClassElement;
1267 FunctionElement callElement = nestedClosureData.callElement; 1272 FunctionElement callElement = nestedClosureData.callElement;
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 false, 2886 false,
2882 <HInstruction>[target, input])); 2887 <HInstruction>[target, input]));
2883 return builder.pop(); 2888 return builder.pop();
2884 } 2889 }
2885 2890
2886 HInstruction result() { 2891 HInstruction result() {
2887 flushLiterals(); 2892 flushLiterals();
2888 return prefix; 2893 return prefix;
2889 } 2894 }
2890 } 2895 }
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/ssa/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698