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

Unified Diff: sdk/lib/_internal/compiler/implementation/constants.dart

Issue 102833009: Redo "Dummy receiver optimization" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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/constants.dart
diff --git a/sdk/lib/_internal/compiler/implementation/constants.dart b/sdk/lib/_internal/compiler/implementation/constants.dart
index d0305244a8c765a205ba3b97d9606a9da83f2350..272fd6a5cd201f82c7fd1eec4ceaa17e7bb834a8 100644
--- a/sdk/lib/_internal/compiler/implementation/constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/constants.dart
@@ -17,6 +17,7 @@ abstract class ConstantVisitor<R> {
R visitConstructed(ConstructedConstant constant);
R visitType(TypeConstant constant);
R visitInterceptor(InterceptorConstant constant);
+ R visitDummyReceiver(DummyReceiverConstant constant);
}
abstract class Constant {
@@ -41,6 +42,7 @@ abstract class Constant {
bool isType() => false;
bool isSentinel() => false;
bool isInterceptor() => false;
+ bool isDummyReceiver() => false;
bool isNaN() => false;
bool isMinusZero() => false;
@@ -538,6 +540,33 @@ class InterceptorConstant extends Constant {
}
}
+class DummyReceiverConstant extends Constant {
+ final ti.TypeMask typeMask;
+
+ DummyReceiverConstant(this.typeMask);
+
+ bool isDummyReceiver() => true;
+
+ bool operator ==(other) {
+ return other is DummyReceiverConstant
+ && typeMask == other.typeMask;
+ }
+
+ get hashCode => typeMask.hashCode;
+
+ List<Constant> getDependencies() => const <Constant>[];
+
+ accept(ConstantVisitor visitor) => visitor.visitDummyReceiver(this);
+
+ DartType computeType(Compiler compiler) => compiler.types.dynamicType;
+
+ ti.TypeMask computeMask(Compiler compiler) => typeMask;
+
+ String toString() {
+ return 'DummyReceiverConstant($typeMask)';
+ }
+}
+
class ConstructedConstant extends ObjectConstant {
final List<Constant> fields;
final int hashCode;

Powered by Google App Engine
This is Rietveld 408576698