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

Side by Side Diff: runtime/lib/function.dart

Issue 2983823002: Improve hashCode for closures (Closed)
Patch Set: Error handling Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class _Closure implements Function { 5 class _Closure implements Function {
6 bool operator ==(other) native "Closure_equals"; 6 bool operator ==(other) native "Closure_equals";
7 7
8 int get hashCode native "Closure_hashCode"; 8 int get hashCode {
9 if (_hash == null) {
10 _hash = _computeHash();
11 }
12 return _hash;
13 }
9 14
10 _Closure get call => this; 15 _Closure get call => this;
11 16
12 _Closure _clone() native "Closure_clone"; 17 _Closure _clone() native "Closure_clone";
13 18
19 int _computeHash() native "Closure_computeHash";
20
14 // No instance fields should be declared before the following 4 fields whose 21 // No instance fields should be declared before the following 4 fields whose
15 // offsets must be identical in Dart and C++. 22 // offsets must be identical in Dart and C++.
16 23
17 // The following 4 fields are declared both in raw_object.h (for direct access 24 // The following fields are declared both in raw_object.h (for direct access
18 // from C++ code) and also here so that the offset-to-field map used by 25 // from C++ code) and also here so that the offset-to-field map used by
19 // deferred objects is properly initialized. 26 // deferred objects is properly initialized.
20 // Caution: These fields are not Dart instances, but VM objects. Their Dart 27 // Caution: These fields are not Dart instances, but VM objects. Their Dart
21 // names do not need to match the C++ names, but they must be private. 28 // names do not need to match the C++ names, but they must be private.
22 var _instantiator_type_arguments; 29 var _instantiator_type_arguments;
23 var _function_type_arguments; 30 var _function_type_arguments;
24 var _function; 31 var _function;
25 var _context; 32 var _context;
33 var _hash;
26 } 34 }
OLDNEW
« no previous file with comments | « runtime/lib/function.cc ('k') | runtime/vm/bootstrap.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698