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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/ssa/types.dart

Issue 11414146: Faster implementation of HTypeMap. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/ssa/types.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/ssa/types.dart b/dart/sdk/lib/_internal/compiler/implementation/ssa/types.dart
index 597ccf1e7f012ba13e486ccb48cc64eb3bac1e07..ec561166d979d2047111f1447fe3d87880db0c70 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/ssa/types.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/ssa/types.dart
@@ -878,17 +878,19 @@ class HBoundedPotentialPrimitiveString extends HBoundedPotentialPrimitiveType {
}
class HTypeMap {
- Map<HInstruction, HType> _map;
-
- HTypeMap() : _map = new Map<HInstruction, HType>();
+ List<HType> _list = new List<HType>();
operator [](HInstruction instruction) {
- HType result = _map[instruction];
+ HType result;
+ if (instruction.id < _list.length) result = _list[instruction.id];
if (result == null) return instruction.guaranteedType;
return result;
}
operator []=(HInstruction instruction, HType value) {
- _map[instruction] = value;
+ if (_list.length <= instruction.id) {
+ _list.length = instruction.id + 1;
+ }
+ _list[instruction.id] = value;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698