Version 3.2.10

Fixed bug in external float arrays on ARM (issue 1323).

Minor performance improvements and bug fixes.


git-svn-id: http://v8.googlecode.com/svn/trunk@7596 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/test/mjsunit/compiler/array-length.js b/test/mjsunit/compiler/array-length.js
index 126c7a0..462a1e7 100644
--- a/test/mjsunit/compiler/array-length.js
+++ b/test/mjsunit/compiler/array-length.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 function ArrayLength(a) { return a.length; }
 
 function Test(a0, a2, a5) {
@@ -36,7 +38,12 @@
 var a0 = [];
 var a2 = [1,2];
 var a5 = [1,2,3,4,5];
-for (var i = 0; i < 100000; i++) Test(a0, a2, a5);
+for (var i = 0; i < 5; i++) Test(a0, a2, a5);
+%OptimizeFunctionOnNextCall(ArrayLength);
+%OptimizeFunctionOnNextCall(Test);
+Test(a0, a2, a5);
 assertEquals("undefined", typeof(ArrayLength(0)));
-for (var i = 0; i < 100000; i++) Test(a0, a2, a5);
+for (var i = 0; i < 5; i++) Test(a0, a2, a5);
+%OptimizeFunctionOnNextCall(Test);
+Test(a0, a2, a5);
 assertEquals(4, ArrayLength("hest"));
diff --git a/test/mjsunit/compiler/assignment-deopt.js b/test/mjsunit/compiler/assignment-deopt.js
index 74f185b..2b00625 100644
--- a/test/mjsunit/compiler/assignment-deopt.js
+++ b/test/mjsunit/compiler/assignment-deopt.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test deopt with count operation on parameter.
 var max_smi = 1073741823;
 var o = {x:0};
@@ -44,12 +46,15 @@
 assign2(o);
 assertEquals("421", o.x);
 
-var s = max_smi - 10000;
+var s = max_smi - 10;
 o.x = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
   assign2(o);
+  if (i == 4) {
+    %OptimizeFunctionOnNextCall(assign2);
+  }
 }
-assertEquals(max_smi + 10000, o.x);
+assertEquals(max_smi + 10, o.x);
 
 
 // Test deopt with count operation on keyed property.
@@ -59,36 +64,48 @@
 assign3(o, 0);
 assertEquals("421", o[0]);
 
-var s = max_smi - 10000;
+var s = max_smi - 10;
 o[0] = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
   assign3(o, 0);
+  if (i == 4) {
+    %OptimizeFunctionOnNextCall(assign3);
+  }
 }
-assertEquals(max_smi + 10000, o[0]);
+assertEquals(max_smi + 10, o[0]);
 
-assign3(o,"0");
+assign3(o, "0");
 
-assertEquals(max_smi + 10001, o[0]);
+assertEquals(max_smi + 11, o[0]);
 
 // Test bailout when accessing a non-existing array element.
 o[0] = 0;
-for(var i = 0; i < 10000; i++) {
+for(var i = 0; i < 5; i++) {
   assign3(o, 0);
 }
-assign3(o,1);
+%OptimizeFunctionOnNextCall(assign3);
+assign3(o, 0);
+assign3(o, 1);
 
 // Test bailout with count operation in a value context.
 function assign5(x,y) { return (x += 1) + y; }
-for (var i = 0; i < 10000; ++i) assertEquals(4, assign5(2, 1));
+for (var i = 0; i < 5; ++i) assertEquals(4, assign5(2, 1));
+%OptimizeFunctionOnNextCall(assign5);
+assertEquals(4, assign5(2, 1));
+
 assertEquals(4.1, assign5(2, 1.1));
 assertEquals(4.1, assign5(2.1, 1));
 
 function assign7(o,y) { return (o.x += 1) + y; }
 o = {x:0};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
   o.x = 42;
   assertEquals(44, assign7(o, 1));
 }
+%OptimizeFunctionOnNextCall(assign7);
+o.x = 42;
+assertEquals(44, assign7(o, 1));
+
 o.x = 42;
 assertEquals(44.1, assign7(o, 1.1));
 o.x = 42.1;
@@ -96,10 +113,14 @@
 
 function assign9(o,y) { return (o[0] += 1) + y; }
 q = [0];
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
   q[0] = 42;
   assertEquals(44, assign9(q, 1));
 }
+%OptimizeFunctionOnNextCall(assign9);
+q[0] = 42;
+assertEquals(44, assign9(q, 1));
+
 q[0] = 42;
 assertEquals(44.1, assign9(q, 1.1));
 q[0] = 42.1;
@@ -109,11 +130,16 @@
 function assign10(p) { return p.x += 1 }
 var g1 = {x:0};
 var g2 = {y:0, x:42};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
   g1.x = 42;
   assertEquals(43, assign10(g1));
   assertEquals(43, g1.x);
 }
+%OptimizeFunctionOnNextCall(assign10);
+g1.x = 42;
+assertEquals(43, assign10(g1));
+assertEquals(43, g1.x);
+
 assertEquals(43, assign10(g2));
 assertEquals(43, g2.x);
 
@@ -123,10 +149,14 @@
 var g3 = { valueOf: function() { o.y = "bar"; return 42; }};
 function assign11(p) { return p.x += 1; }
 
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
   o.x = "a";
   assign11(o);
 }
+%OptimizeFunctionOnNextCall(assign11);
+o.x = "a";
+assign11(o);
+
 assertEquals("a11", assign11(o));
 o.x = g3;
 assertEquals(43, assign11(o));
@@ -136,10 +166,14 @@
 var g4 = { valueOf: function() { o.y = "bar"; return 42; }};
 function assign12(p) { return p[0] += 1; }
 
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
   o[0] = "a";
   assign12(o);
 }
+%OptimizeFunctionOnNextCall(assign12);
+o[0] = "a";
+assign12(o);
+
 assertEquals("a11", assign12(o));
 o[0] = g4;
 assertEquals(43, assign12(o));
diff --git a/test/mjsunit/compiler/count-deopt.js b/test/mjsunit/compiler/count-deopt.js
index dcd82f8..415dadc 100644
--- a/test/mjsunit/compiler/count-deopt.js
+++ b/test/mjsunit/compiler/count-deopt.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test deopt with count operation on parameter.
 var max_smi = 1073741823;
 var o = {x:0};
@@ -44,12 +46,15 @@
 inc2(o);
 assertEquals(43, o.x);
 
-var s = max_smi - 10000;
+var s = max_smi - 10;
 o.x = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
   inc2(o);
+  if (i == 4) {
+    %OptimizeFunctionOnNextCall(inc2);
+  }
 }
-assertEquals(max_smi + 10000, o.x);
+assertEquals(max_smi + 10, o.x);
 
 
 // Test deopt with count operation on keyed property.
@@ -59,40 +64,52 @@
 inc3(o, 0);
 assertEquals(43, o[0]);
 
-var s = max_smi - 10000;
+var s = max_smi - 10;
 o[0] = s;
-for(var i = 0; i < 20000; i++) {
+for(var i = 0; i < 20; i++) {
   inc3(o, 0);
+  if (i == 4) {
+    %OptimizeFunctionOnNextCall(inc3);
+  }
 }
-assertEquals(max_smi + 10000, o[0]);
+assertEquals(max_smi + 10, o[0]);
 
 inc3(o,"0");
 
-assertEquals(max_smi + 10001, o[0]);
+assertEquals(max_smi + 11, o[0]);
 
 // Test bailout when accessing a non-existing array element.
 o[0] = 0;
-for(var i = 0; i < 10000; i++) {
+for(var i = 0; i < 5; i++) {
   inc3(o, 0);
 }
-inc3(o,1);
+%OptimizeFunctionOnNextCall(inc3);
+inc3(o, 0);
+inc3(o, 1);
 
 // Test bailout with count operation in a value context.
 function inc4(x,y) { return (x++) + y; }
-for (var i = 0; i < 100000; ++i) assertEquals(3, inc4(2, 1));
+for (var i = 0; i < 5; ++i) assertEquals(3, inc4(2, 1));
+%OptimizeFunctionOnNextCall(inc4);
+inc4(2, 1);
 assertEquals(3.1, inc4(2, 1.1));
 
 function inc5(x,y) { return (++x) + y; }
-for (var i = 0; i < 100000; ++i) assertEquals(4, inc5(2, 1));
+for (var i = 0; i < 5; ++i) assertEquals(4, inc5(2, 1));
+%OptimizeFunctionOnNextCall(inc5);
+assertEquals(4, inc5(2, 1));
 assertEquals(4.1, inc5(2, 1.1));
 assertEquals(4.1, inc5(2.1, 1));
 
 function inc6(o,y) { return (o.x++) + y; }
 o = {x:0};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
   o.x = 42;
   assertEquals(43, inc6(o, 1));
 }
+%OptimizeFunctionOnNextCall(inc6);
+o.x = 42;
+assertEquals(43, inc6(o, 1));
 o.x = 42;
 assertEquals(43.1, inc6(o, 1.1));
 o.x = 42.1;
@@ -100,10 +117,13 @@
 
 function inc7(o,y) { return (++o.x) + y; }
 o = {x:0};
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
   o.x = 42;
   assertEquals(44, inc7(o, 1));
 }
+%OptimizeFunctionOnNextCall(inc7);
+o.x = 42;
+assertEquals(44, inc7(o, 1));
 o.x = 42;
 assertEquals(44.1, inc7(o, 1.1));
 o.x = 42.1;
@@ -111,10 +131,13 @@
 
 function inc8(o,y) { return (o[0]++) + y; }
 var q = [0];
-for (var i = 0; i < 100000; ++i) {
+for (var i = 0; i < 5; ++i) {
   q[0] = 42;
   assertEquals(43, inc8(q, 1));
 }
+%OptimizeFunctionOnNextCall(inc8);
+q[0] = 42;
+assertEquals(43, inc8(q, 1));
 q[0] = 42;
 assertEquals(43.1, inc8(q, 1.1));
 q[0] = 42.1;
@@ -122,10 +145,13 @@
 
 function inc9(o,y) { return (++o[0]) + y; }
 q = [0];
-for (var i = 0; i < 100000; ++i) {
+for (var i = 0; i < 5; ++i) {
   q[0] = 42;
   assertEquals(44, inc9(q, 1));
 }
+%OptimizeFunctionOnNextCall(inc9);
+q[0] = 42;
+assertEquals(44, inc9(q, 1));
 q[0] = 42;
 assertEquals(44.1, inc9(q, 1.1));
 q[0] = 42.1;
@@ -135,11 +161,15 @@
 function inc10(p) { return p.x++ }
 var g1 = {x:0};
 var g2 = {y:0, x:42}
-for (var i = 0; i < 10000; ++i) {
+for (var i = 0; i < 5; ++i) {
   g1.x = 42;
   assertEquals(42, inc10(g1));
   assertEquals(43, g1.x);
 }
+%OptimizeFunctionOnNextCall(inc10);
+g1.x = 42;
+assertEquals(42, inc10(g1));
+assertEquals(43, g1.x);
 assertEquals(42, inc10(g2));
 assertEquals(43, g2.x);
 
diff --git a/test/mjsunit/compiler/deopt-args.js b/test/mjsunit/compiler/deopt-args.js
index 780e2a2..17c397c 100644
--- a/test/mjsunit/compiler/deopt-args.js
+++ b/test/mjsunit/compiler/deopt-args.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 function g(x) {
   return x.f(0,1,2);
 }
@@ -35,9 +37,11 @@
 
 var object = { };
 object.f = f;
-for (var i = 0; i < 10000000; i++) {
+for (var i = 0; i < 5; i++) {
   assertEquals(42, g(object));
 }
+%OptimizeFunctionOnNextCall(g);
+g(object);
 
 object.f = function(a,b,c) { return 87; };
 assertEquals(87, g(object));
diff --git a/test/mjsunit/compiler/inline-compare.js b/test/mjsunit/compiler/inline-compare.js
index 6efe154..d97dce2 100644
--- a/test/mjsunit/compiler/inline-compare.js
+++ b/test/mjsunit/compiler/inline-compare.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test that we can inline a function that returns the result of
 // a compare operation.
 function TestInlineCompare(o) {
@@ -42,5 +44,7 @@
 
 var o = {};
 o.f = function() { return 0 === 1; };
-for (var i = 0; i < 10000000; i++) TestInlineCompare(o);
+for (var i = 0; i < 5; i++) TestInlineCompare(o);
+%OptimizeFunctionOnNextCall(TestInlineCompare);
+TestInlineCompare(o);
 TestInlineCompare({f: o.f});
diff --git a/test/mjsunit/compiler/inline-global-access.js b/test/mjsunit/compiler/inline-global-access.js
index 3795173..b52652a 100644
--- a/test/mjsunit/compiler/inline-global-access.js
+++ b/test/mjsunit/compiler/inline-global-access.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test that we can inline a function that returns the result of a
 // global variable load.
 var GLOBAL;
@@ -45,5 +47,7 @@
 
 var o = {};
 o.f = function() { return GLOBAL; };
-for (var i = 0; i < 10000000; i++) TestInlineGlobalLoad(o);
+for (var i = 0; i < 5; i++) TestInlineGlobalLoad(o);
+%OptimizeFunctionOnNextCall(TestInlineGlobalLoad);
+TestInlineGlobalLoad(o);
 TestInlineGlobalLoad({f: o.f});
diff --git a/test/mjsunit/compiler/inline-param.js b/test/mjsunit/compiler/inline-param.js
index 8e0933a..8fa8008 100644
--- a/test/mjsunit/compiler/inline-param.js
+++ b/test/mjsunit/compiler/inline-param.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test that we can inline a call with a parameter.
 function TestInlineOneParam(o, p) {
   // Effect context.
@@ -42,7 +44,9 @@
 var obj = {x:42};
 var o1 = {};
 o1.f = function(o) { return o.x; };
-for (var i = 0; i < 10000; i++) TestInlineOneParam(o1, obj);
+for (var i = 0; i < 5; i++) TestInlineOneParam(o1, obj);
+%OptimizeFunctionOnNextCall(TestInlineOneParam);
+TestInlineOneParam(o1, obj);
 TestInlineOneParam({f: o1.f}, {x:42});
 
 
@@ -76,5 +80,7 @@
 
 var o2 = {};
 o2.h = function(i, j) { return i < j; };
-for (var i = 0; i < 10000; i++) TestInlineTwoParams(o2, 42);
+for (var i = 0; i < 5; i++) TestInlineTwoParams(o2, 42);
+%OptimizeFunctionOnNextCall(TestInlineTwoParams);
+TestInlineTwoParams(o2, 42);
 TestInlineTwoParams({h: o2.h}, 42);
diff --git a/test/mjsunit/compiler/inline-two.js b/test/mjsunit/compiler/inline-two.js
index 30f579d..68372a9 100644
--- a/test/mjsunit/compiler/inline-two.js
+++ b/test/mjsunit/compiler/inline-two.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test that we can inline a function that calls another function.
 function TestInlineX(o) {
   // Effect context.
@@ -42,7 +44,9 @@
 var o2 = {};
 o2.size = function() { return 42; }
 o2.g = function() { return this.size(); };
-for (var i = 0; i < 10000; i++) TestInlineX(o2);
+for (var i = 0; i < 5; i++) TestInlineX(o2);
+%OptimizeFunctionOnNextCall(TestInlineX);
+TestInlineX(o2);
 TestInlineX({g: o2.g, size:o2.size});
 
 
@@ -65,7 +69,9 @@
 var o3 = {};
 o3.v = obj;
 o3.h = function() { return this.v.foo(); };
-for (var i = 0; i < 10000; i++) TestInlineX2(o3);
+for (var i = 0; i < 5; i++) TestInlineX2(o3);
+%OptimizeFunctionOnNextCall(TestInlineX2);
+TestInlineX2(o3);
 TestInlineX2({h: o3.h, v:obj});
 
 
@@ -89,5 +95,7 @@
 o3.v = obj;
 o3.f = function() { return this.v; }
 o3.h = function() { return this.f().g(); };
-for (var i = 0; i < 10000; i++) TestInlineFG(o3);
+for (var i = 0; i < 5; i++) TestInlineFG(o3);
+%OptimizeFunctionOnNextCall(TestInlineFG);
+TestInlineFG(o3);
 TestInlineFG({h: o3.h, f: o3.f, v:obj});
diff --git a/test/mjsunit/compiler/optimized-function-calls.js b/test/mjsunit/compiler/optimized-function-calls.js
index 1b5f3b0..c3e69d7 100644
--- a/test/mjsunit/compiler/optimized-function-calls.js
+++ b/test/mjsunit/compiler/optimized-function-calls.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.
 
-// Flags: --expose-gc
+// Flags: --allow-natives-syntax --expose-gc
 
 function f() {
   gc();
@@ -48,7 +48,9 @@
 function call_f(o) {
   return o.f();
 }
-for (var i = 0; i < 10000000; i++) call_f(object);
+for (var i = 0; i < 5; i++) call_f(object);
+%OptimizeFunctionOnNextCall(call_f);
+call_f(object);
 
 
 // Check that nested global function calls work.
diff --git a/test/mjsunit/compiler/pic.js b/test/mjsunit/compiler/pic.js
index 06f2b3e..f5b136c 100644
--- a/test/mjsunit/compiler/pic.js
+++ b/test/mjsunit/compiler/pic.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 function GetX(o) { return o.x; }
 function CallF(o) { return o.f(); }
 function SetX(o) { o.x = 42; }
@@ -53,11 +55,15 @@
 
 // Run the test until we're fairly sure we've optimized the
 // polymorphic property access.
-for (var i = 0; i < 100000; i++) {
+for (var i = 0; i < 5; i++) {
   Test(o1);
   Test(o2);
   Test(o3);
 }
+%OptimizeFunctionOnNextCall(Test);
+Test(o1);
+Test(o2);
+Test(o3);
 
 // Make sure that the following doesn't crash.
 GetX(0);
diff --git a/test/mjsunit/compiler/property-calls.js b/test/mjsunit/compiler/property-calls.js
index 3366971..ad5ca81 100644
--- a/test/mjsunit/compiler/property-calls.js
+++ b/test/mjsunit/compiler/property-calls.js
@@ -25,12 +25,16 @@
 // (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 f(o) { return o.g(); }
 function g() { return 42; }
 
 var object = { };
 object.g = g;
-for (var i = 0; i < 10000000; i++) f(object);
+for (var i = 0; i < 5; i++) f(object);
+%OptimizeFunctionOnNextCall(f);
+f(object);
 assertEquals(42, f(object));
 
 object = { g: function() { return 87; } };
diff --git a/test/mjsunit/compiler/property-refs.js b/test/mjsunit/compiler/property-refs.js
index 3f6f793..6f1f19f 100644
--- a/test/mjsunit/compiler/property-refs.js
+++ b/test/mjsunit/compiler/property-refs.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 function Load(o) {
   return o.outer.x | o.outer.inner.y;
 }
@@ -45,7 +47,9 @@
   return Load(object);
 }
 
-for (var i = 0; i < 10000; i++) LoadXY(i, i);
+for (var i = 0; i < 5; i++) LoadXY(i, i);
+%OptimizeFunctionOnNextCall(LoadXY);
+LoadXY(6, 6);
 assertEquals(42 | 87, LoadXY(42, 87));
 assertEquals(42 | 87, LoadXY(42, 87));
 assertEquals(42 | 99, LoadXY(42, "99"));
diff --git a/test/mjsunit/compiler/property-stores.js b/test/mjsunit/compiler/property-stores.js
index 0dec82a..4ffac07 100644
--- a/test/mjsunit/compiler/property-stores.js
+++ b/test/mjsunit/compiler/property-stores.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 var a = 42;
 
 var obj = {x: 0,
@@ -33,11 +35,17 @@
            h: function() { this.x = a; }};
 
 var i;
-for (i = 0; i < 10000; i++) { obj.f(); }
+for (i = 0; i < 5; i++) { obj.f(); }
+%OptimizeFunctionOnNextCall(obj.f);
+obj.f();
 assertEquals(7, obj.x);
 
-for (i = 0; i < 10000; i++) { obj.g(); }
+for (i = 0; i < 5; i++) { obj.g(); }
+%OptimizeFunctionOnNextCall(obj.g);
+obj.g();
 assertEquals(43, obj.x);
 
-for (i = 0; i < 10000; i++) { obj.h(); }
+for (i = 0; i < 5; i++) { obj.h(); }
+%OptimizeFunctionOnNextCall(obj.h);
+obj.h();
 assertEquals(42, obj.x);
diff --git a/test/mjsunit/compiler/recursive-deopt.js b/test/mjsunit/compiler/recursive-deopt.js
index 366f59a..c921ade 100644
--- a/test/mjsunit/compiler/recursive-deopt.js
+++ b/test/mjsunit/compiler/recursive-deopt.js
@@ -25,6 +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.
 
+// Flags: --allow-natives-syntax
 
 function f(n) {
   // Force deopt in both leaf case and when returning. To make
@@ -34,15 +35,11 @@
   return f(n - 1) << one;
 }
 
-function RunTests() {
-  assertEquals(1 << 1, f(0));
-  assertEquals(1 << 2, f(1));
-  assertEquals(1 << 5, f(4));
-}
-
 
 var one = 1;
-for (var i = 0; i < 1000000; i++) RunTests();
+for (var i = 0; i < 5; i++) assertEquals(1 << 5, f(4));
+%OptimizeFunctionOnNextCall(f);
+assertEquals(1 << 5, f(4));
 
 var one = { valueOf: function() { return 1; } };
-for (var j = 0; j < 100000; j++) RunTests();
+assertEquals(1 << 5, f(4));
diff --git a/test/mjsunit/compiler/regress-3218915.js b/test/mjsunit/compiler/regress-3218915.js
index d27c319..dfce815 100644
--- a/test/mjsunit/compiler/regress-3218915.js
+++ b/test/mjsunit/compiler/regress-3218915.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Regression test for failure to deoptimize properly when the most recent
 // side effect occurred in a comma expression in an effect context.
 
@@ -40,7 +42,9 @@
 function test(x) { return observe(this, ((0, side_effect()), x + 1)); }
 
 // Run test enough times to get it optimized.
-for (var i = 0; i < 1000000; ++i) test(0);
+for (var i = 0; i < 5; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
 
 // Force test to deopt.  If it behaves normally, it should return the global
 // object.  If the value of the call to side_effect() is lingering after the
diff --git a/test/mjsunit/compiler/regress-loadfield.js b/test/mjsunit/compiler/regress-loadfield.js
index a202891..a3da156 100644
--- a/test/mjsunit/compiler/regress-loadfield.js
+++ b/test/mjsunit/compiler/regress-loadfield.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Regression test for GVN on field loads.
 
 function bar() {}
@@ -58,8 +60,10 @@
 a.p10 = "";
 a.p11 = "";
 a.foo = "foo";
-for (var i = 0; i < 100000; i++) {
+for (var i = 0; i < 5; i++) {
  test(a);
 }
+%OptimizeFunctionOnNextCall(test);
+test(a);
 
 test("");
diff --git a/test/mjsunit/compiler/regress-max.js b/test/mjsunit/compiler/regress-max.js
index 94c543a..ee2fd58 100644
--- a/test/mjsunit/compiler/regress-max.js
+++ b/test/mjsunit/compiler/regress-max.js
@@ -25,10 +25,12 @@
 // (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 Math.max with negative zero as input.
-function f(x, y) { return Math.max(x, y) }
+for (var i = 0; i < 5; i++) Math.max(0, 0);
+%OptimizeFunctionOnNextCall(Math.max);
+Math.max(0, 0);
 
-for (var i = 0; i < 1000000; i++) f(0, 0);
-
-var r = f(-0, -0);
+var r = Math.max(-0, -0);
 assertEquals(-Infinity, 1 / r);
diff --git a/test/mjsunit/compiler/regress-stacktrace-methods.js b/test/mjsunit/compiler/regress-stacktrace-methods.js
index 4900ccf..4d28727 100644
--- a/test/mjsunit/compiler/regress-stacktrace-methods.js
+++ b/test/mjsunit/compiler/regress-stacktrace-methods.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test stack traces with method calls.
 function Hest() {}
 function Svin() {}
@@ -39,9 +41,12 @@
 var s = new Svin();
 var v = 0;
 
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
   o.one(s);
 }
+%OptimizeFunctionOnNextCall(Hest.prototype.one);
+%OptimizeFunctionOnNextCall(Hest.prototype.three);
+o.one(s);
 
 v = 42;
 
@@ -57,8 +62,8 @@
   assertTrue(p1 != -1);
   assertTrue(p3 < p2);
   assertTrue(p2 < p1);
-  assertTrue(stack.indexOf("36:56") != -1);
-  assertTrue(stack.indexOf("32:51") != -1);
-  assertTrue(stack.indexOf("34:38") != -1);
-  assertTrue(stack.indexOf("49:5") != -1);
+  assertTrue(stack.indexOf("38:56") != -1);
+  assertTrue(stack.indexOf("34:51") != -1);
+  assertTrue(stack.indexOf("36:38") != -1);
+  assertTrue(stack.indexOf("54:5") != -1);
 }
diff --git a/test/mjsunit/compiler/simple-deopt.js b/test/mjsunit/compiler/simple-deopt.js
index 8befd9f..7f985ac 100644
--- a/test/mjsunit/compiler/simple-deopt.js
+++ b/test/mjsunit/compiler/simple-deopt.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 function f(x) {
   return ~x;
 }
@@ -59,7 +61,9 @@
 function k(o) {
   return o.g();
 }
-for (var i = 0; i < 1000000; i++) k(obj);
+for (var i = 0; i < 5; i++) k(obj);
+%OptimizeFunctionOnNextCall(k);
+k(obj);
 assertEquals(42, k(obj));
 assertEquals(87, k({g: function() { return 87; }}));
 
@@ -88,9 +92,11 @@
 var str = "abc";
 var r;
 function CallCharAt(n) { return str.charAt(n); }
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
   r = CallCharAt(0);
 }
+%OptimizeFunctionOnNextCall(CallCharAt);
+r = CallCharAt(0);
 assertEquals("a", r);
 
 
diff --git a/test/mjsunit/compiler/simple-inlining.js b/test/mjsunit/compiler/simple-inlining.js
index 219580f..8bd37ea 100644
--- a/test/mjsunit/compiler/simple-inlining.js
+++ b/test/mjsunit/compiler/simple-inlining.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test that we can inline a function that returns a constant.
 function TestInlineConstant(o) {
   // Effect context.
@@ -41,7 +43,9 @@
 
 var o1 = {};
 o1.f = function() { return 42; };
-for (var i = 0; i < 10000; i++) TestInlineConstant(o1);
+for (var i = 0; i < 5; i++) TestInlineConstant(o1);
+%OptimizeFunctionOnNextCall(TestInlineConstant);
+TestInlineConstant(o1);
 TestInlineConstant({f: o1.f});
 
 
@@ -61,7 +65,9 @@
 
 var o2 = {};
 o2.g = function() { return this; };
-for (var i = 0; i < 10000; i++) TestInlineThis(o2);
+for (var i = 0; i < 5; i++) TestInlineThis(o2);
+%OptimizeFunctionOnNextCall(TestInlineThis);
+TestInlineThis(o2);
 TestInlineThis({g: o2.g});
 
 
@@ -81,7 +87,9 @@
 
 var o3 = {y:0,x:42};
 o3.h = function() { return this.x; };
-for (var i = 0; i < 10000; i++) TestInlineThisX(o3);
+for (var i = 0; i < 5; i++) TestInlineThisX(o3);
+%OptimizeFunctionOnNextCall(TestInlineThisX);
+TestInlineThisX(o3);
 TestInlineThisX({h: o3.h, x:42});
 
 
@@ -101,7 +109,9 @@
 
 var o4 = {x:[1,2,3]};
 o4.h = function() { return this.x.length; };
-for (var i = 0; i < 10000; i++) TestInlineThisXLength(o4);
+for (var i = 0; i < 5; i++) TestInlineThisXLength(o4);
+%OptimizeFunctionOnNextCall(TestInlineThisXLength);
+TestInlineThisXLength(o4);
 TestInlineThisXLength({h: o4.h, x:[1,2,3]});
 
 
@@ -122,7 +132,9 @@
 var o6 = {y:42}
 var o5 = {e:o6};
 o5.h = function() { return this.e.y; };
-for (var i = 0; i < 10000; i++) TestInlineThisXY(o5);
+for (var i = 0; i < 5; i++) TestInlineThisXY(o5);
+%OptimizeFunctionOnNextCall(TestInlineThisXY);
+TestInlineThisXY(o5);
 TestInlineThisXY({h: o5.h, e:o6});
 
 
@@ -142,5 +154,7 @@
 
 var o7 = {x:[42,43,44]};
 o7.foo = function() { return this.x[0]; };
-for (var i = 0; i < 10000; i++) TestInlineThisX0(o7);
+for (var i = 0; i < 5; i++) TestInlineThisX0(o7);
+%OptimizeFunctionOnNextCall(TestInlineThisX0);
+TestInlineThisX0(o7);
 TestInlineThisX0({foo: o7.foo, x:[42,0,0]});
diff --git a/test/mjsunit/compiler/switch-bailout.js b/test/mjsunit/compiler/switch-bailout.js
index 8011d44..084074e 100644
--- a/test/mjsunit/compiler/switch-bailout.js
+++ b/test/mjsunit/compiler/switch-bailout.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test that bailing out of the optimized compilation doesn't mess with
 // the labels in the AST.
 function f(x) {
@@ -35,5 +37,7 @@
   return 99;
 }
 
-for (var i = 0; i < 10000; i++) f("foo");
+for (var i = 0; i < 5; i++) f("foo");
+%OptimizeFunctionOnNextCall(f);
+f("foo");
 assertEquals(42, f("bar"));
diff --git a/test/mjsunit/const-eval-init.js b/test/mjsunit/const-eval-init.js
index 3f380d9..d350384 100644
--- a/test/mjsunit/const-eval-init.js
+++ b/test/mjsunit/const-eval-init.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test the handling of initialization of deleted const variables.
 // This only makes sense in local scopes since the declaration and
 // initialization of consts in the global scope happen at the same
@@ -67,9 +69,11 @@
   assertEquals(7, x);
 }
 
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
   testAssignmentArgument();
 }
+%OptimizeFunctionOnNextCall(testAssignmentArgument);
+testAssignmentArgument();
 assertEquals(6, x);
 
 __defineSetter__('x', function() { throw 42; });
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js
index 228e8f0..45d8be5 100644
--- a/test/mjsunit/external-array.js
+++ b/test/mjsunit/external-array.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // This is a regression test for overlapping key and value registers.
 function f(a) {
   a[0] = 0;
@@ -32,9 +34,11 @@
 }
 
 var a = new Int32Array(2);
-for (var i = 0; i < 1000000; i++) {
+for (var i = 0; i < 5; i++) {
   f(a);
 }
+%OptimizeFunctionOnNextCall(f);
+f(a);
 
 assertEquals(0, a[0]);
 assertEquals(0, a[1]);
diff --git a/test/mjsunit/regress/regress-1079.js b/test/mjsunit/regress/regress-1079.js
index f3f3ce5..208dc5b 100644
--- a/test/mjsunit/regress/regress-1079.js
+++ b/test/mjsunit/regress/regress-1079.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Getting the arguments property of an optimized function should not crash,
 // even if called through our optimized version of Function.prototype.apply.
 
@@ -39,7 +41,8 @@
   }
 }
 
-for (var i = 0; i < 100000; ++i) {
+for (var i = 0; i < 5; ++i) {
   assertEquals(3, optimized(1, 2, 3).length);
 }
-
+%OptimizeFunctionOnNextCall(optimized);
+assertEquals(3, optimized(1, 2, 3).length);
diff --git a/test/mjsunit/regress/regress-1106.js b/test/mjsunit/regress/regress-1106.js
index 382fd1b..e462d5d 100644
--- a/test/mjsunit/regress/regress-1106.js
+++ b/test/mjsunit/regress/regress-1106.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Test for issue 1106, where the optimizing compiler broke when accessing
 // a property lying on a prototype of the global object, and that prototype
 // object was in dictionary mode.
@@ -37,14 +39,18 @@
 
 function f() { return foo; }
 
-for (i=0 ; i < 100000; ++i) {
+for (i=0 ; i < 5; ++i) {
   assertEquals(5, f());
 }
+%OptimizeFunctionOnNextCall(f);
+assertEquals(5, f());
 
 // Test calls on functions defined in the prototype of the global object.
 x.gee = function() { return 42; }
 function g() { return gee(); }
 
-for (i=0 ; i < 100000; ++i) {
+for (i=0 ; i < 5; ++i) {
   assertEquals(42, g());
 }
+%OptimizeFunctionOnNextCall(g);
+assertEquals(42, g());
diff --git a/test/mjsunit/regress/regress-1166.js b/test/mjsunit/regress/regress-1166.js
index d75d397..8278aba 100644
--- a/test/mjsunit/regress/regress-1166.js
+++ b/test/mjsunit/regress/regress-1166.js
@@ -25,11 +25,16 @@
 // (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
+
 // Deoptimization after a short-circuit logical operation in an effect
 // context should not see the value of the expression.
 function observe(x, y) { return x; }
 
 function test(x) { return observe(1, ((false || false), x + 1)); }
 
-for (var i = 0; i < 10000000; ++i) test(0);
+for (var i = 0; i < 5; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
+
 test("a");
diff --git a/test/mjsunit/regress/regress-1167.js b/test/mjsunit/regress/regress-1167.js
index 8437d83..2206f3d 100644
--- a/test/mjsunit/regress/regress-1167.js
+++ b/test/mjsunit/regress/regress-1167.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Deoptimization after a logical not in an effect context should not see a
 // value for the logical not expression.
 function test0(n) {
@@ -68,5 +70,7 @@
                   x + 1));
 }
 
-for (var i = 0; i < 1000000; ++i) test2(0);
+for (var i = 0; i < 5; ++i) test2(0);
+%OptimizeFunctionOnNextCall(test2);
+test2(0);
 test2(test2);
diff --git a/test/mjsunit/regress/regress-1210.js b/test/mjsunit/regress/regress-1210.js
index 9c708a5..7d4735a 100644
--- a/test/mjsunit/regress/regress-1210.js
+++ b/test/mjsunit/regress/regress-1210.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Deoptimization of the key expression in an arguments access should see
 // the arguments object as the value of the receiver.
 
@@ -43,6 +45,8 @@
 
 // Run enough to optimize assuming global 'a' is a smi.
 for (var i = 0; i < 1000000; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
 
 a = "hello";
 test(0);
diff --git a/test/mjsunit/regress/regress-1229.js b/test/mjsunit/regress/regress-1229.js
index 4afb964..e16d278 100644
--- a/test/mjsunit/regress/regress-1229.js
+++ b/test/mjsunit/regress/regress-1229.js
@@ -56,11 +56,17 @@
   return f(local_y, local_z); /* f should be inlined into h */
 }
 
-for (var i = 0; i < 100000; i++) f(2, 3);
+for (var i = 0; i < 5; i++) f(2, 3);
+%OptimizeFunctionOnNextCall(f);
+f(2, 3);
 
-for (var i = 0; i < 100000; i++) g(3, 2);
+for (var i = 0; i < 5; i++) g(3, 2);
+%OptimizeFunctionOnNextCall(g);
+g(3, 2);
 
-for (var i = 0; i < 100000; i++) h(6, 4);
+for (var i = 0; i < 5; i++) h(6, 4);
+%OptimizeFunctionOnNextCall(h);
+h(6, 4);
 
 // Check that %_IsConstructCall returns correct value when inlined
 var NON_CONSTRUCT_MARKER = {};
@@ -76,4 +82,6 @@
   assertEquals(construct, CONSTRUCT_MARKER);
 }
 
-for (var i = 0; i < 100000; i++) new bar(1, 2, 3);
+for (var i = 0; i < 5; i++) new bar(1, 2, 3);
+%OptimizeFunctionOnNextCall(bar);
+bar(1, 2, 3);
diff --git a/test/mjsunit/regress/regress-1237.js b/test/mjsunit/regress/regress-1237.js
index f97f978..111df80 100644
--- a/test/mjsunit/regress/regress-1237.js
+++ b/test/mjsunit/regress/regress-1237.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Deoptimization after a conditional expression in an effect context should
 // not see the value of the expression.
 function observe(x, y) { return x; }
@@ -32,5 +34,8 @@
   return observe(1, ((x? observe(observe.prototype.x): 'c'), x + 1));
 }
 
-for (var i = 0; i < 10000000; ++i) test(0);
+for (var i = 0; i < 5; ++i) test(0);
+%OptimizeFunctionOnNextCall(test);
+test(0);
+
 test("a");
diff --git a/test/mjsunit/regress/regress-1323.js b/test/mjsunit/regress/regress-1323.js
new file mode 100644
index 0000000..552a48d
--- /dev/null
+++ b/test/mjsunit/regress/regress-1323.js
@@ -0,0 +1,50 @@
+// 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
+
+// Regression test for load/store operating with wrong number of bits.
+function get(a, index) {
+  return a[index];
+}
+
+var a = new Float32Array(2);
+a[0] = 2.5;
+a[1] = 3.5;
+for (var i = 0; i < 5; i++) get(a, 0);
+%OptimizeFunctionOnNextCall(get);
+assertEquals(2.5, get(a, 0));
+assertEquals(3.5, get(a, 1));
+
+function set(a, index, value) {
+  a[index] = value;
+}
+for (var i = 0; i < 5; i++) set(a, 0, 4.5);
+%OptimizeFunctionOnNextCall(set);
+set(a, 0, 4.5);
+assertEquals(4.5, a[0]);
+assertEquals(3.5, a[1]);
diff --git a/test/mjsunit/regress/regress-3218915.js b/test/mjsunit/regress/regress-3218915.js
index 5fcbcec..4b08a6e 100644
--- a/test/mjsunit/regress/regress-3218915.js
+++ b/test/mjsunit/regress/regress-3218915.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 // Checks that comma expression in conditional context is processed correctly.
 
 function withCommaExpressionInConditional(x) {
@@ -36,7 +38,9 @@
   return (y = x + 1, y > 1) ? 'medium' : 'small';
 }
 
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
   withCommaExpressionInConditional(i);
 }
+%OptimizeFunctionOnNextCall(withCommaExpressionInConditional);
+withCommaExpressionInConditional(i);
 withCommaExpressionInConditional("1")
diff --git a/test/mjsunit/regress/regress-962.js b/test/mjsunit/regress/regress-962.js
index f9f46e1..85ada0c 100644
--- a/test/mjsunit/regress/regress-962.js
+++ b/test/mjsunit/regress/regress-962.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 function L(scope) { this.s = new Object(); }
 
 L.prototype.c = function() { return true; }
@@ -50,4 +52,6 @@
 
 var ctx = new F;
 
-for (var i = 0; i < 10000; i++) ctx.foo();
+for (var i = 0; i < 5; i++) ctx.foo();
+%OptimizeFunctionOnNextCall(F.prototype.foo);
+ctx.foo();
diff --git a/test/mjsunit/string-charcodeat.js b/test/mjsunit/string-charcodeat.js
index f18d0a5..8be6a09 100644
--- a/test/mjsunit/string-charcodeat.js
+++ b/test/mjsunit/string-charcodeat.js
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 /**
  * @fileoverview Check all sorts of borderline cases for charCodeAt.
  */
@@ -159,9 +161,11 @@
   assertTrue(isNaN(str.charCodeAt(0x7fffffff)));
 }
 
-for (var i = 0; i < 100000; i++) {
+for (var i = 0; i < 5; i++) {
   ConsNotSmiIndex();
 }
+%OptimizeFunctionOnNextCall(ConsNotSmiIndex);
+ConsNotSmiIndex();
 
 
 for (var i = 0; i != 10; i++) {
@@ -222,6 +226,8 @@
   assertEquals(99, "c".x(0));
 }
 
-for (var i = 0; i < 10000; i++) {
+for (var i = 0; i < 5; i++) {
   directlyOnPrototype();
 }
+%OptimizeFunctionOnNextCall(directlyOnPrototype);
+directlyOnPrototype();
diff --git a/test/mjsunit/sum-0-plus-undefined-is-NaN.js b/test/mjsunit/sum-0-plus-undefined-is-NaN.js
index fb98d0c..5d662d1 100644
--- a/test/mjsunit/sum-0-plus-undefined-is-NaN.js
+++ b/test/mjsunit/sum-0-plus-undefined-is-NaN.js
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// 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:
@@ -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.
 
+// Flags: --allow-natives-syntax
+
 /**
  * @fileoverview Test addition of 0 and undefined.
  */
@@ -32,9 +34,11 @@
 function sum(a, b) { return a + b; }
 
 function test(x, y, expectNaN) {
-  for (var i = 0; i < 1000; i++) {
+  for (var i = 0; i < 5; i++) {
     assertEquals(expectNaN, isNaN(sum(x, y)));
   }
+  %OptimizeFunctionOnNextCall(sum);
+  assertEquals(expectNaN, isNaN(sum(x, y)));
 }
 
 test(0, 1, false);