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

Unified Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 2392343004: Optimize out checkInt, checkNum and checkString (Closed)
Patch Set: Created 4 years, 2 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 | « pkg/compiler/lib/src/js_backend/backend_helpers.dart ('k') | tests/compiler/dart2js/mock_libraries.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 6ff4e783c2628f33e7a24e2fe26721b75945ba10..e8c546a42b03ff4ec80de283618a7b05b856c8df 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -952,7 +952,9 @@ class SsaInstructionSimplifier extends HBaseVisitor
HInstruction visitInvokeStatic(HInvokeStatic node) {
propagateConstantValueToUses(node);
- if (node.element == backend.helpers.checkConcurrentModificationError) {
+ Element element = node.element;
+
+ if (element == backend.helpers.checkConcurrentModificationError) {
if (node.inputs.length == 2) {
HInstruction firstArgument = node.inputs[0];
if (firstArgument is HConstant) {
@@ -960,6 +962,21 @@ class SsaInstructionSimplifier extends HBaseVisitor
if (constant.constant.isTrue) return constant;
}
}
+ } else if (element == backend.helpers.checkInt) {
+ if (node.inputs.length == 1) {
+ HInstruction argument = node.inputs[0];
+ if (argument.isInteger(compiler)) return argument;
+ }
+ } else if (element == backend.helpers.checkNum) {
+ if (node.inputs.length == 1) {
+ HInstruction argument = node.inputs[0];
+ if (argument.isNumber(compiler)) return argument;
+ }
+ } else if (element == backend.helpers.checkString) {
+ if (node.inputs.length == 1) {
+ HInstruction argument = node.inputs[0];
+ if (argument.isString(compiler)) return argument;
+ }
}
return node;
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend_helpers.dart ('k') | tests/compiler/dart2js/mock_libraries.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698