Revision: 13558
Author:   [email protected]
Date:     Wed Jan 30 07:07:58 2013
Log:      Also allow the empty object map to keep transitions.

With the old implementation, due to the map-check being inadequate, such
transitions were already added for cross-context field stores. It is not
necessary anymore to not store transitions, since we properly clear
non-live transitions. Globally enabling this feature will help find more
bugs.

BUG=v8:2518
[email protected]

Review URL: https://chromiumcodereview.appspot.com/12092063
http://code.google.com/p/v8/source/detail?r=13558

Modified:
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/isolate.h       Wed Jan 30 04:19:32 2013
+++ /branches/bleeding_edge/src/isolate.h       Wed Jan 30 07:07:58 2013
@@ -531,11 +531,6 @@
   void set_save_context(SaveContext* save) {
     thread_local_top_.save_context_ = save;
   }
-
-  // Access to the map of "new Object()".
-  Map* empty_object_map() {
-    return context()->native_context()->object_function()->map();
-  }

   // Access to current thread id.
   ThreadId thread_id() { return thread_local_top_.thread_id_; }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Thu Jan 24 03:55:05 2013
+++ /branches/bleeding_edge/src/objects.cc      Wed Jan 30 07:07:58 2013
@@ -1601,10 +1601,7 @@
     if (!maybe_values->To(&values)) return maybe_values;
   }

-  // Only allow map transition if the object isn't the global object.
-  TransitionFlag flag = isolate->empty_object_map() != map()
-      ? INSERT_TRANSITION
-      : OMIT_TRANSITION;
+  TransitionFlag flag = INSERT_TRANSITION;

   Map* new_map;
   MaybeObject* maybe_new_map = map()->CopyAddDescriptor(&new_field, flag);
@@ -1630,15 +1627,11 @@
   // Allocate new instance descriptors with (name, function) added
   ConstantFunctionDescriptor d(name, function, attributes, 0);

-  Heap* heap = GetHeap();
   TransitionFlag flag =
- // Do not add transitions to the empty object map (map of "new Object()"),
-      // nor to global objects.
-      (map() == heap->isolate()->empty_object_map() || IsGlobalObject() ||
+      // Do not add transitions to  global objects.
+      (IsGlobalObject() ||
       // Don't add transitions to special properties with non-trivial
       // attributes.
- // TODO(verwaest): Once we support attribute changes, these transitions
-      // should be kept as well.
        attributes != NONE)
       ? OMIT_TRANSITION
       : INSERT_TRANSITION;
@@ -1841,10 +1834,8 @@

   if (!HasFastProperties()) return result;

- // This method should only be used to convert existing transitions. Objects - // with the map of "new Object()" cannot have transitions in the first place.
+  // This method should only be used to convert existing transitions.
   Map* new_map = map();
-  ASSERT(new_map != GetIsolate()->empty_object_map());

   // TODO(verwaest): From here on we lose existing map transitions, causing
   // invalid back pointers. This will change once we can store multiple
@@ -2415,10 +2406,8 @@
   }

   bool allow_store_transition =
- // Only remember the map transition if the object's map is NOT equal to - // the global object_function's map and there is not an already existing + // Only remember the map transition if there is not an already existing
       // non-matching element transition.
-      (GetIsolate()->empty_object_map() != map()) &&
       !start_map->IsUndefined() && !start_map->is_shared() &&
       IsFastElementsKind(from_kind);

--
--
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/groups/opt_out.


Reply via email to