Index: runtime/lib/function.dart |
diff --git a/runtime/lib/function.dart b/runtime/lib/function.dart |
index 7f0556de37369ccc5dda11d71eea2b0e25f49832..2e42f4fb82d110a0d74024c02e0af72e99dba95e 100644 |
--- a/runtime/lib/function.dart |
+++ b/runtime/lib/function.dart |
@@ -5,16 +5,23 @@ |
class _Closure implements Function { |
bool operator ==(other) native "Closure_equals"; |
- int get hashCode native "Closure_hashCode"; |
+ int get hashCode { |
+ if (_cached_hash_code == null) { |
+ _cached_hash_code = _calculateHashCode(); |
+ } |
+ return _cached_hash_code; |
+ } |
_Closure get call => this; |
_Closure _clone() native "Closure_clone"; |
+ int _calculateHashCode() native "Closure_calculateHashCode"; |
+ |
// No instance fields should be declared before the following 4 fields whose |
// offsets must be identical in Dart and C++. |
- // The following 4 fields are declared both in raw_object.h (for direct access |
+ // The following fields are declared both in raw_object.h (for direct access |
// from C++ code) and also here so that the offset-to-field map used by |
// deferred objects is properly initialized. |
// Caution: These fields are not Dart instances, but VM objects. Their Dart |
@@ -23,4 +30,5 @@ class _Closure implements Function { |
var _function_type_arguments; |
var _function; |
var _context; |
+ var _cached_hash_code; |
} |