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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1243063002: dart2js cps: Remove NonTailThrow. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 5 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closurelib; 7 import '../closure.dart' as closurelib;
8 import '../closure.dart' hide ClosureScope; 8 import '../closure.dart' hide ClosureScope;
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 2404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 // Instance field initializers are inlined in the constructor, 2415 // Instance field initializers are inlined in the constructor,
2416 // so we shouldn't need to build anything here. 2416 // so we shouldn't need to build anything here.
2417 // TODO(asgerf): But what should we return? 2417 // TODO(asgerf): But what should we return?
2418 return null; 2418 return null;
2419 } 2419 }
2420 break; 2420 break;
2421 2421
2422 default: 2422 default:
2423 compiler.internalError(element, "Unexpected element type $element"); 2423 compiler.internalError(element, "Unexpected element type $element");
2424 } 2424 }
2425 new CleanupPass().visit(root);
2426 return root; 2425 return root;
2427 }); 2426 });
2428 } 2427 }
2429 2428
2430 ir.FunctionDefinition buildStaticFieldInitializer(FieldElement element) { 2429 ir.FunctionDefinition buildStaticFieldInitializer(FieldElement element) {
2431 if (!backend.constants.lazyStatics.contains(element)) { 2430 if (!backend.constants.lazyStatics.contains(element)) {
2432 return null; // Nothing to do. 2431 return null; // Nothing to do.
2433 } 2432 }
2434 closureClassMap = 2433 closureClassMap =
2435 compiler.closureToClassMapper.computeClosureToClassMapping( 2434 compiler.closureToClassMapper.computeClosureToClassMapping(
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
3350 if (compiler.backend.isForeign(function)) { 3349 if (compiler.backend.isForeign(function)) {
3351 return handleForeignCode(node, function, argumentList, callStructure); 3350 return handleForeignCode(node, function, argumentList, callStructure);
3352 } else { 3351 } else {
3353 return irBuilder.buildStaticFunctionInvocation(function, callStructure, 3352 return irBuilder.buildStaticFunctionInvocation(function, callStructure,
3354 translateStaticArguments(argumentList, function, callStructure), 3353 translateStaticArguments(argumentList, function, callStructure),
3355 sourceInformation: 3354 sourceInformation:
3356 sourceInformationBuilder.buildCall(node, node.selector)); 3355 sourceInformationBuilder.buildCall(node, node.selector));
3357 } 3356 }
3358 } 3357 }
3359 } 3358 }
3360
3361 /// Perform simple post-processing on the initial CPS-translated root term.
3362 ///
3363 /// This pass performs backend-independent post-processing on the translated
3364 /// term. It is implemented separately from the optimization passes because
3365 /// it is required for correctness of the implementation.
3366 ///
3367 /// It performs the following translations:
3368 /// - Replace [ir.LetPrim] binding a [ir.NonTailThrow] with a [ir.Throw]
3369 /// expression.
3370 class CleanupPass extends ir.RecursiveVisitor {
3371 ir.Expression replacementFor(ir.Expression expression) {
3372 if (expression != null && expression is ir.LetPrim) {
3373 ir.Primitive primitive = expression.primitive;
3374 if (primitive is ir.NonTailThrow) {
3375 ir.RemovalVisitor.remove(expression);
3376 return new ir.Throw(primitive.value.definition);
3377 }
3378 }
3379 return expression;
3380 }
3381
3382 processFunctionDefinition(ir.FunctionDefinition node) {
3383 node.body = replacementFor(node.body);
3384 }
3385
3386 processLetPrim(ir.LetPrim node) {
3387 node.body = replacementFor(node.body);
3388 }
3389
3390 processLetCont(ir.LetCont node) {
3391 node.body = replacementFor(node.body);
3392 }
3393
3394 processLetHandler(ir.LetHandler node) {
3395 node.body = replacementFor(node.body);
3396 }
3397
3398 processLetMutable(ir.LetMutable node) {
3399 node.body = replacementFor(node.body);
3400 }
3401
3402 processContinuation(ir.Continuation node) {
3403 node.body = replacementFor(node.body);
3404 }
3405 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698