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

Unified Diff: src/json-stringifier.h

Issue 12440061: Improve SeqString::Truncate for latest allocated strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: renamed according to suggestion Created 7 years, 9 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 | « src/json-parser.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index 418d4794595367f088e09cbb519d65209ff7bd96..b9775c9d8a9f19b19c15c400818514f9e12da238 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -55,7 +55,7 @@ class BasicJsonStringifier BASE_EMBEDDED {
void ChangeEncoding();
- void ShrinkCurrentPart();
+ INLINE(void ShrinkCurrentPart());
template <bool is_ascii, typename Char>
INLINE(void Append_(Char c));
@@ -322,15 +322,7 @@ MaybeObject* BasicJsonStringifier::StringifyString_(Isolate* isolate,
dest->GetChars() + 1,
string->length());
dest->Set(final_size++, '\"');
- if (isolate->heap()->InNewSpace(*result)) {
- // In new space, simply lower the allocation top to fit the actual size.
- isolate->heap()->new_space()->ShrinkStringAtAllocationBoundary<StringType>(
- *result, final_size);
- return *result;
- } else {
- // Not in new space, need to fill the wasted space with filler objects.
- return SeqString::cast(*result)->Truncate(final_size);
- }
+ return *SeqString::Truncate(Handle<SeqString>::cast(result), final_size);
}
@@ -697,8 +689,8 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
void BasicJsonStringifier::ShrinkCurrentPart() {
ASSERT(current_index_ < part_length_);
- current_part_ = Handle<String>(
- SeqString::cast(*current_part_)->Truncate(current_index_), isolate_);
+ current_part_ = SeqString::Truncate(Handle<SeqString>::cast(current_part_),
+ current_index_);
}
« no previous file with comments | « src/json-parser.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698