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

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

Issue 10238003: Reapply "Avoid "=== true" inside code by calling a function that does this for us." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 27 matching lines...) Expand all
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 = "builtin\$${name.slowToString()}\$${parameters}";
48 Element result = compiler.findHelper(new SourceString(mangledName)); 48 return compiler.findHelper(new SourceString(mangledName));
49 return result;
50 } 49 }
51 50
52 Element getStaticGetInterceptor(SourceString name) { 51 Element getStaticGetInterceptor(SourceString name) {
53 String mangledName = "builtin\$get\$${name.slowToString()}"; 52 String mangledName = "builtin\$get\$${name.slowToString()}";
54 Element result = compiler.findHelper(new SourceString(mangledName)); 53 return compiler.findHelper(new SourceString(mangledName));
55 return result;
56 } 54 }
57 55
58 Element getStaticSetInterceptor(SourceString name) { 56 Element getStaticSetInterceptor(SourceString name) {
59 String mangledName = "builtin\$set\$${name.slowToString()}"; 57 String mangledName = "builtin\$set\$${name.slowToString()}";
60 Element result = compiler.findHelper(new SourceString(mangledName)); 58 return compiler.findHelper(new SourceString(mangledName));
61 return result;
62 } 59 }
63 60
64 Element getOperatorInterceptor(Operator op) { 61 Element getOperatorInterceptor(Operator op) {
65 SourceString name = mapOperatorToMethodName(op); 62 SourceString name = mapOperatorToMethodName(op);
66 Element result = compiler.findHelper(name); 63 return compiler.findHelper(name);
67 return result; 64 }
65
66 Element getBoolifiedVersionOf(Element interceptor) {
67 String boolifiedName = "${interceptor.name.slowToString()}B";
68 return compiler.findHelper(new SourceString(boolifiedName));
68 } 69 }
69 70
70 Element getPrefixOperatorInterceptor(Operator op) { 71 Element getPrefixOperatorInterceptor(Operator op) {
71 String name = op.source.stringValue; 72 String name = op.source.stringValue;
72 if (name === '~') { 73 if (name === '~') {
73 return compiler.findHelper(const SourceString('not')); 74 return compiler.findHelper(const SourceString('not'));
74 } 75 }
75 if (name === '-') { 76 if (name === '-') {
76 return compiler.findHelper(const SourceString('neg')); 77 return compiler.findHelper(const SourceString('neg'));
77 } 78 }
(...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 false, 3123 false,
3123 <HInstruction>[target, input])); 3124 <HInstruction>[target, input]));
3124 return builder.pop(); 3125 return builder.pop();
3125 } 3126 }
3126 3127
3127 HInstruction result() { 3128 HInstruction result() {
3128 flushLiterals(); 3129 flushLiterals();
3129 return prefix; 3130 return prefix;
3130 } 3131 }
3131 } 3132 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/lib/js_helper.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698