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); |