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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart

Issue 2944413002: optimize null safe ops by using DDC's let abstraction (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 | « pkg/dev_compiler/lib/src/compiler/side_effect_analysis.dart ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// This library defines runtime operations on objects used by the code 5 /// This library defines runtime operations on objects used by the code
6 /// generator. 6 /// generator.
7 part of dart._runtime; 7 part of dart._runtime;
8 8
9 class InvocationImpl extends Invocation { 9 class InvocationImpl extends Invocation {
10 final Symbol memberName; 10 final Symbol memberName;
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // tools. 743 // tools.
744 stackPrint(exception) { 744 stackPrint(exception) {
745 var error = recordJsError(exception); 745 var error = recordJsError(exception);
746 JS('', 'console.log(#.stack ? #.stack : "No stack trace for: " + #)', error, 746 JS('', 'console.log(#.stack ? #.stack : "No stack trace for: " + #)', error,
747 error, error); 747 error, error);
748 } 748 }
749 749
750 // Forward to dart:_js_helper to create a _StackTrace object. 750 // Forward to dart:_js_helper to create a _StackTrace object.
751 stackTrace(exception) => getTraceFromException(exception); 751 stackTrace(exception) => getTraceFromException(exception);
752 752
753 ///
754 /// Implements a sequence of .? operations.
755 ///
756 /// Will call each successive callback, unless one returns null, which stops
757 /// the sequence.
758 ///
759 nullSafe(obj, @rest callbacks) => JS(
760 '',
761 '''(() => {
762 if ($obj == null) return $obj;
763 for (let callback of $callbacks) {
764 $obj = callback($obj);
765 if ($obj == null) break;
766 }
767 return $obj;
768 })()''');
769
770 final _value = JS('', 'Symbol("_value")'); 753 final _value = JS('', 'Symbol("_value")');
771 754
772 /// 755 ///
773 /// Looks up a sequence of [keys] in [map], recursively, and 756 /// Looks up a sequence of [keys] in [map], recursively, and
774 /// returns the result. If the value is not found, [valueFn] will be called to 757 /// returns the result. If the value is not found, [valueFn] will be called to
775 /// add it. For example: 758 /// add it. For example:
776 /// 759 ///
777 /// let map = new Map(); 760 /// let map = new Map();
778 /// putIfAbsent(map, [1, 2, 'hi ', 'there '], () => 'world'); 761 /// putIfAbsent(map, [1, 2, 'hi ', 'there '], () => 'world');
779 /// 762 ///
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 JS('', '# = "+" + #', name, name); 995 JS('', '# = "+" + #', name, name);
1013 } 996 }
1014 return name; 997 return name;
1015 } 998 }
1016 999
1017 /// Emulates the implicit "loadLibrary" function provided by a deferred library. 1000 /// Emulates the implicit "loadLibrary" function provided by a deferred library.
1018 /// 1001 ///
1019 /// Libraries are not actually deferred in DDC, so this just returns a future 1002 /// Libraries are not actually deferred in DDC, so this just returns a future
1020 /// that completes immediately. 1003 /// that completes immediately.
1021 Future loadLibrary() => new Future.value(); 1004 Future loadLibrary() => new Future.value();
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/side_effect_analysis.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698