[Webkit-unassigned] [Bug 131704] Simple ES6 feature:String prototype additions
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Aug 18 12:44:30 PDT 2014
https://bugs.webkit.org/show_bug.cgi?id=131704
--- Comment #10 from Darin Adler <darin at apple.com> 2014-08-18 12:44:36 PST ---
(From update of attachment 236762)
View in context: https://bugs.webkit.org/attachment.cgi?id=236762&action=review
> Source/JavaScriptCore/runtime/StringPrototype.cpp:1579
> + uint32_t start = std::min(static_cast<uint32_t>(std::max(pos, 0)), len);
> +
> + if (searchLength + start > len)
> + JSValue::encode(jsBoolean(false));
> +
> + if (!searchLength)
> + return JSValue::encode(jsBoolean(!len));
We likely don’t need this code if we use WTF::String::startsWith.
> Source/JavaScriptCore/runtime/StringPrototype.cpp:1581
> + for (uint32_t i = start, j = 0; j < searchLength; i++, j++) {
Why do this a character at a time instead of using WTF::String::startsWith? If WTF::String::startsWith is missing some features, we could add them.
> Source/JavaScriptCore/runtime/StringPrototype.cpp:1613
> + uint32_t end = std::min(static_cast<uint32_t>(std::max(pos, 0)), len);
> + int32_t start = end - searchLength;
> +
> + if (start < 0)
> + return JSValue::encode(jsBoolean(false));
> +
> + if (!searchLength)
> + return JSValue::encode(jsBoolean(!len));
We likely don’t need this code if we use WTF::String::endsWith.
> Source/JavaScriptCore/runtime/StringPrototype.cpp:1616
> + for (uint32_t j = 0; j < searchLength; i++, j++) {
Why do this a character at a time instead of using WTF::String::endsWith? If WTF::String::endsWith is missing some features, we could add them.
> Source/JavaScriptCore/runtime/StringPrototype.cpp:1644
> + uint32_t start = std::min(static_cast<uint32_t>(std::max(pos, 0)), len);
> +
> + if (!searchLength)
> + return JSValue::encode(jsBoolean(!len));
We likely don’t need this code if we use WTF::String::contains.
> Source/JavaScriptCore/runtime/StringPrototype.cpp:1646
> + for (uint32_t i = start; i < len; i++) {
Why do this a character at a time instead of using WTF::String::contains? If WTF::String::contains is missing some features, we could add them.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list