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

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

Issue 1058433003: "Redo "Avoid getInterceptor calls in cases were the interceptor would be constant if it were not `n… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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: pkg/compiler/lib/src/ssa/nodes.dart
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index 9759c5c209ddcf5128552d50b1c610aefaf949d7..fd28580862f04815a45bea90249c54b104f3696d 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -2300,15 +2300,34 @@ class HInterceptor extends HInstruction {
// This field should originally be null to allow GVN'ing all
// [HInterceptor] on the same input.
Set<ClassElement> interceptedClasses;
+
+ // inputs[0] is initially the only input, the receiver.
+
+ // inputs[1] is a constant interceptor when the interceptor is a constant
+ // except for a `null` receiver. This is used when the receiver can't be
+ // falsy, except for `null`, allowing the generation of code like
+ //
+ // (a && C.JSArray_methods).get$first(a)
+ //
+
HInterceptor(HInstruction receiver, TypeMask type)
: super(<HInstruction>[receiver], type) {
sideEffects.clearAllSideEffects();
sideEffects.clearAllDependencies();
setUseGvn();
}
+
String toString() => 'interceptor on $interceptedClasses';
accept(HVisitor visitor) => visitor.visitInterceptor(this);
HInstruction get receiver => inputs[0];
+
+ bool get isConditionalConstantInterceptor => inputs.length == 2;
+ HInstruction get conditionalConstantInterceptor => inputs[1];
+ void set conditionalConstantInterceptor(HConstant constant) {
+ assert(!isConditionalConstantInterceptor);
+ inputs.add(constant);
+ }
+
bool isInterceptor(Compiler compiler) => true;
int typeCode() => HInstruction.INTERCEPTOR_TYPECODE;
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | tests/compiler/dart2js/analyze_unused_dart2js_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698