| 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 part of native; | 5 part of native; |
| 6 | 6 |
| 7 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); | 7 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); |
| 8 | 8 |
| 9 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { | 9 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { |
| 10 Compiler compiler = builder.compiler; | 10 Compiler compiler = builder.compiler; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 builder.push( | 87 builder.push( |
| 88 new HForeignCode( | 88 new HForeignCode( |
| 89 // TODO(sra): This could be cached. The number of templates should | 89 // TODO(sra): This could be cached. The number of templates should |
| 90 // be proportional to the number of native methods, which is bounded | 90 // be proportional to the number of native methods, which is bounded |
| 91 // by the dart: libraries. | 91 // by the dart: libraries. |
| 92 js.js.uncachedExpressionTemplate(nativeMethodCall), | 92 js.js.uncachedExpressionTemplate(nativeMethodCall), |
| 93 backend.dynamicType, | 93 backend.dynamicType, |
| 94 inputs, effects: new SideEffects())); | 94 inputs, effects: new SideEffects())); |
| 95 builder.close(new HReturn(builder.pop())).addSuccessor(builder.graph.exit); | 95 // TODO(johnniwinther): Provide source information. |
| 96 builder |
| 97 .close(new HReturn(builder.pop(), null)) |
| 98 .addSuccessor(builder.graph.exit); |
| 96 } else { | 99 } else { |
| 97 if (parameters.parameterCount != 0) { | 100 if (parameters.parameterCount != 0) { |
| 98 compiler.internalError(nativeBody, | 101 compiler.internalError(nativeBody, |
| 99 'native "..." syntax is restricted to ' | 102 'native "..." syntax is restricted to ' |
| 100 'functions with zero parameters.'); | 103 'functions with zero parameters.'); |
| 101 } | 104 } |
| 102 LiteralString jsCode = nativeBody.asLiteralString(); | 105 LiteralString jsCode = nativeBody.asLiteralString(); |
| 103 builder.push(new HForeignCode.statement( | 106 builder.push(new HForeignCode.statement( |
| 104 js.js.statementTemplateYielding( | 107 js.js.statementTemplateYielding( |
| 105 new js.LiteralStatement(jsCode.dartString.slowToString())), | 108 new js.LiteralStatement(jsCode.dartString.slowToString())), |
| 106 <HInstruction>[], | 109 <HInstruction>[], |
| 107 new SideEffects(), | 110 new SideEffects(), |
| 108 null, | 111 null, |
| 109 backend.dynamicType)); | 112 backend.dynamicType)); |
| 110 } | 113 } |
| 111 } | 114 } |
| OLD | NEW |