Roll V8 back to 3.6
Roll back to V8 3.6 to fix x86 build, we don't have ucontext.h.
This reverts commits:
5d4cdbf7a67d3662fa0bee4efdb7edd8daec9b0b
c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9
592a9fc1d8ea420377a2e7efd0600e20b058be2b
Bug: 5688872
Change-Id: Ic961bb5e65b778e98bbfb71cce71d99fa949e995
diff --git a/test/mjsunit/undeletable-functions.js b/test/mjsunit/undeletable-functions.js
index 635ea6f..04fd060 100644
--- a/test/mjsunit/undeletable-functions.js
+++ b/test/mjsunit/undeletable-functions.js
@@ -25,8 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Test that we match ECMAScript in making most builtin functions
-// deletable and only specific ones undeletable or read-only.
+// Test that we match JSC in making some functions undeletable.
+// See http://code.google.com/p/chromium/issues/detail?id=1717
+// The functions on these prototypes are not just undeletable. It is
+// possible to override them with new definitions, then get the old
+// version back by deleting the new definition.
var array;
@@ -34,7 +37,7 @@
"toString", "toLocaleString", "join", "pop", "push", "concat", "reverse",
"shift", "unshift", "slice", "splice", "sort", "filter", "forEach", "some",
"every", "map", "indexOf", "lastIndexOf", "reduce", "reduceRight"];
-CheckEcmaSemantics(Array.prototype, array, "Array prototype");
+CheckJSCSemantics(Array.prototype, array, "Array prototype");
var old_Array_prototype = Array.prototype;
var new_Array_prototype = {};
@@ -54,12 +57,12 @@
"setUTCMinutes", "setHours", "setUTCHours", "setDate", "setUTCDate",
"setMonth", "setUTCMonth", "setFullYear", "setUTCFullYear", "toGMTString",
"toUTCString", "getYear", "setYear", "toISOString", "toJSON"];
-CheckEcmaSemantics(Date.prototype, array, "Date prototype");
+CheckJSCSemantics(Date.prototype, array, "Date prototype");
array = [
"random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor", "log",
"round", "sin", "sqrt", "tan", "atan2", "pow", "max", "min"];
-CheckEcmaSemantics(Math, array, "Math1");
+CheckJSCSemantics(Math, array, "Math1");
CheckEcmaSemantics(Date, ["UTC", "parse", "now"], "Date");
@@ -73,8 +76,6 @@
"execScript"];
CheckEcmaSemantics(this, array, "Global");
CheckReadOnlyAttr(this, "Infinity");
-CheckReadOnlyAttr(this, "NaN");
-CheckReadOnlyAttr(this, "undefined");
array = ["exec", "test", "toString", "compile"];
CheckEcmaSemantics(RegExp.prototype, array, "RegExp prototype");
@@ -111,7 +112,7 @@
"toUpperCase", "toLocaleUpperCase", "link", "anchor", "fontcolor", "fontsize",
"big", "blink", "bold", "fixed", "italics", "small", "strike", "sub", "sup",
"toJSON", "toString", "valueOf"];
-CheckEcmaSemantics(String.prototype, array, "String prototype");
+CheckJSCSemantics(String.prototype, array, "String prototype");
CheckEcmaSemantics(String, ["fromCharCode"], "String");
@@ -123,6 +124,14 @@
}
+function CheckJSCSemantics(type, props, name) {
+ print(name);
+ for (var i = 0; i < props.length; i++) {
+ CheckNotDeletable(type, props[i]);
+ }
+}
+
+
function CheckDontDelete(type, props, name) {
print(name);
for (var i = 0; i < props.length; i++) {
@@ -145,6 +154,21 @@
}
+function CheckNotDeletable(type, prop) {
+ var old = type[prop];
+ if (!type[prop]) return;
+ assertTrue(type.hasOwnProperty(prop), "inherited: " + prop);
+ var deleted = delete type[prop];
+ assertTrue(deleted, "delete operator returned false: " + prop);
+ assertTrue(type.hasOwnProperty(prop), "not there after delete: " + prop);
+ type[prop] = "foo";
+ assertEquals("foo", type[prop], "not overwritable: " + prop);
+ deleted = delete type[prop];
+ assertTrue(deleted, "delete operator returned false 2nd time: " + prop);
+ assertEquals(old.toString(), type[prop].toString(), "delete didn't restore the old value: " + prop);
+}
+
+
function CheckDontDeleteAttr(type, prop) {
var old = type[prop];
if (!type[prop]) return;
@@ -165,7 +189,7 @@
assertFalse(deleted, "delete operator returned true: " + prop);
assertTrue(type.hasOwnProperty(prop), "not there after delete: " + prop);
type[prop] = "foo";
- assertEquals(old, type[prop], "overwritable: " + prop);
+ assertEquals("foo", type[prop], "overwritable: " + prop);
}
print("OK");