Revision: 17327
Author:   [email protected]
Date:     Tue Oct 22 17:41:08 2013 UTC
Log:      Handlify Map::CopyForObserved

[email protected]

Review URL: https://codereview.chromium.org/34023002
http://code.google.com/p/v8/source/detail?r=17327

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

=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Oct 22 13:48:54 2013 UTC
+++ /branches/bleeding_edge/src/objects.cc      Tue Oct 22 17:41:08 2013 UTC
@@ -2432,6 +2432,16 @@

   object->set_map(*new_map);
 }
+
+
+Handle<TransitionArray> Map::AddTransition(Handle<Map> map,
+                                           Handle<Name> key,
+                                           Handle<Map> target,
+                                           SimpleTransitionFlag flag) {
+  CALL_HEAP_FUNCTION(map->GetIsolate(),
+                     map->AddTransition(*key, *target, flag),
+                     TransitionArray);
+}


 void JSObject::GeneralizeFieldRepresentation(Handle<JSObject> object,
@@ -6930,41 +6940,33 @@


 Handle<Map> Map::CopyForObserved(Handle<Map> map) {
-  CALL_HEAP_FUNCTION(map->GetIsolate(),
-                     map->CopyForObserved(),
-                     Map);
-}
+  ASSERT(!map->is_observed());

-
-MaybeObject* Map::CopyForObserved() {
-  ASSERT(!is_observed());
+  Isolate* isolate = map->GetIsolate();

   // In case the map owned its own descriptors, share the descriptors and
   // transfer ownership to the new map.
-  Map* new_map;
-  MaybeObject* maybe_new_map;
-  if (owns_descriptors()) {
-    maybe_new_map = CopyDropDescriptors();
+  Handle<Map> new_map;
+  if (map->owns_descriptors()) {
+    new_map = Map::CopyDropDescriptors(map);
   } else {
-    maybe_new_map = Copy();
+    new_map = Map::Copy(map);
   }
-  if (!maybe_new_map->To(&new_map)) return maybe_new_map;

-  TransitionArray* transitions;
- MaybeObject* maybe_transitions = AddTransition(GetHeap()->observed_symbol(),
-                                                 new_map,
-                                                 FULL_TRANSITION);
-  if (!maybe_transitions->To(&transitions)) return maybe_transitions;
-  set_transitions(transitions);
+  Handle<TransitionArray> transitions =
+ Map::AddTransition(map, isolate->factory()->observed_symbol(), new_map,
+                         FULL_TRANSITION);
+
+  map->set_transitions(*transitions);

   new_map->set_is_observed(true);

-  if (owns_descriptors()) {
-    new_map->InitializeDescriptors(instance_descriptors());
-    set_owns_descriptors(false);
+  if (map->owns_descriptors()) {
+    new_map->InitializeDescriptors(map->instance_descriptors());
+    map->set_owns_descriptors(false);
   }

-  new_map->SetBackPointer(this);
+  new_map->SetBackPointer(*map);
   return new_map;
 }

=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Oct 22 13:48:54 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Oct 22 17:41:08 2013 UTC
@@ -5749,6 +5749,12 @@
       Map* transitioned_map);
   inline void SetTransition(int transition_index, Map* target);
   inline Map* GetTransition(int transition_index);
+
+  static Handle<TransitionArray> AddTransition(Handle<Map> map,
+                                               Handle<Name> key,
+                                               Handle<Map> target,
+                                               SimpleTransitionFlag flag);
+
   MUST_USE_RESULT inline MaybeObject* AddTransition(Name* key,
                                                     Map* target,
SimpleTransitionFlag flag);
@@ -5986,7 +5992,6 @@
                                                   TransitionFlag flag);

   static Handle<Map> CopyForObserved(Handle<Map> map);
-  MUST_USE_RESULT MaybeObject* CopyForObserved();

   static Handle<Map> CopyNormalized(Handle<Map> map,
                                     PropertyNormalizationMode mode,

--
--
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