Avoid size increase of snapshot.
authorlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 7 Sep 2011 11:56:06 +0000 (11:56 +0000)
committerlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 7 Sep 2011 11:56:06 +0000 (11:56 +0000)
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
test/mjsunit/builtins.js

index 829d719..1616ac3 100644 (file)
@@ -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);
 }
 
 
index 340b03d..f2ad544 100644 (file)
@@ -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;