Revision: 18965
Author:   [email protected]
Date:     Thu Jan 30 20:05:11 2014 UTC
Log: MIPS: Specialize FixedTypedArray<> set and get functions to solve unaligned double access.

BUG=
TEST=test-api/FixedFloat64Array
[email protected]

Review URL: https://codereview.chromium.org/136333011

Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=18965

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

=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Jan 29 14:31:34 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Jan 30 20:05:11 2014 UTC
@@ -3674,6 +3674,15 @@
       FIELD_ADDR(this, kDataOffset));
   return ptr[index];
 }
+
+
+template<> inline
+FixedTypedArray<Float64ArrayTraits>::ElementType
+    FixedTypedArray<Float64ArrayTraits>::get_scalar(int index) {
+  ASSERT((index >= 0) && (index < this->length()));
+  return READ_DOUBLE_FIELD(this, ElementOffset(index));
+}
+

 template <class Traits>
 void FixedTypedArray<Traits>::set(int index, ElementType value) {
@@ -3682,6 +3691,14 @@
       FIELD_ADDR(this, kDataOffset));
   ptr[index] = value;
 }
+
+
+template<> inline
+void FixedTypedArray<Float64ArrayTraits>::set(
+    int index, Float64ArrayTraits::ElementType value) {
+  ASSERT((index >= 0) && (index < this->length()));
+  WRITE_DOUBLE_FIELD(this, ElementOffset(index), value);
+}


 template <class Traits>
=======================================
--- /branches/bleeding_edge/src/objects.h       Fri Jan 24 16:01:15 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Thu Jan 30 20:05:11 2014 UTC
@@ -4895,8 +4895,12 @@
   // Casting:
   static inline FixedTypedArray<Traits>* cast(Object* obj);

+  static inline int ElementOffset(int index) {
+    return kDataOffset + index * sizeof(ElementType);
+  }
+
   static inline int SizeFor(int length) {
-    return kDataOffset + length * sizeof(ElementType);
+    return ElementOffset(length);
   }

   inline ElementType get_scalar(int index);

--
--
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/groups/opt_out.

Reply via email to