Make PropertyCell::UpdatedType return a handle.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 22 Oct 2013 08:24:35 +0000 (08:24 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 22 Oct 2013 08:24:35 +0000 (08:24 +0000)
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/31933003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17312 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/objects.cc
src/objects.h
src/stub-cache.cc

index aec412c..f82e92c 100644 (file)
@@ -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 165261b..4d633f8 100644 (file)
@@ -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 bac274c..67002a3 100644 (file)
@@ -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);