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

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

Issue 2303163002: Update web_command code so that it continues to use the legacy module loader. Drive by removal of m… (Closed)
Patch Set: Update web_command code so that it continues to use the legacy module loader. Drive by removal of m… Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/js/legacy/dart_sdk.js ('k') | pkg/dev_compiler/web/main.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 72538db5a005269ca2e398814d8718390f395448..d30b6280fa7028158bad9f2c0091dcf0a7aa13af 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -33,7 +33,7 @@ class InvocationImpl extends Invocation {
dload(obj, field) {
var f = _canonicalMember(obj, field);
- _trackCall(obj, f);
+ _trackCall(obj);
if (f != null) {
if (hasMethod(obj, f)) return bind(obj, f, JS('', 'void 0'));
return JS('', '#[#]', obj, f);
@@ -44,7 +44,7 @@ dload(obj, field) {
dput(obj, field, value) {
var f = _canonicalMember(obj, field);
- _trackCall(obj, f);
+ _trackCall(obj);
if (f != null) {
return JS('', '#[#] = #', obj, f, value);
}
@@ -106,7 +106,7 @@ extractNamedArgs(args) {
}
_checkAndCall(f, ftype, obj, typeArgs, args, name) => JS('', '''(() => {
- $_trackCall($obj, $name);
+ $_trackCall($obj);
let originalTarget = obj === void 0 ? f : obj;
@@ -182,17 +182,28 @@ dcall(f, @rest args) => _checkAndCall(
dgcall(f, typeArgs, @rest args) => _checkAndCall(
f, _getRuntimeType(f), JS('', 'void 0'), typeArgs, args, 'call');
-Map<String, int> _callMethodStats = new Map();
+class _MethodStats {
+ final String typeName;
+ final String frame;
+ int count;
+
+ _MethodStats(this.typeName, this.frame) {
+ count = 0;
+ }
+}
+
+Map<String, _MethodStats> _callMethodStats = new Map();
List<List<Object>> getDynamicStats() {
List<List<Object>> ret = [];
var keys = _callMethodStats.keys.toList();
- keys.sort((a, b) => _callMethodStats[b].compareTo(_callMethodStats[a]));
+ keys.sort((a, b) => _callMethodStats[b].count.compareTo(
+ _callMethodStats[a].count));
for (var key in keys) {
- int count = _callMethodStats[key];
- ret.add([key, count]);
+ var stats = _callMethodStats[key];
+ ret.add([stats.typeName, stats.frame, stats.count]);
}
return ret;
@@ -204,7 +215,7 @@ clearDynamicStats() {
bool trackProfile = JS('bool', 'dart.global.trackDdcProfile');
-_trackCall(obj, name) {
+_trackCall(obj) {
if (JS('bool', '!#', trackProfile)) return;
var actual = getReifiedType(obj);
@@ -219,12 +230,9 @@ _trackCall(obj, name) {
}
}
- name = "${typeName(actual)}.$name <$src>";
- if (_callMethodStats.containsKey(name)) {
- _callMethodStats[name] = _callMethodStats[name] + 1;
- } else {
- _callMethodStats[name] = 1;
- }
+ var actualTypeName = typeName(actual);
+ _callMethodStats.putIfAbsent("$actualTypeName <$src>",
+ () => new _MethodStats(actualTypeName, src)).count++;
}
/// Shared code for dsend, dindex, and dsetindex.
« no previous file with comments | « pkg/dev_compiler/lib/js/legacy/dart_sdk.js ('k') | pkg/dev_compiler/web/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698