Analyze functions for assignment to this properties.
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 19 Aug 2009 07:30:20 +0000 (07:30 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 19 Aug 2009 07:30:20 +0000 (07:30 +0000)
commit4e03645dc42125f92a0f1f19fd5b4ad9a96e3f40
tree5c56b9bdf211480e1c63ab973230761c9d816ec0
parent03a39152b9eee74187cf60995c0e9c9efd77d30a
Analyze functions for assignment to this properties.

During parsing functions are analyzed for statements of the form this.x = ...;. These assignments are categorized in two types: simple and non simple. The simple ones are where the right hand side is known to be either a constant or an argument to the function. If a function only contains statements of this type the property names are collected and for the simple assignments the index of the argument or the constant value assigned are stored as well.

When the initial map for a function is created and the function consists of only this type of assignemnts the initial map is created with a descriptor array describing these properties which will be known to always exist in an object created from the function.

The information on this property assignments is not collected during pre-parsing so if compiling using pre-parse data these optimization hints are not available.

Next step will be to use the information collected for the simple assignments to generate constructor code which will create and initialize the object from this information without calling the code for the function.
Review URL: http://codereview.chromium.org/172088

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2710 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
13 files changed:
src/ast.h
src/codegen.cc
src/heap.cc
src/ia32/builtins-ia32.cc
src/objects-debug.cc
src/objects-inl.h
src/objects.cc
src/objects.h
src/parser.cc
src/runtime.cc
src/v8-counters.h
src/x64/builtins-x64.cc
test/mjsunit/simple-constructor.js [new file with mode: 0755]