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

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

Issue 1327403002: [objects] do not visit ArrayBuffer's backing store (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: visit all fields in array buffer, reorder fields for simplicity Created 5 years, 3 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') | test/cctest/test-api.cc » ('j') | 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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 #if 0 1498 #if 0
1499 // TODO(jochen): Enable eventually. 1499 // TODO(jochen): Enable eventually.
1500 } else if (type == JS_FUNCTION_TYPE) { 1500 } else if (type == JS_FUNCTION_TYPE) {
1501 return HeapObjectContents::kMixedValues; 1501 return HeapObjectContents::kMixedValues;
1502 #endif 1502 #endif
1503 } else if (type == BYTECODE_ARRAY_TYPE) { 1503 } else if (type == BYTECODE_ARRAY_TYPE) {
1504 return HeapObjectContents::kMixedValues; 1504 return HeapObjectContents::kMixedValues;
1505 } else if (type >= FIRST_FIXED_TYPED_ARRAY_TYPE && 1505 } else if (type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
1506 type <= LAST_FIXED_TYPED_ARRAY_TYPE) { 1506 type <= LAST_FIXED_TYPED_ARRAY_TYPE) {
1507 return HeapObjectContents::kMixedValues; 1507 return HeapObjectContents::kMixedValues;
1508 } else if (type == JS_ARRAY_BUFFER_TYPE) {
1509 return HeapObjectContents::kMixedValues;
1508 } else if (type <= LAST_DATA_TYPE) { 1510 } else if (type <= LAST_DATA_TYPE) {
1509 // TODO(jochen): Why do we claim that Code and Map contain only raw values? 1511 // TODO(jochen): Why do we claim that Code and Map contain only raw values?
1510 return HeapObjectContents::kRawValues; 1512 return HeapObjectContents::kRawValues;
1511 } else { 1513 } else {
1512 if (FLAG_unbox_double_fields) { 1514 if (FLAG_unbox_double_fields) {
1513 LayoutDescriptorHelper helper(map()); 1515 LayoutDescriptorHelper helper(map());
1514 if (!helper.all_fields_tagged()) return HeapObjectContents::kMixedValues; 1516 if (!helper.all_fields_tagged()) return HeapObjectContents::kMixedValues;
1515 } 1517 }
1516 return HeapObjectContents::kTaggedValues; 1518 return HeapObjectContents::kTaggedValues;
1517 } 1519 }
(...skipping 5061 matching lines...) Expand 10 before | Expand all | Expand 10 after
6579 6581
6580 6582
6581 bool JSArrayBuffer::is_shared() { return IsShared::decode(bit_field()); } 6583 bool JSArrayBuffer::is_shared() { return IsShared::decode(bit_field()); }
6582 6584
6583 6585
6584 void JSArrayBuffer::set_is_shared(bool value) { 6586 void JSArrayBuffer::set_is_shared(bool value) {
6585 set_bit_field(IsShared::update(bit_field(), value)); 6587 set_bit_field(IsShared::update(bit_field(), value));
6586 } 6588 }
6587 6589
6588 6590
6591 // static
6592 template <typename StaticVisitor>
6593 void JSArrayBuffer::JSArrayBufferIterateBody(Heap* heap, HeapObject* obj) {
6594 StaticVisitor::VisitPointers(
6595 heap, obj,
6596 HeapObject::RawField(obj, JSArrayBuffer::BodyDescriptor::kStartOffset),
6597 HeapObject::RawField(obj,
6598 JSArrayBuffer::kByteLengthOffset + kPointerSize));
6599 StaticVisitor::VisitPointers(
6600 heap, obj, HeapObject::RawField(obj, JSArrayBuffer::kSize),
6601 HeapObject::RawField(obj, JSArrayBuffer::kSizeWithInternalFields));
6602 }
6603
6604
6605 void JSArrayBuffer::JSArrayBufferIterateBody(HeapObject* obj,
6606 ObjectVisitor* v) {
6607 v->VisitPointers(
6608 HeapObject::RawField(obj, JSArrayBuffer::BodyDescriptor::kStartOffset),
6609 HeapObject::RawField(obj,
6610 JSArrayBuffer::kByteLengthOffset + kPointerSize));
6611 v->VisitPointers(
6612 HeapObject::RawField(obj, JSArrayBuffer::kSize),
6613 HeapObject::RawField(obj, JSArrayBuffer::kSizeWithInternalFields));
6614 }
6615
6616
6589 Object* JSArrayBufferView::byte_offset() const { 6617 Object* JSArrayBufferView::byte_offset() const {
6590 if (WasNeutered()) return Smi::FromInt(0); 6618 if (WasNeutered()) return Smi::FromInt(0);
6591 return Object::cast(READ_FIELD(this, kByteOffsetOffset)); 6619 return Object::cast(READ_FIELD(this, kByteOffsetOffset));
6592 } 6620 }
6593 6621
6594 6622
6595 void JSArrayBufferView::set_byte_offset(Object* value, WriteBarrierMode mode) { 6623 void JSArrayBufferView::set_byte_offset(Object* value, WriteBarrierMode mode) {
6596 WRITE_FIELD(this, kByteOffsetOffset, value); 6624 WRITE_FIELD(this, kByteOffsetOffset, value);
6597 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kByteOffsetOffset, value, mode); 6625 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kByteOffsetOffset, value, mode);
6598 } 6626 }
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
7905 #undef READ_INT64_FIELD 7933 #undef READ_INT64_FIELD
7906 #undef WRITE_INT64_FIELD 7934 #undef WRITE_INT64_FIELD
7907 #undef READ_BYTE_FIELD 7935 #undef READ_BYTE_FIELD
7908 #undef WRITE_BYTE_FIELD 7936 #undef WRITE_BYTE_FIELD
7909 #undef NOBARRIER_READ_BYTE_FIELD 7937 #undef NOBARRIER_READ_BYTE_FIELD
7910 #undef NOBARRIER_WRITE_BYTE_FIELD 7938 #undef NOBARRIER_WRITE_BYTE_FIELD
7911 7939
7912 } } // namespace v8::internal 7940 } } // namespace v8::internal
7913 7941
7914 #endif // V8_OBJECTS_INL_H_ 7942 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698