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

Unified Diff: runtime/lib/double.dart

Issue 2137673002: Sped up hashCode by removing megamorphic call to _identityHashCode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/lib/double.dart
diff --git a/runtime/lib/double.dart b/runtime/lib/double.dart
index cbf955dc81a4d791d6cfd36ea6e780aefc2236a7..71fddca77c0c44e14ac7f5da7a434f27d0be24d5 100644
--- a/runtime/lib/double.dart
+++ b/runtime/lib/double.dart
@@ -8,10 +8,10 @@ class _Double implements double {
Type get runtimeType => double;
- int get _identityHashCode {
- if (isNaN || isInfinite) return 0;
- return toInt();
- }
+ // Code is replicated to avoid unnecessary dispath overhead.
sra1 2016/07/08 21:35:59 They could both call a common static method. Since
bakster 2016/07/08 22:04:22 I'll add a todo in the code for now. A static only
+ int get hashCode => (isNaN || isInfinite) ? 0 : toInt();
+ int get _identityHashCode => (isNaN || isInfinite) ? 0 : toInt();
+
double operator +(num other) {
return _add(other.toDouble());
}
« no previous file with comments | « runtime/lib/bool_patch.dart ('k') | runtime/lib/integers.dart » ('j') | runtime/lib/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698