Reviewers: Yang,

Description:
Remove obsolete SLOT_ADDR macro usages.

[email protected]


Please review this at https://chromiumcodereview.appspot.com/10823254/

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

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


Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 261cf9e1ad4ed85ef73d7e7cc2b6dcc5d8300553..658b02d4f3b8f45b6350c949bbbcb31b2847aabb 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1430,10 +1430,6 @@ class MarkCompactMarkingVisitor
   }


-#define SLOT_ADDR(obj, offset) \
-  reinterpret_cast<Object**>((obj)->address() + offset)
-
-
   static inline void VisitJSFunctionFields(Map* map,
                                            JSFunction* object,
                                            bool flush_code_candidate) {
@@ -1469,27 +1465,29 @@ class MarkCompactMarkingVisitor
         heap,
         HeapObject::RawField(object,
                              JSFunction::kCodeEntryOffset + kPointerSize),
-        HeapObject::RawField(object,
-                             JSFunction::kNonWeakFieldsEndOffset));
+        HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset));
   }


   static void VisitSharedFunctionInfoFields(Heap* heap,
                                             HeapObject* object,
                                             bool flush_code_candidate) {
-    VisitPointer(heap, SLOT_ADDR(object, SharedFunctionInfo::kNameOffset));
+    VisitPointer(heap,
+ HeapObject::RawField(object, SharedFunctionInfo::kNameOffset));

     if (!flush_code_candidate) {
- VisitPointer(heap, SLOT_ADDR(object, SharedFunctionInfo::kCodeOffset));
+      VisitPointer(heap,
+                   HeapObject::RawField(object,
+                                        SharedFunctionInfo::kCodeOffset));
     }

-    VisitPointers(heap,
-        SLOT_ADDR(object, SharedFunctionInfo::kOptimizedCodeMapOffset),
-        SLOT_ADDR(object, SharedFunctionInfo::kSize));
+    VisitPointers(
+        heap,
+        HeapObject::RawField(object,
+                             SharedFunctionInfo::kOptimizedCodeMapOffset),
+        HeapObject::RawField(object, SharedFunctionInfo::kSize));
   }

-  #undef SLOT_ADDR
-
   static VisitorDispatchTable<Callback> non_count_table_;
 };

Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 9bc6b9b6a5174b5dd65a9549d6f69092d0365f36..3bffe241f6e8624daad0aa70a19210477b39020d 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5359,14 +5359,13 @@ void ExternalTwoByteString::ExternalTwoByteStringIterateBody() {
       reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
 }

-#define SLOT_ADDR(obj, offset) \
-  reinterpret_cast<Object**>((obj)->address() + offset)

 template<int start_offset, int end_offset, int size>
 void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody(
     HeapObject* obj,
     ObjectVisitor* v) {
- v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, end_offset));
+    v->VisitPointers(HeapObject::RawField(obj, start_offset),
+                     HeapObject::RawField(obj, end_offset));
 }


@@ -5374,10 +5373,10 @@ template<int start_offset>
 void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj,
                                                        int object_size,
                                                        ObjectVisitor* v) {
- v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, object_size));
+  v->VisitPointers(HeapObject::RawField(obj, start_offset),
+                   HeapObject::RawField(obj, object_size));
 }

-#undef SLOT_ADDR

 #undef TYPE_CHECKER
 #undef CAST_ACCESSOR
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 1c7a9e325d82db2a66ae69c8d1da963d8c1bdd5d..0b3143aba5f32cdf778d8c2f060445dd3688c68d 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1254,9 +1254,6 @@ class HeapObject: public Object {
 };


-#define SLOT_ADDR(obj, offset) \
-  reinterpret_cast<Object**>((obj)->address() + offset)
-
 // This class describes a body of an object of a fixed size
// in which all pointer fields are located in the [start_offset, end_offset)
 // interval.
@@ -1271,8 +1268,8 @@ class FixedBodyDescriptor {

   template<typename StaticVisitor>
   static inline void IterateBody(HeapObject* obj) {
-    StaticVisitor::VisitPointers(SLOT_ADDR(obj, start_offset),
-                                 SLOT_ADDR(obj, end_offset));
+    StaticVisitor::VisitPointers(HeapObject::RawField(obj, start_offset),
+                                 HeapObject::RawField(obj, end_offset));
   }
 };

@@ -1291,13 +1288,11 @@ class FlexibleBodyDescriptor {

   template<typename StaticVisitor>
   static inline void IterateBody(HeapObject* obj, int object_size) {
-    StaticVisitor::VisitPointers(SLOT_ADDR(obj, start_offset),
-                                 SLOT_ADDR(obj, object_size));
+    StaticVisitor::VisitPointers(HeapObject::RawField(obj, start_offset),
+                                 HeapObject::RawField(obj, object_size));
   }
 };

-#undef SLOT_ADDR
-

 // The HeapNumber class describes heap allocated numbers that cannot be
 // represented in a Smi (small integer)


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

Reply via email to