Title: [198171] trunk
Revision
198171
Author
[email protected]
Date
2016-03-14 16:28:03 -0700 (Mon, 14 Mar 2016)

Log Message

REGRESSION(r194394): >2x slow-down on CDjs
https://bugs.webkit.org/show_bug.cgi?id=155471

Unreviewed (rollout).

Source/_javascript_Core:

This revision changes localeCompare() so that it's *much* slower than before. It's
understandable that sometimes things will get a tiny bit slower when implementing new
language features, but more than 2x regression on a major benchmark is not OK.

This rolls out that change. We can reland it once we think about how to do it in a
performant way.

* builtins/StringPrototype.js:
(search):
(localeCompare): Deleted.
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):

LayoutTests:

* js/dom/script-tests/string-prototype-properties.js:
* js/dom/string-prototype-properties-expected.txt:
* js/script-tests/string-localeCompare.js:
* js/string-localeCompare-expected.txt:
* js/string-localeCompare.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198170 => 198171)


--- trunk/LayoutTests/ChangeLog	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/LayoutTests/ChangeLog	2016-03-14 23:28:03 UTC (rev 198171)
@@ -1,3 +1,16 @@
+2016-03-14  Filip Pizlo  <[email protected]>
+
+        REGRESSION(r194394): >2x slow-down on CDjs
+        https://bugs.webkit.org/show_bug.cgi?id=155471
+
+        Unreviewed (rollout).
+
+        * js/dom/script-tests/string-prototype-properties.js:
+        * js/dom/string-prototype-properties-expected.txt:
+        * js/script-tests/string-localeCompare.js:
+        * js/string-localeCompare-expected.txt:
+        * js/string-localeCompare.html:
+
 2016-03-14  Ryan Haddad  <[email protected]>
 
         Marking js/funcion-apply.html as flaky on mac debug

Modified: trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js (198170 => 198171)


--- trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js	2016-03-14 23:28:03 UTC (rev 198171)
@@ -20,7 +20,7 @@
 shouldThrow("String.prototype.substring.call(undefined, 1, 3)");
 shouldThrow("String.prototype.toLowerCase.call(undefined)");
 shouldThrow("String.prototype.toUpperCase.call(undefined)");
