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

Side by Side Diff: test/cctest/test-unique.cc

Issue 23866016: Implement local check elimination on basic blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix HCheckMaps and reduce HLoadNamedField of the map in check elimination. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/unique.h ('k') | tools/gyp/v8.gyp » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 CHECK_EQ(3, set->size()); 158 CHECK_EQ(3, set->size());
159 set->Add(C, &zone); 159 set->Add(C, &zone);
160 CHECK_EQ(3, set->size()); 160 CHECK_EQ(3, set->size());
161 set->Add(B, &zone); 161 set->Add(B, &zone);
162 CHECK_EQ(3, set->size()); 162 CHECK_EQ(3, set->size());
163 set->Add(A, &zone); 163 set->Add(A, &zone);
164 CHECK_EQ(3, set->size()); 164 CHECK_EQ(3, set->size());
165 } 165 }
166 166
167 167
168 TEST(UniqueSet_Remove) {
169 CcTest::InitializeVM();
170 MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
171 MAKE_UNIQUES_A_B_C;
172
173 Zone zone(isolate);
174
175 UniqueSet<String>* set = new(&zone) UniqueSet<String>();
176
177 set->Add(A, &zone);
178 set->Add(B, &zone);
179 set->Add(C, &zone);
180 CHECK_EQ(3, set->size());
181
182 set->Remove(A);
183 CHECK_EQ(2, set->size());
184 CHECK(!set->Contains(A));
185 CHECK(set->Contains(B));
186 CHECK(set->Contains(C));
187
188 set->Remove(A);
189 CHECK_EQ(2, set->size());
190 CHECK(!set->Contains(A));
191 CHECK(set->Contains(B));
192 CHECK(set->Contains(C));
193
194 set->Remove(B);
195 CHECK_EQ(1, set->size());
196 CHECK(!set->Contains(A));
197 CHECK(!set->Contains(B));
198 CHECK(set->Contains(C));
199
200 set->Remove(C);
201 CHECK_EQ(0, set->size());
202 CHECK(!set->Contains(A));
203 CHECK(!set->Contains(B));
204 CHECK(!set->Contains(C));
205 }
206
207
168 TEST(UniqueSet_Contains) { 208 TEST(UniqueSet_Contains) {
169 CcTest::InitializeVM(); 209 CcTest::InitializeVM();
170 MAKE_HANDLES_AND_DISALLOW_ALLOCATION; 210 MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
171 MAKE_UNIQUES_A_B_C; 211 MAKE_UNIQUES_A_B_C;
172 212
173 Zone zone(isolate); 213 Zone zone(isolate);
174 214
175 UniqueSet<String>* set = new(&zone) UniqueSet<String>(); 215 UniqueSet<String>* set = new(&zone) UniqueSet<String>();
176 216
177 CHECK_EQ(0, set->size()); 217 CHECK_EQ(0, set->size());
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 540
501 UniqueSet<String>* result = set1->Union(set2, &zone); 541 UniqueSet<String>* result = set1->Union(set2, &zone);
502 UniqueSet<String>* expected = MakeSet(&zone, i | j, elements); 542 UniqueSet<String>* expected = MakeSet(&zone, i | j, elements);
503 543
504 CHECK(result->Equals(expected)); 544 CHECK(result->Equals(expected));
505 CHECK(expected->Equals(result)); 545 CHECK(expected->Equals(result));
506 } 546 }
507 } 547 }
508 } 548 }
509 549
OLDNEW
« no previous file with comments | « src/unique.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698