| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 var inputs = <HInstruction>[]; | 2358 var inputs = <HInstruction>[]; |
| 2359 inputs.add(target); | 2359 inputs.add(target); |
| 2360 if (element.kind == ElementKind.FUNCTION) { | 2360 if (element.kind == ElementKind.FUNCTION) { |
| 2361 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, | 2361 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, |
| 2362 element, inputs); | 2362 element, inputs); |
| 2363 if (!succeeded) { | 2363 if (!succeeded) { |
| 2364 // TODO(ngeoffray): Match the VM behavior and throw an | 2364 // TODO(ngeoffray): Match the VM behavior and throw an |
| 2365 // exception at runtime. | 2365 // exception at runtime. |
| 2366 compiler.cancel('Unimplemented non-matching static call', node: node); | 2366 compiler.cancel('Unimplemented non-matching static call', node: node); |
| 2367 } | 2367 } |
| 2368 pushWithPosition(new HInvokeStatic(inputs), node); | 2368 HInvokeStatic instruction = new HInvokeStatic(inputs); |
| 2369 HType returnType = |
| 2370 builder.backend.optimisticReturnTypesWithRecompilationOnTypeChange( |
| 2371 work.element, element); |
| 2372 if (returnType != null) instruction.guaranteedType = returnType; |
| 2373 pushWithPosition(instruction, node); |
| 2369 } else { | 2374 } else { |
| 2370 if (element.kind == ElementKind.GETTER) { | 2375 if (element.kind == ElementKind.GETTER) { |
| 2371 target = new HInvokeStatic(inputs); | 2376 target = new HInvokeStatic(inputs); |
| 2372 add(target); | 2377 add(target); |
| 2373 inputs = <HInstruction>[target]; | 2378 inputs = <HInstruction>[target]; |
| 2374 } | 2379 } |
| 2375 addDynamicSendArgumentsToList(node, inputs); | 2380 addDynamicSendArgumentsToList(node, inputs); |
| 2376 pushWithPosition(new HInvokeClosure(selector, inputs), node); | 2381 pushWithPosition(new HInvokeClosure(selector, inputs), node); |
| 2377 } | 2382 } |
| 2378 } | 2383 } |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3221 } | 3226 } |
| 3222 else { | 3227 else { |
| 3223 VariableDefinitions declaration = catchBlock.formals.nodes.head; | 3228 VariableDefinitions declaration = catchBlock.formals.nodes.head; |
| 3224 HInstruction condition = null; | 3229 HInstruction condition = null; |
| 3225 if (declaration.type == null) { | 3230 if (declaration.type == null) { |
| 3226 condition = graph.addConstantBool(true); | 3231 condition = graph.addConstantBool(true); |
| 3227 stack.add(condition); | 3232 stack.add(condition); |
| 3228 } else { | 3233 } else { |
| 3229 // TODO(aprelev@gmail.com): Once old catch syntax is removed | 3234 // TODO(aprelev@gmail.com): Once old catch syntax is removed |
| 3230 // "if" condition above and this "else" branch should be deleted as | 3235 // "if" condition above and this "else" branch should be deleted as |
| 3231 // type of declared variable won't matter for the catch | 3236 // type of declared variable won't matter for the catch |
| 3232 // condition | 3237 // condition |
| 3233 Type type = elements.getType(declaration.type); | 3238 Type type = elements.getType(declaration.type); |
| 3234 if (type == null) { | 3239 if (type == null) { |
| 3235 compiler.cancel('Catch with unresolved type', node: catchBlock); | 3240 compiler.cancel('Catch with unresolved type', node: catchBlock); |
| 3236 } | 3241 } |
| 3237 condition = new HIs(type, unwrappedException, nullOk: true); | 3242 condition = new HIs(type, unwrappedException, nullOk: true); |
| 3238 push(condition); | 3243 push(condition); |
| 3239 } | 3244 } |
| 3240 } | 3245 } |
| 3241 } | 3246 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3625 new HSubGraphBlockInformation(elseBranch.graph)); | 3630 new HSubGraphBlockInformation(elseBranch.graph)); |
| 3626 | 3631 |
| 3627 HBasicBlock conditionStartBlock = conditionBranch.block; | 3632 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 3628 conditionStartBlock.setBlockFlow(info, joinBlock); | 3633 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 3629 SubGraph conditionGraph = conditionBranch.graph; | 3634 SubGraph conditionGraph = conditionBranch.graph; |
| 3630 HIf branch = conditionGraph.end.last; | 3635 HIf branch = conditionGraph.end.last; |
| 3631 assert(branch is HIf); | 3636 assert(branch is HIf); |
| 3632 branch.blockInformation = conditionStartBlock.blockFlow; | 3637 branch.blockInformation = conditionStartBlock.blockFlow; |
| 3633 } | 3638 } |
| 3634 } | 3639 } |
| OLD | NEW |