| 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 3284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3295 generateThrowNoSuchMethod( | 3295 generateThrowNoSuchMethod( |
| 3296 send, | 3296 send, |
| 3297 noSuchMethodTargetSymbolString(element, 'get'), | 3297 noSuchMethodTargetSymbolString(element, 'get'), |
| 3298 argumentNodes: const Link<ast.Node>()); | 3298 argumentNodes: const Link<ast.Node>()); |
| 3299 } else { | 3299 } else { |
| 3300 // TODO(ahe): Do something like the above, that is, emit a runtime | 3300 // TODO(ahe): Do something like the above, that is, emit a runtime |
| 3301 // error. | 3301 // error. |
| 3302 stack.add(graph.addConstantNull(compiler)); | 3302 stack.add(graph.addConstantNull(compiler)); |
| 3303 } | 3303 } |
| 3304 } else { | 3304 } else { |
| 3305 LocalElement local = element; | 3305 if (send.asSendSet() == null) { |
| 3306 stack.add(localsHandler.readLocal(local)); | 3306 internalError(send, "Unhandled local: $element"); |
| 3307 } |
| 3308 // TODO(johnniwinther): Remove this when [generateGetter] is no longer |
| 3309 // called from [visitSendSet] (for compound assignments). |
| 3310 handleLocalGet(element); |
| 3307 } | 3311 } |
| 3308 } | 3312 } |
| 3309 | 3313 |
| 3314 /// Read a local variable, function or parameter. |
| 3315 void handleLocalGet(LocalElement local) { |
| 3316 stack.add(localsHandler.readLocal(local)); |
| 3317 } |
| 3318 |
| 3319 @override |
| 3320 void visitLocalVariableGet(ast.Send node, LocalVariableElement variable, _) { |
| 3321 handleLocalGet(variable); |
| 3322 } |
| 3323 |
| 3324 @override |
| 3325 void visitParameterGet(ast.Send node, ParameterElement parameter, _) { |
| 3326 handleLocalGet(parameter); |
| 3327 } |
| 3328 |
| 3329 @override |
| 3330 void visitLocalFunctionGet(ast.Send node, LocalFunctionElement function, _) { |
| 3331 handleLocalGet(function); |
| 3332 } |
| 3333 |
| 3310 void generateInstanceSetterWithCompiledReceiver(ast.Send send, | 3334 void generateInstanceSetterWithCompiledReceiver(ast.Send send, |
| 3311 HInstruction receiver, | 3335 HInstruction receiver, |
| 3312 HInstruction value, | 3336 HInstruction value, |
| 3313 {Selector selector, | 3337 {Selector selector, |
| 3314 ast.Node location}) { | 3338 ast.Node location}) { |
| 3315 assert(send == null || Elements.isInstanceSend(send, elements)); | 3339 assert(send == null || Elements.isInstanceSend(send, elements)); |
| 3316 if (selector == null) { | 3340 if (selector == null) { |
| 3317 assert(send != null); | 3341 assert(send != null); |
| 3318 selector = elements.getSelector(send); | 3342 selector = elements.getSelector(send); |
| 3319 } | 3343 } |
| (...skipping 3634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6954 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6978 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6955 unaliased.accept(this, builder); | 6979 unaliased.accept(this, builder); |
| 6956 } | 6980 } |
| 6957 | 6981 |
| 6958 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6982 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6959 JavaScriptBackend backend = builder.compiler.backend; | 6983 JavaScriptBackend backend = builder.compiler.backend; |
| 6960 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6984 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6961 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6985 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6962 } | 6986 } |
| 6963 } | 6987 } |
| OLD | NEW |