From 2c8680cc465b6fc54d73c7ee03f4fc4fa7147883 Mon Sep 17 00:00:00 2001 From: "lrn@chromium.org" Date: Wed, 7 Sep 2011 11:56:06 +0000 Subject: [PATCH] Avoid size increase of snapshot. The prototype of builtin functions is already unwritable, so we don't have to make it so (the default map for functions changes after builtins are initialized). We no longer need to make the prototype non-extensible, since all properties that are ever read by the bultins code has been added and frozen already. Adding properties to the prototype, or changing its __proto__, cannot affect code. Removing these two pieces of initialization code reduces the snapshot size by a few Kb. Review URL: http://codereview.chromium.org/7839028 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9166 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/v8natives.js | 6 ------ test/mjsunit/builtins.js | 1 - 2 files changed, 7 deletions(-) diff --git a/src/v8natives.js b/src/v8natives.js index 829d719..1616ac3 100644 --- a/src/v8natives.js +++ b/src/v8natives.js @@ -97,13 +97,7 @@ function SetUpLockedPrototype(constructor, fields, methods) { %SetNativeFlag(f); } prototype.__proto__ = null; - %PreventExtensions(prototype); %ToFastProperties(prototype); - - var desc = GetOwnProperty(constructor, "prototype"); - desc.setWritable(false); - desc.setConfigurable(false); - DefineOwnProperty(constructor, "prototype", desc, false); } diff --git a/test/mjsunit/builtins.js b/test/mjsunit/builtins.js index 340b03d..f2ad544 100644 --- a/test/mjsunit/builtins.js +++ b/test/mjsunit/builtins.js @@ -56,7 +56,6 @@ function checkConstructor(func, name) { assertFalse(proto_desc.configurable, name); var prototype = proto_desc.value; assertEquals(null, prototype.__proto__, name); - assertFalse(Object.isExtensible(prototype), name); for (var i = 0; i < propNames.length; i++) { var propName = propNames[i]; if (propName == "constructor") continue; -- 2.7.4