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

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

Issue 9355031: Improve List implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 Element result = compiler.findHelper(new SourceString(mangledName)); 48 Element result = compiler.findHelper(new SourceString(mangledName));
49 return result; 49 return result;
50 } 50 }
51 51
52 Element getStaticGetInterceptor(SourceString name) { 52 Element getStaticGetInterceptor(SourceString name) {
53 String mangledName = "builtin\$get\$${name}"; 53 String mangledName = "builtin\$get\$${name}";
54 Element result = compiler.findHelper(new SourceString(mangledName)); 54 Element result = compiler.findHelper(new SourceString(mangledName));
55 return result; 55 return result;
56 } 56 }
57 57
58 Element getStaticSetInterceptor(SourceString name) {
59 String mangledName = "builtin\$set\$${name}";
60 Element result = compiler.findHelper(new SourceString(mangledName));
61 return result;
62 }
63
58 Element getOperatorInterceptor(Operator op) { 64 Element getOperatorInterceptor(Operator op) {
59 SourceString name = mapOperatorToMethodName(op); 65 SourceString name = mapOperatorToMethodName(op);
60 Element result = compiler.findHelper(name); 66 Element result = compiler.findHelper(name);
61 return result; 67 return result;
62 } 68 }
63 69
64 Element getPrefixOperatorInterceptor(Operator op) { 70 Element getPrefixOperatorInterceptor(Operator op) {
65 String name = op.source.stringValue; 71 String name = op.source.stringValue;
66 if (name === '~') { 72 if (name === '~') {
67 return compiler.findHelper(const SourceString('not')); 73 return compiler.findHelper(const SourceString('not'));
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 stack.add(value); 1292 stack.add(value);
1287 } else if (element === null || Elements.isInstanceField(element)) { 1293 } else if (element === null || Elements.isInstanceField(element)) {
1288 SourceString dartSetterName = send.selector.asIdentifier().source; 1294 SourceString dartSetterName = send.selector.asIdentifier().source;
1289 HInstruction receiver; 1295 HInstruction receiver;
1290 if (send.receiver == null) { 1296 if (send.receiver == null) {
1291 receiver = localsHandler.readThis(); 1297 receiver = localsHandler.readThis();
1292 } else { 1298 } else {
1293 visit(send.receiver); 1299 visit(send.receiver);
1294 receiver = pop(); 1300 receiver = pop();
1295 } 1301 }
1296 add(new HInvokeDynamicSetter( 1302 Element staticInterceptor = null;
1297 selector, null, dartSetterName, receiver, value)); 1303 if (methodInterceptionEnabled) {
kasperl 2012/02/21 07:16:43 Would it make sense to move the methodInterception
ngeoffray 2012/02/21 10:41:45 I decided to put it on the compiler because the in
ahe 2012/02/21 23:03:25 I'll stay out of this discussion. It seems to me t
ngeoffray 2012/02/22 08:52:04 Why do you think it's temporary? The flag is for i
ahe 2012/02/22 08:58:30 I see. Another reason for me to stay out of this d
1304 staticInterceptor =
1305 interceptors.getStaticSetInterceptor(dartSetterName);
1306 }
1307 if (staticInterceptor != null) {
1308 HStatic target = new HStatic(staticInterceptor);
1309 add(target);
1310 List<HInstruction> inputs = <HInstruction>[target, receiver, value];
1311 add(new HInvokeInterceptor(selector, dartSetterName, true, inputs));
1312 } else {
1313 add(new HInvokeDynamicSetter(selector, null, dartSetterName,
1314 receiver, value));
1315 }
1298 stack.add(value); 1316 stack.add(value);
1299 } else { 1317 } else {
1300 localsHandler.updateLocal(element, value); 1318 localsHandler.updateLocal(element, value);
1301 stack.add(value); 1319 stack.add(value);
1302 } 1320 }
1303 } 1321 }
1304 1322
1305 visitOperatorSend(node) { 1323 visitOperatorSend(node) {
1306 assert(node.selector is Operator); 1324 assert(node.selector is Operator);
1307 Operator op = node.selector; 1325 Operator op = node.selector;
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 } 2097 }
2080 2098
2081 visitCatchBlock(CatchBlock node) { 2099 visitCatchBlock(CatchBlock node) {
2082 visit(node.block); 2100 visit(node.block);
2083 } 2101 }
2084 2102
2085 visitTypedef(Typedef node) { 2103 visitTypedef(Typedef node) {
2086 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 2104 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
2087 } 2105 }
2088 } 2106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698