dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.58k forks source link

dart2js: Better getInterceptor names #7063

Open rakudrama opened 11 years ago

rakudrama commented 11 years ago

I think the default and specialized getInterceptor functions would be better named as 'methods' or 'getMethods'.

Also, it would be better if 'Object' was included in the name of the specialized versions that can dispatch to Object.

For example, this looks like it works on String and num, but also works on Date and Duration in the program this was extracted from. Adding 'Object' to the name will help:

$.Comparable_compare = function(a, b) {   return $.getInterceptor$JSStringJSNumber(a).compareTo$1(a, b); };

$.getInterceptor$JSStringJSNumber = function(receiver) {   if (typeof receiver == 'string') return $.JSString.prototype;   if (typeof receiver == 'number') return $.JSNumber.prototype;   return $.ObjectInterceptor.prototype; };

Although we don't do it yet, I think there are circumstances where it is possible to generate faster specializations where there is no Object fallthrough - there would be one less test.

rakudrama commented 11 years ago

Set owner to ngeoffray@google.com. Added this to the Later milestone. Removed Priority-Medium label. Added Priority-Low label.

kasperl commented 11 years ago

Added TriageForM5 label.

kasperl commented 11 years ago

Removed TriageForM5 label.

DartBot commented 10 years ago

This comment was originally written by ngeoffray@google.com


Set owner to @floitschG.

kasperl commented 10 years ago

Removed this from the Later milestone. Added Oldschool-Milestone-Later label.

kasperl commented 10 years ago

Removed Oldschool-Milestone-Later label.