pkg:native_stack_traces - use Object.hash

Require Dart 2.14

Change-Id: Iec3e1b0563c6402840bfbcb66bd68478b40063c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216691
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
This commit is contained in:
Kevin Moore
2021-10-14 07:35:43 +00:00
committed by commit-bot@chromium.org
parent 0fb4f647cc
commit b0874f26b7
4 changed files with 15 additions and 30 deletions
+2 -2
View File
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
"generated": "2021-10-04T10:29:25.433041",
"generated": "2021-10-13T14:43:47.733371",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -470,7 +470,7 @@
"name": "native_stack_traces",
"rootUri": "../pkg/native_stack_traces",
"packageUri": "lib/",
"languageVersion": "2.12"
"languageVersion": "2.14"
},
{
"name": "nnbd_migration",
+2
View File
@@ -1,5 +1,7 @@
## 0.4.5-dev
- Require Dart >= 2.14
## 0.4.4
- Added handling of dynamic tables for testing.
+10 -27
View File
@@ -1066,20 +1066,6 @@ class LineNumberInfo {
}
}
// TODO(11617): Replace calls to these functions with a general hashing solution
// once available.
int _hashCombine(int hash, int value) {
hash = 0x1fffffff & (hash + value);
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
return hash ^ (hash >> 6);
}
int _hashFinish(int hash) {
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
hash = hash ^ (hash >> 11);
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
}
/// Represents the information for a call site.
abstract class CallInfo {
/// Whether this call site is considered internal (i.e. not located in either
@@ -1108,16 +1094,14 @@ class DartCallInfo extends CallInfo {
bool get isInternal => internal;
@override
int get hashCode {
var hash = 0;
hash = _hashCombine(hash, inlined.hashCode);
hash = _hashCombine(hash, internal.hashCode);
hash = _hashCombine(hash, function.hashCode);
hash = _hashCombine(hash, filename.hashCode);
hash = _hashCombine(hash, line.hashCode);
hash = _hashCombine(hash, column.hashCode);
return _hashFinish(hash);
}
int get hashCode => Object.hash(
inlined,
internal,
function,
filename,
line,
column,
);
@override
bool operator ==(Object other) {
@@ -1166,8 +1150,7 @@ class StubCallInfo extends CallInfo {
StubCallInfo({required this.name, required this.offset});
@override
int get hashCode => _hashFinish(
_hashCombine(_hashCombine(0, name.hashCode), offset.hashCode));
int get hashCode => Object.hash(name, offset);
@override
bool operator ==(Object other) {
@@ -1207,7 +1190,7 @@ class PCOffset {
includeInternalFrames: includeInternalFrames);
@override
int get hashCode => _hashFinish(_hashCombine(offset.hashCode, section.index));
int get hashCode => Object.hash(offset, section);
@override
bool operator ==(Object other) {
+1 -1
View File
@@ -5,7 +5,7 @@ version: 0.4.5-dev
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/native_stack_traces
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.14.0 <3.0.0'
executables:
decode: