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

Unified Diff: src/objects-inl.h

Issue 1248483007: Store offset between fixed typed array base and data start in object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/ppc/lithium-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index c5f6486331fd0b849776d9bc5598a236c9927bb2..a4ca8c34e29eeec8737c7f0b3025952c319b54cd 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3833,8 +3833,23 @@ void ExternalFloat64Array::set(int index, double value) {
ACCESSORS(FixedTypedArrayBase, base_pointer, Object, kBasePointerOffset)
+void* FixedTypedArrayBase::external_pointer() const {
+ intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
+ return reinterpret_cast<void*>(ptr);
+}
+
+
+void FixedTypedArrayBase::set_external_pointer(void* value,
+ WriteBarrierMode mode) {
+ intptr_t ptr = reinterpret_cast<intptr_t>(value);
+ WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr);
+}
+
+
void* FixedTypedArrayBase::DataPtr() {
- return FIELD_ADDR(this, kDataOffset);
+ return reinterpret_cast<void*>(
+ reinterpret_cast<intptr_t>(base_pointer()) +
+ reinterpret_cast<intptr_t>(external_pointer()));
}
@@ -3915,8 +3930,7 @@ double Float64ArrayTraits::defaultValue() {
template <class Traits>
typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) {
DCHECK((index >= 0) && (index < this->length()));
- ElementType* ptr = reinterpret_cast<ElementType*>(
- FIELD_ADDR(this, kDataOffset));
+ ElementType* ptr = reinterpret_cast<ElementType*>(DataPtr());
return ptr[index];
}
@@ -3924,8 +3938,7 @@ typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) {
template <class Traits>
void FixedTypedArray<Traits>::set(int index, ElementType value) {
DCHECK((index >= 0) && (index < this->length()));
- ElementType* ptr = reinterpret_cast<ElementType*>(
- FIELD_ADDR(this, kDataOffset));
+ ElementType* ptr = reinterpret_cast<ElementType*>(DataPtr());
ptr[index] = value;
}
« no previous file with comments | « src/objects.h ('k') | src/ppc/lithium-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698