Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2919713003: Remove KernelAstAdapter.getNativeBehavior (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698