Reviewers: Søren Gjesse,
Description:
Make sure that the inline_new flag guards all the optimizations for
constructors that only contain simple this assignments.
Make sure that constructors with declarations are not treated as
constructors with only simple this property assignments.
Please review this at http://codereview.chromium.org/601081
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/heap.cc
M src/parser.cc
M src/runtime.cc
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 3866)
+++ src/heap.cc (working copy)
@@ -2383,11 +2383,14 @@
map->set_unused_property_fields(in_object_properties);
map->set_prototype(prototype);
- // If the function has only simple this property assignments add field
- // descriptors for these to the initial map as the object cannot be
- // constructed without having these properties.
+ // If the function has only simple this property assignments add
+ // field descriptors for these to the initial map as the object
+ // cannot be constructed without having these properties. Guard by
+ // the inline_new flag so we only change the map if we generate a
+ // specialized construct stub.
ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields);
- if (fun->shared()->has_only_simple_this_property_assignments() &&
+ if (FLAG_inline_new &&
+ fun->shared()->has_only_simple_this_property_assignments() &&
fun->shared()->this_property_assignments_count() > 0) {
int count = fun->shared()->this_property_assignments_count();
if (count > in_object_properties) {
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 3866)
+++ src/runtime.cc (working copy)
@@ -4850,9 +4850,6 @@
static Code* ComputeConstructStub(Handle<SharedFunctionInfo> shared) {
- // TODO(385): Change this to create a construct stub specialized for
- // the given map to make allocation of simple objects - and maybe
- // arrays - much faster.
if (FLAG_inline_new
&& shared->has_only_simple_this_property_assignments()) {
ConstructStubCompiler compiler;
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 3866)
+++ src/parser.cc (working copy)
@@ -1690,7 +1690,8 @@
// Propagate the collected information on this property assignments.
if (top_scope_->is_function_scope()) {
bool only_simple_this_property_assignments =
-
this_property_assignment_finder.only_simple_this_property_assignments();
+
this_property_assignment_finder.only_simple_this_property_assignments()
+ && top_scope_->declarations()->length() == 0;
if (only_simple_this_property_assignments) {
temp_scope_->SetThisPropertyAssignmentInfo(
only_simple_this_property_assignments,
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev