Revision: 9995
Author:   [email protected]
Date:     Tue Nov 15 04:18:24 2011
Log: Avoid write barrier when writing an external pointer to an internal field.
Review URL: http://codereview.chromium.org/8572003
http://code.google.com/p/v8/source/detail?r=9995

Modified:
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Fri Nov 11 06:49:16 2011
+++ /branches/bleeding_edge/src/objects-inl.h   Tue Nov 15 04:18:24 2011
@@ -1383,6 +1383,16 @@
   WRITE_FIELD(this, offset, value);
   WRITE_BARRIER(GetHeap(), this, offset, value);
 }
+
+
+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
=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Nov 14 03:13:29 2011
+++ /branches/bleeding_edge/src/objects.h       Tue Nov 15 04:18:24 2011
@@ -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