Chromium Code Reviews| Index: src/v8natives.js |
| diff --git a/src/v8natives.js b/src/v8natives.js |
| index 26724a24199d3384e224573a6bc50138071d4d75..f1e8084a53038dff8d8c33a888d2e1bf41311af4 100644 |
| --- a/src/v8natives.js |
| +++ b/src/v8natives.js |
| @@ -1258,6 +1258,16 @@ function ObjectIsExtensible(obj) { |
| } |
| +// Harmony egal. |
| +function ObjectIs(obj1, obj2) { |
| + if (obj1 === obj2) { |
|
arv (Not doing code reviews)
2012/03/13 05:15:49
Why don't we use the SameValue function?
http://c
Michael Starzinger
2012/03/13 09:02:08
Yes we could use that function, but I didn't care
|
| + return (obj1 !== 0) || (1 / obj1 === 1 / obj2); |
| + } else { |
| + return (obj1 !== obj1) && (obj2 !== obj2); |
| + } |
| +} |
| + |
| + |
| %SetCode($Object, function(x) { |
| if (%_IsConstructCall()) { |
| if (x == null) return this; |
| @@ -1297,6 +1307,7 @@ function SetUpObject() { |
| "getPrototypeOf", ObjectGetPrototypeOf, |
| "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, |
| "getOwnPropertyNames", ObjectGetOwnPropertyNames, |
| + "is", ObjectIs, |
| "isExtensible", ObjectIsExtensible, |
| "isFrozen", ObjectIsFrozen, |
| "isSealed", ObjectIsSealed, |
| @@ -1461,6 +1472,18 @@ function NumberToPrecision(precision) { |
| } |
| +// Harmony isFinite. |
| +function NumberIsFinite(number) { |
| + return IS_NUMBER(number) && NUMBER_IS_FINITE(number); |
| +} |
| + |
| + |
| +// Harmony isNaN. |
| +function NumberIsNaN(number) { |
| + return IS_NUMBER(number) && NUMBER_IS_NAN(number); |
| +} |
| + |
| + |
| // ---------------------------------------------------------------------------- |
| function SetUpNumber() { |
| @@ -1505,6 +1528,10 @@ function SetUpNumber() { |
| "toExponential", NumberToExponential, |
| "toPrecision", NumberToPrecision |
| )); |
| + InstallFunctions($Number, DONT_ENUM, $Array( |
| + "isFinite", NumberIsFinite, |
| + "isNaN", NumberIsNaN |
| + )); |
| } |
| SetUpNumber(); |