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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 16337005: Deprecate FACTORY helper macro. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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-heap.cc ('k') | test/cctest/test-object-observe.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 obj = JSObject::cast(Isolate::Current()->context()->global_object()-> 228 obj = JSObject::cast(Isolate::Current()->context()->global_object()->
229 GetProperty(obj_name)->ToObjectChecked()); 229 GetProperty(obj_name)->ToObjectChecked());
230 prop_name = 230 prop_name =
231 String::cast(HEAP->InternalizeUtf8String("theSlot")->ToObjectChecked()); 231 String::cast(HEAP->InternalizeUtf8String("theSlot")->ToObjectChecked());
232 CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23)); 232 CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23));
233 } 233 }
234 234
235 235
236 // TODO(1600): compaction of map space is temporary removed from GC. 236 // TODO(1600): compaction of map space is temporary removed from GC.
237 #if 0 237 #if 0
238 static Handle<Map> CreateMap() { 238 static Handle<Map> CreateMap(Isolate* isolate) {
239 return FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 239 return isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
240 } 240 }
241 241
242 242
243 TEST(MapCompact) { 243 TEST(MapCompact) {
244 FLAG_max_map_space_pages = 16; 244 FLAG_max_map_space_pages = 16;
245 CcTest::InitializeVM(); 245 CcTest::InitializeVM();
246 Isolate* isolate = Isolate::Current();
247 Factory* factory = isolate->factory();
246 248
247 { 249 {
248 v8::HandleScope sc; 250 v8::HandleScope sc;
249 // keep allocating maps while pointers are still encodable and thus 251 // keep allocating maps while pointers are still encodable and thus
250 // mark compact is permitted. 252 // mark compact is permitted.
251 Handle<JSObject> root = FACTORY->NewJSObjectFromMap(CreateMap()); 253 Handle<JSObject> root = factory->NewJSObjectFromMap(CreateMap());
252 do { 254 do {
253 Handle<Map> map = CreateMap(); 255 Handle<Map> map = CreateMap();
254 map->set_prototype(*root); 256 map->set_prototype(*root);
255 root = FACTORY->NewJSObjectFromMap(map); 257 root = factory->NewJSObjectFromMap(map);
256 } while (HEAP->map_space()->MapPointersEncodable()); 258 } while (HEAP->map_space()->MapPointersEncodable());
257 } 259 }
258 // Now, as we don't have any handles to just allocated maps, we should 260 // Now, as we don't have any handles to just allocated maps, we should
259 // be able to trigger map compaction. 261 // be able to trigger map compaction.
260 // To give an additional chance to fail, try to force compaction which 262 // To give an additional chance to fail, try to force compaction which
261 // should be impossible right now. 263 // should be impossible right now.
262 HEAP->CollectAllGarbage(Heap::kForceCompactionMask); 264 HEAP->CollectAllGarbage(Heap::kForceCompactionMask);
263 // And now map pointers should be encodable again. 265 // And now map pointers should be encodable again.
264 CHECK(HEAP->map_space()->MapPointersEncodable()); 266 CHECK(HEAP->map_space()->MapPointersEncodable());
265 } 267 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 if (v8::internal::Snapshot::IsEnabled()) { 559 if (v8::internal::Snapshot::IsEnabled()) {
558 CHECK_LE(delta, 2900 * 1024); 560 CHECK_LE(delta, 2900 * 1024);
559 } else { 561 } else {
560 CHECK_LE(delta, 3400 * 1024); 562 CHECK_LE(delta, 3400 * 1024);
561 } 563 }
562 } 564 }
563 } 565 }
564 } 566 }
565 567
566 #endif // __linux__ and !USE_SIMULATOR 568 #endif // __linux__ and !USE_SIMULATOR
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698