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

Unified Diff: src/heap.cc

Issue 7521: Make one-ascii-character-string a symbol in its cache. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 528)
+++ src/heap.cc (working copy)
@@ -1488,16 +1488,20 @@
}
-Object* Heap:: LookupSingleCharacterStringFromCode(uint16_t code) {
+Object* Heap::LookupSingleCharacterStringFromCode(uint16_t code) {
if (code <= String::kMaxAsciiCharCode) {
Object* value = Heap::single_character_string_cache()->get(code);
if (value != Heap::undefined_value()) return value;
- Object* result = Heap::AllocateRawAsciiString(1);
+
+ char buffer[1];
+ buffer[0] = static_cast<char>(code);
+ Object* result = LookupSymbol(Vector<const char>(buffer, 1));
+
if (result->IsFailure()) return result;
- String::cast(result)->Set(0, code);
Heap::single_character_string_cache()->set(code, result);
return result;
}
+
Object* result = Heap::AllocateRawTwoByteString(1);
iposva 2008/10/21 04:33:46 Is there a reason we do not symbolize one characte
Feng Qian 2008/10/21 16:27:11 I viewed single_character_string_cache is a cache
if (result->IsFailure()) return result;
String::cast(result)->Set(0, code);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698