| 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 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 assert(superClass != null); | 1956 assert(superClass != null); |
| 1957 assert(superClass.resolutionState == STATE_DONE); | 1957 assert(superClass.resolutionState == STATE_DONE); |
| 1958 // TODO(johnniwinther): Should we find injected constructors as well? | 1958 // TODO(johnniwinther): Should we find injected constructors as well? |
| 1959 FunctionElement target = superClass.lookupDefaultConstructor(); | 1959 FunctionElement target = superClass.lookupDefaultConstructor(); |
| 1960 if (target == null) { | 1960 if (target == null) { |
| 1961 compiler.internalError(superClass, | 1961 compiler.internalError(superClass, |
| 1962 "No default constructor available."); | 1962 "No default constructor available."); |
| 1963 } | 1963 } |
| 1964 Selector selector = new Selector.callDefaultConstructor(); | 1964 Selector selector = new Selector.callDefaultConstructor(); |
| 1965 List<HInstruction> arguments = | 1965 List<HInstruction> arguments = |
| 1966 selector.makeArgumentsList2(const Link<ast.Node>(), | 1966 selector.makeArgumentsList(const Link<ast.Node>(), |
| 1967 target.implementation, | 1967 target.implementation, |
| 1968 null, | 1968 null, |
| 1969 handleConstantForOptionalParameter); | 1969 handleConstantForOptionalParameter); |
| 1970 inlineSuperOrRedirect(target, | 1970 inlineSuperOrRedirect(target, |
| 1971 arguments, | 1971 arguments, |
| 1972 constructors, | 1972 constructors, |
| 1973 fieldValues, | 1973 fieldValues, |
| 1974 constructor); | 1974 constructor); |
| 1975 } | 1975 } |
| 1976 } | 1976 } |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 /** | 1979 /** |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3552 List<HInstruction> makeStaticArgumentList(Selector selector, | 3552 List<HInstruction> makeStaticArgumentList(Selector selector, |
| 3553 Link<ast.Node> arguments, | 3553 Link<ast.Node> arguments, |
| 3554 FunctionElement element) { | 3554 FunctionElement element) { |
| 3555 assert(invariant(element, element.isImplementation)); | 3555 assert(invariant(element, element.isImplementation)); |
| 3556 | 3556 |
| 3557 HInstruction compileArgument(ast.Node argument) { | 3557 HInstruction compileArgument(ast.Node argument) { |
| 3558 visit(argument); | 3558 visit(argument); |
| 3559 return pop(); | 3559 return pop(); |
| 3560 } | 3560 } |
| 3561 | 3561 |
| 3562 return selector.makeArgumentsList2(arguments, | 3562 return selector.makeArgumentsList(arguments, |
| 3563 element, | 3563 element, |
| 3564 compileArgument, | 3564 compileArgument, |
| 3565 handleConstantForOptionalParameter); | 3565 handleConstantForOptionalParameter); |
| 3566 } | 3566 } |
| 3567 | 3567 |
| 3568 void addGenericSendArgumentsToList(Link<ast.Node> link, List<HInstruction> lis
t) { | 3568 void addGenericSendArgumentsToList(Link<ast.Node> link, List<HInstruction> lis
t) { |
| 3569 for (; !link.isEmpty; link = link.tail) { | 3569 for (; !link.isEmpty; link = link.tail) { |
| 3570 visit(link.head); | 3570 visit(link.head); |
| 3571 list.add(pop()); | 3571 list.add(pop()); |
| 3572 } | 3572 } |
| 3573 } | 3573 } |
| 3574 | 3574 |
| 3575 visitDynamicSend(ast.Send node) { | 3575 visitDynamicSend(ast.Send node) { |
| (...skipping 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6874 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6874 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6875 unaliased.accept(this, builder); | 6875 unaliased.accept(this, builder); |
| 6876 } | 6876 } |
| 6877 | 6877 |
| 6878 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6878 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6879 JavaScriptBackend backend = builder.compiler.backend; | 6879 JavaScriptBackend backend = builder.compiler.backend; |
| 6880 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6880 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6881 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6881 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6882 } | 6882 } |
| 6883 } | 6883 } |
| OLD | NEW |