| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/codegen.dart' show CodegenRegistry; | 9 import '../common/codegen.dart' show CodegenRegistry; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 // Result expected on stack. | 2549 // Result expected on stack. |
| 2550 stack.add(graph.addConstantNull(closedWorld)); | 2550 stack.add(graph.addConstantNull(closedWorld)); |
| 2551 return; | 2551 return; |
| 2552 } | 2552 } |
| 2553 String globalName = _foreignConstantStringArgument( | 2553 String globalName = _foreignConstantStringArgument( |
| 2554 invocation, 1, 'JS_EMBEDDED_GLOBAL', 'second '); | 2554 invocation, 1, 'JS_EMBEDDED_GLOBAL', 'second '); |
| 2555 js.Template expr = js.js.expressionTemplateYielding( | 2555 js.Template expr = js.js.expressionTemplateYielding( |
| 2556 emitter.generateEmbeddedGlobalAccess(globalName)); | 2556 emitter.generateEmbeddedGlobalAccess(globalName)); |
| 2557 | 2557 |
| 2558 native.NativeBehavior nativeBehavior = | 2558 native.NativeBehavior nativeBehavior = |
| 2559 astAdapter.getNativeBehavior(invocation); | 2559 _elementMap.getNativeBehaviorForJsEmbeddedGlobalCall(invocation); |
| 2560 assert(invariant(_elementMap.getSpannable(targetElement, invocation), | 2560 assert(invariant(_elementMap.getSpannable(targetElement, invocation), |
| 2561 nativeBehavior != null, | 2561 nativeBehavior != null, |
| 2562 message: "No NativeBehavior for $invocation")); | 2562 message: "No NativeBehavior for $invocation")); |
| 2563 | 2563 |
| 2564 TypeMask ssaType = | 2564 TypeMask ssaType = |
| 2565 _typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld); | 2565 _typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld); |
| 2566 push(new HForeignCode(expr, ssaType, const <HInstruction>[], | 2566 push(new HForeignCode(expr, ssaType, const <HInstruction>[], |
| 2567 nativeBehavior: nativeBehavior)); | 2567 nativeBehavior: nativeBehavior)); |
| 2568 } | 2568 } |
| 2569 | 2569 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2594 return; | 2594 return; |
| 2595 } | 2595 } |
| 2596 | 2596 |
| 2597 List<HInstruction> inputs = <HInstruction>[]; | 2597 List<HInstruction> inputs = <HInstruction>[]; |
| 2598 for (ir.Expression argument in arguments.skip(2)) { | 2598 for (ir.Expression argument in arguments.skip(2)) { |
| 2599 argument.accept(this); | 2599 argument.accept(this); |
| 2600 inputs.add(pop()); | 2600 inputs.add(pop()); |
| 2601 } | 2601 } |
| 2602 | 2602 |
| 2603 native.NativeBehavior nativeBehavior = | 2603 native.NativeBehavior nativeBehavior = |
| 2604 astAdapter.getNativeBehavior(invocation); | 2604 _elementMap.getNativeBehaviorForJsBuiltinCall(invocation); |
| 2605 assert(invariant(_elementMap.getSpannable(targetElement, invocation), | 2605 assert(invariant(_elementMap.getSpannable(targetElement, invocation), |
| 2606 nativeBehavior != null, | 2606 nativeBehavior != null, |
| 2607 message: "No NativeBehavior for $invocation")); | 2607 message: "No NativeBehavior for $invocation")); |
| 2608 | 2608 |
| 2609 TypeMask ssaType = | 2609 TypeMask ssaType = |
| 2610 _typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld); | 2610 _typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld); |
| 2611 push(new HForeignCode(template, ssaType, inputs, | 2611 push(new HForeignCode(template, ssaType, inputs, |
| 2612 nativeBehavior: nativeBehavior)); | 2612 nativeBehavior: nativeBehavior)); |
| 2613 } | 2613 } |
| 2614 | 2614 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 } | 2662 } |
| 2663 | 2663 |
| 2664 void handleForeignJs(ir.StaticInvocation invocation) { | 2664 void handleForeignJs(ir.StaticInvocation invocation) { |
| 2665 if (_unexpectedForeignArguments(invocation, 2)) { | 2665 if (_unexpectedForeignArguments(invocation, 2)) { |
| 2666 // Result expected on stack. | 2666 // Result expected on stack. |
| 2667 stack.add(graph.addConstantNull(closedWorld)); | 2667 stack.add(graph.addConstantNull(closedWorld)); |
| 2668 return; | 2668 return; |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 native.NativeBehavior nativeBehavior = | 2671 native.NativeBehavior nativeBehavior = |
| 2672 astAdapter.getNativeBehaviorForJsCall(invocation); | 2672 _elementMap.getNativeBehaviorForJsCall(invocation); |
| 2673 assert(invariant(_elementMap.getSpannable(targetElement, invocation), | 2673 assert(invariant(_elementMap.getSpannable(targetElement, invocation), |
| 2674 nativeBehavior != null, | 2674 nativeBehavior != null, |
| 2675 message: "No NativeBehavior for $invocation")); | 2675 message: "No NativeBehavior for $invocation")); |
| 2676 | 2676 |
| 2677 List<HInstruction> inputs = <HInstruction>[]; | 2677 List<HInstruction> inputs = <HInstruction>[]; |
| 2678 for (ir.Expression argument in invocation.arguments.positional.skip(2)) { | 2678 for (ir.Expression argument in invocation.arguments.positional.skip(2)) { |
| 2679 argument.accept(this); | 2679 argument.accept(this); |
| 2680 inputs.add(pop()); | 2680 inputs.add(pop()); |
| 2681 } | 2681 } |
| 2682 | 2682 |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3406 enterBlock.setBlockFlow( | 3406 enterBlock.setBlockFlow( |
| 3407 new HTryBlockInformation( | 3407 new HTryBlockInformation( |
| 3408 kernelBuilder.wrapStatementGraph(bodyGraph), | 3408 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3409 exception, | 3409 exception, |
| 3410 kernelBuilder.wrapStatementGraph(catchGraph), | 3410 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3411 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3411 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3412 exitBlock); | 3412 exitBlock); |
| 3413 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3413 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3414 } | 3414 } |
| 3415 } | 3415 } |
| OLD | NEW |