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

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

Issue 10389063: Implement PrimitiveOrNull types. (Closed) Base URL: http://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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 Element sourceElement) { 1041 Element sourceElement) {
1042 if (!compiler.enableTypeAssertions) return original; 1042 if (!compiler.enableTypeAssertions) return original;
1043 1043
1044 Type type = sourceElement.computeType(compiler); 1044 Type type = sourceElement.computeType(compiler);
1045 if (type === null) return original; 1045 if (type === null) return original;
1046 if (type.element === compiler.dynamicClass) return original; 1046 if (type.element === compiler.dynamicClass) return original;
1047 if (type.element === compiler.objectClass) return original; 1047 if (type.element === compiler.objectClass) return original;
1048 1048
1049 HType convertedType = new HType.fromBoundedType(type, compiler, true); 1049 HType convertedType = new HType.fromBoundedType(type, compiler, true);
1050 1050
1051 // TODO(ngeoffray): the factory method should never return null.
1052 if (convertedType === null) {
1053 return original;
1054 }
1055
1056 // No need to convert if we know the instruction has 1051 // No need to convert if we know the instruction has
1057 // [convertedType] as a bound. 1052 // [convertedType] as a bound.
1058 if (original.guaranteedType == convertedType) { 1053 if (original.guaranteedType == convertedType) {
1059 return original; 1054 return original;
1060 } 1055 }
1061 1056
1062 HInstruction instruction = 1057 HInstruction instruction =
1063 new HTypeConversion(convertedType, original, true); 1058 new HTypeConversion(convertedType, original, true);
1064 add(instruction); 1059 add(instruction);
1065 return instruction; 1060 return instruction;
(...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after
3316 <HInstruction>[target, input], 3311 <HInstruction>[target, input],
3317 HType.STRING)); 3312 HType.STRING));
3318 return builder.pop(); 3313 return builder.pop();
3319 } 3314 }
3320 3315
3321 HInstruction result() { 3316 HInstruction result() {
3322 flushLiterals(); 3317 flushLiterals();
3323 return prefix; 3318 return prefix;
3324 } 3319 }
3325 } 3320 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698