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

Side by Side Diff: pkg/compiler/lib/src/constants/values.dart

Issue 2112893002: Use unordered map hash on ConstructedConstantValue. (Closed) Base URL: https://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 | pkg/compiler/lib/src/util/util.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library dart2js.constants.values; 5 library dart2js.constants.values;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart' 10 import '../elements/elements.dart'
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 659
660 class ConstructedConstantValue extends ObjectConstantValue { 660 class ConstructedConstantValue extends ObjectConstantValue {
661 // TODO(johnniwinther): Make [fields] private to avoid misuse of the map 661 // TODO(johnniwinther): Make [fields] private to avoid misuse of the map
662 // ordering and mutability. 662 // ordering and mutability.
663 final Map<FieldElement, ConstantValue> fields; 663 final Map<FieldElement, ConstantValue> fields;
664 final int hashCode; 664 final int hashCode;
665 665
666 ConstructedConstantValue( 666 ConstructedConstantValue(
667 InterfaceType type, Map<FieldElement, ConstantValue> fields) 667 InterfaceType type, Map<FieldElement, ConstantValue> fields)
668 : this.fields = fields, 668 : this.fields = fields,
669 hashCode = Hashing.mapHash(fields, Hashing.objectHash(type)), 669 hashCode = Hashing.unorderedMapHash(fields, Hashing.objectHash(type)),
670 super(type) { 670 super(type) {
671 assert(type != null); 671 assert(type != null);
672 assert(!fields.containsValue(null)); 672 assert(!fields.containsValue(null));
673 } 673 }
674 674
675 bool get isConstructedObject => true; 675 bool get isConstructedObject => true;
676 676
677 bool operator ==(var otherVar) { 677 bool operator ==(var otherVar) {
678 if (identical(this, otherVar)) return true; 678 if (identical(this, otherVar)) return true;
679 if (otherVar is! ConstructedConstantValue) return false; 679 if (otherVar is! ConstructedConstantValue) return false;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 775
776 @override 776 @override
777 DartType getType(CoreTypes types) => const DynamicType(); 777 DartType getType(CoreTypes types) => const DynamicType();
778 778
779 @override 779 @override
780 String toStructuredText() => 'NonConstant'; 780 String toStructuredText() => 'NonConstant';
781 781
782 @override 782 @override
783 String toDartText() => '>>non-constant<<'; 783 String toDartText() => '>>non-constant<<';
784 } 784 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/util/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698