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

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

Issue 1755823003: Replace TypeMask.isEmpty by isEmptyOrNull, use isEmpty when it's really empty. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 return false; 1394 return false;
1395 } 1395 }
1396 1396
1397 // A generative constructor body is not seen by global analysis, 1397 // A generative constructor body is not seen by global analysis,
1398 // so we should not query for its type. 1398 // so we should not query for its type.
1399 if (!element.isGenerativeConstructorBody) { 1399 if (!element.isGenerativeConstructorBody) {
1400 // Don't inline if the return type was inferred to be non-null empty. 1400 // Don't inline if the return type was inferred to be non-null empty.
1401 // This means that the function always throws an exception. 1401 // This means that the function always throws an exception.
1402 TypeMask returnType = 1402 TypeMask returnType =
1403 compiler.typesTask.getGuaranteedReturnTypeOfElement(element); 1403 compiler.typesTask.getGuaranteedReturnTypeOfElement(element);
1404 if (returnType != null 1404 if (returnType != null && returnType.isEmpty) {
1405 && returnType.isEmpty
1406 && !returnType.isNullable) {
1407 isReachable = false; 1405 isReachable = false;
1408 return false; 1406 return false;
1409 } 1407 }
1410 } 1408 }
1411 1409
1412 return true; 1410 return true;
1413 } 1411 }
1414 1412
1415 bool doesNotContainCode() { 1413 bool doesNotContainCode() {
1416 // A function with size 1 does not contain any code. 1414 // A function with size 1 does not contain any code.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 closeAndGotoExit(new HReturn( 1679 closeAndGotoExit(new HReturn(
1682 graph.addConstantBool(false, compiler), 1680 graph.addConstantBool(false, compiler),
1683 sourceInformationBuilder 1681 sourceInformationBuilder
1684 .buildImplicitReturn(functionElement))); 1682 .buildImplicitReturn(functionElement)));
1685 }, 1683 },
1686 visitElse: null, 1684 visitElse: null,
1687 sourceInformation: sourceInformationBuilder.buildIf(function.body)); 1685 sourceInformation: sourceInformationBuilder.buildIf(function.body));
1688 } 1686 }
1689 } 1687 }
1690 if (const bool.fromEnvironment('unreachable-throw') == true) { 1688 if (const bool.fromEnvironment('unreachable-throw') == true) {
1691 var emptyParameters = parameters.values.where((p) => 1689 var emptyParameters = parameters.values
1692 p.instructionType.isEmpty && !p.instructionType.isNullable); 1690 .where((p) => p.instructionType.isEmpty);
1693 if (emptyParameters.length > 0) { 1691 if (emptyParameters.length > 0) {
1694 addComment('${emptyParameters} inferred as [empty]'); 1692 addComment('${emptyParameters} inferred as [empty]');
1695 pushInvokeStatic(function.body, helpers.assertUnreachableMethod, []); 1693 pushInvokeStatic(function.body, helpers.assertUnreachableMethod, []);
1696 pop(); 1694 pop();
1697 return closeFunction(); 1695 return closeFunction();
1698 } 1696 }
1699 } 1697 }
1700 function.body.accept(this); 1698 function.body.accept(this);
1701 return closeFunction(); 1699 return closeFunction();
1702 } 1700 }
(...skipping 7536 matching lines...) Expand 10 before | Expand all | Expand 10 after
9239 if (unaliased is TypedefType) throw 'unable to unalias $type'; 9237 if (unaliased is TypedefType) throw 'unable to unalias $type';
9240 unaliased.accept(this, builder); 9238 unaliased.accept(this, builder);
9241 } 9239 }
9242 9240
9243 void visitDynamicType(DynamicType type, SsaBuilder builder) { 9241 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9244 JavaScriptBackend backend = builder.compiler.backend; 9242 JavaScriptBackend backend = builder.compiler.backend;
9245 ClassElement cls = backend.helpers.DynamicRuntimeType; 9243 ClassElement cls = backend.helpers.DynamicRuntimeType;
9246 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9244 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9247 } 9245 }
9248 } 9246 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/ssa/interceptor_simplifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698