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

Unified Diff: src/json-stringifier.h

Issue 11348349: Improve array to string conversion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index 80ef39507812207ac5dbaa690b51855bfd522793..2399395396aa28c601cd5a4a88c07a85e12cbfc5 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -603,26 +603,7 @@ void BasicJsonStringifier::ShrinkCurrentPart() {
return;
}
- int string_size, allocated_string_size;
- if (is_ascii_) {
- allocated_string_size = SeqOneByteString::SizeFor(part_length_);
- string_size = SeqOneByteString::SizeFor(current_index_);
- } else {
- allocated_string_size = SeqTwoByteString::SizeFor(part_length_);
- string_size = SeqTwoByteString::SizeFor(current_index_);
- }
-
- int delta = allocated_string_size - string_size;
- current_part_->set_length(current_index_);
-
- // String sizes are pointer size aligned, so that we can use filler objects
- // that are a multiple of pointer size.
- Address end_of_string = current_part_->address() + string_size;
- isolate_->heap()->CreateFillerObjectAt(end_of_string, delta);
- if (Marking::IsBlack(Marking::MarkBitFrom(*current_part_))) {
- MemoryChunk::IncrementLiveBytesFromMutator(
- current_part_->address(), -delta);
- }
+ SeqString::cast(*current_part_)->Truncate(current_index_);
Toon Verwaest 2012/12/05 14:29:12 Runtime_Truncate returns the resulting string; and
}

Powered by Google App Engine
This is Rietveld 408576698