-shouldThrow("String.prototype.localeCompare.call(undefined, '1224')", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");
+shouldThrow("String.prototype.localeCompare.call(undefined, '1224')");
 shouldThrow("String.prototype.toLocaleLowerCase.call(undefined)");
 shouldThrow("String.prototype.toLocaleUpperCase.call(undefined)");
 shouldThrow("String.prototype.trim.call(undefined)");

Modified: trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt (198170 => 198171)


--- trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt	2016-03-14 23:28:03 UTC (rev 198171)
@@ -20,7 +20,7 @@
 PASS String.prototype.substring.call(undefined, 1, 3) threw exception TypeError: Type error.
 PASS String.prototype.toLowerCase.call(undefined) threw exception TypeError: Type error.
 PASS String.prototype.toUpperCase.call(undefined) threw exception TypeError: Type error.
-PASS String.prototype.localeCompare.call(undefined, '1224') threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.
+PASS String.prototype.localeCompare.call(undefined, '1224') threw exception TypeError: Type error.
 PASS String.prototype.toLocaleLowerCase.call(undefined) threw exception TypeError: Type error.
 PASS String.prototype.toLocaleUpperCase.call(undefined) threw exception TypeError: Type error.
 PASS String.prototype.trim.call(undefined) threw exception TypeError: Type error.

Modified: trunk/LayoutTests/js/script-tests/string-localeCompare.js (198170 => 198171)


--- trunk/LayoutTests/js/script-tests/string-localeCompare.js	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/LayoutTests/js/script-tests/string-localeCompare.js	2016-03-14 23:28:03 UTC (rev 198171)
@@ -1,28 +1,5 @@
-description("This test checks the behavior of String.prototype.localeCompare as described in the ECMAScript Internationalization API Specification (ECMA-402 2.0).");
+description("This test checks String.localeCompare().");
 
-shouldBe("String.prototype.localeCompare.length", "1");
-shouldBeFalse("Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').enumerable");
-shouldBeTrue("Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').configurable");
-shouldBeTrue("Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').writable");
-
-// Test RequireObjectCoercible.
-shouldThrow("String.prototype.localeCompare.call()", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");
-shouldThrow("String.prototype.localeCompare.call(undefined)", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");
-shouldThrow("String.prototype.localeCompare.call(null)", "'TypeError: String.prototype.localeCompare requires that |this| not be null'");
-shouldNotThrow("String.prototype.localeCompare.call({}, '')");
-shouldNotThrow("String.prototype.localeCompare.call([], '')");
-shouldNotThrow("String.prototype.localeCompare.call(NaN, '')");
-shouldNotThrow("String.prototype.localeCompare.call(5, '')");
-shouldNotThrow("String.prototype.localeCompare.call('', '')");
-shouldNotThrow("String.prototype.localeCompare.call(() => {}, '')");
-
-// Test toString fails.
-shouldThrow("''.localeCompare.call({ toString() { throw 'thisFail' } }, '')", "'thisFail'");
-shouldThrow("''.localeCompare({ toString() { throw 'thatFail' } })", "'thatFail'");
-shouldNotThrow("''.localeCompare()");
-shouldNotThrow("''.localeCompare(null)");
-
-// Basic support.
 shouldBeTrue('"a".localeCompare("aa") < 0');
 shouldBeTrue('"a".localeCompare("b") < 0');
 
@@ -31,45 +8,3 @@
 
 shouldBeTrue('"aa".localeCompare("a") > 0');
 shouldBeTrue('"b".localeCompare("a") > 0');
-
-// Uses Intl.Collator.
-shouldThrow("'a'.localeCompare('b', '$')", "'RangeError: invalid language tag: $'");
-shouldThrow("'a'.localeCompare('b', 'en', {usage: 'Sort'})", '\'RangeError: usage must be either "sort" or "search"\'');
-
-shouldBe("'ä'.localeCompare('z', 'en')", "-1");
-shouldBe("'ä'.localeCompare('z', 'sv')", "1");
-
-shouldBe("'a'.localeCompare('b', 'en', { sensitivity:'base' })", "-1");
-shouldBe("'a'.localeCompare('ä', 'en', { sensitivity:'base' })", "0");
-shouldBe("'a'.localeCompare('A', 'en', { sensitivity:'base' })", "0");
-shouldBe("'a'.localeCompare('ⓐ', 'en', { sensitivity:'base' })", "0");
-
-shouldBe("'a'.localeCompare('b', 'en', { sensitivity:'accent' })", "-1");
-shouldBe("'a'.localeCompare('ä', 'en', { sensitivity:'accent' })", "-1");
-shouldBe("'a'.localeCompare('A', 'en', { sensitivity:'accent' })", "0");
-shouldBe("'a'.localeCompare('ⓐ', 'en', { sensitivity:'accent' })", "0");
-
-shouldBe("'a'.localeCompare('b', 'en', { sensitivity:'case' })", "-1");
-shouldBe("'a'.localeCompare('ä', 'en', { sensitivity:'case' })", "0");
-shouldBe("'a'.localeCompare('A', 'en', { sensitivity:'case' })", "-1");
-shouldBe("'a'.localeCompare('ⓐ', 'en', { sensitivity:'case' })", "0");
-
-shouldBe("'a'.localeCompare('b', 'en', { sensitivity:'variant' })", "-1");
-shouldBe("'a'.localeCompare('ä', 'en', { sensitivity:'variant' })", "-1");
-shouldBe("'a'.localeCompare('A', 'en', { sensitivity:'variant' })", "-1");
-shouldBe("'a'.localeCompare('ⓐ', 'en', { sensitivity:'variant' })", "-1");
-
-shouldBe("'1'.localeCompare('2', 'en', { numeric:false })", "-1");
-shouldBe("'2'.localeCompare('10', 'en', { numeric:false })", "1");
-shouldBe("'01'.localeCompare('1', 'en', { numeric:false })", "-1");
-shouldBe("'๑'.localeCompare('๒', 'en', { numeric:false })", "-1");
-shouldBe("'๒'.localeCompare('๑๐', 'en', { numeric:false })", "1");
-shouldBe("'๐๑'.localeCompare('๑', 'en', { numeric:false })", "-1");
-
-shouldBe("'1'.localeCompare('2', 'en', { numeric:true })", "-1");
-shouldBe("'2'.localeCompare('10', 'en', { numeric:true })", "-1");
-shouldBe("'01'.localeCompare('1', 'en', { numeric:true })", "0");
-shouldBe("'๑'.localeCompare('๒', 'en', { numeric:true })", "-1");
-shouldBe("'๒'.localeCompare('๑๐', 'en', { numeric:true })", "-1");
-shouldBe("'๐๑'.localeCompare('๑', 'en', { numeric:true })", "0");
-

Modified: trunk/LayoutTests/js/string-localeCompare-expected.txt (198170 => 198171)


--- trunk/LayoutTests/js/string-localeCompare-expected.txt	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/LayoutTests/js/string-localeCompare-expected.txt	2016-03-14 23:28:03 UTC (rev 198171)
@@ -1,63 +1,14 @@
-This test checks the behavior of String.prototype.localeCompare as described in the ECMAScript Internationalization API Specification (ECMA-402 2.0).
+This test checks String.localeCompare().
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS String.prototype.localeCompare.length is 1
-PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').enumerable is false
-PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').configurable is true
-PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').writable is true
-PASS String.prototype.localeCompare.call() threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.
-PASS String.prototype.localeCompare.call(undefined) threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.
-PASS String.prototype.localeCompare.call(null) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null.
-PASS String.prototype.localeCompare.call({}, '') did not throw exception.
-PASS String.prototype.localeCompare.call([], '') did not throw exception.
-PASS String.prototype.localeCompare.call(NaN, '') did not throw exception.
-PASS String.prototype.localeCompare.call(5, '') did not throw exception.
-PASS String.prototype.localeCompare.call('', '') did not throw exception.
-PASS String.prototype.localeCompare.call(() => {}, '') did not throw exception.
-PASS ''.localeCompare.call({ toString() { throw 'thisFail' } }, '') threw exception thisFail.
-PASS ''.localeCompare({ toString() { throw 'thatFail' } }) threw exception thatFail.
-PASS ''.localeCompare() did not throw exception.
-PASS ''.localeCompare(null) did not throw exception.
 PASS "a".localeCompare("aa") < 0 is true
 PASS "a".localeCompare("b") < 0 is true
 PASS "a".localeCompare("a") === 0 is true
 PASS "ạ̈".localeCompare("ạ̈") === 0 is true
 PASS "aa".localeCompare("a") > 0 is true
 PASS "b".localeCompare("a") > 0 is true
-PASS 'a'.localeCompare('b', '$') threw exception RangeError: invalid language tag: $.
-PASS 'a'.localeCompare('b', 'en', {usage: 'Sort'}) threw exception RangeError: usage must be either "sort" or "search".
-PASS 'ä'.localeCompare('z', 'en') is -1
-PASS 'ä'.localeCompare('z', 'sv') is 1
-PASS 'a'.localeCompare('b', 'en', { sensitivity:'base' }) is -1
-PASS 'a'.localeCompare('ä', 'en', { sensitivity:'base' }) is 0
-PASS 'a'.localeCompare('A', 'en', { sensitivity:'base' }) is 0
-PASS 'a'.localeCompare('ⓐ', 'en', { sensitivity:'base' }) is 0
-PASS 'a'.localeCompare('b', 'en', { sensitivity:'accent' }) is -1
-PASS 'a'.localeCompare('ä', 'en', { sensitivity:'accent' }) is -1
-PASS 'a'.localeCompare('A', 'en', { sensitivity:'accent' }) is 0
-PASS 'a'.localeCompare('ⓐ', 'en', { sensitivity:'accent' }) is 0
-PASS 'a'.localeCompare('b', 'en', { sensitivity:'case' }) is -1
-PASS 'a'.localeCompare('ä', 'en', { sensitivity:'case' }) is 0
-PASS 'a'.localeCompare('A', 'en', { sensitivity:'case' }) is -1
-PASS 'a'.localeCompare('ⓐ', 'en', { sensitivity:'case' }) is 0
-PASS 'a'.localeCompare('b', 'en', { sensitivity:'variant' }) is -1
-PASS 'a'.localeCompare('ä', 'en', { sensitivity:'variant' }) is -1
-PASS 'a'.localeCompare('A', 'en', { sensitivity:'variant' }) is -1
-PASS 'a'.localeCompare('ⓐ', 'en', { sensitivity:'variant' }) is -1
-PASS '1'.localeCompare('2', 'en', { numeric:false }) is -1
-PASS '2'.localeCompare('10', 'en', { numeric:false }) is 1
-PASS '01'.localeCompare('1', 'en', { numeric:false }) is -1
-PASS '๑'.localeCompare('๒', 'en', { numeric:false }) is -1
-PASS '๒'.localeCompare('๑๐', 'en', { numeric:false }) is 1
-PASS '๐๑'.localeCompare('๑', 'en', { numeric:false }) is -1
-PASS '1'.localeCompare('2', 'en', { numeric:true }) is -1
-PASS '2'.localeCompare('10', 'en', { numeric:true }) is -1
-PASS '01'.localeCompare('1', 'en', { numeric:true }) is 0
-PASS '๑'.localeCompare('๒', 'en', { numeric:true }) is -1
-PASS '๒'.localeCompare('๑๐', 'en', { numeric:true }) is -1
-PASS '๐๑'.localeCompare('๑', 'en', { numeric:true }) is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/js/string-localeCompare.html (198170 => 198171)


--- trunk/LayoutTests/js/string-localeCompare.html	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/LayoutTests/js/string-localeCompare.html	2016-03-14 23:28:03 UTC (rev 198171)
@@ -1,7 +1,6 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<meta charset="utf-8">
 <script src=""
 </head>
 <body>

Modified: trunk/Source/_javascript_Core/ChangeLog (198170 => 198171)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-14 23:28:03 UTC (rev 198171)
@@ -1,3 +1,23 @@
+2016-03-14  Filip Pizlo  <[email protected]>
+
+        REGRESSION(r194394): >2x slow-down on CDjs
+        https://bugs.webkit.org/show_bug.cgi?id=155471
+
+        Unreviewed (rollout).
+
+        This revision changes localeCompare() so that it's *much* slower than before. It's
+        understandable that sometimes things will get a tiny bit slower when implementing new
+        language features, but more than 2x regression on a major benchmark is not OK.
+
+        This rolls out that change. We can reland it once we think about how to do it in a
+        performant way.
+
+        * builtins/StringPrototype.js:
+        (search):
+        (localeCompare): Deleted.
+        * runtime/StringPrototype.cpp:
+        (JSC::StringPrototype::finishCreation):
+
 2016-03-14  Mark Lam  <[email protected]>
 
         Need to distinguish between Symbol() and Symbol("").

Modified: trunk/Source/_javascript_Core/builtins/StringPrototype.js (198170 => 198171)


--- trunk/Source/_javascript_Core/builtins/StringPrototype.js	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/Source/_javascript_Core/builtins/StringPrototype.js	2016-03-14 23:28:03 UTC (rev 198171)
@@ -26,40 +26,6 @@
 
 // @conditional=ENABLE(INTL)
 
-function localeCompare(that/*, locales, options */)
-{
-    "use strict";
-
-    // 13.1.1 String.prototype.localeCompare (that [, locales [, options ]]) (ECMA-402 2.0)
-    // http://ecma-international.org/publications/standards/Ecma-402.htm
-
-    // 1. Let O be RequireObjectCoercible(this value).
-    if (this === null)
-        throw new @TypeError("String.prototype.localeCompare requires that |this| not be null");
-    
-    if (this === @undefined)
-        throw new @TypeError("String.prototype.localeCompare requires that |this| not be undefined");
-
-    // 2. Let S be ToString(O).
-    // 3. ReturnIfAbrupt(S).
-    var thisString = @toString(this);
-
-    // 4. Let That be ToString(that).
-    // 5. ReturnIfAbrupt(That).
-    var thatString = @toString(that);
-
-    // Avoid creating a collator for defaults.
-    if (arguments[1] === @undefined && arguments[2] === @undefined)
-        return @Collator.prototype.compare(thisString, thatString);
-
-    // 6. Let collator be Construct(%Collator%, «locales, options»).
-    // 7. ReturnIfAbrupt(collator).
-    var collator = new @Collator(arguments[1], arguments[2]);
-
-    // 8. Return CompareStrings(collator, S, That).
-    return collator.compare(thisString, thatString);
-}
-
 function search(regexp)
 {
     "use strict";

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (198170 => 198171)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2016-03-14 23:26:37 UTC (rev 198170)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2016-03-14 23:28:03 UTC (rev 198171)
@@ -142,12 +142,11 @@
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("substring", stringProtoFuncSubstring, DontEnum, 2);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("toLowerCase", stringProtoFuncToLowerCase, DontEnum, 0);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("toUpperCase", stringProtoFuncToUpperCase, DontEnum, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("localeCompare", stringProtoFuncLocaleCompare, DontEnum, 1);
 #if ENABLE(INTL)
-    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("localeCompare", stringPrototypeLocaleCompareCodeGenerator, DontEnum);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("toLocaleLowerCase", stringProtoFuncToLocaleLowerCase, DontEnum, 0);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("toLocaleUpperCase", stringProtoFuncToLocaleUpperCase, DontEnum, 0);
 #else
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("localeCompare", stringProtoFuncLocaleCompare, DontEnum, 1);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("toLocaleLowerCase", stringProtoFuncToLowerCase, DontEnum, 0);
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("toLocaleUpperCase", stringProtoFuncToUpperCase, DontEnum, 0);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to