| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { |
| 8 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
| 9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
| 10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
| (...skipping 3741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3752 // signatures have different elements for parameters. | 3752 // signatures have different elements for parameters. |
| 3753 FunctionElement implementation = function.implementation; | 3753 FunctionElement implementation = function.implementation; |
| 3754 FunctionSignature params = implementation.functionSignature; | 3754 FunctionSignature params = implementation.functionSignature; |
| 3755 if (params.optionalParameterCount != 0) { | 3755 if (params.optionalParameterCount != 0) { |
| 3756 compiler.internalError(closure, | 3756 compiler.internalError(closure, |
| 3757 '"$name" does not handle closure with optional parameters.'); | 3757 '"$name" does not handle closure with optional parameters.'); |
| 3758 } | 3758 } |
| 3759 | 3759 |
| 3760 registry.registerStaticUse(element); | 3760 registry.registerStaticUse(element); |
| 3761 push(new HForeign(js.js.expressionTemplateYielding( | 3761 push(new HForeign(js.js.expressionTemplateYielding( |
| 3762 backend.namer.elementAccess(element)), | 3762 backend.emitter.staticFunctionAccess(element)), |
| 3763 backend.dynamicType, | 3763 backend.dynamicType, |
| 3764 <HInstruction>[])); | 3764 <HInstruction>[])); |
| 3765 return params; | 3765 return params; |
| 3766 } | 3766 } |
| 3767 | 3767 |
| 3768 void handleForeignDartClosureToJs(ast.Send node, String name) { | 3768 void handleForeignDartClosureToJs(ast.Send node, String name) { |
| 3769 // TODO(ahe): This implements DART_CLOSURE_TO_JS and should probably take | 3769 // TODO(ahe): This implements DART_CLOSURE_TO_JS and should probably take |
| 3770 // care to wrap the closure in another closure that saves the current | 3770 // care to wrap the closure in another closure that saves the current |
| 3771 // isolate. | 3771 // isolate. |
| 3772 handleForeignRawFunctionRef(node, name); | 3772 handleForeignRawFunctionRef(node, name); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3795 push(new HForeign(js.js.parseForeignJS("new $constructorName()"), | 3795 push(new HForeign(js.js.parseForeignJS("new $constructorName()"), |
| 3796 backend.dynamicType, | 3796 backend.dynamicType, |
| 3797 <HInstruction>[])); | 3797 <HInstruction>[])); |
| 3798 } | 3798 } |
| 3799 | 3799 |
| 3800 void handleForeignDartObjectJsConstructorFunction(ast.Send node) { | 3800 void handleForeignDartObjectJsConstructorFunction(ast.Send node) { |
| 3801 if (!node.arguments.isEmpty) { | 3801 if (!node.arguments.isEmpty) { |
| 3802 compiler.internalError(node.argumentsNode, 'Too many arguments.'); | 3802 compiler.internalError(node.argumentsNode, 'Too many arguments.'); |
| 3803 } | 3803 } |
| 3804 push(new HForeign(js.js.expressionTemplateYielding( | 3804 push(new HForeign(js.js.expressionTemplateYielding( |
| 3805 backend.namer.elementAccess(compiler.objectClass)), | 3805 backend.emitter.classAccess( |
| 3806 compiler.objectClass)), |
| 3806 backend.dynamicType, | 3807 backend.dynamicType, |
| 3807 <HInstruction>[])); | 3808 <HInstruction>[])); |
| 3808 } | 3809 } |
| 3809 | 3810 |
| 3810 void handleForeignJsCurrentIsolate(ast.Send node) { | 3811 void handleForeignJsCurrentIsolate(ast.Send node) { |
| 3811 if (!node.arguments.isEmpty) { | 3812 if (!node.arguments.isEmpty) { |
| 3812 compiler.internalError(node.argumentsNode, 'Too many arguments.'); | 3813 compiler.internalError(node.argumentsNode, 'Too many arguments.'); |
| 3813 } | 3814 } |
| 3814 push(new HForeign(js.js.parseForeignJS(backend.namer.currentIsolate), | 3815 push(new HForeign(js.js.parseForeignJS(backend.namer.currentIsolate), |
| 3815 backend.dynamicType, | 3816 backend.dynamicType, |
| (...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6622 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6623 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6623 unaliased.accept(this, builder); | 6624 unaliased.accept(this, builder); |
| 6624 } | 6625 } |
| 6625 | 6626 |
| 6626 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6627 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6627 JavaScriptBackend backend = builder.compiler.backend; | 6628 JavaScriptBackend backend = builder.compiler.backend; |
| 6628 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6629 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6629 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6630 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6630 } | 6631 } |
| 6631 } | 6632 } |
| OLD | NEW |