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

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

Issue 1176263004: Introduce a base pointer field in FixedTypedArrayBase and teach GC about it (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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-debug.cc ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 // map-word). 1531 // map-word).
1532 if (((type & kIsIndirectStringMask) != kIsIndirectStringTag)) 1532 if (((type & kIsIndirectStringMask) != kIsIndirectStringTag))
1533 return HeapObjectContents::kRawValues; 1533 return HeapObjectContents::kRawValues;
1534 else 1534 else
1535 return HeapObjectContents::kTaggedValues; 1535 return HeapObjectContents::kTaggedValues;
1536 #if 0 1536 #if 0
1537 // TODO(jochen): Enable eventually. 1537 // TODO(jochen): Enable eventually.
1538 } else if (type == JS_FUNCTION_TYPE) { 1538 } else if (type == JS_FUNCTION_TYPE) {
1539 return HeapObjectContents::kMixedValues; 1539 return HeapObjectContents::kMixedValues;
1540 #endif 1540 #endif
1541 } else if (type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
1542 type <= LAST_FIXED_TYPED_ARRAY_TYPE) {
1543 return HeapObjectContents::kMixedValues;
1541 } else if (type <= LAST_DATA_TYPE) { 1544 } else if (type <= LAST_DATA_TYPE) {
1542 // TODO(jochen): Why do we claim that Code and Map contain only raw values? 1545 // TODO(jochen): Why do we claim that Code and Map contain only raw values?
1543 return HeapObjectContents::kRawValues; 1546 return HeapObjectContents::kRawValues;
1544 } else { 1547 } else {
1545 if (FLAG_unbox_double_fields) { 1548 if (FLAG_unbox_double_fields) {
1546 LayoutDescriptorHelper helper(map()); 1549 LayoutDescriptorHelper helper(map());
1547 if (!helper.all_fields_tagged()) return HeapObjectContents::kMixedValues; 1550 if (!helper.all_fields_tagged()) return HeapObjectContents::kMixedValues;
1548 } 1551 }
1549 return HeapObjectContents::kTaggedValues; 1552 return HeapObjectContents::kTaggedValues;
1550 } 1553 }
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 } 3873 }
3871 3874
3872 3875
3873 void ExternalFloat64Array::set(int index, double value) { 3876 void ExternalFloat64Array::set(int index, double value) {
3874 DCHECK((index >= 0) && (index < this->length())); 3877 DCHECK((index >= 0) && (index < this->length()));
3875 double* ptr = static_cast<double*>(external_pointer()); 3878 double* ptr = static_cast<double*>(external_pointer());
3876 ptr[index] = value; 3879 ptr[index] = value;
3877 } 3880 }
3878 3881
3879 3882
3883 ACCESSORS(FixedTypedArrayBase, base_pointer, Object, kBasePointerOffset)
3884
3885
3880 void* FixedTypedArrayBase::DataPtr() { 3886 void* FixedTypedArrayBase::DataPtr() {
3881 return FIELD_ADDR(this, kDataOffset); 3887 return FIELD_ADDR(this, kDataOffset);
3882 } 3888 }
3883 3889
3884 3890
3885 int FixedTypedArrayBase::ElementSize(InstanceType type) { 3891 int FixedTypedArrayBase::ElementSize(InstanceType type) {
3886 int element_size; 3892 int element_size;
3887 switch (type) { 3893 switch (type) {
3888 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ 3894 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
3889 case FIXED_##TYPE##_ARRAY_TYPE: \ 3895 case FIXED_##TYPE##_ARRAY_TYPE: \
(...skipping 3264 matching lines...) Expand 10 before | Expand all | Expand 10 after
7154 } 7160 }
7155 7161
7156 7162
7157 template<typename StaticVisitor> 7163 template<typename StaticVisitor>
7158 void Foreign::ForeignIterateBody() { 7164 void Foreign::ForeignIterateBody() {
7159 StaticVisitor::VisitExternalReference( 7165 StaticVisitor::VisitExternalReference(
7160 reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset))); 7166 reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset)));
7161 } 7167 }
7162 7168
7163 7169
7170 void FixedTypedArrayBase::FixedTypedArrayBaseIterateBody(ObjectVisitor* v) {
7171 v->VisitPointer(
7172 reinterpret_cast<Object**>(FIELD_ADDR(this, kBasePointerOffset)));
7173 }
7174
7175
7176 template <typename StaticVisitor>
7177 void FixedTypedArrayBase::FixedTypedArrayBaseIterateBody() {
7178 StaticVisitor::VisitPointer(
7179 reinterpret_cast<Object**>(FIELD_ADDR(this, kBasePointerOffset)));
7180 }
7181
7182
7164 void ExternalOneByteString::ExternalOneByteStringIterateBody(ObjectVisitor* v) { 7183 void ExternalOneByteString::ExternalOneByteStringIterateBody(ObjectVisitor* v) {
7165 typedef v8::String::ExternalOneByteStringResource Resource; 7184 typedef v8::String::ExternalOneByteStringResource Resource;
7166 v->VisitExternalOneByteString( 7185 v->VisitExternalOneByteString(
7167 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); 7186 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
7168 } 7187 }
7169 7188
7170 7189
7171 template <typename StaticVisitor> 7190 template <typename StaticVisitor>
7172 void ExternalOneByteString::ExternalOneByteStringIterateBody() { 7191 void ExternalOneByteString::ExternalOneByteStringIterateBody() {
7173 typedef v8::String::ExternalOneByteStringResource Resource; 7192 typedef v8::String::ExternalOneByteStringResource Resource;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
7339 #undef READ_SHORT_FIELD 7358 #undef READ_SHORT_FIELD
7340 #undef WRITE_SHORT_FIELD 7359 #undef WRITE_SHORT_FIELD
7341 #undef READ_BYTE_FIELD 7360 #undef READ_BYTE_FIELD
7342 #undef WRITE_BYTE_FIELD 7361 #undef WRITE_BYTE_FIELD
7343 #undef NOBARRIER_READ_BYTE_FIELD 7362 #undef NOBARRIER_READ_BYTE_FIELD
7344 #undef NOBARRIER_WRITE_BYTE_FIELD 7363 #undef NOBARRIER_WRITE_BYTE_FIELD
7345 7364
7346 } } // namespace v8::internal 7365 } } // namespace v8::internal
7347 7366
7348 #endif // V8_OBJECTS_INL_H_ 7367 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698