Revision: 20717
Author: [email protected]
Date: Mon Apr 14 11:24:40 2014 UTC
Log: Try to switch Array builtins into strict mode.
[email protected]
TEST=mjsunit,test262,webkit
Review URL: https://codereview.chromium.org/233083003
http://code.google.com/p/v8/source/detail?r=20717
Modified:
/branches/bleeding_edge/src/array.js
/branches/bleeding_edge/src/promise.js
/branches/bleeding_edge/test/mjsunit/function-caller.js
/branches/bleeding_edge/test/mjsunit/object-freeze.js
/branches/bleeding_edge/test/mjsunit/regress/regress-1548.js
/branches/bleeding_edge/test/mjsunit/regress/regress-2419.js
=======================================
--- /branches/bleeding_edge/src/array.js Wed Apr 9 09:14:56 2014 UTC
+++ /branches/bleeding_edge/src/array.js Mon Apr 14 11:24:40 2014 UTC
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"use strict";
+
// This file relies on the fact that the following declarations have been
made
// in runtime.js:
// var $Array = global.Array;
=======================================
--- /branches/bleeding_edge/src/promise.js Mon Mar 31 12:40:32 2014 UTC
+++ /branches/bleeding_edge/src/promise.js Mon Apr 14 11:24:40 2014 UTC
@@ -25,7 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"use strict";
// This file relies on the fact that the following declaration has been
made
=======================================
--- /branches/bleeding_edge/test/mjsunit/function-caller.js Thu Aug 25
13:38:58 2011 UTC
+++ /branches/bleeding_edge/test/mjsunit/function-caller.js Mon Apr 14
11:24:40 2014 UTC
@@ -46,10 +46,10 @@
// Check called from eval.
eval('f(null)');
-// Check called from builtin functions. Only show the initially called
-// (publicly exposed) builtin function, not it's internal helper functions.
-[Array.prototype.sort, Array.prototype.sort].sort(f);
+// Check called from strict builtin functions.
+[null, null].sort(f);
+// Check called from sloppy builtin functions.
"abel".replace(/b/g, function h() {
assertEquals(String.prototype.replace, h.caller);
});
=======================================
--- /branches/bleeding_edge/test/mjsunit/object-freeze.js Fri Nov 29
15:22:16 2013 UTC
+++ /branches/bleeding_edge/test/mjsunit/object-freeze.js Mon Apr 14
11:24:40 2014 UTC
@@ -322,13 +322,15 @@
// sufficient.
assertTrue(Object.isSealed(obj));
-assertDoesNotThrow(function() { obj.push(); });
-assertDoesNotThrow(function() { obj.unshift(); });
-assertDoesNotThrow(function() { obj.splice(0,0); });
+// Verify that the length can't be written by builtins.
+assertThrows(function() { obj.push(); }, TypeError);
+assertThrows(function() { obj.unshift(); }, TypeError);
+assertThrows(function() { obj.splice(0,0); }, TypeError);
assertTrue(Object.isFrozen(obj));
// Verify that an item can't be changed with splice.
assertThrows(function() { obj.splice(0,1,1); }, TypeError);
+assertTrue(Object.isFrozen(obj));
// Verify that unshift() with no arguments will fail if it reifies from
// the prototype into the object.
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-1548.js Mon Sep 19
18:36:47 2011 UTC
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-1548.js Mon Apr 14
11:24:40 2014 UTC
@@ -30,19 +30,19 @@
function testfn(f) { return [1].map(f)[0]; }
function foo() { return [].map.caller; }
-assertEquals(null, testfn(foo));
+assertThrows(function() { testfn(foo); } );
// Try to delete the caller property (to make sure that we can't get to the
// caller accessor on the prototype.
delete Array.prototype.map.caller;
-assertEquals(null, testfn(foo));
+assertThrows(function() { testfn(foo); } );
// Redo tests with arguments object.
function testarguments(f) { return [1].map(f)[0]; }
function bar() { return [].map.arguments; }
-assertEquals(null, testfn(bar));
+assertThrows(function() { testarguments(bar); } );
// Try to delete the arguments property (to make sure that we can't get to
the
// caller accessor on the prototype.
delete Array.prototype.map.arguments;
-assertEquals(null, testarguments(bar));
+assertThrows(function() { testarguments(bar); } );
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-2419.js Fri Nov 22
13:50:39 2013 UTC
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-2419.js Mon Apr 14
11:24:40 2014 UTC
@@ -27,10 +27,10 @@
var a = [5, 4, 3, 2, 1, 0];
Object.freeze(a);
-a.sort();
+assertThrows(function() { a.sort(); });
assertArrayEquals([5, 4, 3, 2, 1, 0], a);
var b = {0: 5, 1: 4, 2: 3, 3: 2, 4: 1, 5: 0, length: 6};
Object.freeze(b);
-Array.prototype.sort.call(b);
+assertThrows(function() { Array.prototype.sort.call(b); });
assertPropertiesEqual({0: 5, 1: 4, 2: 3, 3: 2, 4: 1, 5: 0, length: 6}, b);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.