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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart

Issue 1185633003: cps-ir: Support foreign code. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update test expectations. Created 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart2js.ir_tracer; 5 library dart2js.ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import 'cps_ir_nodes.dart' as cps_ir hide Function; 8 import 'cps_ir_nodes.dart' as cps_ir hide Function;
9 import '../tracer.dart'; 9 import '../tracer.dart';
10 10
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 String value = formatReference(node.value); 370 String value = formatReference(node.value);
371 String args = node.typeArguments.map(formatReference).join(', '); 371 String args = node.typeArguments.map(formatReference).join(', ');
372 return "TypeTest ($value ${node.type} ($args))"; 372 return "TypeTest ($value ${node.type} ($args))";
373 } 373 }
374 374
375 visitApplyBuiltinOperator(cps_ir.ApplyBuiltinOperator node) { 375 visitApplyBuiltinOperator(cps_ir.ApplyBuiltinOperator node) {
376 String operator = node.operator.toString(); 376 String operator = node.operator.toString();
377 String args = node.arguments.map(formatReference).join(', '); 377 String args = node.arguments.map(formatReference).join(', ');
378 return 'ApplyBuiltinOperator $operator ($args)'; 378 return 'ApplyBuiltinOperator $operator ($args)';
379 } 379 }
380
381 @override
382 visitForeignCode(cps_ir.ForeignCode node) {
383 String id = names.name(node);
384 String arguments = node.arguments.map(formatReference).join(', ');
385 String continuation = node.continuation == null ? ''
386 : ' ${formatReference(node.continuation)}';
387 printStmt(id, "ForeignCode ${node.type} ${node.codeTemplate} $arguments"
388 "$continuation");
389 }
380 } 390 }
381 391
382 /** 392 /**
383 * Invents (and remembers) names for Continuations, Parameters, etc. 393 * Invents (and remembers) names for Continuations, Parameters, etc.
384 * The names must match the conventions used by IR Hydra, e.g. 394 * The names must match the conventions used by IR Hydra, e.g.
385 * Continuations and Functions must have names of form B### since they 395 * Continuations and Functions must have names of form B### since they
386 * are visualized as basic blocks. 396 * are visualized as basic blocks.
387 */ 397 */
388 class Names { 398 class Names {
389 final Map<Object, String> names = {}; 399 final Map<Object, String> names = {};
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 566
557 // Primitives and conditions are not visited when searching for blocks. 567 // Primitives and conditions are not visited when searching for blocks.
558 unexpectedNode(cps_ir.Node node) { 568 unexpectedNode(cps_ir.Node node) {
559 throw "The IR tracer's block collector reached an unexpected IR " 569 throw "The IR tracer's block collector reached an unexpected IR "
560 "instruction: $node"; 570 "instruction: $node";
561 } 571 }
562 572
563 visitLiteralList(cps_ir.LiteralList node) { 573 visitLiteralList(cps_ir.LiteralList node) {
564 unexpectedNode(node); 574 unexpectedNode(node);
565 } 575 }
576
566 visitLiteralMap(cps_ir.LiteralMap node) { 577 visitLiteralMap(cps_ir.LiteralMap node) {
567 unexpectedNode(node); 578 unexpectedNode(node);
568 } 579 }
580
569 visitConstant(cps_ir.Constant node) { 581 visitConstant(cps_ir.Constant node) {
570 unexpectedNode(node); 582 unexpectedNode(node);
571 } 583 }
584
572 visitCreateFunction(cps_ir.CreateFunction node) { 585 visitCreateFunction(cps_ir.CreateFunction node) {
573 unexpectedNode(node); 586 unexpectedNode(node);
574 } 587 }
588
575 visitGetMutableVariable(cps_ir.GetMutableVariable node) { 589 visitGetMutableVariable(cps_ir.GetMutableVariable node) {
576 unexpectedNode(node); 590 unexpectedNode(node);
577 } 591 }
592
578 visitParameter(cps_ir.Parameter node) { 593 visitParameter(cps_ir.Parameter node) {
579 unexpectedNode(node); 594 unexpectedNode(node);
580 } 595 }
596
581 visitMutableVariable(cps_ir.MutableVariable node) { 597 visitMutableVariable(cps_ir.MutableVariable node) {
582 unexpectedNode(node); 598 unexpectedNode(node);
583 } 599 }
600
584 visitGetField(cps_ir.GetField node) { 601 visitGetField(cps_ir.GetField node) {
585 unexpectedNode(node); 602 unexpectedNode(node);
586 } 603 }
604
587 visitGetStatic(cps_ir.GetStatic node) { 605 visitGetStatic(cps_ir.GetStatic node) {
588 unexpectedNode(node); 606 unexpectedNode(node);
589 } 607 }
608
590 visitCreateBox(cps_ir.CreateBox node) { 609 visitCreateBox(cps_ir.CreateBox node) {
591 unexpectedNode(node); 610 unexpectedNode(node);
592 } 611 }
612
593 visitCreateInstance(cps_ir.CreateInstance node) { 613 visitCreateInstance(cps_ir.CreateInstance node) {
594 unexpectedNode(node); 614 unexpectedNode(node);
595 } 615 }
616
596 visitIsTrue(cps_ir.IsTrue node) { 617 visitIsTrue(cps_ir.IsTrue node) {
597 unexpectedNode(node); 618 unexpectedNode(node);
598 } 619 }
620
599 visitIdentical(cps_ir.Identical node) { 621 visitIdentical(cps_ir.Identical node) {
600 unexpectedNode(node); 622 unexpectedNode(node);
601 } 623 }
624
602 visitInterceptor(cps_ir.Interceptor node) { 625 visitInterceptor(cps_ir.Interceptor node) {
603 unexpectedNode(node); 626 unexpectedNode(node);
604 } 627 }
628
605 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { 629 visitReadTypeVariable(cps_ir.ReadTypeVariable node) {
606 unexpectedNode(node); 630 unexpectedNode(node);
607 } 631 }
632
608 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { 633 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) {
609 unexpectedNode(node); 634 unexpectedNode(node);
610 } 635 }
636
611 visitTypeExpression(cps_ir.TypeExpression node) { 637 visitTypeExpression(cps_ir.TypeExpression node) {
612 unexpectedNode(node); 638 unexpectedNode(node);
613 } 639 }
640
614 visitNonTailThrow(cps_ir.NonTailThrow node) { 641 visitNonTailThrow(cps_ir.NonTailThrow node) {
615 unexpectedNode(node); 642 unexpectedNode(node);
616 } 643 }
644
617 visitCreateInvocationMirror(cps_ir.CreateInvocationMirror node) { 645 visitCreateInvocationMirror(cps_ir.CreateInvocationMirror node) {
618 unexpectedNode(node); 646 unexpectedNode(node);
619 } 647 }
648
620 visitTypeTest(cps_ir.TypeTest node) { 649 visitTypeTest(cps_ir.TypeTest node) {
621 unexpectedNode(node); 650 unexpectedNode(node);
622 } 651 }
652
623 visitApplyBuiltinOperator(cps_ir.ApplyBuiltinOperator node) { 653 visitApplyBuiltinOperator(cps_ir.ApplyBuiltinOperator node) {
624 unexpectedNode(node); 654 unexpectedNode(node);
625 } 655 }
656
657 @override
658 visitForeignCode(cps_ir.ForeignCode node) {
659 if (node.continuation != null) {
660 addEdgeToContinuation(node.continuation);
661 }
662 }
626 } 663 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart ('k') | pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698