| Index: pkg/compiler/lib/src/ssa/builder.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
|
| index 85fd58338a7e5e5b627034dbb009549182e4e9ba..2feabefdffd022ba84cc6a14217ad81191d3916c 100644
|
| --- a/pkg/compiler/lib/src/ssa/builder.dart
|
| +++ b/pkg/compiler/lib/src/ssa/builder.dart
|
| @@ -2,7 +2,71 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -part of ssa;
|
| +import 'dart:collection';
|
| +
|
| +import 'package:js_runtime/shared/embedded_names.dart';
|
| +
|
| +import '../closure.dart';
|
| +import '../common.dart';
|
| +import '../common/codegen.dart' show
|
| + CodegenRegistry,
|
| + CodegenWorkItem;
|
| +import '../common/names.dart' show
|
| + Identifiers,
|
| + Selectors;
|
| +import '../common/tasks.dart' show
|
| + CompilerTask;
|
| +import '../compiler.dart' show
|
| + Compiler;
|
| +import '../constants/constant_system.dart';
|
| +import '../constants/expressions.dart';
|
| +import '../constants/values.dart';
|
| +import '../core_types.dart' show
|
| + CoreClasses;
|
| +import '../dart_types.dart';
|
| +import '../diagnostics/messages.dart' show
|
| + Message,
|
| + MessageTemplate;
|
| +import '../elements/elements.dart';
|
| +import '../elements/modelx.dart' show
|
| + ConstructorBodyElementX,
|
| + ElementX,
|
| + VariableElementX;
|
| +import '../io/source_information.dart';
|
| +import '../js/js.dart' as js;
|
| +import '../js_backend/backend_helpers.dart' show
|
| + BackendHelpers;
|
| +import '../js_backend/js_backend.dart';
|
| +import '../js_emitter/js_emitter.dart' show
|
| + CodeEmitterTask,
|
| + NativeEmitter;
|
| +import '../native/native.dart' as native;
|
| +import '../resolution/operators.dart';
|
| +import '../resolution/semantic_visitor.dart';
|
| +import '../resolution/tree_elements.dart' show
|
| + TreeElements;
|
| +import '../tree/tree.dart' as ast;
|
| +import '../types/types.dart';
|
| +import '../universe/call_structure.dart' show
|
| + CallStructure;
|
| +import '../universe/selector.dart' show
|
| + Selector;
|
| +import '../universe/side_effects.dart' show
|
| + SideEffects;
|
| +import '../universe/use.dart' show
|
| + DynamicUse,
|
| + StaticUse,
|
| + TypeUse;
|
| +import '../util/util.dart';
|
| +import '../world.dart' show
|
| + ClassWorld,
|
| + World;
|
| +import '../dump_info.dart' show InfoReporter;
|
| +
|
| +import 'nodes.dart';
|
| +import 'codegen.dart';
|
| +import 'optimize.dart';
|
| +import 'types.dart';
|
|
|
| class SsaFunctionCompiler implements FunctionCompiler {
|
| final SsaCodeGeneratorTask generator;
|
| @@ -2969,7 +3033,7 @@ class SsaBuilder extends ast.Visitor
|
| conditionBlock.postProcessLoopHeader();
|
| HLoopBlockInformation info =
|
| new HLoopBlockInformation(
|
| - HLoopBlockInformation.loopType(loop),
|
| + _loopKind(loop),
|
| wrapExpressionGraph(initializerGraph),
|
| wrapExpressionGraph(conditionExpression),
|
| wrapStatementGraph(bodyGraph),
|
| @@ -4187,7 +4251,7 @@ class SsaBuilder extends ast.Visitor
|
| if (inputs.length != 2) {
|
| reporter.internalError(node.argumentsNode, 'Two arguments expected.');
|
| }
|
| - push(new HStringConcat(inputs[0], inputs[1], node, backend.stringType));
|
| + push(new HStringConcat(inputs[0], inputs[1], backend.stringType));
|
| }
|
|
|
| void handleForeignJsCurrentIsolateContext(ast.Send node) {
|
| @@ -8711,14 +8775,14 @@ class StringBuilderVisitor extends ast.Visitor {
|
|
|
| HInstruction concat(HInstruction left, HInstruction right) {
|
| HInstruction instruction = new HStringConcat(
|
| - left, right, diagnosticNode, builder.backend.stringType);
|
| + left, right, builder.backend.stringType);
|
| builder.add(instruction);
|
| return instruction;
|
| }
|
|
|
| HInstruction stringify(ast.Node node, HInstruction expression) {
|
| HInstruction instruction =
|
| - new HStringify(expression, node, builder.backend.stringType);
|
| + new HStringify(expression, builder.backend.stringType);
|
| builder.add(instruction);
|
| return instruction;
|
| }
|
| @@ -9246,3 +9310,19 @@ class TypeBuilder implements DartTypeVisitor<dynamic, SsaBuilder> {
|
| builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
|
| }
|
| }
|
| +
|
| +/// Determine what kind of loop [node] represents. The result is one of the
|
| +/// kinds defined in [HLoopBlockInformation].
|
| +int _loopKind(ast.Node node) => node.accept(const _LoopTypeVisitor());
|
| +
|
| +class _LoopTypeVisitor extends ast.Visitor {
|
| + const _LoopTypeVisitor();
|
| + int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP;
|
| + int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP;
|
| + int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP;
|
| + int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
|
| + int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
|
| + int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
|
| + int visitSwitchStatement(ast.SwitchStatement node) =>
|
| + HLoopBlockInformation.SWITCH_CONTINUE_LOOP;
|
| +}
|
|
|