Chromium Code Reviews| Index: src/api-natives.cc |
| diff --git a/src/api-natives.cc b/src/api-natives.cc |
| index f09f42d5f0480f76b8d6ac4c0e54efb0f6a9314e..adb5a303e26456c544eb24675b15c121be1e4b18 100644 |
| --- a/src/api-natives.cc |
| +++ b/src/api-natives.cc |
| @@ -304,7 +304,8 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, |
| JSFunction::cast(*new_target)->shared()->function_data() == |
| info->constructor() && |
| JSFunction::cast(*new_target)->context()->native_context() == |
| - isolate->context()->native_context()) { |
| + isolate->context()->native_context() && |
| + !info->immutable_proto()) { |
| constructor = Handle<JSFunction>::cast(new_target); |
| } else { |
| // Disable caching for subclass instantiation. |
| @@ -346,6 +347,11 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate, |
| ASSIGN_RETURN_ON_EXCEPTION( |
| isolate, result, |
| ConfigureInstance(isolate, object, info, is_hidden_prototype), JSObject); |
| + if (info->immutable_proto()) { |
| + MAYBE_RETURN(JSObject::SetImmutableProto( |
|
Toon Verwaest
2016/06/30 15:35:33
I don't think we need to walk the hidden prototype
Dan Ehrenberg
2016/06/30 23:12:41
Removed all that extra useless code.
|
| + object, false, Object::ShouldThrow::THROW_ON_ERROR), |
| + MaybeHandle<JSObject>()); |
| + } |
| // TODO(dcarney): is this necessary? |
| JSObject::MigrateSlowToFast(result, 0, "ApiNatives::InstantiateObject"); |
| @@ -572,8 +578,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction( |
| if (!obj->instance_template()->IsUndefined(isolate)) { |
| Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>( |
| ObjectTemplateInfo::cast(obj->instance_template())); |
| - internal_field_count = |
| - Smi::cast(instance_template->internal_field_count())->value(); |
| + internal_field_count = instance_template->internal_field_count(); |
| } |
| // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing |