| OLD | NEW |
| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <cstring> | 6 #include <cstring> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 Object& null_value = Object::Handle(table.GetOrNull("0")); | 132 Object& null_value = Object::Handle(table.GetOrNull("0")); |
| 133 EXPECT(null_value.IsNull()); | 133 EXPECT(null_value.IsNull()); |
| 134 | 134 |
| 135 // Test on-demand allocation of a new key object using NewKey in traits. | 135 // Test on-demand allocation of a new key object using NewKey in traits. |
| 136 String& b_value = String::Handle(); | 136 String& b_value = String::Handle(); |
| 137 b_value ^= | 137 b_value ^= |
| 138 table.InsertNewOrGetValue("b", String::Handle(String::New("BBB"))); | 138 table.InsertNewOrGetValue("b", String::Handle(String::New("BBB"))); |
| 139 EXPECT(b_value.Equals("BBB")); | 139 EXPECT(b_value.Equals("BBB")); |
| 140 { | 140 { |
| 141 // When the key is already present, there should be no allocation. | 141 // When the key is already present, there should be no allocation. |
| 142 NoGCScope no_gc; | 142 NoSafepointScope no_safepoint; |
| 143 b_value ^= table.InsertNewOrGetValue("b", a_value); | 143 b_value ^= table.InsertNewOrGetValue("b", a_value); |
| 144 EXPECT(b_value.Equals("BBB")); | 144 EXPECT(b_value.Equals("BBB")); |
| 145 } | 145 } |
| 146 table.Release(); | 146 table.Release(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 std::string ToStdString(const String& str) { | 150 std::string ToStdString(const String& str) { |
| 151 EXPECT(str.IsOneByteString()); | 151 EXPECT(str.IsOneByteString()); |
| 152 std::string result; | 152 std::string result; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 TEST_CASE(Maps) { | 295 TEST_CASE(Maps) { |
| 296 for (intptr_t initial_capacity = 0; | 296 for (intptr_t initial_capacity = 0; |
| 297 initial_capacity < 32; | 297 initial_capacity < 32; |
| 298 ++initial_capacity) { | 298 ++initial_capacity) { |
| 299 TestMap<UnorderedHashMap<TestTraits> >(initial_capacity, false); | 299 TestMap<UnorderedHashMap<TestTraits> >(initial_capacity, false); |
| 300 TestMap<EnumIndexHashMap<TestTraits> >(initial_capacity, true); | 300 TestMap<EnumIndexHashMap<TestTraits> >(initial_capacity, true); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace dart | 304 } // namespace dart |
| OLD | NEW |