Version 3.6.0
Fixed a bug when optimizing named function expression (issue 1647).
Fixed a bug when optimizing f.call.apply (issue 1650).
Made arguments and caller always be null on native functions (issues 1548 and 1643).
Fixed issue 1648 (cross-compiling x64 targeting ia32).
Fixed issue 371 (d8 printing of strings containing \0).
Fixed order of evaluation in arguments to parseInt (issue 1649).
Fixed a problem with large heap snapshots in Chrome DevTools (issue 1658, chromium issue 89268).
Upped default maximum heap size from 512M to 700M.
git-svn-id: http://v8.googlecode.com/svn/trunk@9132 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/test/mjsunit/array-constructor.js b/test/mjsunit/array-constructor.js
index 063ccde..bf5d3d6 100644
--- a/test/mjsunit/array-constructor.js
+++ b/test/mjsunit/array-constructor.js
@@ -73,7 +73,7 @@
a = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8);
assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8], a);
a = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);
+ assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);
}
@@ -91,9 +91,9 @@
var a = eval('[' + str + ']');
var b = eval('new Array(' + str + ')')
var c = eval('Array(' + str + ')')
- assertEquals(n, a.length);
- assertArrayEquals(a, b);
- assertArrayEquals(a, c);
+ assertEquals(n, a.length);
+ assertArrayEquals(a, b);
+ assertArrayEquals(a, c);
}
diff --git a/test/mjsunit/array-iteration.js b/test/mjsunit/array-iteration.js
index f11b51c..0ee2e6e 100644
--- a/test/mjsunit/array-iteration.js
+++ b/test/mjsunit/array-iteration.js
@@ -134,7 +134,7 @@
a = [0,1];
assertFalse(a.every(function(n, index, array) { array[index] = n + 1; return n == 1;}));
assertArrayEquals([1,1], a);
-
+
// Only loop through initial part of array eventhough elements are
// added.
a = [1,1];
@@ -156,23 +156,23 @@
//
(function() {
var a = [0,1,2,3,4];
-
+
// Simple use.
var result = [1,2,3,4,5];
assertArrayEquals(result, a.map(function(n) { return n + 1; }));
assertEquals(a, a);
-
+
// Use specified object as this object when calling the function.
var o = { delta: 42 }
result = [42,43,44,45,46];
assertArrayEquals(result, a.map(function(n) { return this.delta + n; }, o));
-
+
// Modify original array.
a = [0,1,2,3,4];
result = [1,2,3,4,5];
assertArrayEquals(result, a.map(function(n, index, array) { array[index] = n + 1; return n + 1;}));
assertArrayEquals(result, a);
-
+
// Only loop through initial part of array eventhough elements are
// added.
a = [0,1,2,3,4];
@@ -197,7 +197,7 @@
// Simple use.
assertTrue(a.some(function(n) { return n == 3}));
assertFalse(a.some(function(n) { return n == 5}));
-
+
// Use specified object as this object when calling the function.
var o = { element: 42 };
a = [1,42,3];
diff --git a/test/mjsunit/array-sort.js b/test/mjsunit/array-sort.js
index fd18a5b..3fa623a 100644
--- a/test/mjsunit/array-sort.js
+++ b/test/mjsunit/array-sort.js
@@ -392,7 +392,7 @@
// Test that sort calls compare function with global object as receiver,
// and with only elements of the array as arguments.
-function o(v) {
+function o(v) {
return {__proto__: o.prototype, val: v};
}
var arr = [o(1), o(2), o(4), o(8), o(16), o(32), o(64), o(128), o(256), o(-0)];
diff --git a/test/mjsunit/bugs/618.js b/test/mjsunit/bugs/618.js
index afa9929..ddc0c19 100644
--- a/test/mjsunit/bugs/618.js
+++ b/test/mjsunit/bugs/618.js
@@ -32,14 +32,14 @@
var c1 = new C1();
assertEquals(23, c1.x);
assertEquals("undefined", typeof c1.y);
-
+
// Add setter somewhere on the prototype chain after having constructed the
// first instance.
C1.prototype = { set x(value) { this.y = 23; } };
var c1 = new C1();
assertEquals("undefined", typeof c1.x);
assertEquals(23, c1.y);
-
+
// Simple class using inline constructor.
function C2() {
this.x = 23;
diff --git a/test/mjsunit/bugs/bug-618.js b/test/mjsunit/bugs/bug-618.js
index 8f47440..ae84326 100644
--- a/test/mjsunit/bugs/bug-618.js
+++ b/test/mjsunit/bugs/bug-618.js
@@ -33,11 +33,11 @@
this.x = 23;
}
-// If a setter is added to the prototype chain of a simple constructor setting
-// one of the properties assigned in the constructor then this setter is
+// If a setter is added to the prototype chain of a simple constructor setting
+// one of the properties assigned in the constructor then this setter is
// ignored when constructing new objects from the constructor.
-// This only happens if the setter is added _after_ an instance has been
+// This only happens if the setter is added _after_ an instance has been
// created.
assertEquals(23, new C().x);
diff --git a/test/mjsunit/builtins.js b/test/mjsunit/builtins.js
new file mode 100644
index 0000000..340b03d
--- /dev/null
+++ b/test/mjsunit/builtins.js
@@ -0,0 +1,83 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --expose-natives-as=builtins
+
+// Checks that all function properties of the builtin object are neither
+// writable nor configurable. Also, theose functions that are actually
+// constructors (recognized by having properties on their .prototype object),
+// have only unconfigurable properties on the prototype, and the methods
+// are also non-writable.
+
+var names = Object.getOwnPropertyNames(builtins);
+
+function isFunction(obj) {
+ return typeof obj == "function";
+}
+
+function checkConstructor(func, name) {
+ // A constructor is a function with a prototype and properties on the
+ // prototype object besides "constructor";
+ if (name.charAt(0) == "$") return;
+ if (typeof func.prototype != "object") return;
+ var propNames = Object.getOwnPropertyNames(func.prototype);
+ if (propNames.length == 0 ||
+ (propNames.length == 1 && propNames[0] == "constructor")) {
+ // Not a constructor.
+ return;
+ }
+ var proto_desc = Object.getOwnPropertyDescriptor(func, "prototype");
+ assertTrue(proto_desc.hasOwnProperty("value"), name);
+ assertFalse(proto_desc.writable, name);
+ assertFalse(proto_desc.configurable, name);
+ var prototype = proto_desc.value;
+ assertEquals(null, prototype.__proto__, name);
+ assertFalse(Object.isExtensible(prototype), name);
+ for (var i = 0; i < propNames.length; i++) {
+ var propName = propNames[i];
+ if (propName == "constructor") continue;
+ var testName = name + "-" + propName;
+ var propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
+ assertTrue(propDesc.hasOwnProperty("value"), testName);
+ assertFalse(propDesc.configurable, testName);
+ if (isFunction(propDesc.value)) {
+ assertFalse(propDesc.writable, testName);
+ }
+ }
+}
+
+for (var i = 0; i < names.length; i++) {
+ var name = names[i];
+ var desc = Object.getOwnPropertyDescriptor(builtins, name);
+ assertTrue(desc.hasOwnProperty("value"));
+ var value = desc.value;
+ if (isFunction(value)) {
+ assertFalse(desc.writable, name);
+ assertFalse(desc.configurable, name);
+ checkConstructor(value, name);
+ }
+}
diff --git a/test/mjsunit/compiler/global-accessors.js b/test/mjsunit/compiler/global-accessors.js
index bd031a8..337424d 100644
--- a/test/mjsunit/compiler/global-accessors.js
+++ b/test/mjsunit/compiler/global-accessors.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This test tests that no bailouts are missing by not hitting asserts in debug
-// mode.
+// mode.
test_count_operation()
test_compound_assignment()
diff --git a/test/mjsunit/const-redecl.js b/test/mjsunit/const-redecl.js
index 26d765b..9459708 100644
--- a/test/mjsunit/const-redecl.js
+++ b/test/mjsunit/const-redecl.js
@@ -55,7 +55,7 @@
function TestGlobal(s,e) {
// Collect the global properties before the call.
var properties = [];
- for (var key in this) properties.push(key);
+ for (var key in this) properties.push(key);
// Compute the result.
var result;
try {
@@ -113,7 +113,7 @@
// Eval second definition.
TestAll("TypeError", def0 + '; eval("' + def1 + '")');
// Eval both definitions separately.
- TestAll("TypeError", 'eval("' + def0 +'"); eval("' + def1 + '")');
+ TestAll("TypeError", 'eval("' + def0 +'"); eval("' + def1 + '")');
}
diff --git a/test/mjsunit/date-parse.js b/test/mjsunit/date-parse.js
index a1eef66..b46e39a 100644
--- a/test/mjsunit/date-parse.js
+++ b/test/mjsunit/date-parse.js
@@ -286,7 +286,7 @@
// Negative tests.
var testCasesNegative = [
'May 25 2008 1:30 (PM)) UTC', // Bad unmatched ')' after number.
- 'May 25 2008 1:30( )AM (PM)', //
+ 'May 25 2008 1:30( )AM (PM)', //
'May 25 2008 AAA (GMT)']; // Unknown word after number.
testCasesNegative.forEach(function (s) {
diff --git a/test/mjsunit/debug-compile-event.js b/test/mjsunit/debug-compile-event.js
index b00a907..94dddfa 100644
--- a/test/mjsunit/debug-compile-event.js
+++ b/test/mjsunit/debug-compile-event.js
@@ -81,7 +81,7 @@
assertTrue('context' in msg.body.script);
// Check that we pick script name from //@ sourceURL, iff present
- assertEquals(current_source.indexOf('sourceURL') >= 0 ?
+ assertEquals(current_source.indexOf('sourceURL') >= 0 ?
'myscript.js' : undefined,
event_data.script().name());
}
diff --git a/test/mjsunit/debug-evaluate-recursive.js b/test/mjsunit/debug-evaluate-recursive.js
index 6ee391b..f34943e 100644
--- a/test/mjsunit/debug-evaluate-recursive.js
+++ b/test/mjsunit/debug-evaluate-recursive.js
@@ -110,7 +110,7 @@
if (event == Debug.DebugEvent.Break)
{
break_count++;
-
+
// Call functions with break using the FrameMirror directly.
if (break_count == 1) {
// First break event evaluates with break enabled.
diff --git a/test/mjsunit/debug-handle.js b/test/mjsunit/debug-handle.js
index 98875ce..1582b9f 100644
--- a/test/mjsunit/debug-handle.js
+++ b/test/mjsunit/debug-handle.js
@@ -72,7 +72,7 @@
// The base part of all lookup requests.
var base_request = '"seq":0,"type":"request","command":"lookup"'
-
+
// Generate request with the supplied arguments.
var request;
if (arguments) {
@@ -214,7 +214,7 @@
'Handle not in the request: ' + handle);
count++;
}
- assertEquals(count, obj.properties.length,
+ assertEquals(count, obj.properties.length,
'Unexpected number of resolved objects');
diff --git a/test/mjsunit/debug-listbreakpoints.js b/test/mjsunit/debug-listbreakpoints.js
index de0114f..1d4755f 100644
--- a/test/mjsunit/debug-listbreakpoints.js
+++ b/test/mjsunit/debug-listbreakpoints.js
@@ -39,7 +39,7 @@
// below. The test checks for these line numbers.
function g() { // line 40
- var x = 5;
+ var x = 5;
var y = 6;
var z = 7;
};
diff --git a/test/mjsunit/debug-references.js b/test/mjsunit/debug-references.js
index ab6c629..763e354 100644
--- a/test/mjsunit/debug-references.js
+++ b/test/mjsunit/debug-references.js
@@ -52,7 +52,7 @@
} else {
request = '{' + base_request + '}'
}
-
+
// Process the request and check expectation.
var response = safeEval(dcp.processDebugJSONRequest(request));
if (success) {
@@ -88,7 +88,7 @@
var response = safeEval(dcp.processDebugJSONRequest(evaluate_point));
assertTrue(response.success, "Evaluation of Point failed");
var handle = response.body.handle;
-
+
// Test some legal references requests.
testRequest(dcp, '{"handle":' + handle + ',"type":"referencedBy"}', true);
testRequest(dcp, '{"handle":' + handle + ',"type":"constructedBy"}',
diff --git a/test/mjsunit/debug-return-value.js b/test/mjsunit/debug-return-value.js
index 3982ea9..02d6a7c 100644
--- a/test/mjsunit/debug-return-value.js
+++ b/test/mjsunit/debug-return-value.js
@@ -103,12 +103,12 @@
// Position at the end of the function.
assertEquals(debugger_source_position + 50,
exec_state.frame(0).sourcePosition());
-
+
// Just about to return from the function.
assertTrue(exec_state.frame(0).isAtReturn())
assertEquals(expected_return_value,
exec_state.frame(0).returnValue().value());
-
+
// Check the same using the JSON commands.
var dcp = exec_state.debugCommandProcessor(false);
var request = '{"seq":0,"type":"request","command":"backtrace"}';
@@ -118,7 +118,7 @@
assertTrue(frames[0].atReturn);
assertEquals(expected_return_value,
response.lookup(frames[0].returnValue.ref).value);
-
+
listener_complete = true;
}
}
@@ -132,7 +132,7 @@
// Four steps from the debugger statement in this function will position us at
// the function return.
-// 0 1 2 3 4 5
+// 0 1 2 3 4 5
// 0123456789012345678901234567890123456789012345678901
function f(x) {debugger; if (x) { return 1; } else { return 2; } };
diff --git a/test/mjsunit/debug-stepin-call-function-stub.js b/test/mjsunit/debug-stepin-call-function-stub.js
index c5cf8fd..053b8bf 100644
--- a/test/mjsunit/debug-stepin-call-function-stub.js
+++ b/test/mjsunit/debug-stepin-call-function-stub.js
@@ -62,7 +62,7 @@
Debug.setListener(listener);
-function g() {
+function g() {
return "s"; // expected line
}
@@ -71,7 +71,7 @@
var s = 1 +f(10);
}
-function g2() {
+function g2() {
return "s2"; // expected line
}
diff --git a/test/mjsunit/debug-stepin-constructor.js b/test/mjsunit/debug-stepin-constructor.js
index 6ee3347..5549814 100644
--- a/test/mjsunit/debug-stepin-constructor.js
+++ b/test/mjsunit/debug-stepin-constructor.js
@@ -38,7 +38,7 @@
if (exec_state.frameCount() > 1) {
exec_state.prepareStep(Debug.StepAction.StepIn);
}
-
+
// Test that there is a script.
assertTrue(typeof(event_data.func().script()) == 'object');
}
diff --git a/test/mjsunit/delete-in-with.js b/test/mjsunit/delete-in-with.js
index 1efc18d..cbcfe99 100644
--- a/test/mjsunit/delete-in-with.js
+++ b/test/mjsunit/delete-in-with.js
@@ -29,6 +29,6 @@
// objects from within 'with' statements.
(function(){
var tmp = { x: 12 };
- with (tmp) { assertTrue(delete x); }
+ with (tmp) { assertTrue(delete x); }
assertFalse("x" in tmp);
})();
diff --git a/test/mjsunit/function-source.js b/test/mjsunit/function-source.js
index 7525775..8f2fc22 100644
--- a/test/mjsunit/function-source.js
+++ b/test/mjsunit/function-source.js
@@ -36,7 +36,7 @@
}
h();
}
-
+
function g() {
function h() {
assertEquals(Debug.scriptSource(f), Debug.scriptSource(h));
diff --git a/test/mjsunit/get-own-property-descriptor.js b/test/mjsunit/get-own-property-descriptor.js
index 79c1fac..abb2420 100644
--- a/test/mjsunit/get-own-property-descriptor.js
+++ b/test/mjsunit/get-own-property-descriptor.js
@@ -27,7 +27,7 @@
// This file only tests very simple descriptors that always have
// configurable, enumerable, and writable set to true.
-// A range of more elaborate tests are performed in
+// A range of more elaborate tests are performed in
// object-define-property.js
function get() { return x; }
diff --git a/test/mjsunit/global-deleted-property-keyed.js b/test/mjsunit/global-deleted-property-keyed.js
index 1a1d3cb..dba3a4d 100644
--- a/test/mjsunit/global-deleted-property-keyed.js
+++ b/test/mjsunit/global-deleted-property-keyed.js
@@ -33,6 +33,6 @@
var name = "fisk";
natives[name] = name;
function foo() { natives[name] + 12; }
-for(var i = 0; i < 3; i++) foo();
+for(var i = 0; i < 3; i++) foo();
delete natives[name];
for(var i = 0; i < 3; i++) foo();
diff --git a/test/mjsunit/harmony/block-conflicts.js b/test/mjsunit/harmony/block-conflicts.js
new file mode 100644
index 0000000..8d3de6f
--- /dev/null
+++ b/test/mjsunit/harmony/block-conflicts.js
@@ -0,0 +1,126 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-block-scoping
+
+// Test for conflicting variable bindings.
+
+function CheckException(e) {
+ var string = e.toString();
+ assertTrue(string.indexOf("has already been declared") >= 0 ||
+ string.indexOf("redeclaration") >= 0); return 'Conflict';
+}
+
+
+function TestFunction(s,e) {
+ try {
+ return eval("(function(){" + s + ";return " + e + "})")();
+ } catch (x) {
+ return CheckException(x);
+ }
+}
+
+
+function TestBlock(s,e) {
+ try {
+ return eval("(function(){ if (true) { " + s + "; }; return " + e + "})")();
+ } catch (x) {
+ return CheckException(x);
+ }
+}
+
+function TestAll(expected,s,opt_e) {
+ var e = "";
+ var msg = s;
+ if (opt_e) { e = opt_e; msg += "; " + opt_e; }
+ assertEquals(expected, TestFunction(s,e), "function:'" + msg + "'");
+ assertEquals(expected, TestBlock(s,e), "block:'" + msg + "'");
+}
+
+
+function TestConflict(s) {
+ TestAll('Conflict', s);
+ TestAll('Conflict', 'eval("' + s + '")');
+}
+
+
+function TestNoConflict(s) {
+ TestAll('NoConflict', s, "'NoConflict'");
+ TestAll('NoConflict', 'eval("' + s + '")', "'NoConflict'");
+}
+
+var letbinds = [ "let x",
+ "let x = 0",
+ "let x = undefined",
+ "function x() { }",
+ "let x = function() {}",
+ "let x, y",
+ "let y, x",
+ ];
+var varbinds = [ "var x",
+ "var x = 0",
+ "var x = undefined",
+ "var x = function() {}",
+ "var x, y",
+ "var y, x",
+ ];
+
+
+for (var l = 0; l < letbinds.length; ++l) {
+ // Test conflicting let/var bindings.
+ for (var v = 0; v < varbinds.length; ++v) {
+ // Same level.
+ TestConflict(letbinds[l] +'; ' + varbinds[v]);
+ TestConflict(varbinds[v] +'; ' + letbinds[l]);
+ // Different level.
+ TestConflict(letbinds[l] +'; {' + varbinds[v] + '; }');
+ TestConflict('{ ' + varbinds[v] +'; }' + letbinds[l]);
+ }
+
+ // Test conflicting let/let bindings.
+ for (var k = 0; k < letbinds.length; ++k) {
+ // Same level.
+ TestConflict(letbinds[l] +'; ' + letbinds[k]);
+ TestConflict(letbinds[k] +'; ' + letbinds[l]);
+ // Different level.
+ TestNoConflict(letbinds[l] +'; { ' + letbinds[k] + '; }');
+ TestNoConflict('{ ' + letbinds[k] +'; } ' + letbinds[l]);
+ }
+
+ // Test conflicting parameter/let bindings.
+ TestConflict('(function (x) { ' + letbinds[l] + '; })()');
+}
+
+// Test conflicting catch/var bindings.
+for (var v = 0; v < varbinds.length; ++v) {
+ TestConflict('try {} catch (x) { ' + varbinds[v] + '; }');
+}
+
+// Test conflicting parameter/var bindings.
+for (var v = 0; v < varbinds.length; ++v) {
+ TestConflict('(function (x) { ' + varbinds[v] + '; })()');
+}
diff --git a/test/mjsunit/harmony/block-let-declaration.js b/test/mjsunit/harmony/block-let-declaration.js
index 19c943f..49b6348 100644
--- a/test/mjsunit/harmony/block-let-declaration.js
+++ b/test/mjsunit/harmony/block-let-declaration.js
@@ -57,11 +57,9 @@
// Unprotected statement
TestLocalThrows("if (true) let x;", SyntaxError);
-TestLocalThrows("with ({}) let x;", SyntaxError);
TestLocalThrows("do let x; while (false)", SyntaxError);
TestLocalThrows("while (false) let x;", SyntaxError);
TestLocalDoesNotThrow("if (true) var x;");
-TestLocalDoesNotThrow("with ({}) var x;");
TestLocalDoesNotThrow("do var x; while (false)");
TestLocalDoesNotThrow("while (false) var x;");
diff --git a/test/mjsunit/harmony/debug-blockscopes.js b/test/mjsunit/harmony/debug-blockscopes.js
index e0df71b..d02c9f6 100644
--- a/test/mjsunit/harmony/debug-blockscopes.js
+++ b/test/mjsunit/harmony/debug-blockscopes.js
@@ -202,17 +202,15 @@
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
+ CheckScopeChain([debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
};
local_block_1();
EndTest();
-// Local scope with a parameter.
+// Simple empty block scope in local scope with a parameter.
BeginTest("Local 2");
function local_2(a) {
@@ -222,10 +220,9 @@
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
+ CheckScopeChain([debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1}, 1, exec_state);
+ CheckScopeContent({a:1}, 0, exec_state);
};
local_2(1);
EndTest();
@@ -266,6 +263,72 @@
EndTest();
+// Single variable in a block scope.
+BeginTest("Local 5");
+
+function local_5(a) {
+ {
+ let x = 5;
+ debugger;
+ }
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Block,
+ debug.ScopeType.Local,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x:5}, 0, exec_state);
+ CheckScopeContent({a:1}, 1, exec_state);
+};
+local_5(1);
+EndTest();
+
+
+// Two variables in a block scope.
+BeginTest("Local 6");
+
+function local_6(a) {
+ {
+ let x = 6;
+ let y = 7;
+ debugger;
+ }
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Block,
+ debug.ScopeType.Local,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x:6,y:7}, 0, exec_state);
+ CheckScopeContent({a:1}, 1, exec_state);
+};
+local_6(1);
+EndTest();
+
+
+// Two variables in a block scope.
+BeginTest("Local 7");
+
+function local_7(a) {
+ {
+ {
+ let x = 8;
+ debugger;
+ }
+ }
+}
+
+listener_delegate = function(exec_state) {
+ CheckScopeChain([debug.ScopeType.Block,
+ debug.ScopeType.Local,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({x:8}, 0, exec_state);
+ CheckScopeContent({a:1}, 1, exec_state);
+};
+local_7(1);
+EndTest();
+
+
// Single empty with block.
BeginTest("With block 1");
@@ -276,8 +339,7 @@
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
+ CheckScopeChain([debug.ScopeType.With,
debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
CheckScopeContent({}, 0, exec_state);
@@ -299,16 +361,13 @@
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Block,
+ CheckScopeChain([debug.ScopeType.With,
debug.ScopeType.With,
debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
CheckScopeContent({}, 0, exec_state);
CheckScopeContent({}, 1, exec_state);
CheckScopeContent({}, 2, exec_state);
- CheckScopeContent({}, 3, exec_state);
};
with_block_2();
EndTest();
@@ -324,12 +383,10 @@
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
+ CheckScopeChain([debug.ScopeType.With,
debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({a:1,b:2}, 1, exec_state);
+ CheckScopeContent({a:1,b:2}, 0, exec_state);
};
with_block_3();
EndTest();
@@ -347,14 +404,12 @@
}
listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.With,
- debug.ScopeType.Block,
+ CheckScopeChain([debug.ScopeType.With,
debug.ScopeType.With,
debug.ScopeType.Local,
debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:2,b:1}, 1, exec_state);
- CheckScopeContent({a:1,b:2}, 3, exec_state);
+ CheckScopeContent({a:2,b:1}, 0, exec_state);
+ CheckScopeContent({a:1,b:2}, 1, exec_state);
};
with_block_4();
EndTest();
diff --git a/test/mjsunit/html-string-funcs.js b/test/mjsunit/html-string-funcs.js
index 213b7f3..b640639 100644
--- a/test/mjsunit/html-string-funcs.js
+++ b/test/mjsunit/html-string-funcs.js
@@ -29,7 +29,7 @@
// HTML.
function CheckSimple(f, tag) {
assertEquals('<' + tag + '>foo</' + tag + '>',
- "foo"[f]().toLowerCase());
+ "foo"[f]().toLowerCase());
};
var simple = { big: 'big', blink: 'blink', bold: 'b',
fixed: 'tt', italics: 'i', small: 'small',
diff --git a/test/mjsunit/in.js b/test/mjsunit/in.js
index f98db42..cca6187 100644
--- a/test/mjsunit/in.js
+++ b/test/mjsunit/in.js
@@ -86,7 +86,7 @@
assertFalse(0 in a);
assertTrue(1 in a);
assertFalse(2 in a);
-assertFalse('0' in a);
+assertFalse('0' in a);
assertTrue('1' in a);
assertFalse('2' in a);
assertTrue('toString' in a, "toString");
diff --git a/test/mjsunit/instanceof.js b/test/mjsunit/instanceof.js
index 01ea426..050ef2d 100644
--- a/test/mjsunit/instanceof.js
+++ b/test/mjsunit/instanceof.js
@@ -60,10 +60,10 @@
function TestExceptions() {
function F() { }
- var items = [ 1, new Number(42),
- true,
+ var items = [ 1, new Number(42),
+ true,
'string', new String('hest'),
- {}, [],
+ {}, [],
F, new F(),
Object, String ];
diff --git a/test/mjsunit/keyed-storage-extend.js b/test/mjsunit/keyed-storage-extend.js
index 04d2f04..d7e157b 100644
--- a/test/mjsunit/keyed-storage-extend.js
+++ b/test/mjsunit/keyed-storage-extend.js
@@ -37,7 +37,7 @@
}
function GrowKeyed(o) {
- var names = ['a','b','c','d','e','f'];
+ var names = ['a','b','c','d','e','f'];
var i = 0;
o[names[i++]] = i;
o[names[i++]] = i;
diff --git a/test/mjsunit/mirror-array.js b/test/mjsunit/mirror-array.js
index eb8f72a..92e3913 100644
--- a/test/mjsunit/mirror-array.js
+++ b/test/mjsunit/mirror-array.js
@@ -64,7 +64,7 @@
assertTrue(mirror.protoObject() instanceof debug.Mirror, 'Unexpected mirror hierachy');
assertTrue(mirror.prototypeObject() instanceof debug.Mirror, 'Unexpected mirror hierachy');
assertEquals(mirror.length(), a.length, "Length mismatch");
-
+
var indexedProperties = mirror.indexedPropertiesFromRange();
assertEquals(indexedProperties.length, a.length);
for (var i = 0; i < indexedProperties.length; i++) {
@@ -110,7 +110,7 @@
var found = false;
for (var j = 0; j < fromJSON.properties.length; j++) {
if (names[i] == fromJSON.properties[j].name) {
- found = true;
+ found = true;
}
}
assertTrue(found, names[i])
diff --git a/test/mjsunit/mirror-function.js b/test/mjsunit/mirror-function.js
index 58aee3d..cda815d 100644
--- a/test/mjsunit/mirror-function.js
+++ b/test/mjsunit/mirror-function.js
@@ -65,7 +65,7 @@
assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror);
assertTrue(mirror.protoObject() instanceof debug.Mirror);
assertTrue(mirror.prototypeObject() instanceof debug.Mirror);
-
+
// Test text representation
assertEquals(f.toString(), mirror.toText());
diff --git a/test/mjsunit/mirror-script.js b/test/mjsunit/mirror-script.js
index 7156170..1d64ac2 100644
--- a/test/mjsunit/mirror-script.js
+++ b/test/mjsunit/mirror-script.js
@@ -62,7 +62,7 @@
if (eval_from_line) {
assertEquals(eval_from_line, mirror.evalFromLocation().line);
}
-
+
// Parse JSON representation and check.
var fromJSON = JSON.parse(json);
assertEquals('script', fromJSON.type);
diff --git a/test/mjsunit/mirror-unresolved-function.js b/test/mjsunit/mirror-unresolved-function.js
index c1fe4a3..46f22a0 100644
--- a/test/mjsunit/mirror-unresolved-function.js
+++ b/test/mjsunit/mirror-unresolved-function.js
@@ -64,7 +64,7 @@
assertEquals('undefined', mirror.constructorFunction().type());
assertEquals('undefined', mirror.protoObject().type());
assertEquals('undefined', mirror.prototypeObject().type());
-
+
// Parse JSON representation of unresolved functions and check.
var fromJSON = eval('(' + json + ')');
assertEquals('function', fromJSON.type, 'Unexpected mirror type in JSON');
diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status
index b7b0c77..027da58 100644
--- a/test/mjsunit/mjsunit.status
+++ b/test/mjsunit/mjsunit.status
@@ -115,6 +115,9 @@
##############################################################################
[ $arch == mips ]
+# Run those tests, but expect them to time out.
+array-sort: PASS || TIMEOUT
+mirror-object: PASS || TIMEOUT
# Skip long-running tests.
compiler/alloc-number: SKIP
@@ -141,8 +144,11 @@
regress/regress-create-exception: SKIP
regress/regress-3218915: SKIP
regress/regress-3247124: SKIP
+regress/regress-1132: SKIP
+regress/regress-1257: SKIP
+regress/regress-91008: SKIP
-
+##############################################################################
[ $isolates ]
# d8-os writes temporary files that might interfer with each other when running
# in multible threads. Skip this if running with isolates testing.
diff --git a/test/mjsunit/no-semicolon.js b/test/mjsunit/no-semicolon.js
index fa6ccba..273ec4b 100644
--- a/test/mjsunit/no-semicolon.js
+++ b/test/mjsunit/no-semicolon.js
@@ -30,7 +30,7 @@
function f() { return }
-function g() {
+function g() {
return
4;
}
@@ -42,4 +42,4 @@
assertEquals(0, i);
for (var i = 0; i < 10; i++) { continue }
-assertEquals(10, i);
\ No newline at end of file
+assertEquals(10, i);
diff --git a/test/mjsunit/object-define-properties.js b/test/mjsunit/object-define-properties.js
index 6b3725b..128df69 100644
--- a/test/mjsunit/object-define-properties.js
+++ b/test/mjsunit/object-define-properties.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Tests the Object.defineProperties method - ES 15.2.3.7
-// Note that the internal DefineOwnProperty method is tested through
+// Note that the internal DefineOwnProperty method is tested through
// object-define-property.js, this file only contains tests specific for
// Object.defineProperties. Also note that object-create.js contains
// a range of indirect tests on this method since Object.create uses
diff --git a/test/mjsunit/object-literal-conversions.js b/test/mjsunit/object-literal-conversions.js
index 8540d93..742f814 100644
--- a/test/mjsunit/object-literal-conversions.js
+++ b/test/mjsunit/object-literal-conversions.js
@@ -43,4 +43,4 @@
assertEquals(7, test5[13]);
assertEquals(7, test6[17.31]);
-
\ No newline at end of file
+
diff --git a/test/mjsunit/object-literal-overwrite.js b/test/mjsunit/object-literal-overwrite.js
index 5c58a2d..5a3584d 100644
--- a/test/mjsunit/object-literal-overwrite.js
+++ b/test/mjsunit/object-literal-overwrite.js
@@ -79,7 +79,7 @@
// Test for the classic code generator.
function fun(x) {
- var inner = { j: function(x) { return x; }, j: 7 };
+ var inner = { j: function(x) { return x; }, j: 7 };
return inner.j;
}
@@ -115,4 +115,4 @@
var y = fun3();
assertEquals(7, y);
-assertEquals(3, glob3);
\ No newline at end of file
+assertEquals(3, glob3);
diff --git a/test/mjsunit/object-prevent-extensions.js b/test/mjsunit/object-prevent-extensions.js
index dc32342..322a2cb 100644
--- a/test/mjsunit/object-prevent-extensions.js
+++ b/test/mjsunit/object-prevent-extensions.js
@@ -33,7 +33,7 @@
assertTrue(Object.isExtensible(obj1));
Object.preventExtensions(obj1);
-// Make sure the is_extensible flag is set.
+// Make sure the is_extensible flag is set.
assertFalse(Object.isExtensible(obj1));
obj1.x = 42;
assertEquals(undefined, obj1.x);
diff --git a/test/mjsunit/parse-int-float.js b/test/mjsunit/parse-int-float.js
index a4f09df..2e4f648 100644
--- a/test/mjsunit/parse-int-float.js
+++ b/test/mjsunit/parse-int-float.js
@@ -100,4 +100,17 @@
assertEquals(Infinity, parseFloat(1/0), "parseFloat Infinity");
assertEquals(-Infinity, parseFloat(-1/0), "parseFloat -Infinity");
+var state;
+var throwingRadix = { valueOf: function() { state = "throwingRadix"; throw null; } };
+var throwingString = { toString: function() { state = "throwingString"; throw null; } };
+state = null;
+try { parseInt('123', throwingRadix); } catch (e) {}
+assertEquals(state, "throwingRadix");
+state = null;
+try { parseInt(throwingString, 10); } catch (e) {}
+assertEquals(state, "throwingString");
+
+state = null;
+try { parseInt(throwingString, throwingRadix); } catch (e) {}
+assertEquals(state, "throwingString");
diff --git a/test/mjsunit/regress/regress-1081309.js b/test/mjsunit/regress/regress-1081309.js
index 009ede1..5a6c524 100644
--- a/test/mjsunit/regress/regress-1081309.js
+++ b/test/mjsunit/regress/regress-1081309.js
@@ -67,7 +67,7 @@
// The expected backtrace is
// 1: g
// 0: [anonymous]
-
+
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor(false);
diff --git a/test/mjsunit/regress/regress-1092.js b/test/mjsunit/regress/regress-1092.js
index 0b29231..00422cb 100644
--- a/test/mjsunit/regress/regress-1092.js
+++ b/test/mjsunit/regress/regress-1092.js
@@ -25,7 +25,7 @@
// (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 CodeGenerator::EmitKeyedPropertyAssignment for the start
+// Test that CodeGenerator::EmitKeyedPropertyAssignment for the start
// of an initialization block doesn't normalize the properties of the
// JSGlobalProxy.
this.w = 0;
diff --git a/test/mjsunit/regress/regress-1110.js b/test/mjsunit/regress/regress-1110.js
index 204a87b..43b8d77 100644
--- a/test/mjsunit/regress/regress-1110.js
+++ b/test/mjsunit/regress/regress-1110.js
@@ -29,7 +29,7 @@
try {
function Crash() { continue;if (Crash) {
- } }
+ } }
Crash();
assertTrue(false);
} catch (e) {
diff --git a/test/mjsunit/regress/regress-1213575.js b/test/mjsunit/regress/regress-1213575.js
index 0c3dcc2..9d82064 100644
--- a/test/mjsunit/regress/regress-1213575.js
+++ b/test/mjsunit/regress/regress-1213575.js
@@ -33,7 +33,7 @@
var caught = false;
try {
- eval('const x');
+ eval('const x');
} catch(e) {
assertTrue(e instanceof TypeError);
caught = true;
diff --git a/test/mjsunit/regress/regress-1548.js b/test/mjsunit/regress/regress-1548.js
new file mode 100644
index 0000000..074007b
--- /dev/null
+++ b/test/mjsunit/regress/regress-1548.js
@@ -0,0 +1,48 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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 the caller and arguments objects are not available on native
+// functions.
+
+function testfn(f) { return [1].map(f)[0]; }
+function foo() { return [].map.caller; }
+assertEquals(null, 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));
+
+// Redo tests with arguments object.
+function testarguments(f) { return [1].map(f)[0]; }
+function bar() { return [].map.arguments; }
+assertEquals(null, testfn(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));
diff --git a/test/mjsunit/regress/regress-1647.js b/test/mjsunit/regress/regress-1647.js
new file mode 100644
index 0000000..a6afcc0
--- /dev/null
+++ b/test/mjsunit/regress/regress-1647.js
@@ -0,0 +1,43 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Test for correct deoptimization in named function expressions.
+
+var t = { foo: function() {} };
+
+var f = (function bar() {
+ t.foo();
+ assertEquals("function", typeof bar);
+});
+
+for (var i = 0; i < 10; i++) f();
+%OptimizeFunctionOnNextCall(f);
+t.number = 2;
+f();
+
diff --git a/test/mjsunit/regress/regress-1650.js b/test/mjsunit/regress/regress-1650.js
new file mode 100644
index 0000000..fb6a178
--- /dev/null
+++ b/test/mjsunit/regress/regress-1650.js
@@ -0,0 +1,60 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function g(f) { return f.call.apply(f.bind, arguments); }
+
+var x = new Object;
+
+function t() { }
+
+g(t, x);
+g(t, x);
+g(t, x);
+%OptimizeFunctionOnNextCall(g);
+
+function Fake() {}
+
+var fakeCallInvoked = false;
+
+Fake.prototype.call = function () {
+ assertSame(Fake.prototype.bind, this);
+ assertEquals(2, arguments.length);
+ assertSame(fake, arguments[0]);
+ assertSame(x, arguments[1]);
+ fakeCallInvoked = true;
+};
+
+Fake.prototype.bind = function () {
+};
+
+var fake = new Fake;
+
+g(fake, x);
+
+assertTrue(fakeCallInvoked);
diff --git a/test/mjsunit/regress/regress-1919169.js b/test/mjsunit/regress/regress-1919169.js
index 774f265..a732312 100644
--- a/test/mjsunit/regress/regress-1919169.js
+++ b/test/mjsunit/regress/regress-1919169.js
@@ -30,7 +30,7 @@
var s2 = "s2";
for (var i = 0; i < 2; i++) {
// Crashes in round i==1 with IllegalAccess in %StringAdd(x,y)
- var res = 1 + s2;
+ var res = 1 + s2;
s2 = 2;
}
}
diff --git a/test/mjsunit/regress/regress-20070207.js b/test/mjsunit/regress/regress-20070207.js
index e90b2ec..b7f7a5c 100644
--- a/test/mjsunit/regress/regress-20070207.js
+++ b/test/mjsunit/regress/regress-20070207.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The following regression test illustrates a problem in using the
-// value of setting a property in the arguments object.
+// value of setting a property in the arguments object.
function f(s) {
arguments.length;
diff --git a/test/mjsunit/regress/regress-269.js b/test/mjsunit/regress/regress-269.js
index 49b24c0..ce165e0 100644
--- a/test/mjsunit/regress/regress-269.js
+++ b/test/mjsunit/regress/regress-269.js
@@ -40,10 +40,10 @@
function g() {
}
-
+
function f() {
debugger;
g.apply(null, ['']);
}
-f()
\ No newline at end of file
+f()
diff --git a/test/mjsunit/regress/regress-619.js b/test/mjsunit/regress/regress-619.js
index 24bdbc1..4d3e66b 100644
--- a/test/mjsunit/regress/regress-619.js
+++ b/test/mjsunit/regress/regress-619.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Tests that Object.defineProperty works correctly on array indices.
+// Tests that Object.defineProperty works correctly on array indices.
// Please see http://code.google.com/p/v8/issues/detail?id=619 for details.
var obj = {};
diff --git a/test/mjsunit/regress/regress-678525.js b/test/mjsunit/regress/regress-678525.js
index 5ff9c3d..11eaf74 100644
--- a/test/mjsunit/regress/regress-678525.js
+++ b/test/mjsunit/regress/regress-678525.js
@@ -36,16 +36,16 @@
assertEquals(56, '\8'.charCodeAt(0));
assertEquals('\010', '\10');
-assertEquals('\011', '\11');
+assertEquals('\011', '\11');
assertEquals('\012', '\12');
assertEquals('\013', '\13');
assertEquals('\014', '\14');
assertEquals('\015', '\15');
assertEquals('\016', '\16');
assertEquals('\017', '\17');
-
+
assertEquals('\020', '\20');
-assertEquals('\021', '\21');
+assertEquals('\021', '\21');
assertEquals('\022', '\22');
assertEquals('\023', '\23');
assertEquals('\024', '\24');
@@ -56,4 +56,4 @@
assertEquals(73, '\111'.charCodeAt(0));
assertEquals(105, '\151'.charCodeAt(0));
-
+
diff --git a/test/mjsunit/regress/regress-696.js b/test/mjsunit/regress/regress-696.js
index 21977e1..e443c42 100644
--- a/test/mjsunit/regress/regress-696.js
+++ b/test/mjsunit/regress/regress-696.js
@@ -28,7 +28,7 @@
// See: http://code.google.com/p/v8/issues/detail?id=696
// Because of the change in dateparser in revision 4557 to support time
// only strings in Date.parse we also misleadingly supported strings with non
-// leading numbers.
+// leading numbers.
assertTrue(isNaN(Date.parse('x')));
assertTrue(isNaN(Date.parse('1x')));
diff --git a/test/mjsunit/regress/regress-720.js b/test/mjsunit/regress/regress-720.js
index 97e1284..267b32d 100644
--- a/test/mjsunit/regress/regress-720.js
+++ b/test/mjsunit/regress/regress-720.js
@@ -27,7 +27,7 @@
// This regression test is used to ensure that Object.defineProperty
// keeps the existing value of the writable flag if none is given
-// in the provided descriptor.
+// in the provided descriptor.
// See: http://code.google.com/p/v8/issues/detail?id=720
var o = {x: 10};
diff --git a/test/mjsunit/regress/regress-747.js b/test/mjsunit/regress/regress-747.js
index 6fcc000..648c366 100644
--- a/test/mjsunit/regress/regress-747.js
+++ b/test/mjsunit/regress/regress-747.js
@@ -40,7 +40,7 @@
callEval();
} catch (e) {
assertUnreachable();
-}
+}
gc();
gc();
@@ -53,4 +53,4 @@
callEval();
} catch (e) {
assertUnreachable();
-}
+}
diff --git a/test/mjsunit/regress/regress-760-1.js b/test/mjsunit/regress/regress-760-1.js
index 2e0cee5..081c993 100644
--- a/test/mjsunit/regress/regress-760-1.js
+++ b/test/mjsunit/regress/regress-760-1.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Check that when valueOf for a String object is overwritten it is called and
-// the result used when that object is added with a string.
+// the result used when that object is added with a string.
// See: http://code.google.com/p/v8/issues/detail?id=760
diff --git a/test/mjsunit/regress/regress-760-2.js b/test/mjsunit/regress/regress-760-2.js
index 1b1cbfe..549ed4e 100644
--- a/test/mjsunit/regress/regress-760-2.js
+++ b/test/mjsunit/regress/regress-760-2.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Check that when valueOf for a String object is overwritten it is called and
-// the result used when that object is added with a string.
+// the result used when that object is added with a string.
// See: http://code.google.com/p/v8/issues/detail?id=760
diff --git a/test/mjsunit/regress/regress-798.js b/test/mjsunit/regress/regress-798.js
index ffee5da..182eb4d 100644
--- a/test/mjsunit/regress/regress-798.js
+++ b/test/mjsunit/regress/regress-798.js
@@ -32,7 +32,7 @@
try {
y.x = 40;
} catch (e) {
- assertEquals(3, e.stack.split('\n').length);
+ assertEquals(3, e.stack.split('\n').length);
}
return 40;
});
@@ -41,7 +41,7 @@
try {
y.x = 40;
} catch(e) {
- assertEquals(3, e.stack.split('\n').length);
+ assertEquals(3, e.stack.split('\n').length);
}
});
@@ -50,7 +50,7 @@
try {
y.x = 30;
} catch (e) {
- assertEquals(3, e.stack.split('\n').length);
+ assertEquals(3, e.stack.split('\n').length);
}
return 30;
}
@@ -59,7 +59,7 @@
try {
y.x = 30;
} catch(e) {
- assertEquals(3, e.stack.split('\n').length);
+ assertEquals(3, e.stack.split('\n').length);
}
}
@@ -72,7 +72,7 @@
try {
y.x = 40;
} catch (e) {
- assertEquals(3, e.stack.split('\n').length);
+ assertEquals(3, e.stack.split('\n').length);
}
return 40;
},
@@ -80,7 +80,7 @@
try {
y.x = 40;
} catch(e) {
- assertEquals(3, e.stack.split('\n').length);
+ assertEquals(3, e.stack.split('\n').length);
}
}
}
@@ -88,7 +88,7 @@
Object.defineProperty(x, 'c', descriptor)
// Check that the stack for an exception in a getter and setter produce the
-// expected stack height.
+// expected stack height.
x.a;
x.b;
x.c;
diff --git a/test/mjsunit/regress/regress-918.js b/test/mjsunit/regress/regress-918.js
index 4b6ddba..871e9d9 100644
--- a/test/mjsunit/regress/regress-918.js
+++ b/test/mjsunit/regress/regress-918.js
@@ -28,6 +28,6 @@
// Parser should not accept parentheses around labels.
// See http://code.google.com/p/v8/issues/detail?id=918
-// The label was parsed as an expression and then tested for being a
+// The label was parsed as an expression and then tested for being a
// single identifier. This threw away the parentheses.
assertThrows("(label):42;");
diff --git a/test/mjsunit/regress/regress-925537.js b/test/mjsunit/regress/regress-925537.js
index 11582ea..d50c568 100644
--- a/test/mjsunit/regress/regress-925537.js
+++ b/test/mjsunit/regress/regress-925537.js
@@ -28,8 +28,8 @@
function assertClose(expected, actual) {
var delta = 0.00001;
if (Math.abs(expected - actual) > delta) {
- print('Failure: Expected <' + actual + '> to be close to <' +
- expected + '>');
+ print('Failure: Expected <' + actual + '> to be close to <' +
+ expected + '>');
}
}
diff --git a/test/mjsunit/regress/regress-937896.js b/test/mjsunit/regress/regress-937896.js
index e8e5ef2..e7831da 100644
--- a/test/mjsunit/regress/regress-937896.js
+++ b/test/mjsunit/regress/regress-937896.js
@@ -41,7 +41,7 @@
}
}
} catch (e) {
- // Empty.
+ // Empty.
}
return 42;
}
diff --git a/test/mjsunit/regress/regress-fundecl.js b/test/mjsunit/regress/regress-fundecl.js
new file mode 100644
index 0000000..fddb589
--- /dev/null
+++ b/test/mjsunit/regress/regress-fundecl.js
@@ -0,0 +1,44 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+// Test hoisting of function declarations in the optimizing
+// compiler in case of deoptimization.
+
+function h(a, b) {
+ var r = a + b;
+ function X() { return 42; }
+ return r + X();
+}
+
+for (var i = 0; i < 5; i++) h(1,2);
+
+%OptimizeFunctionOnNextCall(h);
+
+assertEquals(45, h(1,2));
+assertEquals("foo742", h("foo", 7));
diff --git a/test/mjsunit/setter-on-constructor-prototype.js b/test/mjsunit/setter-on-constructor-prototype.js
index d5718f9..a74f7da 100644
--- a/test/mjsunit/setter-on-constructor-prototype.js
+++ b/test/mjsunit/setter-on-constructor-prototype.js
@@ -35,14 +35,14 @@
if (ensure_fast_case) {
%ToFastProperties(C1.prototype);
}
-
+
for (var i = 0; i < 10; i++) {
var c1 = new C1();
assertEquals("undefined", typeof c1.x);
assertEquals(23, c1.y);
}
-
-
+
+
function C2() {
this.x = 23;
};
@@ -51,14 +51,14 @@
if (ensure_fast_case) {
%ToFastProperties(C2.prototype.__proto__)
}
-
+
for (var i = 0; i < 10; i++) {
var c2 = new C2();
assertEquals("undefined", typeof c2.x);
assertEquals(23, c2.y);
}
-
-
+
+
function C3() {
this.x = 23;
};
@@ -67,14 +67,14 @@
if (ensure_fast_case) {
%ToFastProperties(C3.prototype);
}
-
+
for (var i = 0; i < 10; i++) {
var c3 = new C3();
assertEquals("undefined", typeof c3.x);
assertEquals(23, c3.y);
}
-
-
+
+
function C4() {
this.x = 23;
};
@@ -84,14 +84,14 @@
if (ensure_fast_case) {
%ToFastProperties(C4.prototype.__proto__);
}
-
+
for (var i = 0; i < 10; i++) {
var c4 = new C4();
assertEquals("undefined", typeof c4.x);
assertEquals(23, c4.y);
}
-
-
+
+
function D() {
this.x = 23;
};
@@ -99,7 +99,7 @@
if (ensure_fast_case) {
%ToFastProperties(D.prototype);
}
-
+
for (var i = 0; i < 10; i++) {
var d = new D();
assertEquals(23, d.x);
diff --git a/test/mjsunit/string-compare-alignment.js b/test/mjsunit/string-compare-alignment.js
index a291417..0ae8eb7 100644
--- a/test/mjsunit/string-compare-alignment.js
+++ b/test/mjsunit/string-compare-alignment.js
@@ -29,8 +29,9 @@
// This situation can arise with sliced strings. This tests for an ARM bug
// that was fixed in r554.
-var base = "Now is the time for all good men to come to the aid of the party. " +
- "Now is the time for all good men to come to the aid of the party."
+var base =
+ "Now is the time for all good men to come to the aid of the party. " +
+ "Now is the time for all good men to come to the aid of the party."
var s1 = base.substring(0, 64);
var s2 = base.substring(66, 130);
diff --git a/test/mjsunit/string-indexof-1.js b/test/mjsunit/string-indexof-1.js
index c5ae4b8..db3623f 100644
--- a/test/mjsunit/string-indexof-1.js
+++ b/test/mjsunit/string-indexof-1.js
@@ -63,7 +63,7 @@
assertEquals(2, twoByteString.indexOf("\u03a3"), "First Sigma");
assertEquals(3, twoByteString.indexOf("\u03a3",3), "Second Sigma");
assertEquals(4, twoByteString.indexOf("\u0395"), "Epsilon");
-assertEquals(-1, twoByteString.indexOf("\u0392"), "Not beta");
+assertEquals(-1, twoByteString.indexOf("\u0392"), "Not beta");
// Test multi-char pattern
assertEquals(0, twoByteString.indexOf("\u039a\u0391"), "lambda Alpha");
@@ -71,7 +71,7 @@
assertEquals(2, twoByteString.indexOf("\u03a3\u03a3"), "Sigma Sigma");
assertEquals(3, twoByteString.indexOf("\u03a3\u0395"), "Sigma Epsilon");
-assertEquals(-1, twoByteString.indexOf("\u0391\u03a3\u0395"),
+assertEquals(-1, twoByteString.indexOf("\u0391\u03a3\u0395"),
"Not Alpha Sigma Epsilon");
//single char pattern
diff --git a/test/mjsunit/string-indexof-2.js b/test/mjsunit/string-indexof-2.js
index a7c3f60..48db84d 100644
--- a/test/mjsunit/string-indexof-2.js
+++ b/test/mjsunit/string-indexof-2.js
@@ -57,10 +57,10 @@
var index = -1;
do {
index = lipsum.indexOf(substring, index + 1);
- assertTrue(index != -1,
+ assertTrue(index != -1,
"Lipsum substring " + i + ".." + (i + len-1) + " not found");
- assertEquals(lipsum.substring(index, index + len), substring,
- "Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" +
+ assertEquals(lipsum.substring(index, index + len), substring,
+ "Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" +
index + ".." + (index + len - 1));
} while (index >= 0 && index < i);
assertEquals(i, index, "Lipsum match at " + i + ".." + (i + len - 1));
diff --git a/test/mjsunit/string-slices.js b/test/mjsunit/string-slices.js
index f629ca9..8cc1f81 100755
--- a/test/mjsunit/string-slices.js
+++ b/test/mjsunit/string-slices.js
@@ -57,7 +57,7 @@
assertEquals('abc', s.substr(-100, 3));
assertEquals(s1, s.substr(-s.length + 1));
-// assertEquals('', s.substr(0, void 0)); // smjs and rhino
+// assertEquals('', s.substr(0, void 0)); // smjs and rhino
assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8
assertEquals('', s.substr(0, null));
assertEquals(s, s.substr(0, String(s.length)));
@@ -196,4 +196,4 @@
assertEquals(a.slice(1,-1), b);
externalizeString(a);
assertEquals(a.slice(1,-1), b);
-*/
\ No newline at end of file
+*/
diff --git a/test/mjsunit/string-split.js b/test/mjsunit/string-split.js
index bc50945..d8412f0 100644
--- a/test/mjsunit/string-split.js
+++ b/test/mjsunit/string-split.js
@@ -68,13 +68,13 @@
/* "ab".split(/((?=.))/)
- *
+ *
* KJS: ,a,,b
* SM: a,,b,
* IE: a,b
* Opera: a,,b
* V8: a,,b
- *
+ *
* Opera seems to have this right. The others make no sense.
*/
assertArrayEquals(["a", "", "b"], "ab".split(/((?=.))/));
diff --git a/test/mjsunit/substr.js b/test/mjsunit/substr.js
index cffaf94..cab8b1b 100755
--- a/test/mjsunit/substr.js
+++ b/test/mjsunit/substr.js
@@ -55,7 +55,7 @@
assertEquals('abc', s.substr(-100, 3));
assertEquals(s1, s.substr(-s.length + 1));
-// assertEquals('', s.substr(0, void 0)); // smjs and rhino
+// assertEquals('', s.substr(0, void 0)); // smjs and rhino
assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8
assertEquals('', s.substr(0, null));
assertEquals(s, s.substr(0, String(s.length)));
diff --git a/test/mjsunit/this-property-assignment.js b/test/mjsunit/this-property-assignment.js
index c681999..54c6537 100644
--- a/test/mjsunit/this-property-assignment.js
+++ b/test/mjsunit/this-property-assignment.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Tests the handling of multiple assignments to the same property in a
+// Tests the handling of multiple assignments to the same property in a
// constructor that only has simple this property assignments.
function Node() {
diff --git a/test/mjsunit/try.js b/test/mjsunit/try.js
index 794860a..86afdf7 100644
--- a/test/mjsunit/try.js
+++ b/test/mjsunit/try.js
@@ -250,7 +250,7 @@
} catch (o) {
x--;
}
- }
+ }
return x;
}
@@ -274,7 +274,7 @@
x--;
}
x--; // should not happen
- }
+ }
return x;
}
diff --git a/test/mjsunit/unicode-test.js b/test/mjsunit/unicode-test.js
index 59a684e..66a029a 100644
--- a/test/mjsunit/unicode-test.js
+++ b/test/mjsunit/unicode-test.js
@@ -807,7 +807,7 @@
" * Васильев Л.С. Древний Китай: в 3 т. Т. 3. Период Чжаньго (V–III вв. до н.э.). М.: Восточная литература, 2006. ISBN 502018103X\n" +
" * Непомнин О.Е. История Китая: Эпоха Цин. XVII – начало XX века. М.: Восточная литература, 2005. ISBN 5020184004\n";
-var devanagari =
+var devanagari =
"भारत\n" +
"विकिपीडिया, एक मुक्त ज्ञानकोष से\n" +
"Jump to: navigation, search\n" +
@@ -1417,7 +1417,7 @@
"There are many words of French origin in English, such as competition, art, table, publicity, police, role, routine, machine, force, and many others that have been and are being anglicised; they are now pronounced according to English rules of phonology, rather than French. A large portion of English vocabulary is of French or Oïl language origin, most derived from, or transmitted via, the Anglo-Norman spoken by the upper classes in England for several hundred years after the Norman Conquest.\n";
-var greek =
+var greek =
"Ελλάδα\n" +
"Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια\n" +
"Ελληνική Δημοκρατία\n" +
diff --git a/test/mjsunit/value-wrapper.js b/test/mjsunit/value-wrapper.js
index 88330b4..76e200f 100644
--- a/test/mjsunit/value-wrapper.js
+++ b/test/mjsunit/value-wrapper.js
@@ -39,7 +39,7 @@
assertEquals('object', (42).TypeOfThis());
assertEquals('object', (3.14).TypeOfThis());
}
-
+
for (var i = 0; i < 10; i++) {
assertEquals('object', 'xxx'['TypeOfThis']());
assertEquals('object', true['TypeOfThis']());
@@ -47,11 +47,11 @@
assertEquals('object', (42)['TypeOfThis']());
assertEquals('object', (3.14)['TypeOfThis']());
}
-
+
function CallTypeOfThis(obj) {
assertEquals('object', obj.TypeOfThis());
}
-
+
for (var i = 0; i < 10; i++) {
CallTypeOfThis('xxx');
CallTypeOfThis(true);
@@ -59,7 +59,7 @@
CallTypeOfThis(42);
CallTypeOfThis(3.14);
}
-
+
function TestWithWith(obj) {
with (obj) {
for (var i = 0; i < 10; i++) {
@@ -67,13 +67,13 @@
}
}
}
-
+
TestWithWith('xxx');
TestWithWith(true);
TestWithWith(false);
TestWithWith(42);
TestWithWith(3.14);
-
+
for (var i = 0; i < 10; i++) {
assertEquals('object', true[7]());
assertEquals('object', false[7]());
@@ -100,7 +100,7 @@
function TypeOfThis() { return typeof this; }
-// Test with normal setup of prototype.
+// Test with normal setup of prototype.
String.prototype.TypeOfThis = TypeOfThis;
Boolean.prototype.TypeOfThis = TypeOfThis;
Number.prototype.TypeOfThis = TypeOfThis;