Reviewers: Rico,

Description:
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.


Please review this at http://codereview.chromium.org/7839028/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/v8natives.js
  M test/mjsunit/builtins.js


Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 829d7192e587cba083280a64b546e58b10a36ea9..1616ac366b0e470a07de5884687b22fb9ee81016 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);
 }


Index: test/mjsunit/builtins.js
diff --git a/test/mjsunit/builtins.js b/test/mjsunit/builtins.js
index 340b03dc1a9ce9cda344a223d5f4ac5361089eb4..f2ad5446a06682a16f64ef8c3126e43017a3edb8 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;


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to