| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index fd08c8292f812c8c3084fb699eb9f65dcc98b4a7..5d5f1e0645514d432b1ff0b0806f31cc14ba29b1 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -2877,6 +2877,7 @@ void Heap::CreateInitialObjects() {
|
| set_observed_symbol(*factory->NewPrivateSymbol());
|
| set_stack_trace_symbol(*factory->NewPrivateSymbol());
|
| set_uninitialized_symbol(*factory->NewPrivateSymbol());
|
| + set_home_object_symbol(*factory->NewPrivateOwnSymbol());
|
|
|
| Handle<SeededNumberDictionary> slow_element_dictionary =
|
| SeededNumberDictionary::New(isolate(), 0, TENURED);
|
| @@ -3681,7 +3682,7 @@ AllocationResult Heap::AllocateJSObject(JSFunction* constructor,
|
| AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
|
| // Never used to copy functions. If functions need to be copied we
|
| // have to be careful to clear the literals array.
|
| - SLOW_DCHECK(!source->IsJSFunction());
|
| + // SLOW_DCHECK(!source->IsJSFunction());
|
|
|
| // Make the clone.
|
| Map* map = source->map();
|
| @@ -3756,6 +3757,28 @@ AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
|
| }
|
| JSObject::cast(clone)->set_properties(prop, wb_mode);
|
| }
|
| +
|
| + if (source->IsJSFunction()) {
|
| + SLOW_DCHECK(clone->IsJSFunction());
|
| + JSFunction* source_fun = JSFunction::cast(source);
|
| + JSFunction* clone_fun = JSFunction::cast(clone);
|
| + SharedFunctionInfo* info = source_fun->shared();
|
| + if (!info->bound()) {
|
| + int num_literals = info->num_literals();
|
| + HeapObject* obj;
|
| + {
|
| + AllocationResult allocation = AllocateFixedArrayWithFiller(
|
| + num_literals, NOT_TENURED, undefined_value());
|
| + if (!allocation.To(&obj)) return allocation;
|
| + }
|
| + FixedArray* new_literals = FixedArray::cast(obj);
|
| + if (num_literals > 0) {
|
| + new_literals->set(JSFunction::kLiteralNativeContextIndex,
|
| + JSFunction::NativeContextFromLiterals(source_fun->literals()));
|
| + }
|
| + clone_fun->set_literals(new_literals);
|
| + }
|
| + }
|
| // Return the new clone.
|
| return clone;
|
| }
|
|
|