Status: Accepted
Owner: [email protected]
Labels: Type-Bug Priority-Medium
New issue 2246 by [email protected]: Object literals don't use
CONSTANT_FUNCTION unless they are in global scope.
http://code.google.com/p/v8/issues/detail?id=2246
Heuristic in ParseObjectLiteral:
http://code.google.com/p/v8/source/browse/branches/bleeding_edge/src/parser.cc#4272
seems to be based on the old requirement for constant functions to be in an
old space. Florian have lifted this requirement a while ago and now we have
an inconsistent performance depending on whether one creates function
property inside object literal or outside of it:
(function () {
var z = {test: function () {}};
z.test2 = function () {};
function foo(z) {
var i;
console.time('test speed');
for (i = 0; i < 10000000; i++) z.test();
console.timeEnd('test speed');
console.time('test2 speed');
for (i = 0; i < 10000000; i++) z.test2();
console.timeEnd('test2 speed');
}
foo(z);
foo(z);
})();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev