Version 2.4.5

Changed the RegExp benchmark to exercise the regexp engine on different inputs by scrambling the input strings.

Fixed a bug in keyed loads on strings.

Fixed a bug with loading global function prototypes.

Fixed a bug with profiling RegExp calls (issue http://crbug.com/55999).

Performance improvements on all platforms.



git-svn-id: http://v8.googlecode.com/svn/trunk@5502 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/test/mjsunit/fuzz-natives.js b/test/mjsunit/fuzz-natives.js
index 901c190..cf08d7a 100644
--- a/test/mjsunit/fuzz-natives.js
+++ b/test/mjsunit/fuzz-natives.js
@@ -129,7 +129,6 @@
   // which means that we have to propagate errors back.
   "SetFunctionBreakPoint": true,
   "SetScriptBreakPoint": true,
-  "ChangeBreakOnException": true,
   "PrepareStep": true,
 
   // Too slow.
diff --git a/test/mjsunit/math-floor.js b/test/mjsunit/math-floor.js
new file mode 100644
index 0000000..e56341c
--- /dev/null
+++ b/test/mjsunit/math-floor.js
@@ -0,0 +1,118 @@
+// Copyright 2010 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: --max-new-space-size=262144
+
+function zero() {
+  var x = 0.5;
+  return (function() { return x - 0.5; })();
+}
+
+function test() {
+  assertEquals(0, Math.floor(0));
+  assertEquals(0, Math.floor(zero()));
+  assertEquals(1/-0, 1/Math.floor(-0));  // 0 == -0, so we use reciprocals.
+  assertEquals(Infinity, Math.floor(Infinity));
+  assertEquals(-Infinity, Math.floor(-Infinity));
+  assertNaN(Math.floor(NaN));
+
+  assertEquals(0, Math.floor(0.1));
+  assertEquals(0, Math.floor(0.5));
+  assertEquals(0, Math.floor(0.7));
+  assertEquals(-1, Math.floor(-0.1));
+  assertEquals(-1, Math.floor(-0.5));
+  assertEquals(-1, Math.floor(-0.7));
+  assertEquals(1, Math.floor(1));
+  assertEquals(1, Math.floor(1.1));
+  assertEquals(1, Math.floor(1.5));
+  assertEquals(1, Math.floor(1.7));
+  assertEquals(-1, Math.floor(-1));
+  assertEquals(-2, Math.floor(-1.1));
+  assertEquals(-2, Math.floor(-1.5));
+  assertEquals(-2, Math.floor(-1.7));
+
+  assertEquals(0, Math.floor(Number.MIN_VALUE));
+  assertEquals(-1, Math.floor(-Number.MIN_VALUE));
+  assertEquals(Number.MAX_VALUE, Math.floor(Number.MAX_VALUE));
+  assertEquals(-Number.MAX_VALUE, Math.floor(-Number.MAX_VALUE));
+  assertEquals(Infinity, Math.floor(Infinity));
+  assertEquals(-Infinity, Math.floor(-Infinity));
+
+  // 2^30 is a smi boundary.
+  var two_30 = 1 << 30;
+
+  assertEquals(two_30, Math.floor(two_30));
+  assertEquals(two_30, Math.floor(two_30 + 0.1));
+  assertEquals(two_30, Math.floor(two_30 + 0.5));
+  assertEquals(two_30, Math.floor(two_30 + 0.7));
+
+  assertEquals(two_30 - 1, Math.floor(two_30 - 1));
+  assertEquals(two_30 - 1, Math.floor(two_30 - 1 + 0.1));
+  assertEquals(two_30 - 1, Math.floor(two_30 - 1 + 0.5));
+  assertEquals(two_30 - 1, Math.floor(two_30 - 1 + 0.7));
+
+  assertEquals(-two_30, Math.floor(-two_30));
+  assertEquals(-two_30, Math.floor(-two_30 + 0.1));
+  assertEquals(-two_30, Math.floor(-two_30 + 0.5));
+  assertEquals(-two_30, Math.floor(-two_30 + 0.7));
+
+  assertEquals(-two_30 + 1, Math.floor(-two_30 + 1));
+  assertEquals(-two_30 + 1, Math.floor(-two_30 + 1 + 0.1));
+  assertEquals(-two_30 + 1, Math.floor(-two_30 + 1 + 0.5));
+  assertEquals(-two_30 + 1, Math.floor(-two_30 + 1 + 0.7));
+
+  // 2^52 is a precision boundary.
+  var two_52 = (1 << 30) * (1 << 22);
+
+  assertEquals(two_52, Math.floor(two_52));
+  assertEquals(two_52, Math.floor(two_52 + 0.1));
+  assertEquals(two_52, two_52 + 0.5);
+  assertEquals(two_52, Math.floor(two_52 + 0.5));
+  assertEquals(two_52 + 1, two_52 + 0.7);
+  assertEquals(two_52 + 1, Math.floor(two_52 + 0.7));
+
+  assertEquals(two_52 - 1, Math.floor(two_52 - 1));
+  assertEquals(two_52 - 1, Math.floor(two_52 - 1 + 0.1));
+  assertEquals(two_52 - 1, Math.floor(two_52 - 1 + 0.5));
+  assertEquals(two_52 - 1, Math.floor(two_52 - 1 + 0.7));
+
+  assertEquals(-two_52, Math.floor(-two_52));
+  assertEquals(-two_52, Math.floor(-two_52 + 0.1));
+  assertEquals(-two_52, Math.floor(-two_52 + 0.5));
+  assertEquals(-two_52, Math.floor(-two_52 + 0.7));
+
+  assertEquals(-two_52 + 1, Math.floor(-two_52 + 1));
+  assertEquals(-two_52 + 1, Math.floor(-two_52 + 1 + 0.1));
+  assertEquals(-two_52 + 1, Math.floor(-two_52 + 1 + 0.5));
+  assertEquals(-two_52 + 1, Math.floor(-two_52 + 1 + 0.7));
+}
+
+
+// Test in a loop to cover the custom IC and GC-related issues.
+for (var i = 0; i < 500; i++) {
+  test();
+}
diff --git a/test/mjsunit/regress/regress-900966.js b/test/mjsunit/regress/regress-900966.js
index b95d10e..acffe75 100644
--- a/test/mjsunit/regress/regress-900966.js
+++ b/test/mjsunit/regress/regress-900966.js
@@ -29,6 +29,15 @@
 String.prototype[10] = 'x';
 assertEquals('abc'[10], 'x');
 
+// Test that the fast case character-at stub handles an out-of-bound
+// index correctly. We need to call the function twice to initialize
+// the character-at stub.
+function f() {
+  assertEquals('abc'[10], 'x');
+}
+f();
+f();
+
 assertTrue(2[11] === undefined);
 Number.prototype[11] = 'y';
 assertEquals(2[11], 'y');
diff --git a/test/mjsunit/stack-traces.js b/test/mjsunit/stack-traces.js
index d7ece2c..47a5cc5 100644
--- a/test/mjsunit/stack-traces.js
+++ b/test/mjsunit/stack-traces.js
@@ -63,6 +63,16 @@
   eval("function Outer() { eval('function Inner() { eval(x); }'); Inner(); }; Outer();");
 }
 
