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

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

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 years, 10 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 | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 162
163 // Test that weak map values on an evacuation candidate which are not reachable 163 // Test that weak map values on an evacuation candidate which are not reachable
164 // by other paths are correctly recorded in the slots buffer. 164 // by other paths are correctly recorded in the slots buffer.
165 TEST(Regress2060a) { 165 TEST(Regress2060a) {
166 FLAG_always_compact = true; 166 FLAG_always_compact = true;
167 LocalContext context; 167 LocalContext context;
168 v8::HandleScope scope; 168 v8::HandleScope scope;
169 Handle<JSFunction> function = 169 Handle<JSFunction> function =
170 FACTORY->NewFunction(FACTORY->function_symbol(), FACTORY->null_value()); 170 FACTORY->NewFunction(FACTORY->function_string(), FACTORY->null_value());
171 Handle<JSObject> key = FACTORY->NewJSObject(function); 171 Handle<JSObject> key = FACTORY->NewJSObject(function);
172 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(); 172 Handle<JSWeakMap> weakmap = AllocateJSWeakMap();
173 173
174 // Start second old-space page so that values land on evacuation candidate. 174 // Start second old-space page so that values land on evacuation candidate.
175 Page* first_page = HEAP->old_pointer_space()->anchor()->next_page(); 175 Page* first_page = HEAP->old_pointer_space()->anchor()->next_page();
176 FACTORY->NewFixedArray(900 * KB / kPointerSize, TENURED); 176 FACTORY->NewFixedArray(900 * KB / kPointerSize, TENURED);
177 177
178 // Fill up weak map with values on an evacuation candidate. 178 // Fill up weak map with values on an evacuation candidate.
179 { 179 {
180 v8::HandleScope scope; 180 v8::HandleScope scope;
(...skipping 15 matching lines...) Expand all
196 // other strong paths are correctly recorded in the slots buffer. 196 // other strong paths are correctly recorded in the slots buffer.
197 TEST(Regress2060b) { 197 TEST(Regress2060b) {
198 FLAG_always_compact = true; 198 FLAG_always_compact = true;
199 #ifdef VERIFY_HEAP 199 #ifdef VERIFY_HEAP
200 FLAG_verify_heap = true; 200 FLAG_verify_heap = true;
201 #endif 201 #endif
202 202
203 LocalContext context; 203 LocalContext context;
204 v8::HandleScope scope; 204 v8::HandleScope scope;
205 Handle<JSFunction> function = 205 Handle<JSFunction> function =
206 FACTORY->NewFunction(FACTORY->function_symbol(), FACTORY->null_value()); 206 FACTORY->NewFunction(FACTORY->function_string(), FACTORY->null_value());
207 207
208 // Start second old-space page so that keys land on evacuation candidate. 208 // Start second old-space page so that keys land on evacuation candidate.
209 Page* first_page = HEAP->old_pointer_space()->anchor()->next_page(); 209 Page* first_page = HEAP->old_pointer_space()->anchor()->next_page();
210 FACTORY->NewFixedArray(900 * KB / kPointerSize, TENURED); 210 FACTORY->NewFixedArray(900 * KB / kPointerSize, TENURED);
211 211
212 // Fill up weak map with keys on an evacuation candidate. 212 // Fill up weak map with keys on an evacuation candidate.
213 Handle<JSObject> keys[32]; 213 Handle<JSObject> keys[32];
214 for (int i = 0; i < 32; i++) { 214 for (int i = 0; i < 32; i++) {
215 keys[i] = FACTORY->NewJSObject(function, TENURED); 215 keys[i] = FACTORY->NewJSObject(function, TENURED);
216 CHECK(!HEAP->InNewSpace(keys[i]->address())); 216 CHECK(!HEAP->InNewSpace(keys[i]->address()));
217 CHECK(!first_page->Contains(keys[i]->address())); 217 CHECK(!first_page->Contains(keys[i]->address()));
218 } 218 }
219 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(); 219 Handle<JSWeakMap> weakmap = AllocateJSWeakMap();
220 for (int i = 0; i < 32; i++) { 220 for (int i = 0; i < 32; i++) {
221 PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i))); 221 PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i)));
222 } 222 }
223 223
224 // Force compacting garbage collection. The subsequent collections are used 224 // Force compacting garbage collection. The subsequent collections are used
225 // to verify that key references were actually updated. 225 // to verify that key references were actually updated.
226 CHECK(FLAG_always_compact); 226 CHECK(FLAG_always_compact);
227 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 227 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
228 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 228 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
229 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 229 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
230 } 230 }
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698