From 4fcc06685f9b458a9daaa8b0e2c8ff9db0b16759 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 8 Apr 2014 06:45:53 +0000 Subject: [PATCH] Handlify LookupSingleCharacterStringFromCode. R=ishell@chromium.org Review URL: https://codereview.chromium.org/227593004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20559 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/factory.cc | 10 +++++++++- src/factory.h | 2 ++ src/handles.cc | 9 --------- src/handles.h | 3 --- src/hydrogen-instructions.cc | 2 +- src/json-parser.h | 3 +-- src/runtime.cc | 23 ++++++++--------------- 7 files changed, 21 insertions(+), 31 deletions(-) diff --git a/src/factory.cc b/src/factory.cc index d3a69744d2..d4909a7c1b 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -287,6 +287,14 @@ MaybeHandle Factory::NewRawTwoByteString( } +Handle Factory::LookupSingleCharacterStringFromCode(uint32_t index) { + CALL_HEAP_FUNCTION( + isolate(), + isolate()->heap()->LookupSingleCharacterStringFromCode(index), + String); +} + + // Returns true for a character in a range. Both limits are inclusive. static inline bool Between(uint32_t character, uint32_t from, uint32_t to) { // This makes uses of the the unsigned wraparound. @@ -469,7 +477,7 @@ Handle Factory::NewProperSubString(Handle str, int length = end - begin; if (length <= 0) return empty_string(); if (length == 1) { - return LookupSingleCharacterStringFromCode(isolate(), str->Get(begin)); + return LookupSingleCharacterStringFromCode(str->Get(begin)); } if (length == 2) { // Optimization for 2-byte strings often used as keys in a decompression diff --git a/src/factory.h b/src/factory.h index c1b7ba7251..53f55d3aac 100644 --- a/src/factory.h +++ b/src/factory.h @@ -142,6 +142,8 @@ class Factory V8_FINAL { int length, PretenureFlag pretenure = NOT_TENURED); + Handle LookupSingleCharacterStringFromCode(uint32_t index); + // Create a new cons string object which consists of a pair of strings. MUST_USE_RESULT MaybeHandle NewConsString(Handle left, Handle right); diff --git a/src/handles.cc b/src/handles.cc index b3052ad6a8..7ed7c8e80f 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -179,15 +179,6 @@ Handle GetProperty(Handle obj, } -Handle LookupSingleCharacterStringFromCode(Isolate* isolate, - uint32_t index) { - CALL_HEAP_FUNCTION( - isolate, - isolate->heap()->LookupSingleCharacterStringFromCode(index), - String); -} - - // Wrappers for scripts are kept alive and cached in weak global // handles referred from foreign objects held by the scripts as long as // they are used. When they are not used anymore, the garbage diff --git a/src/handles.h b/src/handles.h index 3f60404212..edeb27b510 100644 --- a/src/handles.h +++ b/src/handles.h @@ -302,9 +302,6 @@ Handle HasProperty(Handle obj, Handle key); Handle GetProperty(Handle obj, const char* name); -Handle LookupSingleCharacterStringFromCode(Isolate* isolate, - uint32_t index); - // Get the JS object corresponding to the given script; create it // if none exists. Handle GetScriptWrapper(Handle