Reviewers: Vyacheslav Egorov,

Description:
Avoid write barrier when writing an external pointer to an internal field.

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

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

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


Index: src/objects-inl.h
===================================================================
--- src/objects-inl.h   (revision 9994)
+++ src/objects-inl.h   (working copy)
@@ -1385,6 +1385,16 @@
 }


+void JSObject::SetInternalField(int index, Smi* value) {
+  ASSERT(index < GetInternalFieldCount() && index >= 0);
+ // Internal objects do follow immediately after the header, whereas in-object
+  // properties are at the end of the object. Therefore there is no need
+  // to adjust the index here.
+  int offset = GetHeaderSize() + (kPointerSize * index);
+  WRITE_FIELD(this, offset, value);
+}
+
+
 // Access fast-case object properties at index. The use of these routines
// is needed to correctly distinguish between properties stored in-object and
 // properties stored in the properties array.
Index: src/objects.h
===================================================================
--- src/objects.h       (revision 9994)
+++ src/objects.h       (working copy)
@@ -1683,6 +1683,7 @@
   inline int GetInternalFieldOffset(int index);
   inline Object* GetInternalField(int index);
   inline void SetInternalField(int index, Object* value);
+  inline void SetInternalField(int index, Smi* value);

   // The following lookup functions skip interceptors.
   void LocalLookupRealNamedProperty(String* name, LookupResult* result);


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

Reply via email to