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

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

Issue 1571953002: cps_ir: add refinement on "success" arguments for a set of whitelisted methods (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/cps_ir/insert_refinements.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'cps_fragment.dart' show CpsFragment; 7 import 'cps_fragment.dart' show CpsFragment;
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 /// Base class of function invocations. 503 /// Base class of function invocations.
504 /// 504 ///
505 /// This class defines the common interface of function invocations. 505 /// This class defines the common interface of function invocations.
506 abstract class InvocationPrimitive extends UnsafePrimitive { 506 abstract class InvocationPrimitive extends UnsafePrimitive {
507 Reference<Primitive> get receiver => null; 507 Reference<Primitive> get receiver => null;
508 List<Reference<Primitive>> get arguments; 508 List<Reference<Primitive>> get arguments;
509 SourceInformation get sourceInformation; 509 SourceInformation get sourceInformation;
510 510
511 Reference<Primitive> get dartReceiverReference => null; 511 Reference<Primitive> get dartReceiverReference => null;
512 Primitive get dartReceiver => dartReceiverReference.definition;
513
512 CallingConvention get callingConvention => CallingConvention.Normal; 514 CallingConvention get callingConvention => CallingConvention.Normal;
515
516 Reference<Primitive> dartArgumentReference(int n) {
517 switch (callingConvention) {
518 case CallingConvention.Normal:
519 case CallingConvention.OneShotIntercepted:
520 return arguments[n];
521
522 case CallingConvention.Intercepted:
523 case CallingConvention.DummyIntercepted:
524 return arguments[n + 1];
525 }
526 }
527
528 Primitive dartArgument(int n) => dartArgumentReference(n).definition;
529
530 int get dartArgumentsLength =>
Siggi Cherem (dart-lang) 2016/01/11 18:45:37 FYI - I also added dartArgumentsLength to expose t
531 arguments.length -
532 (callingConvention == CallingConvention.Intercepted ||
533 callingConvention == CallingConvention.DummyIntercepted ? 1 : 0);
513 } 534 }
514 535
515 /// Invoke a static function. 536 /// Invoke a static function.
516 /// 537 ///
517 /// All optional arguments declared by [target] are passed in explicitly, and 538 /// All optional arguments declared by [target] are passed in explicitly, and
518 /// occur at the end of [arguments] list, in normalized order. 539 /// occur at the end of [arguments] list, in normalized order.
519 /// 540 ///
520 /// Discussion: 541 /// Discussion:
521 /// All information in the [selector] is technically redundant; it will likely 542 /// All information in the [selector] is technically redundant; it will likely
522 /// be removed. 543 /// be removed.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 final SourceInformation sourceInformation; 584 final SourceInformation sourceInformation;
564 585
565 CallingConvention callingConvention = CallingConvention.Normal; 586 CallingConvention callingConvention = CallingConvention.Normal;
566 587
567 Reference<Primitive> get dartReceiverReference { 588 Reference<Primitive> get dartReceiverReference {
568 return callingConvention == CallingConvention.Intercepted 589 return callingConvention == CallingConvention.Intercepted
569 ? arguments[0] 590 ? arguments[0]
570 : receiver; 591 : receiver;
571 } 592 }
572 593
573 Primitive get dartReceiver => dartReceiverReference.definition;
574
575 Reference<Primitive> dartArgumentReference(int n) {
576 switch (callingConvention) {
577 case CallingConvention.Normal:
578 case CallingConvention.OneShotIntercepted:
579 return arguments[n];
580
581 case CallingConvention.Intercepted:
582 case CallingConvention.DummyIntercepted:
583 return arguments[n + 1];
584 }
585 }
586
587 Primitive dartArgument(int n) => dartArgumentReference(n).definition;
588
589 /// If true, it is known that the receiver cannot be `null`. 594 /// If true, it is known that the receiver cannot be `null`.
590 bool receiverIsNotNull = false; 595 bool receiverIsNotNull = false;
591 596
592 InvokeMethod(Primitive receiver, 597 InvokeMethod(Primitive receiver,
593 this.selector, 598 this.selector,
594 this.mask, 599 this.mask,
595 List<Primitive> arguments, 600 List<Primitive> arguments,
596 {this.sourceInformation, 601 {this.sourceInformation,
597 this.callingConvention: CallingConvention.Normal}) 602 this.callingConvention: CallingConvention.Normal})
598 : this.receiver = new Reference<Primitive>(receiver), 603 : this.receiver = new Reference<Primitive>(receiver),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 final SourceInformation sourceInformation; 640 final SourceInformation sourceInformation;
636 641
637 CallingConvention callingConvention; 642 CallingConvention callingConvention;
638 643
639 Reference<Primitive> get dartReceiverReference { 644 Reference<Primitive> get dartReceiverReference {
640 return callingConvention == CallingConvention.Intercepted 645 return callingConvention == CallingConvention.Intercepted
641 ? arguments[0] 646 ? arguments[0]
642 : receiver; 647 : receiver;
643 } 648 }
644 649
645 Primitive get dartReceiver => dartReceiverReference.definition;
646
647 Reference<Primitive> dartArgumentReference(int n) {
648 return callingConvention == CallingConvention.Normal
649 ? arguments[n]
650 : arguments[n + 1];
651 }
652
653 Primitive dartArgument(int n) => dartArgumentReference(n).definition;
654
655 InvokeMethodDirectly(Primitive receiver, 650 InvokeMethodDirectly(Primitive receiver,
656 this.target, 651 this.target,
657 this.selector, 652 this.selector,
658 List<Primitive> arguments, 653 List<Primitive> arguments,
659 this.sourceInformation, 654 this.sourceInformation,
660 {this.callingConvention: CallingConvention.Normal}) 655 {this.callingConvention: CallingConvention.Normal})
661 : this.receiver = new Reference<Primitive>(receiver), 656 : this.receiver = new Reference<Primitive>(receiver),
662 this.arguments = _referenceList(arguments); 657 this.arguments = _referenceList(arguments);
663 658
664 accept(Visitor visitor) => visitor.visitInvokeMethodDirectly(this); 659 accept(Visitor visitor) => visitor.visitInvokeMethodDirectly(this);
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 plug(new Branch.loose(_definitions.getCopy(node.condition), 2789 plug(new Branch.loose(_definitions.getCopy(node.condition),
2795 _copies[node.trueContinuation.definition], 2790 _copies[node.trueContinuation.definition],
2796 _copies[node.falseContinuation.definition]) 2791 _copies[node.falseContinuation.definition])
2797 ..isStrictCheck = node.isStrictCheck); 2792 ..isStrictCheck = node.isStrictCheck);
2798 } 2793 }
2799 2794
2800 visitUnreachable(Unreachable node) { 2795 visitUnreachable(Unreachable node) {
2801 plug(new Unreachable()); 2796 plug(new Unreachable());
2802 } 2797 }
2803 } 2798 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/insert_refinements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698