Chromium Code Reviews| Index: src/api-natives.cc |
| diff --git a/src/api-natives.cc b/src/api-natives.cc |
| index ab1b06256e0301b0ba60ef4705a203ed9a3476b5..0405d329a857ba214cef6190f3d1e35ad00b09c7 100644 |
| --- a/src/api-natives.cc |
| +++ b/src/api-natives.cc |
| @@ -613,10 +613,12 @@ Handle<JSFunction> ApiNatives::CreateApiFunction( |
| } |
| int internal_field_count = 0; |
| + bool immutable_proto = false; |
| if (!obj->instance_template()->IsUndefined(isolate)) { |
| Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>( |
| ObjectTemplateInfo::cast(obj->instance_template())); |
| internal_field_count = instance_template->internal_field_count(); |
| + immutable_proto = instance_template->immutable_proto(); |
| } |
| // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing |
| @@ -650,6 +652,9 @@ Handle<JSFunction> ApiNatives::CreateApiFunction( |
| Handle<Map> map = |
| isolate->factory()->NewMap(type, instance_size, FAST_HOLEY_SMI_ELEMENTS); |
| + |
| + if (immutable_proto) map->set_immutable_proto(true); |
|
adamk
2016/11/04 18:06:12
Please put this down below with all the others (af
|
| + |
| JSFunction::SetInitialMap(result, map, Handle<JSObject>::cast(prototype)); |
| // Mark as undetectable if needed. |