+function testEvalWithSourceURL() {
+  eval("function Doo() { FAIL; }; Doo();\n//@ sourceURL=res://name");
+}
+
+function testNestedEvalWithSourceURL() {
+  var x = "FAIL";
+  var innerEval = 'function Inner() { eval(x); }\n//@ sourceURL=res://inner-eval';
+  eval("function Outer() { eval(innerEval); Inner(); }; Outer();\n//@ sourceURL=res://outer-eval");
+}
+
 function testValue() {
   Number.prototype.causeError = function () { FAIL; };
   (1).causeError();
@@ -110,7 +120,7 @@
   } catch (e) {
     for (var i = 0; i < expected.length; i++) {
       assertTrue(e.stack.indexOf(expected[i]) != -1,
-                 name + " doesn't contain expected[" + i + "]");
+                 name + " doesn't contain expected[" + i + "] stack = " + e.stack);
     }
     if (unexpected) {
       for (var i = 0; i < unexpected.length; i++) {
@@ -190,6 +200,11 @@
 testTrace("testImplicitConversion", testImplicitConversion, ["at Nirk.valueOf"]);
 testTrace("testEval", testEval, ["at Doo (eval at testEval"]);
 testTrace("testNestedEval", testNestedEval, ["eval at Inner (eval at Outer"]);
+testTrace("testEvalWithSourceURL", testEvalWithSourceURL,
+    [ "at Doo (res://name:1:18)" ]);
+testTrace("testNestedEvalWithSourceURL", testNestedEvalWithSourceURL,
+    [" at Inner (res://inner-eval:1:20)",
+     " at Outer (res://outer-eval:1:37)"]);
 testTrace("testValue", testValue, ["at Number.causeError"]);
 testTrace("testConstructor", testConstructor, ["new Plonk"]);
 testTrace("testRenamedMethod", testRenamedMethod, ["Wookie.a$b$c$d [as d]"]);
diff --git a/test/mjsunit/this-property-assignment.js b/test/mjsunit/this-property-assignment.js
new file mode 100644
index 0000000..c681999
--- /dev/null
+++ b/test/mjsunit/this-property-assignment.js
@@ -0,0 +1,41 @@
+// Copyright 2010 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.
+
+// Tests the handling of multiple assignments to the same property in a 
+// constructor that only has simple this property assignments.
+
+function Node() {
+  this.a = 1;
+  this.a = 2;
+  this.a = 3;
+}
+
+var n1 = new Node();
+assertEquals(3, n1.a);
+
+var n2 = new Node();
+assertEquals(3, n2.a);