Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 095425262a6ee7ed2d893b195e9f7d9b5320c2ee..d3ea756337c8b048908b197bb4d7cbbac1493e8a 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -2007,6 +2007,7 @@ int JSObject::GetHeaderSize(InstanceType type) { |
switch (type) { |
case JS_API_OBJECT_TYPE: |
case JS_SPECIAL_API_OBJECT_TYPE: |
+ case JS_WASM_TYPE: |
return JSObject::kHeaderSize; |
case JS_GENERATOR_OBJECT_TYPE: |
return JSGeneratorObject::kSize; |
@@ -3899,6 +3900,12 @@ void StringCharacterStream::VisitTwoByteString( |
int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } |
+void ByteArray::get(int index, byte* buffer, int length) { |
titzer
2016/04/22 13:21:08
Let's move this out of line into the .cc file; it'
titzer
2016/04/22 13:21:08
This shouldn't be called "get", but more like "cop
Clemens Hammacher
2016/04/22 14:38:40
It's not so easy to move it out, since it uses the
|
+ DCHECK(index >= 0 && length >= 0 && index + length >= 0 && |
+ index + length <= this->length()); |
+ const byte* src_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); |
+ memcpy(buffer, src_addr, length); |
+} |
byte ByteArray::get(int index) { |
DCHECK(index >= 0 && index < this->length()); |
@@ -3911,12 +3918,24 @@ void ByteArray::set(int index, byte value) { |
WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); |
} |
+void ByteArray::set(int index, const byte* buffer, int length) { |
titzer
2016/04/22 13:21:07
This shouldn't be called "set", but more like "cop
|
+ DCHECK(index >= 0 && length >= 0 && index + length >= 0 && |
+ index + length <= this->length()); |
+ byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); |
+ memcpy(dst_addr, buffer, length); |
+} |
int ByteArray::get_int(int index) { |
- DCHECK(index >= 0 && (index * kIntSize) < this->length()); |
+ DCHECK(index >= 0 && |
+ (static_cast<uint64_t>(index) * kIntSize) < this->length()); |
return READ_INT_FIELD(this, kHeaderSize + index * kIntSize); |
} |
+void ByteArray::set_int(int index, int value) { |
+ DCHECK(index >= 0 && |
+ (static_cast<uint64_t>(index) * kIntSize) < this->length()); |
+ WRITE_INT_FIELD(this, kHeaderSize + index * kIntSize, value); |
+} |
ByteArray* ByteArray::FromDataStartAddress(Address address) { |
DCHECK_TAG_ALIGNED(address); |