diff options
| author | Ben Murdoch <benm@google.com> | 2011-11-30 16:04:58 +0000 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-12-02 17:28:30 +0000 |
| commit | 589d6979ff2ef66fca2d8fa51404c369ca5e9250 (patch) | |
| tree | 1d9032fcae9d18a05430a4ba9c14e5c635c4096e /src/array.js | |
| parent | 69a99ed0b2b2ef69d393c371b03db3a98aaf880e (diff) | |
| download | android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.tar.gz android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.tar.bz2 android_external_v8-589d6979ff2ef66fca2d8fa51404c369ca5e9250.zip | |
Upgrade to V8 3.6
Merge V8 at 3.6.6.11
Simple merge required updates to makefiles only.
Bug: 5688872
Change-Id: Ib38b7ffbcd409585f6cb6fccc59c767029cecc77
Diffstat (limited to 'src/array.js')
| -rw-r--r-- | src/array.js | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/array.js b/src/array.js index f73b0c1b..98fe3ac7 100644 --- a/src/array.js +++ b/src/array.js @@ -208,7 +208,7 @@ function ConvertToLocaleString(e) { // Call ToString if toLocaleString is not a function. // See issue 877615. var e_obj = ToObject(e); - if (IS_FUNCTION(e_obj.toLocaleString)) + if (IS_SPEC_FUNCTION(e_obj.toLocaleString)) return ToString(e_obj.toLocaleString()); else return ToString(e); @@ -730,7 +730,7 @@ function ArraySort(comparefn) { // In-place QuickSort algorithm. // For short (length <= 22) arrays, insertion sort is used for efficiency. - if (!IS_FUNCTION(comparefn)) { + if (!IS_SPEC_FUNCTION(comparefn)) { comparefn = function (x, y) { if (x === y) return 0; if (%_IsSmi(x) && %_IsSmi(y)) { @@ -993,7 +993,7 @@ function ArrayFilter(f, receiver) { ["Array.prototype.filter"]); } - if (!IS_FUNCTION(f)) { + if (!IS_SPEC_FUNCTION(f)) { throw MakeTypeError('called_non_callable', [ f ]); } if (IS_NULL_OR_UNDEFINED(receiver)) { @@ -1022,7 +1022,7 @@ function ArrayForEach(f, receiver) { ["Array.prototype.forEach"]); } - if (!IS_FUNCTION(f)) { + if (!IS_SPEC_FUNCTION(f)) { throw MakeTypeError('called_non_callable', [ f ]); } if (IS_NULL_OR_UNDEFINED(receiver)) { @@ -1048,7 +1048,7 @@ function ArraySome(f, receiver) { ["Array.prototype.some"]); } - if (!IS_FUNCTION(f)) { + if (!IS_SPEC_FUNCTION(f)) { throw MakeTypeError('called_non_callable', [ f ]); } if (IS_NULL_OR_UNDEFINED(receiver)) { @@ -1073,7 +1073,7 @@ function ArrayEvery(f, receiver) { ["Array.prototype.every"]); } - if (!IS_FUNCTION(f)) { + if (!IS_SPEC_FUNCTION(f)) { throw MakeTypeError('called_non_callable', [ f ]); } if (IS_NULL_OR_UNDEFINED(receiver)) { @@ -1097,7 +1097,7 @@ function ArrayMap(f, receiver) { ["Array.prototype.map"]); } - if (!IS_FUNCTION(f)) { + if (!IS_SPEC_FUNCTION(f)) { throw MakeTypeError('called_non_callable', [ f ]); } if (IS_NULL_OR_UNDEFINED(receiver)) { @@ -1245,7 +1245,7 @@ function ArrayReduce(callback, current) { ["Array.prototype.reduce"]); } - if (!IS_FUNCTION(callback)) { + if (!IS_SPEC_FUNCTION(callback)) { throw MakeTypeError('called_non_callable', [callback]); } @@ -1281,7 +1281,7 @@ function ArrayReduceRight(callback, current) { ["Array.prototype.reduceRight"]); } - if (!IS_FUNCTION(callback)) { + if (!IS_SPEC_FUNCTION(callback)) { throw MakeTypeError('called_non_callable', [callback]); } var i = ToUint32(this.length) - 1; @@ -1314,12 +1314,13 @@ function ArrayIsArray(obj) { // ------------------------------------------------------------------- -function SetupArray() { - // Setup non-enumerable constructor property on the Array.prototype +function SetUpArray() { + %CheckIsBootstrapping(); + // Set up non-enumerable constructor property on the Array.prototype // object. %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM); - // Setup non-enumerable functions on the Array object. + // Set up non-enumerable functions on the Array object. InstallFunctions($Array, DONT_ENUM, $Array( "isArray", ArrayIsArray )); @@ -1337,7 +1338,7 @@ function SetupArray() { return f; } - // Setup non-enumerable functions of the Array.prototype object and + // Set up non-enumerable functions of the Array.prototype object and // set their names. // Manipulate the length of some of the functions to meet // expectations set by ECMA-262 or Mozilla. @@ -1368,19 +1369,13 @@ function SetupArray() { %FinishArrayPrototypeSetup($Array.prototype); // The internal Array prototype doesn't need to be fancy, since it's never - // exposed to user code, so no hidden prototypes or DONT_ENUM attributes - // are necessary. - // The null __proto__ ensures that we never inherit any user created - // getters or setters from, e.g., Object.prototype. - InternalArray.prototype.__proto__ = null; - // Adding only the functions that are actually used, and a toString. - InternalArray.prototype.join = getFunction("join", ArrayJoin); - InternalArray.prototype.pop = getFunction("pop", ArrayPop); - InternalArray.prototype.push = getFunction("push", ArrayPush); - InternalArray.prototype.toString = function() { - return "Internal Array, length " + this.length; - }; + // exposed to user code. + // Adding only the functions that are actually used. + SetUpLockedPrototype(InternalArray, $Array(), $Array( + "join", getFunction("join", ArrayJoin), + "pop", getFunction("pop", ArrayPop), + "push", getFunction("push", ArrayPush) + )); } - -SetupArray(); +SetUpArray(); |
