Commit 4c49e4e2 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Cast const char * to const uint8_t *, which removed a unnecessary version of...

Cast const char * to const uint8_t *, which removed a unnecessary version of InternalStringToDouble template.

Code size (android arm build for d8):
old d8: 17,479,047 bytes
new d8: 17,445,492 bytes
Total code size saved: 33,555 bytes

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/36903002

Patch from Bangfu Tao <bangfu.tao@samsung.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17409 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 93fa1939
......@@ -46,8 +46,11 @@ namespace internal {
double StringToDouble(UnicodeCache* unicode_cache,
const char* str, int flags, double empty_string_val) {
const char* end = str + StrLength(str);
return InternalStringToDouble(unicode_cache, str, end, flags,
// We cast to const uint8_t* here to avoid instantiating the
// InternalStringToDouble() template for const char* as well.
const uint8_t* start = reinterpret_cast<const uint8_t*>(str);
const uint8_t* end = start + StrLength(str);
return InternalStringToDouble(unicode_cache, start, end, flags,
empty_string_val);
}
......@@ -56,11 +59,15 @@ double StringToDouble(UnicodeCache* unicode_cache,
Vector<const char> str,
int flags,
double empty_string_val) {
const char* end = str.start() + str.length();
return InternalStringToDouble(unicode_cache, str.start(), end, flags,
// We cast to const uint8_t* here to avoid instantiating the
// InternalStringToDouble() template for const char* as well.
const uint8_t* start = reinterpret_cast<const uint8_t*>(str.start());
const uint8_t* end = start + str.length();
return InternalStringToDouble(unicode_cache, start, end, flags,
empty_string_val);
}
double StringToDouble(UnicodeCache* unicode_cache,
Vector<const uc16> str,
int flags,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment