OLD | NEW |
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 import 'dart:math' as math; | 5 import 'dart:math' as math; |
6 import '../common.dart'; | 6 import '../common.dart'; |
7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
8 import '../common/tasks.dart' show CompilerTask; | 8 import '../common/tasks.dart' show CompilerTask; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constant_system.dart'; | 10 import '../constants/constant_system.dart'; |
(...skipping 11 matching lines...) Expand all Loading... |
22 import '../elements/types.dart'; | 22 import '../elements/types.dart'; |
23 import '../io/source_information.dart'; | 23 import '../io/source_information.dart'; |
24 import '../js/js.dart' as js; | 24 import '../js/js.dart' as js; |
25 import '../js_backend/backend_helpers.dart' show BackendHelpers; | 25 import '../js_backend/backend_helpers.dart' show BackendHelpers; |
26 import '../js_backend/js_backend.dart'; | 26 import '../js_backend/js_backend.dart'; |
27 import '../js_emitter/js_emitter.dart' show NativeEmitter; | 27 import '../js_emitter/js_emitter.dart' show NativeEmitter; |
28 import '../native/native.dart' as native; | 28 import '../native/native.dart' as native; |
29 import '../types/types.dart'; | 29 import '../types/types.dart'; |
30 import '../universe/call_structure.dart' show CallStructure; | 30 import '../universe/call_structure.dart' show CallStructure; |
31 import '../universe/selector.dart' show Selector; | 31 import '../universe/selector.dart' show Selector; |
32 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; | 32 import '../universe/use.dart' show ConstantUse, DynamicUse, StaticUse, TypeUse; |
33 import '../util/util.dart'; | 33 import '../util/util.dart'; |
34 import '../world.dart' show ClosedWorld; | 34 import '../world.dart' show ClosedWorld; |
35 import 'codegen_helpers.dart'; | 35 import 'codegen_helpers.dart'; |
36 import 'nodes.dart'; | 36 import 'nodes.dart'; |
37 import 'variable_allocator.dart'; | 37 import 'variable_allocator.dart'; |
38 | 38 |
39 class SsaCodeGeneratorTask extends CompilerTask { | 39 class SsaCodeGeneratorTask extends CompilerTask { |
40 final JavaScriptBackend backend; | 40 final JavaScriptBackend backend; |
41 final Compiler compiler; | 41 final Compiler compiler; |
42 final SourceInformationStrategy sourceInformationFactory; | 42 final SourceInformationStrategy sourceInformationFactory; |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 // TODO(johnniwinther): Support source information on synthetic constants. | 2090 // TODO(johnniwinther): Support source information on synthetic constants. |
2091 expression = expression.withSourceInformation(sourceInformation); | 2091 expression = expression.withSourceInformation(sourceInformation); |
2092 } | 2092 } |
2093 push(expression); | 2093 push(expression); |
2094 } | 2094 } |
2095 | 2095 |
2096 visitConstant(HConstant node) { | 2096 visitConstant(HConstant node) { |
2097 assert(isGenerateAtUseSite(node)); | 2097 assert(isGenerateAtUseSite(node)); |
2098 generateConstant(node.constant, node.sourceInformation); | 2098 generateConstant(node.constant, node.sourceInformation); |
2099 | 2099 |
2100 registry.registerCompileTimeConstant(node.constant); | 2100 registry.registerConstantUse(new ConstantUse.literal(node.constant)); |
2101 } | 2101 } |
2102 | 2102 |
2103 visitNot(HNot node) { | 2103 visitNot(HNot node) { |
2104 assert(node.inputs.length == 1); | 2104 assert(node.inputs.length == 1); |
2105 generateNot(node.inputs[0], node.sourceInformation); | 2105 generateNot(node.inputs[0], node.sourceInformation); |
2106 } | 2106 } |
2107 | 2107 |
2108 static String mapRelationalOperator(String op, bool inverse) { | 2108 static String mapRelationalOperator(String op, bool inverse) { |
2109 Map<String, String> inverseOperator = const <String, String>{ | 2109 Map<String, String> inverseOperator = const <String, String>{ |
2110 "==": "!=", | 2110 "==": "!=", |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3128 registry.registerStaticUse(new StaticUse.staticInvoke( | 3128 registry.registerStaticUse(new StaticUse.staticInvoke( |
3129 helper, new CallStructure.unnamed(argumentCount))); | 3129 helper, new CallStructure.unnamed(argumentCount))); |
3130 return backend.emitter.staticFunctionAccess(helper); | 3130 return backend.emitter.staticFunctionAccess(helper); |
3131 } | 3131 } |
3132 | 3132 |
3133 @override | 3133 @override |
3134 void visitRef(HRef node) { | 3134 void visitRef(HRef node) { |
3135 visit(node.value); | 3135 visit(node.value); |
3136 } | 3136 } |
3137 } | 3137 } |
OLD | NEW |