Revision: 3875
Author: [email protected]
Date: Tue Feb 16 07:14:34 2010
Log: 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.

Review URL: http://codereview.chromium.org/601081
http://code.google.com/p/v8/source/detail?r=3875

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/parser.cc
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Feb 16 01:41:11 2010
+++ /branches/bleeding_edge/src/heap.cc Tue Feb 16 07:14:34 2010
@@ -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) {
=======================================
--- /branches/bleeding_edge/src/parser.cc       Mon Feb  1 02:31:55 2010
+++ /branches/bleeding_edge/src/parser.cc       Tue Feb 16 07:14:34 2010
@@ -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,
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Feb  4 23:19:09 2010
+++ /branches/bleeding_edge/src/runtime.cc      Tue Feb 16 07:14:34 2010
@@ -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;

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

Reply via email to