Title: [196949] trunk/Source/_javascript_Core
- Revision
- 196949
- Author
- keith_mil...@apple.com
- Date
- 2016-02-22 11:43:01 -0800 (Mon, 22 Feb 2016)
Log Message
Builtins that should not rely on iteration do.
https://bugs.webkit.org/show_bug.cgi?id=154475
Reviewed by Geoffrey Garen.
When changing the behavior of varargs calls to use ES6 iterators the
call builtin function's use of a varargs call was overlooked. The use
of iterators is observable outside the scope of the the call function,
thus it must be reimplemented.
* builtins/FunctionPrototype.js:
(call):
* tests/stress/call-apply-builtin-functions-dont-use-iterators.js: Added.
(test):
(addAll):
(catch):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (196948 => 196949)
--- trunk/Source/_javascript_Core/ChangeLog 2016-02-22 19:41:00 UTC (rev 196948)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-02-22 19:43:01 UTC (rev 196949)
@@ -1,3 +1,22 @@
+2016-02-22 Keith Miller <keith_mil...@apple.com>
+
+ Builtins that should not rely on iteration do.
+ https://bugs.webkit.org/show_bug.cgi?id=154475
+
+ Reviewed by Geoffrey Garen.
+
+ When changing the behavior of varargs calls to use ES6 iterators the
+ call builtin function's use of a varargs call was overlooked. The use
+ of iterators is observable outside the scope of the the call function,
+ thus it must be reimplemented.
+
+ * builtins/FunctionPrototype.js:
+ (call):
+ * tests/stress/call-apply-builtin-functions-dont-use-iterators.js: Added.
+ (test):
+ (addAll):
+ (catch):
+
2016-02-22 Konstantin Tokarev <annu...@yandex.ru>
[JSC shell] Don't put empty arguments array to VM.
Modified: trunk/Source/_javascript_Core/builtins/FunctionPrototype.js (196948 => 196949)
--- trunk/Source/_javascript_Core/builtins/FunctionPrototype.js 2016-02-22 19:41:00 UTC (rev 196948)
+++ trunk/Source/_javascript_Core/builtins/FunctionPrototype.js 2016-02-22 19:43:01 UTC (rev 196949)
@@ -27,7 +27,12 @@
{
"use strict";
- return this.@call(...arguments);
+ let argumentValues = [];
+ // Start from 1 to ignore thisArgument
+ for (let i = 1; i < arguments.length; i++)
+ @putByValDirect(argumentValues, i-1, arguments[i]);
+
+ return this.@apply(thisArgument, argumentValues);
}
function apply(thisValue, argumentValues)
Added: trunk/Source/_javascript_Core/tests/stress/call-apply-builtin-functions-dont-use-iterators.js (0 => 196949)
--- trunk/Source/_javascript_Core/tests/stress/call-apply-builtin-functions-dont-use-iterators.js (rev 0)
+++ trunk/Source/_javascript_Core/tests/stress/call-apply-builtin-functions-dont-use-iterators.js 2016-02-22 19:43:01 UTC (rev 196949)
@@ -0,0 +1,32 @@
+(function(){
+ "use strict";
+ var it = [][Symbol.iterator]();
+ while (it) {
+ if (it.hasOwnProperty('next'))
+ delete it.next;
+ it = Object.getPrototypeOf(it);
+ }
+
+ var bind = Function.prototype.bind;
+ var uncurryThis = bind.bind(bind.call);
+
+ var bindFn = uncurryThis(bind);
+ var applyFn = uncurryThis(bind.apply);
+ function test() { print("here"); }
+ var sliceFn = uncurryThis([].slice);
+ function addAll(var_args) {
+ var args = sliceFn(arguments, 0);
+ var result = this;
+ for (var i = 0; i < args.length; i++)
+ result += args[i];
+ return result;
+ }
+ var sum;
+
+ try {
+ sum = applyFn(addAll, 3, [4, 5, 6]);
+ } catch (err) {
+ print('oops ', err);
+ }
+ print('sum ', sum);
+})();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes