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

Side by Side Diff: pkg/compiler/lib/src/ssa/nodes.dart

Issue 1031633003: Almost-constant interceptors (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 abstract class HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitAwait(HAwait node); 9 R visitAwait(HAwait node);
10 R visitBitAnd(HBitAnd node); 10 R visitBitAnd(HBitAnd node);
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 int typeCode() => HInstruction.STATIC_TYPECODE; 2293 int typeCode() => HInstruction.STATIC_TYPECODE;
2294 bool typeEquals(other) => other is HStatic; 2294 bool typeEquals(other) => other is HStatic;
2295 bool dataEquals(HStatic other) => element == other.element; 2295 bool dataEquals(HStatic other) => element == other.element;
2296 bool isCodeMotionInvariant() => !element.isAssignable; 2296 bool isCodeMotionInvariant() => !element.isAssignable;
2297 } 2297 }
2298 2298
2299 class HInterceptor extends HInstruction { 2299 class HInterceptor extends HInstruction {
2300 // This field should originally be null to allow GVN'ing all 2300 // This field should originally be null to allow GVN'ing all
2301 // [HInterceptor] on the same input. 2301 // [HInterceptor] on the same input.
2302 Set<ClassElement> interceptedClasses; 2302 Set<ClassElement> interceptedClasses;
2303
2304 // inputs[0] is initially the only input, the receiver.
floitsch 2015/03/26 20:26:45 Create getters.
sra1 2015/04/01 23:06:59 Done.
2305
2306 // inputs[1] is a constant interceptor when the interceptor is a constant
2307 // except for a `null` receiver. This is used when the receiver can't, except
2308 // for `null`, be a falsy JavaScript value, allowing the generation of code
2309 // like `(a && C.JSArray_methods).get$first(a)`.
2310
2303 HInterceptor(HInstruction receiver, TypeMask type) 2311 HInterceptor(HInstruction receiver, TypeMask type)
2304 : super(<HInstruction>[receiver], type) { 2312 : super(<HInstruction>[receiver], type) {
2305 sideEffects.clearAllSideEffects(); 2313 sideEffects.clearAllSideEffects();
2306 sideEffects.clearAllDependencies(); 2314 sideEffects.clearAllDependencies();
2307 setUseGvn(); 2315 setUseGvn();
2308 } 2316 }
2317
2309 String toString() => 'interceptor on $interceptedClasses'; 2318 String toString() => 'interceptor on $interceptedClasses';
2310 accept(HVisitor visitor) => visitor.visitInterceptor(this); 2319 accept(HVisitor visitor) => visitor.visitInterceptor(this);
2311 HInstruction get receiver => inputs[0]; 2320 HInstruction get receiver => inputs[0];
2312 bool isInterceptor(Compiler compiler) => true; 2321 bool isInterceptor(Compiler compiler) => true;
2313 2322
2314 int typeCode() => HInstruction.INTERCEPTOR_TYPECODE; 2323 int typeCode() => HInstruction.INTERCEPTOR_TYPECODE;
2315 bool typeEquals(other) => other is HInterceptor; 2324 bool typeEquals(other) => other is HInterceptor;
2316 bool dataEquals(HInterceptor other) { 2325 bool dataEquals(HInterceptor other) {
2317 return interceptedClasses == other.interceptedClasses 2326 return interceptedClasses == other.interceptedClasses
2318 || (interceptedClasses.length == other.interceptedClasses.length 2327 || (interceptedClasses.length == other.interceptedClasses.length
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 class HDynamicType extends HRuntimeType { 3140 class HDynamicType extends HRuntimeType {
3132 HDynamicType(DynamicType dartType, TypeMask instructionType) 3141 HDynamicType(DynamicType dartType, TypeMask instructionType)
3133 : super(const <HInstruction>[], dartType, instructionType); 3142 : super(const <HInstruction>[], dartType, instructionType);
3134 3143
3135 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3144 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3136 3145
3137 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3146 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3138 3147
3139 bool typeEquals(HInstruction other) => other is HDynamicType; 3148 bool typeEquals(HInstruction other) => other is HDynamicType;
3140 } 3149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698