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

Unified Diff: runtime/vm/hash_map_test.cc

Issue 10824349: Implement class id checks as a separate instruction and add a local CSE optimization pass. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/hash_map.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/hash_map_test.cc
===================================================================
--- runtime/vm/hash_map_test.cc (revision 0)
+++ runtime/vm/hash_map_test.cc (revision 0)
@@ -0,0 +1,35 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "platform/assert.h"
+#include "vm/unit_test.h"
+#include "vm/hash_map.h"
+
+namespace dart {
+
+class TestValue {
+ public:
+ explicit TestValue(intptr_t x) : x_(x) { }
+ intptr_t Hashcode() const { return x_ & 1; }
+ bool Equals(TestValue* other) { return x_ == other->x_; }
+ private:
+ intptr_t x_;
+};
+
+
+TEST_CASE(DirectChainedHashMap) {
+ DirectChainedHashMap<TestValue*> map;
+ EXPECT(map.IsEmpty());
+ TestValue v1(0);
+ TestValue v2(1);
+ TestValue v3(0);
+ map.Insert(&v1);
+ EXPECT(map.Lookup(&v1) == &v1);
+ map.Insert(&v2);
+ EXPECT(map.Lookup(&v1) == &v1);
+ EXPECT(map.Lookup(&v2) == &v2);
+ EXPECT(map.Lookup(&v3) == &v1);
+}
+
+} // namespace dart
Property changes on: runtime/vm/hash_map_test.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « runtime/vm/hash_map.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698