Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: src/objects-inl.h

Issue 136333011: MIPS: Specialize FixedTypedArray<> set and get functions to solve unaligned double access. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: small fix Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after
3668 3668
3669 3669
3670 template <class Traits> 3670 template <class Traits>
3671 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) { 3671 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) {
3672 ASSERT((index >= 0) && (index < this->length())); 3672 ASSERT((index >= 0) && (index < this->length()));
3673 ElementType* ptr = reinterpret_cast<ElementType*>( 3673 ElementType* ptr = reinterpret_cast<ElementType*>(
3674 FIELD_ADDR(this, kDataOffset)); 3674 FIELD_ADDR(this, kDataOffset));
3675 return ptr[index]; 3675 return ptr[index];
3676 } 3676 }
3677 3677
3678
3679 template<> inline
3680 FixedTypedArray<Float64ArrayTraits>::ElementType
3681 FixedTypedArray<Float64ArrayTraits>::get_scalar(int index) {
3682 ASSERT((index >= 0) && (index < this->length()));
3683 return READ_DOUBLE_FIELD(this, ElementOffset(index));
3684 }
3685
3686
3678 template <class Traits> 3687 template <class Traits>
3679 void FixedTypedArray<Traits>::set(int index, ElementType value) { 3688 void FixedTypedArray<Traits>::set(int index, ElementType value) {
3680 ASSERT((index >= 0) && (index < this->length())); 3689 ASSERT((index >= 0) && (index < this->length()));
3681 ElementType* ptr = reinterpret_cast<ElementType*>( 3690 ElementType* ptr = reinterpret_cast<ElementType*>(
3682 FIELD_ADDR(this, kDataOffset)); 3691 FIELD_ADDR(this, kDataOffset));
3683 ptr[index] = value; 3692 ptr[index] = value;
3684 } 3693 }
3685 3694
3686 3695
3696 template<> inline
3697 void FixedTypedArray<Float64ArrayTraits>::set(
3698 int index, Float64ArrayTraits::ElementType value) {
3699 ASSERT((index >= 0) && (index < this->length()));
3700 WRITE_DOUBLE_FIELD(this, ElementOffset(index), value);
3701 }
3702
3703
3687 template <class Traits> 3704 template <class Traits>
3688 MaybeObject* FixedTypedArray<Traits>::get(int index) { 3705 MaybeObject* FixedTypedArray<Traits>::get(int index) {
3689 return Traits::ToObject(GetHeap(), get_scalar(index)); 3706 return Traits::ToObject(GetHeap(), get_scalar(index));
3690 } 3707 }
3691 3708
3692 template <class Traits> 3709 template <class Traits>
3693 MaybeObject* FixedTypedArray<Traits>::SetValue(uint32_t index, Object* value) { 3710 MaybeObject* FixedTypedArray<Traits>::SetValue(uint32_t index, Object* value) {
3694 ElementType cast_value = Traits::defaultValue(); 3711 ElementType cast_value = Traits::defaultValue();
3695 if (index < static_cast<uint32_t>(length())) { 3712 if (index < static_cast<uint32_t>(length())) {
3696 if (value->IsSmi()) { 3713 if (value->IsSmi()) {
(...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after
6787 #undef READ_UINT32_FIELD 6804 #undef READ_UINT32_FIELD
6788 #undef WRITE_UINT32_FIELD 6805 #undef WRITE_UINT32_FIELD
6789 #undef READ_SHORT_FIELD 6806 #undef READ_SHORT_FIELD
6790 #undef WRITE_SHORT_FIELD 6807 #undef WRITE_SHORT_FIELD
6791 #undef READ_BYTE_FIELD 6808 #undef READ_BYTE_FIELD
6792 #undef WRITE_BYTE_FIELD 6809 #undef WRITE_BYTE_FIELD
6793 6810
6794 } } // namespace v8::internal 6811 } } // namespace v8::internal
6795 6812
6796 #endif // V8_OBJECTS_INL_H_ 6813 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698