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

Side by Side Diff: runtime/lib/bigint.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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/bool_patch.dart » ('j') | runtime/lib/double.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // Copyright 2009 The Go Authors. All rights reserved. 5 // Copyright 2009 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style 6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file. 7 // license that can be found in the LICENSE file.
8 8
9 /* 9 /*
10 * Copyright (c) 2003-2005 Tom Wu 10 * Copyright (c) 2003-2005 Tom Wu
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 } 1199 }
1200 // Return remainder, i.e. denormalized r_digits[0..y_used-1]. 1200 // Return remainder, i.e. denormalized r_digits[0..y_used-1].
1201 r_used = y_used; 1201 r_used = y_used;
1202 if (nsh > 0) { 1202 if (nsh > 0) {
1203 // Denormalize remainder. 1203 // Denormalize remainder.
1204 r_used = _rShiftDigits(r_digits, r_used, nsh, r_digits); 1204 r_used = _rShiftDigits(r_digits, r_used, nsh, r_digits);
1205 } 1205 }
1206 return r_used; 1206 return r_used;
1207 } 1207 }
1208 1208
1209 int get _identityHashCode { 1209 int get hashCode => this;
1210 return this; 1210 int get _identityHashCode => this;
1211 } 1211
1212 int operator ~() { 1212 int operator ~() {
1213 return _not()._toValidInt(); 1213 return _not()._toValidInt();
1214 } 1214 }
1215 1215
1216 int get bitLength { 1216 int get bitLength {
1217 if (_used == 0) return 0; 1217 if (_used == 0) return 0;
1218 if (_neg) return (~this).bitLength; 1218 if (_neg) return (~this).bitLength;
1219 return _DIGIT_BITS*(_used - 1) + _nbits(_digits[_used - 1]); 1219 return _DIGIT_BITS*(_used - 1) + _nbits(_digits[_used - 1]);
1220 } 1220 }
1221 1221
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 2082
2083 int _mul(Uint32List x_digits, int x_used, 2083 int _mul(Uint32List x_digits, int x_used,
2084 Uint32List y_digits, int y_used, 2084 Uint32List y_digits, int y_used,
2085 Uint32List r_digits) { 2085 Uint32List r_digits) {
2086 var r_used = _Bigint._mulDigits(x_digits, x_used, 2086 var r_used = _Bigint._mulDigits(x_digits, x_used,
2087 y_digits, y_used, 2087 y_digits, y_used,
2088 r_digits); 2088 r_digits);
2089 return _reduce(r_digits, r_used); 2089 return _reduce(r_digits, r_used);
2090 } 2090 }
2091 } 2091 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/bool_patch.dart » ('j') | runtime/lib/double.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698