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

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

Issue 11885039: Fix selector name check, and make the interceptor participate in speculatively propagating types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (revision 17051)
+++ sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (working copy)
@@ -1355,7 +1355,7 @@
return HType.UNKNOWN;
} else if (selector.kind == SelectorKind.OPERATOR) {
HType propagatedType = types[this];
- if (selector.name == const SourceString('-') && input == inputs[1]) {
+ if (selector.name == const SourceString('unary-') && input == inputs[1]) {
// If the outgoing type should be a number (integer, double or both) we
// want the outgoing type to be the input too.
// If we don't know the outgoing type we try to make it a number.
@@ -1378,7 +1378,7 @@
if (!isInterceptorCall) return HType.UNKNOWN;
if (selector.kind == SelectorKind.OPERATOR) {
- if (selector.name == const SourceString('-')) {
+ if (selector.name == const SourceString('unary-')) {
HType operandType = types[inputs[1]];
if (operandType.isNumber()) return operandType;
} else if (selector.name == const SourceString('~')) {
@@ -2403,6 +2403,24 @@
setUseGvn();
}
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
ngeoffray 2013/01/15 10:32:27 This was the main reason for the unit test to fail
+ if (interceptedClasses.length != 1) return HType.UNKNOWN;
+ // If the only class being intercepted is of type number, we
+ // make this interceptor call say it wants that class as input.
+ Element interceptor = interceptedClasses.toList()[0];
+ JavaScriptBackend backend = compiler.backend;
+ if (interceptor == backend.jsNumberClass) {
+ return HType.NUMBER;
+ } else if (interceptor == backend.jsIntClass) {
+ return HType.INTEGER;
+ } else if (interceptor == backend.jsDoubleClass) {
+ return HType.DOUBLE;
+ }
+ return HType.UNKNOWN;
+ }
+
int typeCode() => HInstruction.INTERCEPTOR_TYPECODE;
bool typeEquals(other) => other is HInterceptor;
bool dataEquals(HInterceptor other) {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698