Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 15670) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -10736,6 +10736,29 @@ |
| } |
| +RawOneByteString* OneByteString::SubStringUnchecked(const String& str, |
| + intptr_t begin_index, |
| + intptr_t length, |
| + Isolate* isolate, |
|
siva
2012/12/04 03:04:50
Isolate is passed in here and not used at all, why
srdjan
2012/12/04 21:41:30
Removed.
|
| + Heap::Space space) { |
| + ASSERT(!str.IsNull() && str.IsOneByteString()); |
| + ASSERT(begin_index >= 0); |
| + ASSERT(length >= 0); |
| + if (begin_index <= str.Length() && length == 0) { |
| + return OneByteString::raw(String::Handle(Symbols::Empty())); |
| + } |
| + ASSERT(begin_index < str.Length()); |
| + RawOneByteString* result = OneByteString::New(length, space); |
| + NoGCScope no_gc; |
| + if (length > 0) { |
| + uint8_t* dest = &result->ptr()->data_[0]; |
| + uint8_t* src = &raw_ptr(str)->data_[begin_index]; |
| + memmove(dest, src, length); |
| + } |
| + return result; |
| +} |
| + |
| + |
| RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str, |
| bool raw_str) { |
| intptr_t len = str.Length(); |
| @@ -11142,8 +11165,15 @@ |
| void GrowableObjectArray::Add(const Object& value, Heap::Space space) const { |
| + Add(value, Isolate::Current(), space); |
| +} |
| + |
| + |
| +void GrowableObjectArray::Add(const Object& value, |
| + Isolate* isolate, |
| + Heap::Space space) const { |
| ASSERT(!IsNull()); |
| - Array& contents = Array::Handle(data()); |
| + Array& contents = Array::Handle(isolate, data()); |
| if (Length() == Capacity()) { |
| // TODO(Issue 2500): Need a better growth strategy. |
| intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2; |
| @@ -11151,7 +11181,7 @@ |
| // Use the preallocated out of memory exception to avoid calling |
| // into dart code or allocating any code. |
| const Instance& exception = |
| - Instance::Handle(Isolate::Current()->object_store()->out_of_memory()); |
| + Instance::Handle(isolate->object_store()->out_of_memory()); |
| Exceptions::Throw(exception); |
| UNREACHABLE(); |
| } |