Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 '../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'; | 9 import '../compiler.dart'; |
| 10 import '../diagnostics/spannable.dart'; | 10 import '../diagnostics/spannable.dart'; |
| 11 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
| 12 import '../io/source_information.dart'; | 12 import '../io/source_information.dart'; |
| 13 import '../js_backend/backend.dart' show JavaScriptBackend; | 13 import '../js_backend/backend.dart' show JavaScriptBackend; |
| 14 import '../kernel/kernel.dart'; | 14 import '../kernel/kernel.dart'; |
| 15 import '../kernel/kernel_visitor.dart'; | 15 import '../kernel/kernel_visitor.dart'; |
| 16 import '../resolution/tree_elements.dart'; | 16 import '../resolution/tree_elements.dart'; |
| 17 import '../tree/dartstring.dart'; | 17 import '../tree/dartstring.dart'; |
| 18 import '../types/masks.dart'; | 18 import '../types/masks.dart'; |
| 19 | 19 |
| 20 import 'context.dart'; | |
| 20 import 'graph_builder.dart'; | 21 import 'graph_builder.dart'; |
| 21 import 'kernel_ast_adapter.dart'; | 22 import 'kernel_ast_adapter.dart'; |
| 22 import 'locals_handler.dart'; | 23 import 'locals_handler.dart'; |
| 23 import 'nodes.dart'; | 24 import 'nodes.dart'; |
| 24 import 'ssa_branch_builder.dart'; | 25 import 'ssa_branch_builder.dart'; |
| 25 | 26 |
| 26 class SsaKernelBuilderTask extends CompilerTask { | 27 class SsaKernelBuilderTask extends CompilerTask { |
| 27 final JavaScriptBackend backend; | 28 final JavaScriptBackend backend; |
| 28 final SourceInformationStrategy sourceInformationFactory; | 29 final SourceInformationStrategy sourceInformationFactory; |
| 29 | 30 |
| 30 String get name => 'SSA kernel builder'; | 31 String get name => 'SSA kernel builder'; |
| 31 | 32 |
| 32 SsaKernelBuilderTask(JavaScriptBackend backend, this.sourceInformationFactory) | 33 SsaKernelBuilderTask(JavaScriptBackend backend, this.sourceInformationFactory) |
| 33 : backend = backend, | 34 : backend = backend, |
| 34 super(backend.compiler.measurer); | 35 super(backend.compiler.measurer); |
| 35 | 36 |
| 36 HGraph build(CodegenWorkItem work) { | 37 HGraph build(CodegenWorkItem work, SsaCompilationContext context) { |
|
Siggi Cherem (dart-lang)
2016/09/02 22:26:38
not in use yet, but it will be :)
| |
| 37 return measure(() { | 38 return measure(() { |
| 38 AstElement element = work.element.implementation; | 39 AstElement element = work.element.implementation; |
| 39 TreeElements treeElements = work.resolvedAst.elements; | 40 TreeElements treeElements = work.resolvedAst.elements; |
| 40 Kernel kernel = new Kernel(backend.compiler); | 41 Kernel kernel = new Kernel(backend.compiler); |
| 41 KernelVisitor visitor = new KernelVisitor(element, treeElements, kernel); | 42 KernelVisitor visitor = new KernelVisitor(element, treeElements, kernel); |
| 42 IrFunction function; | 43 IrFunction function; |
| 43 try { | 44 try { |
| 44 function = visitor.buildFunction(); | 45 function = visitor.buildFunction(); |
| 45 } catch (e) { | 46 } catch (e) { |
| 46 throw "Failed to convert to Kernel IR: $e"; | 47 throw "Failed to convert to Kernel IR: $e"; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 visitThisExpression(ir.ThisExpression thisExpression) { | 306 visitThisExpression(ir.ThisExpression thisExpression) { |
| 306 stack.add(localsHandler.readThis()); | 307 stack.add(localsHandler.readThis()); |
| 307 } | 308 } |
| 308 | 309 |
| 309 @override | 310 @override |
| 310 visitNot(ir.Not not) { | 311 visitNot(ir.Not not) { |
| 311 not.operand.accept(this); | 312 not.operand.accept(this); |
| 312 push(new HNot(popBoolified(), backend.boolType)); | 313 push(new HNot(popBoolified(), backend.boolType)); |
| 313 } | 314 } |
| 314 } | 315 } |
| OLD | NEW |