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

Unified Diff: src/runtime.cc

Issue 227593004: Handlify LookupSingleCharacterStringFromCode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « src/json-parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/json-parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698