| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../constants/values.dart'; | 6 import '../constants/values.dart'; |
| 7 import '../elements/resolution_types.dart'; | 7 import '../elements/resolution_types.dart'; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../js/js.dart' as js; | 9 import '../js/js.dart' as js; |
| 10 import '../js_emitter/js_emitter.dart' show NativeEmitter; | 10 import '../js_emitter/js_emitter.dart' show NativeEmitter; |
| 11 import '../ssa/builder.dart' show SsaBuilder; | 11 import '../ssa/builder.dart' show SsaAstGraphBuilder; |
| 12 import '../ssa/nodes.dart' show HInstruction, HForeignCode, HReturn; | 12 import '../ssa/nodes.dart' show HInstruction, HForeignCode, HReturn; |
| 13 import '../tree/tree.dart'; | 13 import '../tree/tree.dart'; |
| 14 import '../universe/side_effects.dart' show SideEffects; | 14 import '../universe/side_effects.dart' show SideEffects; |
| 15 | 15 |
| 16 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); | 16 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); |
| 17 | 17 |
| 18 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { | 18 void handleSsaNative(SsaAstGraphBuilder builder, Expression nativeBody) { |
| 19 MethodElement element = builder.target; | 19 MethodElement element = builder.target; |
| 20 NativeEmitter nativeEmitter = builder.nativeEmitter; | 20 NativeEmitter nativeEmitter = builder.nativeEmitter; |
| 21 | 21 |
| 22 HInstruction convertDartClosure( | 22 HInstruction convertDartClosure( |
| 23 ParameterElement parameter, ResolutionFunctionType type) { | 23 ParameterElement parameter, ResolutionFunctionType type) { |
| 24 HInstruction local = builder.localsHandler.readLocal(parameter); | 24 HInstruction local = builder.localsHandler.readLocal(parameter); |
| 25 ConstantValue arityConstant = | 25 ConstantValue arityConstant = |
| 26 builder.constantSystem.createInt(type.parameterTypes.length); | 26 builder.constantSystem.createInt(type.parameterTypes.length); |
| 27 HInstruction arity = | 27 HInstruction arity = |
| 28 builder.graph.addConstant(arityConstant, builder.closedWorld); | 28 builder.graph.addConstant(arityConstant, builder.closedWorld); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 LiteralString jsCode = nativeBody.asLiteralString(); | 115 LiteralString jsCode = nativeBody.asLiteralString(); |
| 116 builder.push(new HForeignCode.statement( | 116 builder.push(new HForeignCode.statement( |
| 117 js.js.statementTemplateYielding( | 117 js.js.statementTemplateYielding( |
| 118 new js.LiteralStatement(jsCode.dartString.slowToString())), | 118 new js.LiteralStatement(jsCode.dartString.slowToString())), |
| 119 <HInstruction>[], | 119 <HInstruction>[], |
| 120 new SideEffects(), | 120 new SideEffects(), |
| 121 null, | 121 null, |
| 122 builder.commonMasks.dynamicType)); | 122 builder.commonMasks.dynamicType)); |
| 123 } | 123 } |
| 124 } | 124 } |
| OLD | NEW |