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

Unified Diff: runtime/observatory/test/call_site_data_test.dart

Issue 977283002: Display call site data for functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
Index: runtime/observatory/test/call_site_data_test.dart
diff --git a/runtime/observatory/test/call_site_data_test.dart b/runtime/observatory/test/call_site_data_test.dart
index 2bd23f7d09514de977f5f21024481f428385fc0d..8c08e368ce1e8f83e9aad6522108b1640dea9729 100644
--- a/runtime/observatory/test/call_site_data_test.dart
+++ b/runtime/observatory/test/call_site_data_test.dart
@@ -31,6 +31,18 @@ megamorphic(fooable) {
return null;
}
+class Static {
+ static staticMethod() => 2;
+}
+staticCall() {
+ Static.staticMethod();
+ return null;
+}
+constructorCall() {
+ new Static();
+ return null;
+}
+
script() {
for (int i = 0; i < 10; i++) monomorphic(new A());
@@ -46,6 +58,10 @@ script() {
for (int i = 0; i < 60; i++) megamorphic(new F());
for (int i = 0; i < 70; i++) megamorphic(new G());
for (int i = 0; i < 80; i++) megamorphic(new H());
+
+ for (int i = 0; i < 10; i++) staticCall();
+
+ for (int i = 0; i < 10; i++) constructorCall();
}
@@ -61,6 +77,8 @@ var tests = [
var monomorphic = lib.functions.singleWhere((f) => f.name == 'monomorphic');
var polymorphic = lib.functions.singleWhere((f) => f.name == 'polymorphic');
var megamorphic = lib.functions.singleWhere((f) => f.name == 'megamorphic');
+ var staticCall = lib.functions.singleWhere((f) => f.name == 'staticCall');
+ var constructorCall = lib.functions.singleWhere((f) => f.name == 'constructorCall');
List tests = [];
tests.add(isolate.invokeRpcNoUpgrade('getCallSiteData',
@@ -109,6 +127,34 @@ var tests = [
'E:50', 'F:60', 'G:70', 'H:80'].toSet()));
}));
+ tests.add(isolate.invokeRpcNoUpgrade('getCallSiteData',
+ { 'targetId': staticCall.id })
+ .then((Map response) {
+ expect(response['type'], equals('_CallSiteData'));
+ expect(response['function']['id'], equals(staticCall.id));
+ expect(response['callSites'], isList);
+ expect(response['callSites'], hasLength(1));
+ Map callSite = response['callSites'].single;
+ expect(callSite['name'], equals('staticMethod'));
+ // expect(callSite['deoptReasons'], equals(''));
+ expect(stringifyCacheEntries(callSite),
+ equals(['Static:10'].toSet()));
+ }));
+
+ tests.add(isolate.invokeRpcNoUpgrade('getCallSiteData',
+ { 'targetId': constructorCall.id })
+ .then((Map response) {
+ expect(response['type'], equals('_CallSiteData'));
+ expect(response['function']['id'], equals(constructorCall.id));
+ expect(response['callSites'], isList);
+ expect(response['callSites'], hasLength(1));
+ Map callSite = response['callSites'].single;
+ expect(callSite['name'], equals('Static.'));
+ // expect(callSite['deoptReasons'], equals(''));
+ expect(stringifyCacheEntries(callSite),
+ equals(['Static:10'].toSet()));
+ }));
+
return Future.wait(tests);
});
},

Powered by Google App Engine
This is Rietveld 408576698