Commit 192d439f authored by ager@chromium.org's avatar ager@chromium.org

Update v8natives to use InstallFunctions to get the correct function

names for library functions.
Review URL: http://codereview.chromium.org/6447

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@433 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4b063df8
...@@ -902,15 +902,6 @@ function ArrayLastIndexOf(element, index) { ...@@ -902,15 +902,6 @@ function ArrayLastIndexOf(element, index) {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
function InstallFunctions(prototype, attributes, functions) {
for (var i = 0; i < functions.length; i += 2) {
var key = functions[i];
var f = functions[i + 1];
%FunctionSetName(f, key);
%SetProperty(prototype, key, f, attributes);
}
}
function UpdateFunctionLengths(lengths) { function UpdateFunctionLengths(lengths) {
for (var key in lengths) { for (var key in lengths) {
......
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file relies on the fact that the following declarations have been made
// in v8natives.js:
// const $isNaN = GlobalIsNaN;
// const $isFinite = GlobalIsFinite;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// This file contains date support implemented in JavaScript. // This file contains date support implemented in JavaScript.
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file relies on the fact that the following declarations have been made // This file relies on the fact that the following declarations have been made
// //
// in runtime.js: // in runtime.js:
...@@ -39,36 +38,41 @@ ...@@ -39,36 +38,41 @@
// in math.js: // in math.js:
// const $floor = MathFloor // const $floor = MathFloor
const $isNaN = GlobalIsNaN;
const $isFinite = GlobalIsFinite;
// ECMA 262 - 15.1.1.1. // ----------------------------------------------------------------------------
%SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE);
// ECMA-262 - 15.1.1.2. // Helper function used to install functions on objects.
%SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE); function InstallFunctions(object, attributes, functions) {
for (var i = 0; i < functions.length; i += 2) {
var key = functions[i];
var f = functions[i + 1];
%FunctionSetName(f, key);
%SetProperty(object, key, f, attributes);
}
}
// ECMA-262 - 15.1.1.3. // ----------------------------------------------------------------------------
%SetProperty(global, "undefined", void 0, DONT_ENUM | DONT_DELETE);
// ECMA 262 - 15.1.4 // ECMA 262 - 15.1.4
function $isNaN(number) { function GlobalIsNaN(number) {
var n = ToNumber(number); var n = ToNumber(number);
return NUMBER_IS_NAN(n); return NUMBER_IS_NAN(n);
} }
%SetProperty(global, "isNaN", $isNaN, DONT_ENUM);
// ECMA 262 - 15.1.5 // ECMA 262 - 15.1.5
function $isFinite(number) { function GlobalIsFinite(number) {
return %NumberIsFinite(ToNumber(number)); return %NumberIsFinite(ToNumber(number));
} }
%SetProperty(global, "isFinite", $isFinite, DONT_ENUM);
// ECMA-262 - 15.1.2.2 // ECMA-262 - 15.1.2.2
%SetProperty(global, "parseInt", function(string, radix) { function GlobalParseInt(string, radix) {
if (radix === void 0) { if (radix === void 0) {
radix = 0; radix = 0;
// Some people use parseInt instead of Math.floor. This // Some people use parseInt instead of Math.floor. This
...@@ -89,13 +93,61 @@ function $isFinite(number) { ...@@ -89,13 +93,61 @@ function $isFinite(number) {
return $NaN; return $NaN;
} }
return %StringParseInt(ToString(string), radix); return %StringParseInt(ToString(string), radix);
}, DONT_ENUM); }
// ECMA-262 - 15.1.2.3 // ECMA-262 - 15.1.2.3
%SetProperty(global, "parseFloat", function(string) { function GlobalParseFloat(string) {
return %StringParseFloat(ToString(string)); return %StringParseFloat(ToString(string));
}, DONT_ENUM); }
function GlobalEval(x) {
if (!IS_STRING(x)) return x;
var f = %CompileString(x, 0, true);
if (!IS_FUNCTION(f)) return f;
return f.call(%EvalReceiver(this));
}
// execScript for IE compatibility.
function GlobalExecScript(expr, lang) {
// NOTE: We don't care about the character casing.
if (!lang || /javascript/i.test(lang)) {
var f = %CompileString(ToString(expr), 0, false);
f.call(global);
}
return null;
}
// ----------------------------------------------------------------------------
function SetupGlobal() {
// ECMA 262 - 15.1.1.1.
%SetProperty(global, "NaN", $NaN, DONT_ENUM | DONT_DELETE);
// ECMA-262 - 15.1.1.2.
%SetProperty(global, "Infinity", 1/0, DONT_ENUM | DONT_DELETE);
// ECMA-262 - 15.1.1.3.
%SetProperty(global, "undefined", void 0, DONT_ENUM | DONT_DELETE);
// Setup non-enumerable function on the global object.
InstallFunctions(global, DONT_ENUM, $Array(
"isNaN", GlobalIsNaN,
"isFinite", GlobalIsFinite,
"parseInt", GlobalParseInt,
"parseFloat", GlobalParseFloat,
"eval", GlobalEval,
"execScript", GlobalExecScript
));
}
SetupGlobal();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -119,49 +171,50 @@ function $isFinite(number) { ...@@ -119,49 +171,50 @@ function $isFinite(number) {
$Object.prototype.constructor = $Object; $Object.prototype.constructor = $Object;
%SetProperty($Object.prototype, "toString", function() { // ECMA-262 - 15.2.4.2
function ObjectToString() {
var c = %ClassOf(this); var c = %ClassOf(this);
// Hide Arguments from the outside. // Hide Arguments from the outside.
if (c === 'Arguments') c = 'Object'; if (c === 'Arguments') c = 'Object';
return "[object " + c + "]"; return "[object " + c + "]";
}, DONT_ENUM); }
// ECMA-262, section 15.2.4.3, page 84. // ECMA-262 - 15.2.4.3
%SetProperty($Object.prototype, "toLocaleString", function() { function ObjectToLocaleString() {
return this.toString(); return this.toString();
}, DONT_ENUM); }
// ECMA-262, section 15.2.4.4, page 85. // ECMA-262 - 15.2.4.4
%SetProperty($Object.prototype, "valueOf", function() { function ObjectValueOf() {
return this; return this;
}, DONT_ENUM); }
// ECMA-262, section 15.2.4.5, page 85. // ECMA-262 - 15.2.4.5
%SetProperty($Object.prototype, "hasOwnProperty", function(V) { function ObjectHasOwnProperty(V) {
return %HasLocalProperty(ToObject(this), ToString(V)); return %HasLocalProperty(ToObject(this), ToString(V));
}, DONT_ENUM); }
// ECMA-262, section 15.2.4.6, page 85. // ECMA-262 - 15.2.4.6
%SetProperty($Object.prototype, "isPrototypeOf", function(V) { function ObjectIsPrototypeOf(V) {
if (!IS_OBJECT(V) && !IS_FUNCTION(V)) return false; if (!IS_OBJECT(V) && !IS_FUNCTION(V)) return false;
return %IsInPrototypeChain(this, V); return %IsInPrototypeChain(this, V);
}, DONT_ENUM); }
// ECMA-262, section 15.2.4.6, page 85. // ECMA-262 - 15.2.4.6
%SetProperty($Object.prototype, "propertyIsEnumerable", function(V) { function ObjectPropertyIsEnumerable(V) {
if (this == null) return false; if (this == null) return false;
if (!IS_OBJECT(this) && !IS_FUNCTION(this)) return false; if (!IS_OBJECT(this) && !IS_FUNCTION(this)) return false;
return %IsPropertyEnumerable(this, ToString(V)); return %IsPropertyEnumerable(this, ToString(V));
}, DONT_ENUM); }
// Extensions for providing property getters and setters. // Extensions for providing property getters and setters.
%SetProperty($Object.prototype, "__defineGetter__", function(name, fun) { function ObjectDefineGetter(name, fun) {
if (this == null) { if (this == null) {
throw new $TypeError('Object.prototype.__defineGetter__: this is Null'); throw new $TypeError('Object.prototype.__defineGetter__: this is Null');
} }
...@@ -169,19 +222,18 @@ $Object.prototype.constructor = $Object; ...@@ -169,19 +222,18 @@ $Object.prototype.constructor = $Object;
throw new $TypeError('Object.prototype.__defineGetter__: Expecting function'); throw new $TypeError('Object.prototype.__defineGetter__: Expecting function');
} }
return %DefineAccessor(ToObject(this), ToString(name), GETTER, fun); return %DefineAccessor(ToObject(this), ToString(name), GETTER, fun);
}, DONT_ENUM); }
%SetProperty($Object.prototype, "__lookupGetter__", function(name) { function ObjectLookupGetter(name) {
if (this == null) { if (this == null) {
throw new $TypeError('Object.prototype.__lookupGetter__: this is Null'); throw new $TypeError('Object.prototype.__lookupGetter__: this is Null');
} }
return %LookupAccessor(ToObject(this), ToString(name), GETTER); return %LookupAccessor(ToObject(this), ToString(name), GETTER);
}, DONT_ENUM); }
%SetProperty($Object.prototype, "__defineSetter__", function(name, fun) { function ObjectDefineSetter(name, fun) {
if (this == null) { if (this == null) {
throw new $TypeError('Object.prototype.__defineSetter__: this is Null'); throw new $TypeError('Object.prototype.__defineSetter__: this is Null');
} }
...@@ -190,15 +242,15 @@ $Object.prototype.constructor = $Object; ...@@ -190,15 +242,15 @@ $Object.prototype.constructor = $Object;
'Object.prototype.__defineSetter__: Expecting function'); 'Object.prototype.__defineSetter__: Expecting function');
} }
return %DefineAccessor(ToObject(this), ToString(name), SETTER, fun); return %DefineAccessor(ToObject(this), ToString(name), SETTER, fun);
}, DONT_ENUM); }
%SetProperty($Object.prototype, "__lookupSetter__", function(name) { function ObjectLookupSetter(name) {
if (this == null) { if (this == null) {
throw new $TypeError('Object.prototype.__lookupSetter__: this is Null'); throw new $TypeError('Object.prototype.__lookupSetter__: this is Null');
} }
return %LookupAccessor(ToObject(this), ToString(name), SETTER); return %LookupAccessor(ToObject(this), ToString(name), SETTER);
}, DONT_ENUM); }
%SetCode($Object, function(x) { %SetCode($Object, function(x) {
...@@ -213,50 +265,60 @@ $Object.prototype.constructor = $Object; ...@@ -213,50 +265,60 @@ $Object.prototype.constructor = $Object;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Global stuff...
%SetProperty(global, "eval", function(x) {
if (!IS_STRING(x)) return x;
var f = %CompileString(x, 0, true);
if (!IS_FUNCTION(f)) return f;
return f.call(%EvalReceiver(this));
}, DONT_ENUM);
function SetupObject() {
// Setup non-enumerable functions on the Object.prototype object.
InstallFunctions($Object.prototype, DONT_ENUM, $Array(
"toString", ObjectToString,
"toLocaleString", ObjectToLocaleString,
"valueOf", ObjectValueOf,
"hasOwnProperty", ObjectHasOwnProperty,
"isPrototypeOf", ObjectIsPrototypeOf,
"propertyIsEnumerable", ObjectPropertyIsEnumerable,
"__defineGetter__", ObjectDefineGetter,
"__lookupGetter__", ObjectLookupGetter,
"__defineSetter__", ObjectDefineSetter,
"__lookupSetter__", ObjectLookupSetter
));
}
// execScript for IE compatibility. SetupObject();
%SetProperty(global, "execScript", function(expr, lang) {
// NOTE: We don't care about the character casing.
if (!lang || /javascript/i.test(lang)) {
var f = %CompileString(ToString(expr), 0, false);
f.call(global);
}
return null;
}, DONT_ENUM);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Boolean // Boolean
%SetProperty($Boolean.prototype, "toString", function() { function BooleanToString() {
// NOTE: Both Boolean objects and values can enter here as // NOTE: Both Boolean objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262. // 'this'. This is not as dictated by ECMA-262.
if (!IS_BOOLEAN(this) && %ClassOf(this) !== 'Boolean') if (!IS_BOOLEAN(this) && %ClassOf(this) !== 'Boolean')
throw new $TypeError('Boolean.prototype.toString is not generic'); throw new $TypeError('Boolean.prototype.toString is not generic');
return ToString(%_ValueOf(this)); return ToString(%_ValueOf(this));
}, DONT_ENUM); }
%SetProperty($Boolean.prototype, "valueOf", function() { function BooleanValueOf() {
// NOTE: Both Boolean objects and values can enter here as // NOTE: Both Boolean objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262. // 'this'. This is not as dictated by ECMA-262.
if (!IS_BOOLEAN(this) && %ClassOf(this) !== 'Boolean') if (!IS_BOOLEAN(this) && %ClassOf(this) !== 'Boolean')
throw new $TypeError('Boolean.prototype.valueOf is not generic'); throw new $TypeError('Boolean.prototype.valueOf is not generic');
return %_ValueOf(this); return %_ValueOf(this);
}, DONT_ENUM); }
// ----------------------------------------------------------------------------
function SetupBoolean() {
InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
"toString", BooleanToString,
"valueOf", BooleanValueOf
));
}
SetupBoolean();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Number // Number
...@@ -272,34 +334,8 @@ $Object.prototype.constructor = $Object; ...@@ -272,34 +334,8 @@ $Object.prototype.constructor = $Object;
%FunctionSetPrototype($Number, new $Number(0)); %FunctionSetPrototype($Number, new $Number(0));
%SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
// ECMA-262 section 15.7.3.1.
%SetProperty($Number,
"MAX_VALUE",
1.7976931348623157e+308,
DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.2.
%SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.3.
%SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.4.
%SetProperty($Number,
"NEGATIVE_INFINITY",
-1/0,
DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.5.
%SetProperty($Number,
"POSITIVE_INFINITY",
1/0,
DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.4.2. // ECMA-262 section 15.7.4.2.
%SetProperty($Number.prototype, "toString", function(radix) { function NumberToString(radix) {
// NOTE: Both Number objects and values can enter here as // NOTE: Both Number objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262. // 'this'. This is not as dictated by ECMA-262.
var number = this; var number = this;
...@@ -321,38 +357,38 @@ $Object.prototype.constructor = $Object; ...@@ -321,38 +357,38 @@ $Object.prototype.constructor = $Object;
} }
// Convert the number to a string in the given radix. // Convert the number to a string in the given radix.
return %NumberToRadixString(number, radix); return %NumberToRadixString(number, radix);
}, DONT_ENUM); }
// ECMA-262 section 15.7.4.3 // ECMA-262 section 15.7.4.3
%SetProperty($Number.prototype, "toLocaleString", function() { function NumberToLocaleString() {
return this.toString(); return this.toString();
}, DONT_ENUM); }
// ECMA-262 section 15.7.4.4 // ECMA-262 section 15.7.4.4
%SetProperty($Number.prototype, "valueOf", function() { function NumberValueOf() {
// NOTE: Both Number objects and values can enter here as // NOTE: Both Number objects and values can enter here as
// 'this'. This is not as dictated by ECMA-262. // 'this'. This is not as dictated by ECMA-262.
if (!IS_NUMBER(this) && %ClassOf(this) !== 'Number') if (!IS_NUMBER(this) && %ClassOf(this) !== 'Number')
throw new $TypeError('Number.prototype.valueOf is not generic'); throw new $TypeError('Number.prototype.valueOf is not generic');
return %_ValueOf(this); return %_ValueOf(this);
}, DONT_ENUM); }
// ECMA-262 section 15.7.4.5 // ECMA-262 section 15.7.4.5
%SetProperty($Number.prototype, "toFixed", function(fractionDigits) { function NumberToFixed(fractionDigits) {
var f = TO_INTEGER(fractionDigits); var f = TO_INTEGER(fractionDigits);
if (f < 0 || f > 20) { if (f < 0 || f > 20) {
throw new $RangeError("toFixed() digits argument must be between 0 and 20"); throw new $RangeError("toFixed() digits argument must be between 0 and 20");
} }
var x = ToNumber(this); var x = ToNumber(this);
return %NumberToFixed(x, f); return %NumberToFixed(x, f);
}, DONT_ENUM); }
// ECMA-262 section 15.7.4.6 // ECMA-262 section 15.7.4.6
%SetProperty($Number.prototype, "toExponential", function(fractionDigits) { function NumberToExponential(fractionDigits) {
var f = -1; var f = -1;
if (!IS_UNDEFINED(fractionDigits)) { if (!IS_UNDEFINED(fractionDigits)) {
f = TO_INTEGER(fractionDigits); f = TO_INTEGER(fractionDigits);
...@@ -362,11 +398,11 @@ $Object.prototype.constructor = $Object; ...@@ -362,11 +398,11 @@ $Object.prototype.constructor = $Object;
} }
var x = ToNumber(this); var x = ToNumber(this);
return %NumberToExponential(x, f); return %NumberToExponential(x, f);
}, DONT_ENUM); }
// ECMA-262 section 15.7.4.7 // ECMA-262 section 15.7.4.7
%SetProperty($Number.prototype, "toPrecision", function(precision) { function NumberToPrecision(precision) {
if (IS_UNDEFINED(precision)) return ToString(%_ValueOf(this)); if (IS_UNDEFINED(precision)) return ToString(%_ValueOf(this));
var p = TO_INTEGER(precision); var p = TO_INTEGER(precision);
if (p < 1 || p > 21) { if (p < 1 || p > 21) {
...@@ -374,7 +410,52 @@ $Object.prototype.constructor = $Object; ...@@ -374,7 +410,52 @@ $Object.prototype.constructor = $Object;
} }
var x = ToNumber(this); var x = ToNumber(this);
return %NumberToPrecision(x, p); return %NumberToPrecision(x, p);
}, DONT_ENUM); }
// ----------------------------------------------------------------------------
function SetupNumber() {
// Setup the constructor property on the Number prototype object.
%SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
// ECMA-262 section 15.7.3.1.
%SetProperty($Number,
"MAX_VALUE",
1.7976931348623157e+308,
DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.2.
%SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.3.
%SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.4.
%SetProperty($Number,
"NEGATIVE_INFINITY",
-1/0,
DONT_ENUM | DONT_DELETE | READ_ONLY);
// ECMA-262 section 15.7.3.5.
%SetProperty($Number,
"POSITIVE_INFINITY",
1/0,
DONT_ENUM | DONT_DELETE | READ_ONLY);
// Setup non-enumerable functions on the Number prototype object.
InstallFunctions($Number.prototype, DONT_ENUM, $Array(
"toString", NumberToString,
"toLocaleString", NumberToLocaleString,
"valueOf", NumberValueOf,
"toFixed", NumberToFixed,
"toExponential", NumberToExponential,
"toPrecision", NumberToPrecision
));
}
SetupNumber();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -382,7 +463,6 @@ $Object.prototype.constructor = $Object; ...@@ -382,7 +463,6 @@ $Object.prototype.constructor = $Object;
$Function.prototype.constructor = $Function; $Function.prototype.constructor = $Function;
function FunctionSourceString(func) { function FunctionSourceString(func) {
// NOTE: Both Function objects and values can enter here as // NOTE: Both Function objects and values can enter here as
// 'func'. This is not as dictated by ECMA-262. // 'func'. This is not as dictated by ECMA-262.
...@@ -411,9 +491,9 @@ function FunctionSourceString(func) { ...@@ -411,9 +491,9 @@ function FunctionSourceString(func) {
} }
%SetProperty($Function.prototype, "toString", function() { function FunctionToString() {
return FunctionSourceString(this); return FunctionSourceString(this);
}, DONT_ENUM); }
function NewFunction(arg1) { // length == 1 function NewFunction(arg1) { // length == 1
...@@ -442,3 +522,14 @@ function NewFunction(arg1) { // length == 1 ...@@ -442,3 +522,14 @@ function NewFunction(arg1) { // length == 1
} }
%SetCode($Function, NewFunction); %SetCode($Function, NewFunction);
// ----------------------------------------------------------------------------
function SetupFunction() {
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
"toString", FunctionToString
));
}
SetupFunction();
...@@ -42,6 +42,12 @@ var arrayPrototypeFunctions = [ ...@@ -42,6 +42,12 @@ var arrayPrototypeFunctions = [
TestFunctionNames(Array.prototype, arrayPrototypeFunctions); TestFunctionNames(Array.prototype, arrayPrototypeFunctions);
// Boolean prototype functions.
var booleanPrototypeFunctions = [ "toString", "valueOf" ];
TestFunctionNames(Boolean.prototype, booleanPrototypeFunctions);
// Date functions. // Date functions.
var dateFunctions = ["UTC", "parse", "now"]; var dateFunctions = ["UTC", "parse", "now"];
...@@ -65,6 +71,11 @@ var datePrototypeFunctions = [ ...@@ -65,6 +71,11 @@ var datePrototypeFunctions = [
TestFunctionNames(Date.prototype, datePrototypeFunctions); TestFunctionNames(Date.prototype, datePrototypeFunctions);
// Function.prototype functions.
var functionPrototypeFunctions = [ "toString", "apply", "call" ];
TestFunctionNames(Function.prototype, functionPrototypeFunctions);
// Math functions. // Math functions.
var mathFunctions = [ var mathFunctions = [
"random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor", "random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor",
...@@ -73,6 +84,21 @@ var mathFunctions = [ ...@@ -73,6 +84,21 @@ var mathFunctions = [
TestFunctionNames(Math, mathFunctions); TestFunctionNames(Math, mathFunctions);
// Number.prototype functions.
var numberPrototypeFunctions = [
"toString", "toLocaleString", "valueOf", "toFixed", "toExponential",
"toPrecision"];
TestFunctionNames(Number.prototype, numberPrototypeFunctions);
// Object.prototype functions.
var objectPrototypeFunctions = [
"toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf",
"propertyIsEnumerable", "__defineGetter__", "__lookupGetter__",
"__defineSetter__", "__lookupSetter__"];
TestFunctionNames(Object.prototype, objectPrototypeFunctions);
// RegExp.prototype functions. // RegExp.prototype functions.
var regExpPrototypeFunctions = ["exec", "test", "toString", "compile"]; var regExpPrototypeFunctions = ["exec", "test", "toString", "compile"];
...@@ -101,6 +127,7 @@ var globalFunctions = [ ...@@ -101,6 +127,7 @@ var globalFunctions = [
"escape", "unescape", "decodeURI", "decodeURIComponent", "escape", "unescape", "decodeURI", "decodeURIComponent",
"encodeURI", "encodeURIComponent", "Error", "TypeError", "encodeURI", "encodeURIComponent", "Error", "TypeError",
"RangeError", "SyntaxError", "ReferenceError", "EvalError", "RangeError", "SyntaxError", "ReferenceError", "EvalError",
"URIError"]; "URIError", "isNaN", "isFinite", "parseInt", "parseFloat",
"eval", "execScript"];
TestFunctionNames(this, globalFunctions); TestFunctionNames(this, globalFunctions);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment