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

Unified Diff: runtime/vm/object.cc

Issue 11308337: Improve C++ code for string splittig (Dromaeo benchmark). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 15701)
+++ runtime/vm/object.cc (working copy)
@@ -10736,6 +10736,28 @@
}
+RawOneByteString* OneByteString::SubStringUnchecked(const String& str,
+ intptr_t begin_index,
+ intptr_t length,
+ 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 +11164,15 @@
void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
+ Add(Isolate::Current(), value, space);
+}
+
+
+void GrowableObjectArray::Add(Isolate* isolate,
+ const Object& value,
+ 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 +11180,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();
}
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698