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

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
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,17 @@
stack.add(stack.last());
}
- HBoolify popBoolified() {
- HBoolify boolified = new HBoolify(pop());
- add(boolified);
- return boolified;
+ HInstruction popBoolified() {
+ HInstruction value = pop();
+ if (compiler.enableTypeAssertions) {
+ return potentiallyCheckType(
+ value,
+ compiler.boolClass,
+ kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK);
+ }
+ HInstruction result = new HBoolify(value);
+ add(result);
+ return result;
}
HInstruction attachPosition(HInstruction target, Node node) {
« 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