| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index 7d8198cb7bc03f5e7a26246437777b682bd26d7b..727591f5a5fdc65e9fc3a6690c574165ba046a19 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -932,6 +932,32 @@ Handle<JSPromise> Factory::NewJSPromise() {
|
| return promise;
|
| }
|
|
|
| +void Factory::InitJSWeakRef(
|
| + Handle<JSWeakRef> weak_ref,
|
| + Handle<JSObject> target,
|
| + Handle<JSFunction> executor,
|
| + Handle<Object> holdings
|
| +) {
|
| + Handle<JSFunction> constructor(
|
| + isolate()->native_context()->js_weak_ref_fun(), isolate());
|
| + DCHECK(constructor->has_initial_map());
|
| + Handle<Map> map(constructor->initial_map(), isolate());
|
| +
|
| + DCHECK(!map->is_prototype_map());
|
| +
|
| + weak_ref->set_target(*NewWeakCell(target));
|
| + weak_ref->set_executor(*executor);
|
| + weak_ref->set_holdings(*holdings);
|
| + weak_ref->set_held(false);
|
| + weak_ref->set_queued(false);
|
| +
|
| + Handle<FixedArray> refs(isolate()->heap()->weak_refs(), isolate());
|
| + int num_refs = refs->length();
|
| + refs = isolate()->factory()->CopyFixedArrayAndGrow(refs, 1);
|
| + isolate()->heap()->set_weak_refs(*refs);
|
| + refs->set(num_refs, *weak_ref);
|
| +}
|
| +
|
| Handle<Context> Factory::NewNativeContext() {
|
| Handle<FixedArray> array =
|
| NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED);
|
|
|