ChakraCore/test/Function/apply3.js is resulting wrong result in x86_64
https://bugs.webkit.org/show_bug.cgi?id=175642
Reviewed by Darin Adler.
JSTests:
* ChakraCore/test/Function/apply3.baseline-jsc:
Source/JavaScriptCore:
According JS spec, the ToLength operation[1] has a range of 0..(2^53)
- 1. In Interpreter.cpp::sizeFrameForVarargs, the call to
sizeOfVarargs() was being assigned to "unsigned length", forcing a
type cast that results in different value among architectures JSC supports.
For instance, in x86_64 "
4294967295 + 1" results in 0, while in ARMv6 it
results
4294967295. This patch is changing "sizeOfVarargs" to clamp the
result from "toLength" to unsigned and then get desired behavior for
all supported platforms.
[1] - https://tc39.github.io/ecma262/#sec-tolength
* interpreter/Interpreter.cpp:
(JSC::sizeOfVarargs):
* interpreter/Interpreter.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222724
268f45cc-cd09-0410-ab3c-
d52691b4dbfc