Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 9410a38b32b373755d14614a5076afaf244b2f1a..d13f33d4eeded07eedb2e4969cb1a5df1bca1391 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -3254,16 +3254,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectFreeze) { |
} |
-MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate, |
- Object* char_code) { |
- if (char_code->IsNumber()) { |
- return isolate->heap()->LookupSingleCharacterStringFromCode( |
- NumberToUint32(char_code) & 0xffff); |
- } |
- return isolate->heap()->empty_string(); |
-} |
- |
- |
RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StringCharCodeAt) { |
SealHandleScope shs(isolate); |
ASSERT(args.length() == 2); |
@@ -3289,9 +3279,13 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StringCharCodeAt) { |
RUNTIME_FUNCTION(MaybeObject*, Runtime_CharFromCode) { |
- SealHandleScope shs(isolate); |
+ HandleScope handlescope(isolate); |
ASSERT(args.length() == 1); |
- return CharFromCode(isolate, args[0]); |
+ if (args[0]->IsNumber()) { |
+ uint32_t code = NumberToUint32(args[0]) & 0xffff; |
+ return *isolate->factory()->LookupSingleCharacterStringFromCode(code); |
+ } |
+ return isolate->heap()->empty_string(); |
} |
@@ -4900,8 +4894,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsValidSmi) { |
static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { |
if (index < static_cast<uint32_t>(string->length())) { |
string->TryFlatten(); |
- return LookupSingleCharacterStringFromCode( |
- string->GetIsolate(), |
+ return string->GetIsolate()->factory()->LookupSingleCharacterStringFromCode( |
string->Get(index)); |
} |
return Execution::CharAt(string, index); |
@@ -6871,7 +6864,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) { |
} |
for (int i = position; i < length; ++i) { |
Handle<Object> str = |
- LookupSingleCharacterStringFromCode(isolate, s->Get(i)); |
+ isolate->factory()->LookupSingleCharacterStringFromCode(s->Get(i)); |
elements->set(i, *str); |
} |