[INTL] Use @thisNumberValue instead of `instanceof @Number`
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2016 13:34:02 +0000 (13:34 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2016 13:34:02 +0000 (13:34 +0000)
commit0074e253c9a96cdd098ecf47dfda7e7579cdc426
tree71f09a335def8fc9ade306a190249a1adce71210
parent4921ee1e5a425614bcfa4e479783551b54df8de3
[INTL] Use @thisNumberValue instead of `instanceof @Number`
https://bugs.webkit.org/show_bug.cgi?id=156680

Reviewed by Saam Barati.

Source/JavaScriptCore:

Use @thisNumberValue instead of `instanceof @Number`.
`instanceof @Number` is not enough;
For example, given 2 realms, the object created in one realm does not
inherit the Number of another realm.
Another example is that the object which does not inherit Number.

```
var number = new Number(42);
number.__proto__ = null;
```

* builtins/NumberPrototype.js:
(toLocaleString):
* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/NumberPrototype.cpp:
(JSC::numberProtoFuncValueOf):
* runtime/NumberPrototype.h:
* tests/stress/number-to-locale-string-should-accept-strange-number-objects.js: Added.
(shouldBe):

LayoutTests:

* js/number-toLocaleString-expected.txt:
* js/script-tests/number-toLocaleString.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/number-toLocaleString-expected.txt
LayoutTests/js/script-tests/number-toLocaleString.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/NumberPrototype.js
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/NumberPrototype.cpp
Source/JavaScriptCore/runtime/NumberPrototype.h
Source/JavaScriptCore/tests/stress/number-to-locale-string-should-accept-strange-number-objects.js [new file with mode: 0644]