Reviewers: Yang,

Message:
PTAL #15

Description:
*Shape::AsObject() are no longer used - removed.

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

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

Affected files (+31, -37 lines):
  M src/objects.h
  M src/objects-inl.h


Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 19457858fb3abda3aad8af946a86eb7ca934d871..19f7b65784e7b2e53979c71f8144f951ef47b647 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -475,6 +475,27 @@ Handle<Object> HashTableKey::AsHandle(Isolate* isolate) {
 }


+Handle<Object> StringTableShape::AsHandle(Isolate* isolate, HashTableKey* key) {
+  return key->AsHandle(isolate);
+}
+
+
+Handle<Object> MapCacheShape::AsHandle(Isolate* isolate, HashTableKey* key) {
+  return key->AsHandle(isolate);
+}
+
+
+Handle<Object> CompilationCacheShape::AsHandle(Isolate* isolate,
+                                               HashTableKey* key) {
+  return key->AsHandle(isolate);
+}
+
+
+Handle<Object> CodeCacheHashTableShape::AsHandle(Isolate* isolate,
+                                                 HashTableKey* key) {
+  return key->AsHandle(isolate);
+}
+
 template <typename Char>
 class SequentialStringKey : public HashTableKey {
  public:
@@ -6628,10 +6649,12 @@ uint32_t UnseededNumberDictionaryShape::HashForObject(uint32_t key,
   return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), 0);
 }

+
uint32_t SeededNumberDictionaryShape::SeededHash(uint32_t key, uint32_t seed) {
   return ComputeIntegerHash(key, seed);
 }

+
 uint32_t SeededNumberDictionaryShape::SeededHashForObject(uint32_t key,
                                                           uint32_t seed,
                                                           Object* other) {
@@ -6639,9 +6662,6 @@ uint32_t SeededNumberDictionaryShape::SeededHashForObject(uint32_t key,
   return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), seed);
 }

-MaybeObject* NumberDictionaryShape::AsObject(Heap* heap, uint32_t key) {
-  return heap->NumberFromUint32(key);
-}

Handle<Object> NumberDictionaryShape::AsHandle(Isolate* isolate, uint32_t key) {
   return isolate->factory()->NewNumberFromUint(key);
@@ -6666,12 +6686,6 @@ uint32_t NameDictionaryShape::HashForObject(Handle<Name> key, Object* other) {
 }


-MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Handle<Name> key) {
-  ASSERT(key->IsUniqueName());
-  return *key;
-}
-
-
 Handle<Object> NameDictionaryShape::AsHandle(Isolate* isolate,
                                              Handle<Name> key) {
   ASSERT(key->IsUniqueName());
@@ -6701,11 +6715,6 @@ uint32_t ObjectHashTableShape::HashForObject(Handle<Object> key,
 }


-MaybeObject* ObjectHashTableShape::AsObject(Heap* heap, Handle<Object> key) {
-  return *key;
-}
-
-
 Handle<Object> ObjectHashTableShape::AsHandle(Isolate* isolate,
                                               Handle<Object> key) {
   return key;
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 760a7a12cf517bbefc3a7fd48122d0b43198c06f..167adbc79566266b21f37818fb5bc212839743bd 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3880,16 +3880,16 @@ class StringTableShape : public BaseShape<HashTableKey*> {
   static inline bool IsMatch(HashTableKey* key, Object* value) {
     return key->IsMatch(value);
   }
+
   static inline uint32_t Hash(HashTableKey* key) {
     return key->Hash();
   }
+
   static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
     return key->HashForObject(object);
   }
-  MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
-                                                      HashTableKey* key) {
-    return key->AsObject(heap);
-  }
+
+ static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key);

   static const int kPrefixSize = 0;
   static const int kEntrySize = 1;
@@ -3933,6 +3933,7 @@ class MapCacheShape : public BaseShape<HashTableKey*> {
   static inline bool IsMatch(HashTableKey* key, Object* value) {
     return key->IsMatch(value);
   }
+
   static inline uint32_t Hash(HashTableKey* key) {
     return key->Hash();
   }
@@ -3941,10 +3942,7 @@ class MapCacheShape : public BaseShape<HashTableKey*> {
     return key->HashForObject(object);
   }

-  MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
-                                                      HashTableKey* key) {
-    return key->AsObject(heap);
-  }
+ static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key);

   static const int kPrefixSize = 0;
   static const int kEntrySize = 2;
@@ -4110,8 +4108,6 @@ class NameDictionaryShape : public BaseShape<Handle<Name> > {
   static inline bool IsMatch(Handle<Name> key, Object* other);
   static inline uint32_t Hash(Handle<Name> key);
   static inline uint32_t HashForObject(Handle<Name> key, Object* object);
-  MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
-                                                      Handle<Name> key);
static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Name> key);
   static const int kPrefixSize = 2;
   static const int kEntrySize = 3;
@@ -4148,9 +4144,6 @@ class NameDictionary: public Dictionary<NameDictionary,
 class NumberDictionaryShape : public BaseShape<uint32_t> {
  public:
   static inline bool IsMatch(uint32_t key, Object* other);
-  // TODO(ishell): This should be eventually replaced with AsHandle().
-  MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
-                                                      uint32_t key);
   static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key);
   static const int kEntrySize = 3;
   static const bool kIsEnumerable = false;
@@ -4263,8 +4256,6 @@ class ObjectHashTableShape : public BaseShape<Handle<Object> > {
   static inline bool IsMatch(Handle<Object> key, Object* other);
   static inline uint32_t Hash(Handle<Object> key);
   static inline uint32_t HashForObject(Handle<Object> key, Object* object);
-  MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
-                                                      Handle<Object> key);
static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Object> key);
   static const int kPrefixSize = 0;
   static const int kEntrySize = 2;
@@ -8303,10 +8294,7 @@ class CompilationCacheShape : public BaseShape<HashTableKey*> {
     return key->HashForObject(object);
   }

-  MUST_USE_RESULT static MaybeObject* AsObject(Heap* heap,
-                                               HashTableKey* key) {
-    return key->AsObject(heap);
-  }
+ static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key);

   static const int kPrefixSize = 0;
   static const int kEntrySize = 2;
@@ -8406,10 +8394,7 @@ class CodeCacheHashTableShape : public BaseShape<HashTableKey*> {
     return key->HashForObject(object);
   }

-  MUST_USE_RESULT static MaybeObject* AsObject(Heap* heap,
-                                               HashTableKey* key) {
-    return key->AsObject(heap);
-  }
+ static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key);

   static const int kPrefixSize = 0;
   static const int kEntrySize = 2;


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