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

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

Issue 10265027: Move all the builtin$ interceptors to a new interceptors library and shorten the names of them. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. 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/library_map.dart ('k') | no next file » | 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 26 matching lines...) Expand all
37 if (name === '>>=') return const SourceString('shr'); 37 if (name === '>>=') return const SourceString('shr');
38 if (name === '|=') return const SourceString('or'); 38 if (name === '|=') return const SourceString('or');
39 if (name === '&=') return const SourceString('and'); 39 if (name === '&=') return const SourceString('and');
40 if (name === '^=') return const SourceString('xor'); 40 if (name === '^=') return const SourceString('xor');
41 if (name === '++') return const SourceString('add'); 41 if (name === '++') return const SourceString('add');
42 if (name === '--') return const SourceString('sub'); 42 if (name === '--') return const SourceString('sub');
43 compiler.unimplemented('Unknown operator', node: op); 43 compiler.unimplemented('Unknown operator', node: op);
44 } 44 }
45 45
46 Element getStaticInterceptor(SourceString name, int parameters) { 46 Element getStaticInterceptor(SourceString name, int parameters) {
47 String mangledName = "builtin\$${name.slowToString()}\$${parameters}"; 47 String mangledName = name.slowToString();
48 return compiler.findHelper(new SourceString(mangledName)); 48 Element element = compiler.findInterceptor(new SourceString(mangledName));
49 if (element !== null && element.isFunction()) {
50 // Only pick the function element with the short name if the
51 // number of parameters it expects matches the number we're
52 // passing modulo the receiver.
53 FunctionElement function = element;
54 if (function.parameterCount(compiler) == parameters + 1) return element;
55 }
56 String longMangledName = "$mangledName\$$parameters";
57 return compiler.findInterceptor(new SourceString(longMangledName));
49 } 58 }
50 59
51 Element getStaticGetInterceptor(SourceString name) { 60 Element getStaticGetInterceptor(SourceString name) {
52 String mangledName = "builtin\$get\$${name.slowToString()}"; 61 String mangledName = "get\$${name.slowToString()}";
53 return compiler.findHelper(new SourceString(mangledName)); 62 return compiler.findInterceptor(new SourceString(mangledName));
54 } 63 }
55 64
56 Element getStaticSetInterceptor(SourceString name) { 65 Element getStaticSetInterceptor(SourceString name) {
57 String mangledName = "builtin\$set\$${name.slowToString()}"; 66 String mangledName = "set\$${name.slowToString()}";
58 return compiler.findHelper(new SourceString(mangledName)); 67 return compiler.findInterceptor(new SourceString(mangledName));
59 } 68 }
60 69
61 Element getOperatorInterceptor(Operator op) { 70 Element getOperatorInterceptor(Operator op) {
62 SourceString name = mapOperatorToMethodName(op); 71 SourceString name = mapOperatorToMethodName(op);
63 return compiler.findHelper(name); 72 return compiler.findHelper(name);
64 } 73 }
65 74
66 Element getBoolifiedVersionOf(Element interceptor) { 75 Element getBoolifiedVersionOf(Element interceptor) {
67 String boolifiedName = "${interceptor.name.slowToString()}B"; 76 String boolifiedName = "${interceptor.name.slowToString()}B";
68 return compiler.findHelper(new SourceString(boolifiedName)); 77 return compiler.findHelper(new SourceString(boolifiedName));
(...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 <HInstruction>[target, input], 3202 <HInstruction>[target, input],
3194 HType.STRING)); 3203 HType.STRING));
3195 return builder.pop(); 3204 return builder.pop();
3196 } 3205 }
3197 3206
3198 HInstruction result() { 3207 HInstruction result() {
3199 flushLiterals(); 3208 flushLiterals();
3200 return prefix; 3209 return prefix;
3201 } 3210 }
3202 } 3211 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/library_map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698