Reviewers: Igor Sheludko,

Message:
PTAL

Description:
Remove hole handling since holes cannot occur in JSObjects anymore.
The only case in which the hole can still occur, is in a pre-allocated
PropertyCell in a GlobalObject. In that case it indicates that the property is
absent.

BUG=

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

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

Affected files (+24, -50 lines):
  M src/hydrogen.cc
  M src/lookup.cc
  M src/objects.cc
  M src/runtime.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index a87d623790e0007198cd6bf08ca20a1662606154..018e50fb69585f959141cd6e78b001536abbf37d 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5792,9 +5792,8 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField(
       Handle<JSObject>::cast(object)->Lookup(info->name(), &lookup);
       Handle<Object> value(lookup.GetLazyValue(), isolate());

-      if (!value->IsTheHole()) {
-        return New<HConstant>(value);
-      }
+      ASSERT(!value->IsTheHole());
+      return New<HConstant>(value);
     }
   }

Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 1b46f2c8292362c054c0239d6a4c9cdacb52ed2d..19ae1f021db110b1beb2fea4e368d902020cc8be 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -114,10 +114,9 @@ bool LookupIterator::HasProperty() {
     if (number_ == NameDictionary::kNotFound) return false;

property_details_ = GetHolder()->property_dictionary()->DetailsAt(number_); - // Holes in dictionary cells are absent values unless marked as read-only.
+    // Holes in dictionary cells are absent values.
     if (holder->IsGlobalObject() &&
-        (property_details_.IsDeleted() ||
-         (!property_details_.IsReadOnly() && FetchValue()->IsTheHole()))) {
+        (property_details_.IsDeleted() || FetchValue()->IsTheHole())) {
       return false;
     }
   } else {
@@ -178,10 +177,6 @@ Handle<Object> LookupIterator::GetDataValue() const {
   ASSERT(has_property_);
   ASSERT_EQ(DATA, property_kind_);
   Handle<Object> value = FetchValue();
-  if (value->IsTheHole()) {
-    ASSERT(property_details_.IsReadOnly());
-    return factory()->undefined_value();
-  }
   return value;
 }

Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 34339f14ad79c9e7e56a7fe7aa29134b8c37914d..17be11937a770a2117cad4c90148edd97cc50a36 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -472,7 +472,6 @@ MaybeHandle<Object> Object::SetPropertyWithCallback(Handle<Object> receiver,

   // We should never get here to initialize a const with the hole
   // value since a const declaration would conflict with the setter.
-  ASSERT(!value->IsTheHole());
   ASSERT(!structure->IsForeign());
   if (structure->IsExecutableAccessorInfo()) {
     // api style callbacks
@@ -670,7 +669,8 @@ Handle<Object> JSObject::GetNormalizedProperty(Handle<JSObject> object,
   Handle<Object> value(object->property_dictionary()->ValueAt(
       result->GetDictionaryEntry()), isolate);
   if (object->IsGlobalObject()) {
- value = Handle<Object>(Handle<PropertyCell>::cast(value)->value(), isolate);
+    value = handle(Handle<PropertyCell>::cast(value)->value(), isolate);
+    ASSERT(!value->IsTheHole());
   }
   ASSERT(!value->IsPropertyCell() && !value->IsCell());
   return value;
@@ -2989,11 +2989,8 @@ MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(
         isolate, interceptor->data(), *object, *object);
     v8::NamedPropertySetterCallback setter =
v8::ToCData<v8::NamedPropertySetterCallback>(interceptor->setter());
-    Handle<Object> value_unhole = value->IsTheHole()
-        ? Handle<Object>(isolate->factory()->undefined_value()) : value;
-    v8::Handle<v8::Value> result = args.Call(setter,
- v8::Utils::ToLocal(name_string), - v8::Utils::ToLocal(value_unhole));
+    v8::Handle<v8::Value> result = args.Call(
+ setter, v8::Utils::ToLocal(name_string), v8::Utils::ToLocal(value));
     RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
     if (!result.IsEmpty()) return value;
   }
@@ -3462,13 +3459,6 @@ void JSObject::LookupOwnRealNamedProperty(Handle<Name> name,
     // properties where map transitions are handled.
     ASSERT(!result->IsFound() ||
            (result->holder() == this && result->IsFastPropertyType()));
-    // Disallow caching for uninitialized constants. These can only
-    // occur as fields.
-    if (result->IsField() &&
-        result->IsReadOnly() &&
-        RawFastPropertyAt(result->GetFieldIndex())->IsTheHole()) {
-      result->DisallowCaching();
-    }
     return;
   }

@@ -3477,15 +3467,12 @@ void JSObject::LookupOwnRealNamedProperty(Handle<Name> name,
     Object* value = property_dictionary()->ValueAt(entry);
     if (IsGlobalObject()) {
       PropertyDetails d = property_dictionary()->DetailsAt(entry);
-      if (d.IsDeleted()) {
+ if (d.IsDeleted() || PropertyCell::cast(value)->value()->IsTheHole()) {
         result->NotFound();
         return;
       }
       value = PropertyCell::cast(value)->value();
     }
-    // Make sure to disallow caching for uninitialized constants
-    // found in the dictionary-mode objects.
-    if (value->IsTheHole()) result->DisallowCaching();
     result->DictionaryResult(this, entry);
     return;
   }
@@ -4053,6 +4040,7 @@ MaybeHandle<Object> JSObject::SetPropertyForResult(
     Handle<Object> value,
     StrictMode strict_mode,
     StoreFromKeyed store_mode) {
+  ASSERT(!value->IsTheHole());
   Isolate* isolate = object->GetIsolate();

   // Make sure that the top context does not change when doing callbacks or
@@ -4209,6 +4197,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
     ExtensibilityCheck extensibility_check,
     StoreFromKeyed store_from_keyed,
     ExecutableAccessorInfoHandling handling) {
+  ASSERT(!value->IsTheHole());
   Isolate* isolate = object->GetIsolate();

   // Make sure that the top context does not change when doing callbacks or
@@ -5154,8 +5143,7 @@ Object* JSObject::GetHiddenPropertiesHashTable() {
     if (result.IsFound()) {
       ASSERT(result.IsNormal());
       ASSERT(result.holder() == this);
-      Object* value = GetNormalizedProperty(&result);
-      if (!value->IsTheHole()) return value;
+      return GetNormalizedProperty(&result);
     }
     return GetHeap()->undefined_value();
   }
@@ -16929,12 +16917,11 @@ Handle<HeapType> PropertyCell::UpdatedType(Handle<PropertyCell> cell,
   Handle<HeapType> old_type(cell->type(), isolate);
   // TODO(2803): Do not track ConsString as constant because they cannot be
   // embedded into code.
-  Handle<HeapType> new_type = value->IsConsString() || value->IsTheHole()
-      ? HeapType::Any(isolate) : HeapType::Constant(value, isolate);
+  Handle<HeapType> new_type = value->IsConsString()
+                                  ? HeapType::Any(isolate)
+                                  : HeapType::Constant(value, isolate);

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

   cell->dependent_code()->DeoptimizeDependentCodeGroup(
       isolate, DependentCode::kPropertyCellChangedGroup);
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index d980d327aa89640d2b44cbef8e08b58be0eb3257..82520da5aca78394d758e00cb9a859475a32acd9 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4805,11 +4805,8 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
         int index = keyed_lookup_cache->Lookup(receiver_map, key);
         if (index != -1) {
           // Doubles are not cached, so raw read the value.
-          Object* value = receiver->RawFastPropertyAt(
+          return receiver->RawFastPropertyAt(
               FieldIndex::ForKeyedLookupCacheIndex(*receiver_map, index));
-          return value->IsTheHole()
-              ? isolate->heap()->undefined_value()
-              : value;
         }
         // Lookup cache miss.  Perform lookup and update the cache if
         // appropriate.
@@ -4837,7 +4834,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
           if (!receiver->IsGlobalObject()) return value;
           value = PropertyCell::cast(value)->value();
           if (!value->IsTheHole()) return value;
-          // If value is the hole do the general lookup.
+          // If value is the hole (meaning, absent) do the general lookup.
         }
       }
     } else if (FLAG_smi_only_arrays && key_obj->IsSmi()) {
@@ -10641,14 +10638,12 @@ static Handle<Object> DebugLookupResultValue(Isolate* isolate,
   if  (!result->IsFound()) return value;
   switch (result->type()) {
     case NORMAL:
-      value = JSObject::GetNormalizedProperty(
-          handle(result->holder(), isolate), result);
-      break;
+ return JSObject::GetNormalizedProperty(handle(result->holder(), isolate),
+                                             result);
     case FIELD:
-      value = JSObject::FastPropertyAt(handle(result->holder(), isolate),
-                                       result->representation(),
-                                       result->GetFieldIndex());
-      break;
+      return JSObject::FastPropertyAt(handle(result->holder(), isolate),
+                                      result->representation(),
+                                      result->GetFieldIndex());
     case CONSTANT:
       return handle(result->GetConstant(), isolate);
     case CALLBACKS: {
@@ -10673,9 +10668,7 @@ static Handle<Object> DebugLookupResultValue(Isolate* isolate,
       UNREACHABLE();
       break;
   }
-  ASSERT(!value->IsTheHole() || result->IsReadOnly());
-  return value->IsTheHole()
- ? Handle<Object>::cast(isolate->factory()->undefined_value()) : value;
+  return value;
 }




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