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

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

Issue 2995353002: Test the CapturedScope for local functions (Closed)
Patch Set: Created 3 years, 4 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/codegen.dart' show CodegenRegistry; 9 import '../common/codegen.dart' show CodegenRegistry;
10 import '../common/names.dart'; 10 import '../common/names.dart';
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // Provide the parameters to the generative constructor body. 394 // Provide the parameters to the generative constructor body.
395 body.function.positionalParameters.forEach(handleParameter); 395 body.function.positionalParameters.forEach(handleParameter);
396 body.function.namedParameters.toList() 396 body.function.namedParameters.toList()
397 ..sort(namedOrdering) 397 ..sort(namedOrdering)
398 ..forEach(handleParameter); 398 ..forEach(handleParameter);
399 399
400 // If there are locals that escape (i.e. mutated in closures), we pass the 400 // If there are locals that escape (i.e. mutated in closures), we pass the
401 // box to the constructor. 401 // box to the constructor.
402 CapturedScope scopeData = 402 CapturedScope scopeData =
403 closureDataLookup.getCapturedScope(constructorElement); 403 closureDataLookup.getCapturedScope(constructorElement);
404 if (scopeData.requiresContextBox) { 404 if (scopeData.hasBox) {
405 bodyCallInputs.add(localsHandler.readLocal(scopeData.context)); 405 bodyCallInputs.add(localsHandler.readLocal(scopeData.box));
406 } 406 }
407 407
408 // Pass type arguments. 408 // Pass type arguments.
409 ir.Class currentClass = body.enclosingClass; 409 ir.Class currentClass = body.enclosingClass;
410 if (closedWorld.rtiNeed 410 if (closedWorld.rtiNeed
411 .classNeedsRti(_elementMap.getClass(currentClass))) { 411 .classNeedsRti(_elementMap.getClass(currentClass))) {
412 for (ir.DartType typeParameter in currentClass.thisType.typeArguments) { 412 for (ir.DartType typeParameter in currentClass.thisType.typeArguments) {
413 HInstruction argument = localsHandler.readLocal(localsHandler 413 HInstruction argument = localsHandler.readLocal(localsHandler
414 .getTypeVariableAsLocal(_elementMap.getDartType(typeParameter))); 414 .getTypeVariableAsLocal(_elementMap.getDartType(typeParameter)));
415 bodyCallInputs.add(argument); 415 bodyCallInputs.add(argument);
(...skipping 3264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3680 enterBlock.setBlockFlow( 3680 enterBlock.setBlockFlow(
3681 new HTryBlockInformation( 3681 new HTryBlockInformation(
3682 kernelBuilder.wrapStatementGraph(bodyGraph), 3682 kernelBuilder.wrapStatementGraph(bodyGraph),
3683 exception, 3683 exception,
3684 kernelBuilder.wrapStatementGraph(catchGraph), 3684 kernelBuilder.wrapStatementGraph(catchGraph),
3685 kernelBuilder.wrapStatementGraph(finallyGraph)), 3685 kernelBuilder.wrapStatementGraph(finallyGraph)),
3686 exitBlock); 3686 exitBlock);
3687 kernelBuilder.inTryStatement = previouslyInTryStatement; 3687 kernelBuilder.inTryStatement = previouslyInTryStatement;
3688 } 3688 }
3689 } 3689 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698