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

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

Issue 1627333002: Optimize subclass/subtype queries (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Use strictSubtypeCount Created 4 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 unified diff | Download patch
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 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 final SsaCodeGeneratorTask generator; 8 final SsaCodeGeneratorTask generator;
9 final SsaBuilderTask builder; 9 final SsaBuilderTask builder;
10 final SsaOptimizerTask optimizer; 10 final SsaOptimizerTask optimizer;
(...skipping 4822 matching lines...) Expand 10 before | Expand all | Expand 10 after
4833 Selector selector = elements.getSelector(node); 4833 Selector selector = elements.getSelector(node);
4834 List<HInstruction> inputs = <HInstruction>[]; 4834 List<HInstruction> inputs = <HInstruction>[];
4835 addGenericSendArgumentsToList(arguments.nodes, inputs); 4835 addGenericSendArgumentsToList(arguments.nodes, inputs);
4836 generateSuperNoSuchMethodSend(node, selector, inputs); 4836 generateSuperNoSuchMethodSend(node, selector, inputs);
4837 } 4837 }
4838 4838
4839 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) { 4839 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
4840 ClassWorld classWorld = compiler.world; 4840 ClassWorld classWorld = compiler.world;
4841 if (classWorld.isUsedAsMixin(cls)) return true; 4841 if (classWorld.isUsedAsMixin(cls)) return true;
4842 4842
4843 Iterable<ClassElement> subclasses = compiler.world.strictSubclassesOf(cls); 4843 return compiler.world.anyStrictSubclassOf(cls, (ClassElement subclass) {
4844 return subclasses.any((ClassElement subclass) {
4845 return !rti.isTrivialSubstitution(subclass, cls); 4844 return !rti.isTrivialSubstitution(subclass, cls);
4846 }); 4845 });
4847 } 4846 }
4848 4847
4849 /** 4848 /**
4850 * Generate code to extract the type arguments from the object, substitute 4849 * Generate code to extract the type arguments from the object, substitute
4851 * them as an instance of the type we are testing against (if necessary), and 4850 * them as an instance of the type we are testing against (if necessary), and
4852 * extract the type argument by the index of the variable in the list of type 4851 * extract the type argument by the index of the variable in the list of type
4853 * variables for that class. 4852 * variables for that class.
4854 */ 4853 */
(...skipping 4374 matching lines...) Expand 10 before | Expand all | Expand 10 after
9229 if (unaliased is TypedefType) throw 'unable to unalias $type'; 9228 if (unaliased is TypedefType) throw 'unable to unalias $type';
9230 unaliased.accept(this, builder); 9229 unaliased.accept(this, builder);
9231 } 9230 }
9232 9231
9233 void visitDynamicType(DynamicType type, SsaBuilder builder) { 9232 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9234 JavaScriptBackend backend = builder.compiler.backend; 9233 JavaScriptBackend backend = builder.compiler.backend;
9235 ClassElement cls = backend.helpers.DynamicRuntimeType; 9234 ClassElement cls = backend.helpers.DynamicRuntimeType;
9236 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9235 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9237 } 9236 }
9238 } 9237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698