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

Unified Diff: src/api.cc

Issue 228093004: Implement handlified String::Flatten. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: even shorter Created 6 years, 8 months 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 | « no previous file | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9c5e53c1f0f515a6e7cddf716268d21253538488..eafc86c2d7f5752f6ef37a78fffffced490575cf 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2312,8 +2312,8 @@ Local<Value> JSON::Parse(Local<String> json_string) {
EnsureInitializedForIsolate(isolate, "v8::JSON::Parse");
ENTER_V8(isolate);
i::HandleScope scope(isolate);
- i::Handle<i::String> source = i::Handle<i::String>(
- FlattenGetString(Utils::OpenHandle(*json_string)));
+ i::Handle<i::String> source =
+ i::String::Flatten(Utils::OpenHandle(*json_string));
EXCEPTION_PREAMBLE(isolate);
i::MaybeHandle<i::Object> maybe_result =
source->IsSeqOneByteString() ? i::JsonParser<true>::Parse(source)
@@ -4676,7 +4676,7 @@ int String::WriteUtf8(char* buffer,
ENTER_V8(isolate);
i::Handle<i::String> str = Utils::OpenHandle(this);
if (options & HINT_MANY_WRITES_EXPECTED) {
- FlattenString(str); // Flatten the string for efficiency.
+ str = i::String::Flatten(str); // Flatten the string for efficiency.
}
const int string_length = str->length();
bool write_null = !(options & NO_NULL_TERMINATION);
@@ -4711,7 +4711,7 @@ int String::WriteUtf8(char* buffer,
}
}
// Recursive slow path can potentially be unreasonable slow. Flatten.
- str = FlattenGetString(str);
+ str = i::String::Flatten(str);
Utf8WriterVisitor writer(buffer, capacity, false, replace_invalid_utf8);
i::String::VisitFlat(&writer, *str);
return writer.CompleteWrite(write_null, nchars_ref);
@@ -4733,7 +4733,7 @@ static inline int WriteHelper(const String* string,
if (options & String::HINT_MANY_WRITES_EXPECTED) {
// Flatten the string for efficiency. This applies whether we are
// using StringCharacterStream or Get(i) to access the characters.
- FlattenString(str);
+ str = i::String::Flatten(str);
}
int end = start + length;
if ((length == -1) || (length > str->length() - start) )
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698