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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10905235: Check boolean conversion in checked mode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/ssa/builder.dart
===================================================================
--- lib/compiler/implementation/ssa/builder.dart (revision 12308)
+++ lib/compiler/implementation/ssa/builder.dart (working copy)
@@ -1352,11 +1352,11 @@
}
}
- HInstruction potentiallyCheckType(HInstruction original,
- Element sourceElement) {
+ HInstruction potentiallyCheckType(
+ HInstruction original, Element sourceElement,
+ { int kind: HTypeConversion.CHECKED_MODE_CHECK }) {
if (!compiler.enableTypeAssertions) return original;
- HInstruction other = original.convertType(
- compiler, sourceElement, HTypeConversion.CHECKED_MODE_CHECK);
+ HInstruction other = original.convertType(compiler, sourceElement, kind);
if (other != original) add(other);
return other;
}
@@ -1433,10 +1433,19 @@
stack.add(stack.last());
}
- HBoolify popBoolified() {
- HBoolify boolified = new HBoolify(pop());
- add(boolified);
- return boolified;
+ HInstruction popBoolified() {
+ HInstruction result;
kasperl 2012/09/13 10:34:19 Maybe move this to the else branch and just return
ngeoffray 2012/09/13 10:52:32 Done.
+ HInstruction value = pop();
+ if (compiler.enableTypeAssertions) {
+ result = potentiallyCheckType(
+ value,
+ compiler.boolClass,
+ kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK);
+ } else {
+ result = new HBoolify(value);
+ add(result);
+ }
+ return result;
}
HInstruction attachPosition(HInstruction target, Node node) {

Powered by Google App Engine
This is Rietveld 408576698