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

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

Issue 910333004: Contribution of PowerPC port (continuation of 422063005) - PPC opt 2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated to remove non-test changes Created 5 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
« no previous file with comments | « test/cctest/test-spaces.cc ('k') | test/cctest/test-weaksets.cc » ('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 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 Factory* factory = isolate->factory(); 177 Factory* factory = isolate->factory();
178 Heap* heap = isolate->heap(); 178 Heap* heap = isolate->heap();
179 HandleScope scope(isolate); 179 HandleScope scope(isolate);
180 Handle<JSFunction> function = factory->NewFunction( 180 Handle<JSFunction> function = factory->NewFunction(
181 factory->function_string()); 181 factory->function_string());
182 Handle<JSObject> key = factory->NewJSObject(function); 182 Handle<JSObject> key = factory->NewJSObject(function);
183 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); 183 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate);
184 184
185 // Start second old-space page so that values land on evacuation candidate. 185 // Start second old-space page so that values land on evacuation candidate.
186 Page* first_page = heap->old_pointer_space()->anchor()->next_page(); 186 Page* first_page = heap->old_pointer_space()->anchor()->next_page();
187 factory->NewFixedArray(900 * KB / kPointerSize, TENURED); 187 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB;
188 factory->NewFixedArray(dummy_array_size / kPointerSize, TENURED);
188 189
189 // Fill up weak map with values on an evacuation candidate. 190 // Fill up weak map with values on an evacuation candidate.
190 { 191 {
191 HandleScope scope(isolate); 192 HandleScope scope(isolate);
192 for (int i = 0; i < 32; i++) { 193 for (int i = 0; i < 32; i++) {
193 Handle<JSObject> object = factory->NewJSObject(function, TENURED); 194 Handle<JSObject> object = factory->NewJSObject(function, TENURED);
194 CHECK(!heap->InNewSpace(object->address())); 195 CHECK(!heap->InNewSpace(object->address()));
195 CHECK(!first_page->Contains(object->address())); 196 CHECK(!first_page->Contains(object->address()));
196 Runtime::WeakCollectionSet(weakmap, key, object); 197 Runtime::WeakCollectionSet(weakmap, key, object);
197 } 198 }
(...skipping 17 matching lines...) Expand all
215 LocalContext context; 216 LocalContext context;
216 Isolate* isolate = GetIsolateFrom(&context); 217 Isolate* isolate = GetIsolateFrom(&context);
217 Factory* factory = isolate->factory(); 218 Factory* factory = isolate->factory();
218 Heap* heap = isolate->heap(); 219 Heap* heap = isolate->heap();
219 HandleScope scope(isolate); 220 HandleScope scope(isolate);
220 Handle<JSFunction> function = factory->NewFunction( 221 Handle<JSFunction> function = factory->NewFunction(
221 factory->function_string()); 222 factory->function_string());
222 223
223 // Start second old-space page so that keys land on evacuation candidate. 224 // Start second old-space page so that keys land on evacuation candidate.
224 Page* first_page = heap->old_pointer_space()->anchor()->next_page(); 225 Page* first_page = heap->old_pointer_space()->anchor()->next_page();
225 factory->NewFixedArray(900 * KB / kPointerSize, TENURED); 226 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB;
227 factory->NewFixedArray(dummy_array_size / kPointerSize, TENURED);
226 228
227 // Fill up weak map with keys on an evacuation candidate. 229 // Fill up weak map with keys on an evacuation candidate.
228 Handle<JSObject> keys[32]; 230 Handle<JSObject> keys[32];
229 for (int i = 0; i < 32; i++) { 231 for (int i = 0; i < 32; i++) {
230 keys[i] = factory->NewJSObject(function, TENURED); 232 keys[i] = factory->NewJSObject(function, TENURED);
231 CHECK(!heap->InNewSpace(keys[i]->address())); 233 CHECK(!heap->InNewSpace(keys[i]->address()));
232 CHECK(!first_page->Contains(keys[i]->address())); 234 CHECK(!first_page->Contains(keys[i]->address()));
233 } 235 }
234 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); 236 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate);
235 for (int i = 0; i < 32; i++) { 237 for (int i = 0; i < 32; i++) {
(...skipping 18 matching lines...) Expand all
254 { 256 {
255 HandleScope scope(isolate); 257 HandleScope scope(isolate);
256 AllocateJSWeakMap(isolate); 258 AllocateJSWeakMap(isolate);
257 SimulateIncrementalMarking(heap); 259 SimulateIncrementalMarking(heap);
258 } 260 }
259 // The weak map is marked black here but leaving the handle scope will make 261 // The weak map is marked black here but leaving the handle scope will make
260 // the object unreachable. Aborting incremental marking will clear all the 262 // the object unreachable. Aborting incremental marking will clear all the
261 // marking bits which makes the weak map garbage. 263 // marking bits which makes the weak map garbage.
262 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 264 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
263 } 265 }
OLDNEW
« no previous file with comments | « test/cctest/test-spaces.cc ('k') | test/cctest/test-weaksets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698