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

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

Issue 964553004: Analyze locals in await for loops as inside a try-finally. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Refer directly to class in dartdoc comment 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
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | tests/language/await_for_use_local_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 6004 matching lines...) Expand 10 before | Expand all | Expand 10 after
6015 visitSwitchCase(ast.SwitchCase node) { 6015 visitSwitchCase(ast.SwitchCase node) {
6016 compiler.internalError(node, 'SsaFromAstMixin.visitSwitchCase.'); 6016 compiler.internalError(node, 'SsaFromAstMixin.visitSwitchCase.');
6017 } 6017 }
6018 6018
6019 visitCaseMatch(ast.CaseMatch node) { 6019 visitCaseMatch(ast.CaseMatch node) {
6020 compiler.internalError(node, 'SsaFromAstMixin.visitCaseMatch.'); 6020 compiler.internalError(node, 'SsaFromAstMixin.visitCaseMatch.');
6021 } 6021 }
6022 6022
6023 /// Calls [buildTry] inside a synthetic try block with [buildFinally] in the 6023 /// Calls [buildTry] inside a synthetic try block with [buildFinally] in the
6024 /// finally block. 6024 /// finally block.
6025 ///
6026 /// Note that to get the right locals behavior, the code visited by [buildTry]
6027 /// and [buildFinally] must have been analyzed as if inside a try-statement by
6028 /// [ClosureTranslator].
6025 void buildProtectedByFinally(void buildTry(), void buildFinally()) { 6029 void buildProtectedByFinally(void buildTry(), void buildFinally()) {
6030 // Save the current locals. The finally block must not reuse the existing
6031 // locals handler. None of the variables that have been defined in the
6032 // body-block will be used, but for loops we will add (unnecessary) phis
6033 // that will reference the body variables. This makes it look as if the
6034 // variables were used in a non-dominated block.
6026 HBasicBlock enterBlock = openNewBlock(); 6035 HBasicBlock enterBlock = openNewBlock();
6027 HTry tryInstruction = new HTry(); 6036 HTry tryInstruction = new HTry();
6028 close(tryInstruction); 6037 close(tryInstruction);
6029 bool oldInTryStatement = inTryStatement; 6038 bool oldInTryStatement = inTryStatement;
6030 inTryStatement = true; 6039 inTryStatement = true;
6031 6040
6032 HBasicBlock startTryBlock; 6041 HBasicBlock startTryBlock;
6033 HBasicBlock endTryBlock; 6042 HBasicBlock endTryBlock;
6034 HBasicBlock startFinallyBlock; 6043 HBasicBlock startFinallyBlock;
6035 HBasicBlock endFinallyBlock; 6044 HBasicBlock endFinallyBlock;
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
6927 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6936 if (unaliased is TypedefType) throw 'unable to unalias $type';
6928 unaliased.accept(this, builder); 6937 unaliased.accept(this, builder);
6929 } 6938 }
6930 6939
6931 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6940 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6932 JavaScriptBackend backend = builder.compiler.backend; 6941 JavaScriptBackend backend = builder.compiler.backend;
6933 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6942 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6934 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6943 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6935 } 6944 }
6936 } 6945 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | tests/language/await_for_use_local_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698