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

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: Rebased and resolved conflicts 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
« no previous file with comments | « dart/frog/leg/scanner/scanner.dart ('k') | dart/frog/leg/ssa/codegen.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 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 stack.add(value); 1290 stack.add(value);
1285 } else if (element === null || Elements.isInstanceField(element)) { 1291 } else if (element === null || Elements.isInstanceField(element)) {
1286 SourceString dartSetterName = send.selector.asIdentifier().source; 1292 SourceString dartSetterName = send.selector.asIdentifier().source;
1287 HInstruction receiver; 1293 HInstruction receiver;
1288 if (send.receiver == null) { 1294 if (send.receiver == null) {
1289 receiver = localsHandler.readThis(); 1295 receiver = localsHandler.readThis();
1290 } else { 1296 } else {
1291 visit(send.receiver); 1297 visit(send.receiver);
1292 receiver = pop(); 1298 receiver = pop();
1293 } 1299 }
1294 add(new HInvokeDynamicSetter( 1300 Element staticInterceptor = null;
1295 selector, null, dartSetterName, receiver, value)); 1301 if (methodInterceptionEnabled) {
1302 staticInterceptor =
1303 interceptors.getStaticSetInterceptor(dartSetterName);
1304 }
1305 if (staticInterceptor != null) {
1306 HStatic target = new HStatic(staticInterceptor);
1307 add(target);
1308 List<HInstruction> inputs = <HInstruction>[target, receiver, value];
1309 add(new HInvokeInterceptor(selector, dartSetterName, false, inputs));
1310 } else {
1311 add(new HInvokeDynamicSetter(selector, null, dartSetterName,
1312 receiver, value));
1313 }
1296 stack.add(value); 1314 stack.add(value);
1297 } else { 1315 } else {
1298 localsHandler.updateLocal(element, value); 1316 localsHandler.updateLocal(element, value);
1299 stack.add(value); 1317 stack.add(value);
1300 } 1318 }
1301 } 1319 }
1302 1320
1303 visitOperatorSend(node) { 1321 visitOperatorSend(node) {
1304 assert(node.selector is Operator); 1322 assert(node.selector is Operator);
1305 Operator op = node.selector; 1323 Operator op = node.selector;
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 } 2098 }
2081 2099
2082 visitCatchBlock(CatchBlock node) { 2100 visitCatchBlock(CatchBlock node) {
2083 visit(node.block); 2101 visit(node.block);
2084 } 2102 }
2085 2103
2086 visitTypedef(Typedef node) { 2104 visitTypedef(Typedef node) {
2087 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 2105 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
2088 } 2106 }
2089 } 2107 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/scanner.dart ('k') | dart/frog/leg/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698