Reviewers: rossberg,

Description:
Make PropertyCell::UpdatedType return a handle.

[email protected]

Please review this at https://codereview.chromium.org/31933003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+10, -12 lines):
  M src/objects.h
  M src/objects.cc
  M src/stub-cache.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index aec412c5d8bc846dd0218defc99a09400ae75fc0..f82e92c904adcea112e05778334a7f036c5ee212 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -16310,8 +16310,8 @@ void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
 }


-Type* PropertyCell::UpdatedType(Handle<PropertyCell> cell,
-                                Handle<Object> value) {
+Handle<Type> PropertyCell::UpdatedType(Handle<PropertyCell> cell,
+                                       Handle<Object> value) {
   Isolate* isolate = cell->GetIsolate();
   Handle<Type> old_type(cell->type(), isolate);
   // TODO(2803): Do not track ConsString as constant because they cannot be
@@ -16321,17 +16321,17 @@ Type* PropertyCell::UpdatedType(Handle<PropertyCell> cell,
                         : Type::Constant(value, isolate), isolate);

   if (new_type->Is(old_type)) {
-    return *old_type;
+    return old_type;
   }

   cell->dependent_code()->DeoptimizeDependentCodeGroup(
       isolate, DependentCode::kPropertyCellChangedGroup);

   if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) {
-    return *new_type;
+    return new_type;
   }

-  return Type::Any();
+  return handle(Type::Any(), isolate);
 }


@@ -16339,8 +16339,8 @@ void PropertyCell::SetValueInferType(Handle<PropertyCell> cell,
                                      Handle<Object> value) {
   cell->set_value(*value);
   if (!Type::Any()->Is(cell->type())) {
-    Type* new_type = UpdatedType(cell, value);
-    cell->set_type(new_type);
+    Handle<Type> new_type = UpdatedType(cell, value);
+    cell->set_type(*new_type);
   }
 }

Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 165261b043dacde2dfb7d99ab850e6de79ae5f74..4d633f8e90c349f43d0119c2e3e9e1a72154de81 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -9197,9 +9197,8 @@ class PropertyCell: public Cell {

   // Computes the new type of the cell's contents for the given value, but
   // without actually modifying the 'type' field.
-  // TODO(mstarzinger): Return value should be handlified.
-  static Type* UpdatedType(Handle<PropertyCell> cell,
-                           Handle<Object> value);
+  static Handle<Type> UpdatedType(Handle<PropertyCell> cell,
+                                  Handle<Object> value);

   void AddDependentCompilationInfo(CompilationInfo* info);

Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index bac274c31a6797465207eaf2141fa65c1fd4a988..67002a36b17abdba2a2a136ff226f00ed2237d5f 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -267,8 +267,7 @@ Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name,
                                            Handle<PropertyCell> cell,
                                            Handle<Object> value,
                                            StrictModeFlag strict_mode) {
-  Isolate* isolate = cell->GetIsolate();
-  Handle<Type> union_type(PropertyCell::UpdatedType(cell, value), isolate);
+  Handle<Type> union_type = PropertyCell::UpdatedType(cell, value);
   bool is_constant = union_type->IsConstant();
   StoreGlobalStub stub(strict_mode, is_constant);



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