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

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

Issue 268063008: Replace NewFunctionWithPrototype(name, prototype) by NewFunction(name) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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-weakmaps.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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Test that weak set values on an evacuation candidate which are not reachable 178 // Test that weak set values on an evacuation candidate which are not reachable
179 // by other paths are correctly recorded in the slots buffer. 179 // by other paths are correctly recorded in the slots buffer.
180 TEST(WeakSet_Regress2060a) { 180 TEST(WeakSet_Regress2060a) {
181 if (i::FLAG_never_compact) return; 181 if (i::FLAG_never_compact) return;
182 FLAG_always_compact = true; 182 FLAG_always_compact = true;
183 LocalContext context; 183 LocalContext context;
184 Isolate* isolate = GetIsolateFrom(&context); 184 Isolate* isolate = GetIsolateFrom(&context);
185 Factory* factory = isolate->factory(); 185 Factory* factory = isolate->factory();
186 Heap* heap = isolate->heap(); 186 Heap* heap = isolate->heap();
187 HandleScope scope(isolate); 187 HandleScope scope(isolate);
188 Handle<JSFunction> function = factory->NewFunctionWithPrototype( 188 Handle<JSFunction> function = factory->NewFunction(
189 factory->function_string(), factory->null_value()); 189 factory->function_string());
190 Handle<JSObject> key = factory->NewJSObject(function); 190 Handle<JSObject> key = factory->NewJSObject(function);
191 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); 191 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
192 192
193 // Start second old-space page so that values land on evacuation candidate. 193 // Start second old-space page so that values land on evacuation candidate.
194 Page* first_page = heap->old_pointer_space()->anchor()->next_page(); 194 Page* first_page = heap->old_pointer_space()->anchor()->next_page();
195 factory->NewFixedArray(900 * KB / kPointerSize, TENURED); 195 factory->NewFixedArray(900 * KB / kPointerSize, TENURED);
196 196
197 // Fill up weak set with values on an evacuation candidate. 197 // Fill up weak set with values on an evacuation candidate.
198 { 198 {
199 HandleScope scope(isolate); 199 HandleScope scope(isolate);
(...skipping 18 matching lines...) Expand all
218 FLAG_always_compact = true; 218 FLAG_always_compact = true;
219 #ifdef VERIFY_HEAP 219 #ifdef VERIFY_HEAP
220 FLAG_verify_heap = true; 220 FLAG_verify_heap = true;
221 #endif 221 #endif
222 222
223 LocalContext context; 223 LocalContext context;
224 Isolate* isolate = GetIsolateFrom(&context); 224 Isolate* isolate = GetIsolateFrom(&context);
225 Factory* factory = isolate->factory(); 225 Factory* factory = isolate->factory();
226 Heap* heap = isolate->heap(); 226 Heap* heap = isolate->heap();
227 HandleScope scope(isolate); 227 HandleScope scope(isolate);
228 Handle<JSFunction> function = factory->NewFunctionWithPrototype( 228 Handle<JSFunction> function = factory->NewFunction(
229 factory->function_string(), factory->null_value()); 229 factory->function_string());
230 230
231 // Start second old-space page so that keys land on evacuation candidate. 231 // Start second old-space page so that keys land on evacuation candidate.
232 Page* first_page = heap->old_pointer_space()->anchor()->next_page(); 232 Page* first_page = heap->old_pointer_space()->anchor()->next_page();
233 factory->NewFixedArray(900 * KB / kPointerSize, TENURED); 233 factory->NewFixedArray(900 * KB / kPointerSize, TENURED);
234 234
235 // Fill up weak set with keys on an evacuation candidate. 235 // Fill up weak set with keys on an evacuation candidate.
236 Handle<JSObject> keys[32]; 236 Handle<JSObject> keys[32];
237 for (int i = 0; i < 32; i++) { 237 for (int i = 0; i < 32; i++) {
238 keys[i] = factory->NewJSObject(function, TENURED); 238 keys[i] = factory->NewJSObject(function, TENURED);
239 CHECK(!heap->InNewSpace(keys[i]->address())); 239 CHECK(!heap->InNewSpace(keys[i]->address()));
240 CHECK(!first_page->Contains(keys[i]->address())); 240 CHECK(!first_page->Contains(keys[i]->address()));
241 } 241 }
242 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); 242 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
243 for (int i = 0; i < 32; i++) { 243 for (int i = 0; i < 32; i++) {
244 PutIntoWeakSet(weakset, 244 PutIntoWeakSet(weakset,
245 keys[i], 245 keys[i],
246 Handle<Smi>(Smi::FromInt(i), isolate)); 246 Handle<Smi>(Smi::FromInt(i), isolate));
247 } 247 }
248 248
249 // Force compacting garbage collection. The subsequent collections are used 249 // Force compacting garbage collection. The subsequent collections are used
250 // to verify that key references were actually updated. 250 // to verify that key references were actually updated.
251 CHECK(FLAG_always_compact); 251 CHECK(FLAG_always_compact);
252 heap->CollectAllGarbage(Heap::kNoGCFlags); 252 heap->CollectAllGarbage(Heap::kNoGCFlags);
253 heap->CollectAllGarbage(Heap::kNoGCFlags); 253 heap->CollectAllGarbage(Heap::kNoGCFlags);
254 heap->CollectAllGarbage(Heap::kNoGCFlags); 254 heap->CollectAllGarbage(Heap::kNoGCFlags);
255 } 255 }
OLDNEW
« no previous file with comments | « test/cctest/test-weakmaps.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698