Revision: 25266
Author:   [email protected]
Date:     Tue Nov 11 15:40:51 2014 UTC
Log:      Reland "Avoid some unnecessary fast-properties map creations."

This relands commit ea74f0f85a7730879a2f17721629f93525886092.

The revert was due to failures in cctest/test-heap/ReleaseOverReservedPages,
caused by apparent changes to memory layout and fragmentation of the
first page. Eliminating a situation in messages.js where this CL has had
an effect on map transitions seems to solve the issue.

[email protected]

Review URL: https://codereview.chromium.org/714883003
https://code.google.com/p/v8/source/detail?r=25266

Modified:
 /branches/bleeding_edge/src/messages.js
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/runtime/runtime-object.cc
 /branches/bleeding_edge/test/mjsunit/object-freeze.js
 /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-137689.js

=======================================
--- /branches/bleeding_edge/src/messages.js     Fri Oct 31 13:03:15 2014 UTC
+++ /branches/bleeding_edge/src/messages.js     Tue Nov 11 15:40:51 2014 UTC
@@ -1224,7 +1224,6 @@
         // Define all the expected properties directly on the error
         // object. This avoids going through getters and setters defined
         // on prototype objects.
-        %AddNamedProperty(this, 'stack', UNDEFINED, DONT_ENUM);
         if (!IS_UNDEFINED(m)) {
           %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM);
         }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Nov 11 10:24:52 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Tue Nov 11 15:40:51 2014 UTC
@@ -9609,13 +9609,17 @@
     JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0,
                                   "NormalizeAsPrototype");
   }
+  bool has_just_copied_map = false;
   if (!object->HasFastProperties()) {
     JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype");
+    has_just_copied_map = true;
   }
   if (mode == FAST_PROTOTYPE && object->HasFastProperties() &&
       !object->map()->is_prototype_map()) {
- Handle<Map> new_map = Map::Copy(handle(object->map()), "CopyAsPrototype");
-    JSObject::MigrateToMap(object, new_map);
+    if (!has_just_copied_map) {
+ Handle<Map> new_map = Map::Copy(handle(object->map()), "CopyAsPrototype");
+      JSObject::MigrateToMap(object, new_map);
+    }
     object->map()->set_is_prototype_map(true);
   }
 }
=======================================
--- /branches/bleeding_edge/src/runtime/runtime-object.cc Tue Nov 11 10:24:52 2014 UTC +++ /branches/bleeding_edge/src/runtime/runtime-object.cc Tue Nov 11 15:40:51 2014 UTC
@@ -1454,10 +1454,8 @@
RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
   PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);

-  bool fast = obj->HasFastProperties();
   RETURN_FAILURE_ON_EXCEPTION(
       isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr));
-  if (fast) JSObject::MigrateSlowToFast(obj, 0, "RuntimeDefineAccessor");
   return isolate->heap()->undefined_value();
 }

=======================================
--- /branches/bleeding_edge/test/mjsunit/object-freeze.js Fri Nov 7 18:49:24 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/object-freeze.js Tue Nov 11 15:40:51 2014 UTC
@@ -303,7 +303,7 @@

 // Also test a simpler case
 obj = {};
-Object.defineProperty(obj, 'accessor', {
+Object.defineProperty(obj, 'accessor2', {
   get: function() { return 42 },
   set: function() { accessorDidRun = true },
   configurable: true,
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-137689.js Fri Nov 7 18:49:24 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-137689.js Tue Nov 11 15:40:51 2014 UTC
@@ -44,5 +44,4 @@

 Object.defineProperty(o, "foo", { set: setter, configurable: true });
 Object.defineProperty(o2, "foo", { set: setter, configurable: true });
-// TODO(ishell): this should eventually become assertTrue().
-assertFalse(%HaveSameMap(o, o2));
+assertTrue(%HaveSameMap(o, o2));

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to