Revision: 9166
Author: [email protected]
Date: Wed Sep 7 04:56:06 2011
Log: 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
http://code.google.com/p/v8/source/detail?r=9166
Modified:
/branches/bleeding_edge/src/v8natives.js
/branches/bleeding_edge/test/mjsunit/builtins.js
=======================================
--- /branches/bleeding_edge/src/v8natives.js Tue Sep 6 07:03:32 2011
+++ /branches/bleeding_edge/src/v8natives.js Wed Sep 7 04:56:06 2011
@@ -97,13 +97,7 @@
%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);
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/builtins.js Mon Sep 5 00:30:35
2011
+++ /branches/bleeding_edge/test/mjsunit/builtins.js Wed Sep 7 04:56:06
2011
@@ -56,7 +56,6 @@
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