| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index 11819eaa09d13db19bf029f07c9b92a960c72c31..9946c88c13a99f5c0741ab44106a6ba46e15c687 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -256,11 +256,13 @@ bool Object::IsExternalTwoByteString() {
|
| String::cast(this)->IsTwoByteRepresentation();
|
| }
|
|
|
| +
|
| bool Object::HasValidElements() {
|
| // Dictionary is covered under FixedArray.
|
| return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray();
|
| }
|
|
|
| +
|
| StringShape::StringShape(String* str)
|
| : type_(str->map()->instance_type()) {
|
| set_valid();
|
| @@ -2143,7 +2145,7 @@ String* String::TryFlattenGetString(PretenureFlag pretenure) {
|
| }
|
|
|
|
|
| -uint16_t String::Get(int index) {
|
| +uint16_t String::Get(int index, ExternalStringBufferFlag flag) {
|
| ASSERT(index >= 0 && index < length());
|
| switch (StringShape(this).full_representation_tag()) {
|
| case kSeqStringTag | kAsciiStringTag:
|
| @@ -2152,14 +2154,16 @@ uint16_t String::Get(int index) {
|
| return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index);
|
| case kConsStringTag | kAsciiStringTag:
|
| case kConsStringTag | kTwoByteStringTag:
|
| - return ConsString::cast(this)->ConsStringGet(index);
|
| + return ConsString::cast(this)->ConsStringGet(index, flag);
|
| case kExternalStringTag | kAsciiStringTag:
|
| - return ExternalAsciiString::cast(this)->ExternalAsciiStringGet(index);
|
| + return ExternalAsciiString::cast(this)->ExternalAsciiStringGet(index,
|
| + flag);
|
| case kExternalStringTag | kTwoByteStringTag:
|
| - return ExternalTwoByteString::cast(this)->ExternalTwoByteStringGet(index);
|
| + return ExternalTwoByteString::cast(this)->ExternalTwoByteStringGet(index,
|
| + flag);
|
| case kSlicedStringTag | kAsciiStringTag:
|
| case kSlicedStringTag | kTwoByteStringTag:
|
| - return SlicedString::cast(this)->SlicedStringGet(index);
|
| + return SlicedString::cast(this)->SlicedStringGet(index, flag);
|
| default:
|
| break;
|
| }
|
| @@ -2297,6 +2301,32 @@ void ConsString::set_second(String* value, WriteBarrierMode mode) {
|
| }
|
|
|
|
|
| +bool ExternalString::IsBuffered() {
|
| + uint32_t type = map()->instance_type();
|
| + ASSERT(StringShape(this).IsExternal());
|
| + return (type & kBufferedStringMask) == kBufferedStringTag;
|
| +}
|
| +
|
| +
|
| +int ExternalString::buffer_index() {
|
| + ASSERT(IsBuffered());
|
| + Object* value = READ_FIELD(this, kBufferIndexOffset);
|
| + return Smi::cast(value)->value();
|
| +}
|
| +
|
| +
|
| +void ExternalString::set_buffer_index(int value) {
|
| + ASSERT(IsBuffered());
|
| + WRITE_FIELD(this, kBufferIndexOffset, Smi::FromInt(value));
|
| +}
|
| +
|
| +
|
| +Address ExternalString::buffer() {
|
| + return reinterpret_cast<Address>(
|
| + HeapObject::RawField(this, kBufferContentOffset));
|
| +}
|
| +
|
| +
|
| const ExternalAsciiString::Resource* ExternalAsciiString::resource() {
|
| return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
|
| }
|
|
|