Reviewers: Kevin Millikin,

Description:
Change JSObject elements to be of type FixedArrayBase


[email protected]
BUG=none
TEST=none


Please review this at http://codereview.chromium.org/7617010/

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

Affected files:
  M src/objects-inl.h
  M src/objects.h
  M src/objects.cc
  M src/runtime.cc


Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 46e09ba123a0038e26573213cbb64e7bdb442dce..99486d5512e24ef1c2cafda385be9d5fca5d175b 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1335,14 +1335,14 @@ int HeapNumber::get_sign() {
 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)


-HeapObject* JSObject::elements() {
+FixedArrayBase* JSObject::elements() {
   Object* array = READ_FIELD(this, kElementsOffset);
   ASSERT(array->HasValidElements());
-  return reinterpret_cast<HeapObject*>(array);
+  return reinterpret_cast<FixedArrayBase*>(array);
 }


-void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) {
+void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) {
   ASSERT(map()->has_fast_elements() ==
          (value->map() == GetHeap()->fixed_array_map() ||
           value->map() == GetHeap()->fixed_cow_array_map()));
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 4424b629339b83965ae8142c29b0ad801bb6cc9b..d68b8722dc67d417c6d65a35fb97df0b88445a42 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8407,14 +8407,14 @@ MaybeObject* JSObject::SetDictionaryElement(uint32_t index,
         return isolate->Throw(*error);
       }
     }
-    Object* new_dictionary;
+    FixedArrayBase* new_dictionary;
     MaybeObject* maybe = dictionary->AtNumberPut(index, value);
-    if (!maybe->ToObject(&new_dictionary)) return maybe;
+    if (!maybe->To<FixedArrayBase>(&new_dictionary)) return maybe;
     if (dictionary != NumberDictionary::cast(new_dictionary)) {
       if (is_arguments) {
         elements->set(1, new_dictionary);
       } else {
-        set_elements(HeapObject::cast(new_dictionary));
+        set_elements(new_dictionary);
       }
       dictionary = NumberDictionary::cast(new_dictionary);
     }
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 2a22ade9686affa3fa50c31d124d78d4590af546..9b49115e26161b35625fbb0fae5c34949b4c246b 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -635,10 +635,11 @@ enum CompareResult {
                          WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \


+class DictionaryElementsAccessor;
 class ElementsAccessor;
-class StringStream;
+class FixedArrayBase;
 class ObjectVisitor;
-class DictionaryElementsAccessor;
+class StringStream;

 struct ValueInfo : public Malloced {
   ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
@@ -1492,7 +1493,7 @@ class JSObject: public JSReceiver {
   // In the slow mode the elements is either a NumberDictionary, an
   // ExternalArray, or a FixedArray parameter map for a (non-strict)
   // arguments object.
-  DECL_ACCESSORS(elements, HeapObject)
+  DECL_ACCESSORS(elements, FixedArrayBase)
   inline void initialize_elements();
   MUST_USE_RESULT inline MaybeObject* ResetElements();
   inline ElementsKind GetElementsKind();
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 38199f8c5826fbbee560d6dde3bb78a317009d35..36618d76bcc62ccd7ad6289999d98ebb5b66dd34 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -9656,7 +9656,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) {
   ASSERT(args.length() == 2);
   CONVERT_CHECKED(JSArray, from, args[0]);
   CONVERT_CHECKED(JSArray, to, args[1]);
-  HeapObject* new_elements = from->elements();
+  FixedArrayBase* new_elements = from->elements();
   MaybeObject* maybe_new_map;
   if (new_elements->map() == isolate->heap()->fixed_array_map() ||
       new_elements->map() == isolate->heap()->fixed_cow_array_map()) {


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to