| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index 1996e736f03d207894ab13e8a14c6d72075b3760..d298d5db814b1d24c5190f460aa66690b58a2832 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -1333,10 +1333,8 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
|
| Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
|
|
|
| if (!function->shared()->is_generator()) {
|
| - JSObject::SetOwnPropertyIgnoreAttributes(prototype,
|
| - constructor_string(),
|
| - function,
|
| - DONT_ENUM).Assert();
|
| + JSObject::InitializeProperty(prototype, constructor_string(),
|
| + function, DONT_ENUM);
|
| }
|
|
|
| return prototype;
|
| @@ -2170,11 +2168,19 @@ Handle<JSFunction> Factory::CreateApiFunction(
|
| return result;
|
| }
|
|
|
| - JSObject::SetOwnPropertyIgnoreAttributes(
|
| - handle(JSObject::cast(result->prototype())),
|
| - constructor_string(),
|
| - result,
|
| - DONT_ENUM).Assert();
|
| + if (prototype->IsTheHole()) {
|
| +#ifdef DEBUG
|
| + LookupIterator it(handle(JSObject::cast(result->prototype())),
|
| + constructor_string(),
|
| + LookupIterator::CHECK_OWN_REAL);
|
| + MaybeHandle<Object> maybe_prop = Object::GetProperty(&it);
|
| + ASSERT(it.IsFound());
|
| + ASSERT(maybe_prop.ToHandleChecked().is_identical_to(result));
|
| +#endif
|
| + } else {
|
| + JSObject::InitializeProperty(handle(JSObject::cast(result->prototype())),
|
| + constructor_string(), result, DONT_ENUM);
|
| + }
|
|
|
| // Down from here is only valid for API functions that can be used as a
|
| // constructor (don't set the "remove prototype" flag).
|
|
|