Changeset 36006 in webkit for trunk/JavaScriptCore/kjs/StringConstructor.cpp
- Timestamp:
- Aug 30, 2008, 11:58:07 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/StringConstructor.cpp
r35807 r36006 29 29 namespace KJS { 30 30 31 static NEVER_INLINE JSValue* stringFromCharCodeSlowCase(ExecState* exec, const ArgList& args) 32 { 33 UChar* buf = static_cast<UChar*>(fastMalloc(args.size() * sizeof(UChar))); 34 UChar* p = buf; 35 ArgList::const_iterator end = args.end(); 36 for (ArgList::const_iterator it = args.begin(); it != end; ++it) 37 *p++ = static_cast<UChar>((*it).jsValue(exec)->toUInt32(exec)); 38 return jsString(exec, UString(buf, p - buf, false)); 39 } 40 31 41 static JSValue* stringFromCharCode(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 32 42 { 33 UString s; 34 if (args.size()) { 35 UChar* buf = static_cast<UChar*>(fastMalloc(args.size() * sizeof(UChar))); 36 UChar* p = buf; 37 ArgList::const_iterator end = args.end(); 38 for (ArgList::const_iterator it = args.begin(); it != end; ++it) 39 *p++ = static_cast<UChar>((*it).jsValue(exec)->toUInt32(exec)); 40 s = UString(buf, args.size(), false); 41 } else 42 s = ""; 43 44 return jsString(exec, s); 43 if (LIKELY(args.size() == 1)) 44 return jsSingleCharacterString(exec, args.at(exec, 0)->toUInt32(exec)); 45 return stringFromCharCodeSlowCase(exec, args); 45 46 } 46 47 … … 79 80 { 80 81 if (args.isEmpty()) 81 return js String(exec, "");82 return jsEmptyString(exec); 82 83 return jsString(exec, args.at(exec, 0)->toString(exec)); 83 84 }
Note:
See TracChangeset
for help on using the changeset viewer.