Index: src/runtime.cc |
=================================================================== |
--- src/runtime.cc (revision 2174) |
+++ src/runtime.cc (working copy) |
@@ -2416,6 +2416,19 @@ |
NoHandleAllocation ha; |
ASSERT(args.length() == 2); |
+ // Fast case where the result is a one char string. |
Kasper Lund
2009/06/16 06:41:18
char -> character
|
+ if (args[0]->IsSmi() && args[1]->IsSmi()) { |
+ int value = Smi::cast(args[0])->value(); |
+ int radix = Smi::cast(args[1])->value(); |
+ if (value >= 0 && value < radix) { |
+ RUNTIME_ASSERT(radix <= 36); |
+ // Character array used for conversion. |
+ static const char chars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; |
Kasper Lund
2009/06/16 06:41:18
Should be something like kChars or kCharsMap, righ
|
+ return Heap::LookupSingleCharacterStringFromCode(chars[value]); |
+ } |
+ } |
+ |
+ // Slow case. |
CONVERT_DOUBLE_CHECKED(value, args[0]); |
if (isnan(value)) { |
return Heap::AllocateStringFromAscii(CStrVector("NaN")); |