Commit 02d8dc57 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Specialize FixedTypedArray<> set and get functions to solve unaligned double access.

BUG=
TEST=test-api/FixedFloat64Array
R=dslomov@chromium.org

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18965 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5b46492c
...@@ -3675,6 +3675,15 @@ typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { ...@@ -3675,6 +3675,15 @@ typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) {
return ptr[index]; 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> template <class Traits>
void FixedTypedArray<Traits>::set(int index, ElementType value) { void FixedTypedArray<Traits>::set(int index, ElementType value) {
ASSERT((index >= 0) && (index < this->length())); ASSERT((index >= 0) && (index < this->length()));
...@@ -3684,6 +3693,14 @@ void FixedTypedArray<Traits>::set(int index, ElementType value) { ...@@ -3684,6 +3693,14 @@ void FixedTypedArray<Traits>::set(int index, ElementType 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> template <class Traits>
MaybeObject* FixedTypedArray<Traits>::get(int index) { MaybeObject* FixedTypedArray<Traits>::get(int index) {
return Traits::ToObject(GetHeap(), get_scalar(index)); return Traits::ToObject(GetHeap(), get_scalar(index));
......
...@@ -4895,8 +4895,12 @@ class FixedTypedArray: public FixedTypedArrayBase { ...@@ -4895,8 +4895,12 @@ class FixedTypedArray: public FixedTypedArrayBase {
// Casting: // Casting:
static inline FixedTypedArray<Traits>* cast(Object* obj); static inline FixedTypedArray<Traits>* cast(Object* obj);
static inline int ElementOffset(int index) {
return kDataOffset + index * sizeof(ElementType);
}
static inline int SizeFor(int length) { static inline int SizeFor(int length) {
return kDataOffset + length * sizeof(ElementType); return ElementOffset(length);
} }
inline ElementType get_scalar(int index); inline ElementType get_scalar(int index);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment