Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Unified Diff: src/api-natives.cc

Issue 2474843003: Allow the global object to be frozen through the global template (Closed)
Patch Set: Refactor to keep all template logic in api Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698