static Handle<JSWeakSet> AllocateJSWeakSet(Isolate* isolate) {
Factory* factory = isolate->factory();
- Heap* heap = isolate->heap();
Handle<Map> map = factory->NewMap(JS_WEAK_SET_TYPE, JSWeakSet::kSize);
Handle<JSObject> weakset_obj = factory->NewJSObjectFromMap(map);
Handle<JSWeakSet> weakset(JSWeakSet::cast(*weakset_obj));
// Do not use handles for the hash table, it would make entries strong.
- Object* table_obj = ObjectHashTable::Allocate(heap, 1)->ToObjectChecked();
- ObjectHashTable* table = ObjectHashTable::cast(table_obj);
- weakset->set_table(table);
+ Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 1);
+ weakset->set_table(*table);
weakset->set_next(Smi::FromInt(0));
return weakset;
}
// Test that weak set values on an evacuation candidate which are not reachable
// by other paths are correctly recorded in the slots buffer.
TEST(WeakSet_Regress2060a) {
+ if (i::FLAG_never_compact) return;
FLAG_always_compact = true;
LocalContext context;
Isolate* isolate = GetIsolateFrom(&context);
Factory* factory = isolate->factory();
Heap* heap = isolate->heap();
HandleScope scope(isolate);
- Handle<JSFunction> function =
- factory->NewFunction(factory->function_string(), factory->null_value());
+ Handle<JSFunction> function = factory->NewFunctionWithPrototype(
+ factory->function_string(), factory->null_value());
Handle<JSObject> key = factory->NewJSObject(function);
Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
// Test that weak set keys on an evacuation candidate which are reachable by
// other strong paths are correctly recorded in the slots buffer.
TEST(WeakSet_Regress2060b) {
+ if (i::FLAG_never_compact) return;
FLAG_always_compact = true;
#ifdef VERIFY_HEAP
FLAG_verify_heap = true;
Factory* factory = isolate->factory();
Heap* heap = isolate->heap();
HandleScope scope(isolate);
- Handle<JSFunction> function =
- factory->NewFunction(factory->function_string(), factory->null_value());
+ Handle<JSFunction> function = factory->NewFunctionWithPrototype(
+ factory->function_string(), factory->null_value());
// Start second old-space page so that keys land on evacuation candidate.
Page* first_page = heap->old_pointer_space()->anchor()->next_page();