Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a629326262070db710ebf4981d9bd3a788623c9d..60a140b79c58f0fda45e1126dc97d0669ed142c0 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -3906,7 +3906,6 @@ void StringCharacterStream::VisitTwoByteString( |
int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } |
- |
byte ByteArray::get(int index) { |
DCHECK(index >= 0 && index < this->length()); |
return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); |
@@ -3918,12 +3917,29 @@ void ByteArray::set(int index, byte value) { |
WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); |
} |
+void ByteArray::copy_in(int index, const byte* buffer, int length) { |
+ DCHECK(index >= 0 && length >= 0 && index + length >= index && |
+ index + length <= this->length()); |
+ byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); |
+ memcpy(dst_addr, buffer, length); |
+} |
+ |
+void ByteArray::copy_out(int index, byte* buffer, int length) { |
+ DCHECK(index >= 0 && length >= 0 && index + length >= index && |
+ index + length <= this->length()); |
+ const byte* src_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); |
+ memcpy(buffer, src_addr, length); |
+} |
int ByteArray::get_int(int index) { |
- DCHECK(index >= 0 && (index * kIntSize) < this->length()); |
+ DCHECK(index >= 0 && index < this->length() / kIntSize); |
return READ_INT_FIELD(this, kHeaderSize + index * kIntSize); |
} |
+void ByteArray::set_int(int index, int value) { |
+ DCHECK(index >= 0 && index < this->length() / kIntSize); |
+ WRITE_INT_FIELD(this, kHeaderSize + index * kIntSize, value); |
+} |
ByteArray* ByteArray::FromDataStartAddress(Address address) { |
DCHECK_TAG_ALIGNED(address); |