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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart

Issue 682243004: Redo "Constant fold charCodeAt via constant system" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix analysis warning Created 6 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
Index: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart b/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
index d9fc2865689090dbc84f51569946e071dfa5f528..5511118ee603a6cf9148ffdf3f5150b14cfe79f6 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
@@ -69,6 +69,12 @@ class InvokeDynamicSpecializer {
} else if (selector.name == '>=') {
return const GreaterEqualSpecializer();
}
+ } else if (selector.kind == SelectorKind.CALL) {
+ if (selector.argumentCount == 1 && selector.namedArguments.length == 0) {
+ if (selector.name == 'codeUnitAt') {
+ return const CodeUnitAtSpecializer();
+ }
+ }
}
return const InvokeDynamicSpecializer();
}
@@ -726,3 +732,18 @@ class LessEqualSpecializer extends RelationalSpecializer {
instruction.selector, backend.boolType);
}
}
+
+class CodeUnitAtSpecializer extends InvokeDynamicSpecializer {
+ const CodeUnitAtSpecializer();
+
+ BinaryOperation operation(ConstantSystem constantSystem) {
+ return constantSystem.codeUnitAt;
+ }
+
+ HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
+ Compiler compiler) {
+ // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index
+ // bounds checking optimizations as for HIndex.
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698