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

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

Issue 10866021: Simplify HInvokeInterceptor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/nodes.dart
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index 9c51bb7095ec4c58b9b088e51e4e9e1212133e4a..b2a19813ef4fb4c498d18cfb2e554107ef2e206c 100644
--- a/lib/compiler/implementation/ssa/nodes.dart
+++ b/lib/compiler/implementation/ssa/nodes.dart
@@ -1295,23 +1295,18 @@ class HInvokeSuper extends HInvokeStatic {
class HInvokeInterceptor extends HInvokeStatic {
final Selector selector;
- final SourceString name;
- final bool getter;
- final bool setter;
HInvokeInterceptor(this.selector,
- this.name,
List<HInstruction> inputs,
- [HType knownType = HType.UNKNOWN,
- this.getter = false,
- this.setter = false])
+ [HType knownType = HType.UNKNOWN])
: super(inputs, knownType);
toString() => 'invoke interceptor: ${element.name}';
accept(HVisitor visitor) => visitor.visitInvokeInterceptor(this);
bool isLengthGetter() {
- return getter && name == const SourceString('length');
+ return selector.isGetter() &&
+ selector.name == const SourceString('length');
}
bool isLengthGetterOnStringOrArray(HTypeMap types) {
@@ -1320,7 +1315,7 @@ class HInvokeInterceptor extends HInvokeStatic {
HType computeLikelyType(HTypeMap types) {
// In general a length getter or method returns an int.
- if (name == const SourceString('length')) return HType.INTEGER;
+ if (isLengthGetter()) return HType.INTEGER;
return HType.UNKNOWN;
}
@@ -1335,8 +1330,9 @@ class HInvokeInterceptor extends HInvokeStatic {
// on it that mutate it, then we want to restrict the incoming type to be
// a mutable array.
if (input == inputs[1] && input.isIndexablePrimitive(types)) {
- if (name == const SourceString('add')
- || name == const SourceString('removeLast')) {
+ // TODO(kasperl): Should we check that the selector is a call selector?
ngeoffray 2012/08/22 13:58:54 I think not checking is ok. If it's a getter, you
+ if (selector.name == const SourceString('add')
+ || selector.name == const SourceString('removeLast')) {
return HType.MUTABLE_ARRAY;
}
}
@@ -1355,9 +1351,7 @@ class HInvokeInterceptor extends HInvokeStatic {
int typeCode() => 4;
bool typeEquals(other) => other is HInvokeInterceptor;
- bool dataEquals(HInvokeInterceptor other) {
- return getter == other.getter && name == other.name;
- }
+ bool dataEquals(HInvokeInterceptor other) => selector == other.selector;
}
abstract class HFieldAccess extends HInstruction {

Powered by Google App Engine
This is Rietveld 408576698