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

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

Issue 1762723002: Cleanup 1: split parts into their own libraries, remove unused imports (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 import '../common.dart';
6 import '../common/codegen.dart' show
7 CodegenRegistry,
8 CodegenWorkItem;
9 import '../common/tasks.dart' show
10 CompilerTask;
11 import '../compiler.dart' show
12 Compiler;
13 import '../constants/constant_system.dart';
14 import '../constants/values.dart';
15 import '../core_types.dart' show
16 CoreClasses;
17 import '../dart_types.dart';
18 import '../elements/elements.dart';
19 import '../io/source_information.dart';
20 import '../js/js.dart' as js;
21 import '../js_backend/backend_helpers.dart' show
22 BackendHelpers;
23 import '../js_backend/js_backend.dart';
24 import '../js_emitter/js_emitter.dart' show
25 CodeEmitterTask,
26 NativeEmitter;
27 import '../native/native.dart' as native;
28 import '../types/types.dart';
29 import '../universe/call_structure.dart' show
30 CallStructure;
31 import '../universe/selector.dart' show
32 Selector;
33 import '../universe/use.dart' show
34 DynamicUse,
35 StaticUse,
36 TypeUse;
37 import '../util/util.dart';
38 import '../world.dart' show
39 ClassWorld,
40 World;
41
42 import 'nodes.dart';
43 import 'codegen_helpers.dart';
44 import 'variable_allocator.dart';
6 45
7 class SsaCodeGeneratorTask extends CompilerTask { 46 class SsaCodeGeneratorTask extends CompilerTask {
8 47
9 final JavaScriptBackend backend; 48 final JavaScriptBackend backend;
10 final SourceInformationStrategy sourceInformationFactory; 49 final SourceInformationStrategy sourceInformationFactory;
11 50
12 SsaCodeGeneratorTask(JavaScriptBackend backend, 51 SsaCodeGeneratorTask(JavaScriptBackend backend,
13 this.sourceInformationFactory) 52 this.sourceInformationFactory)
14 : this.backend = backend, 53 : this.backend = backend,
15 super(backend.compiler); 54 super(backend.compiler);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 * If the [block] only contains one statement returns that statement. If the 445 * If the [block] only contains one statement returns that statement. If the
407 * that statement itself is a block, recursively calls this method. 446 * that statement itself is a block, recursively calls this method.
408 * 447 *
409 * If the block is empty, returns a new instance of [js.NOP]. 448 * If the block is empty, returns a new instance of [js.NOP].
410 */ 449 */
411 js.Statement unwrapStatement(js.Block block) { 450 js.Statement unwrapStatement(js.Block block) {
412 int len = block.statements.length; 451 int len = block.statements.length;
413 if (len == 0) return new js.EmptyStatement(); 452 if (len == 0) return new js.EmptyStatement();
414 if (len == 1) { 453 if (len == 1) {
415 js.Statement result = block.statements[0]; 454 js.Statement result = block.statements[0];
416 if (result is ast.Block) return unwrapStatement(result); 455 if (result is js.Block) return unwrapStatement(result);
417 return result; 456 return result;
418 } 457 }
419 return block; 458 return block;
420 } 459 }
421 460
422 /** 461 /**
423 * Generate expressions from block information. 462 * Generate expressions from block information.
424 */ 463 */
425 js.Expression generateExpression(HExpressionInformation expression) { 464 js.Expression generateExpression(HExpressionInformation expression) {
426 // Currently we only handle sub-expression graphs. 465 // Currently we only handle sub-expression graphs.
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 LabelDefinition label = node.label; 1449 LabelDefinition label = node.label;
1411 if (!tryCallAction(continueAction, label)) { 1450 if (!tryCallAction(continueAction, label)) {
1412 // TODO(floitsch): should this really be the breakLabelName? 1451 // TODO(floitsch): should this really be the breakLabelName?
1413 pushStatement( 1452 pushStatement(
1414 new js.Continue(backend.namer.breakLabelName(label)) 1453 new js.Continue(backend.namer.breakLabelName(label))
1415 .withSourceInformation(node.sourceInformation)); 1454 .withSourceInformation(node.sourceInformation));
1416 } 1455 }
1417 } else { 1456 } else {
1418 JumpTarget target = node.target; 1457 JumpTarget target = node.target;
1419 if (!tryCallAction(continueAction, target)) { 1458 if (!tryCallAction(continueAction, target)) {
1420 if (target.statement is ast.SwitchStatement) { 1459 if (target.isSwitch) {
1421 pushStatement( 1460 pushStatement(
1422 new js.Continue(backend.namer.implicitContinueLabelName(target)) 1461 new js.Continue(backend.namer.implicitContinueLabelName(target))
1423 .withSourceInformation(node.sourceInformation)); 1462 .withSourceInformation(node.sourceInformation));
1424 } else { 1463 } else {
1425 pushStatement(new js.Continue(null) 1464 pushStatement(new js.Continue(null)
1426 .withSourceInformation(node.sourceInformation)); 1465 .withSourceInformation(node.sourceInformation));
1427 } 1466 }
1428 } 1467 }
1429 } 1468 }
1430 } 1469 }
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 new StaticUse.staticInvoke(helper, 2952 new StaticUse.staticInvoke(helper,
2914 new CallStructure.unnamed(argumentCount))); 2953 new CallStructure.unnamed(argumentCount)));
2915 return backend.emitter.staticFunctionAccess(helper); 2954 return backend.emitter.staticFunctionAccess(helper);
2916 } 2955 }
2917 2956
2918 @override 2957 @override
2919 void visitRef(HRef node) { 2958 void visitRef(HRef node) {
2920 visit(node.value); 2959 visit(node.value);
2921 } 2960 }
2922 } 2961 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698