Upgrade to 3.29

Update V8 to 3.29.88.17 and update makefiles to support building on
all the relevant platforms.

Bug: 17370214

Change-Id: Ia3407c157fd8d72a93e23d8318ccaf6ecf77fa4e
diff --git a/test/mjsunit/elements-transition-hoisting.js b/test/mjsunit/elements-transition-hoisting.js
index 5e78f10..9f229d2 100644
--- a/test/mjsunit/elements-transition-hoisting.js
+++ b/test/mjsunit/elements-transition-hoisting.js
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 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,26 +25,14 @@
 // (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 --smi-only-arrays --expose-gc
+// Flags: --allow-natives-syntax
+// Flags: --nostress-opt
 
 // Ensure that ElementsKind transitions in various situations are hoisted (or
 // not hoisted) correctly, don't change the semantics programs and don't trigger
 // deopt through hoisting in important situations.
 
-support_smi_only_arrays = %HasFastSmiOnlyElements(new Array(1,2,3,4,5,6));
-
-if (support_smi_only_arrays) {
-  print("Tests include smi-only arrays.");
-} else {
-  print("Tests do NOT include smi-only arrays.");
-}
-
-// Force existing ICs from previous stress runs to be flushed, otherwise the
-// assumptions in this test about when deoptimizations get triggered are not
-// valid.
-gc();
-
-if (support_smi_only_arrays) {
+function test_wrapper() {
   // Make sure that a simple elements array transitions inside a loop before
   // stores to an array gets hoisted in a way that doesn't generate a deopt in
   // simple cases.}
@@ -58,32 +46,40 @@
   }
 
   testDoubleConversion4(new Array(5));
+  testDoubleConversion4(new Array(5));  // Call twice to make sure that second
+                                        // store is a transition and not
+                                        // optimistically MONOMORPHIC
   %OptimizeFunctionOnNextCall(testDoubleConversion4);
   testDoubleConversion4(new Array(5));
   testDoubleConversion4(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testDoubleConversion4));
+  assertOptimized(testDoubleConversion4);
+  %ClearFunctionTypeFeedback(testDoubleConversion4);
 
   // Make sure that non-element related map checks that are not preceded by
   // transitions in a loop still get hoisted in a way that doesn't generate a
   // deopt in simple cases.
   function testExactMapHoisting(a) {
     var object = new Object();
-    a.foo = 0;
+    a.foo = {};
     a[0] = 0;
     a[1] = 1;
     var count = 3;
     do {
-      a.foo = object; // This map check should be hoistable
+      a.foo = object;  // This map check should be hoistable
       a[1] = object;
       result = a.foo == object && a[1] == object;
     } while (--count > 0);
   }
 
   testExactMapHoisting(new Array(5));
+  testExactMapHoisting(new Array(5));  // Call twice to make sure that second
+                                       // store is a transition and not
+                                       // optimistically MONOMORPHIC
   %OptimizeFunctionOnNextCall(testExactMapHoisting);
   testExactMapHoisting(new Array(5));
   testExactMapHoisting(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting));
+  assertOptimized(testExactMapHoisting);
+  %ClearFunctionTypeFeedback(testExactMapHoisting);
 
   // Make sure that non-element related map checks do NOT get hoisted if they
   // depend on an elements transition before them and it's not possible to hoist
@@ -98,44 +94,53 @@
       if (a.bar === undefined) {
         a[1] = 2.5;
       }
-      a.foo = object; // This map check should NOT be hoistable because it
-                      // includes a check for the FAST_ELEMENTS map as well as
-                      // the FAST_DOUBLE_ELEMENTS map, which depends on the
-                      // double transition above in the if, which cannot be
-                      // hoisted.
+      a.foo = object;  // This map check should NOT be hoistable because it
+                       // includes a check for the FAST_ELEMENTS map as well as
+                       // the FAST_DOUBLE_ELEMENTS map, which depends on the
+                       // double transition above in the if, which cannot be
+                       // hoisted.
     } while (--count > 0);
   }
 
   testExactMapHoisting2(new Array(5));
+  testExactMapHoisting2(new Array(5));  // Call twice to make sure that second
+                                        // store is a transition and not
+                                        // optimistically MONOMORPHIC
   %OptimizeFunctionOnNextCall(testExactMapHoisting2);
   testExactMapHoisting2(new Array(5));
   testExactMapHoisting2(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting2));
+  // Temporarily disabled - see bug 2176.
+  // assertOptimized(testExactMapHoisting2);
+  %ClearFunctionTypeFeedback(testExactMapHoisting2);
 
   // Make sure that non-element related map checks do get hoisted if they use
   // the transitioned map for the check and all transitions that they depend
   // upon can hoisted, too.
   function testExactMapHoisting3(a) {
     var object = new Object();
-    a.foo = 0;
+    a.foo = null;
     a[0] = 0;
     a[1] = 1;
     var count = 3;
     do {
       a[1] = 2.5;
-      a.foo = object; // This map check should be hoistable because all elements
-                      // transitions in the loop can also be hoisted.
+      a.foo = object;  // This map check should be hoistable because all elements
+                       // transitions in the loop can also be hoisted.
     } while (--count > 0);
   }
 
   var add_transition = new Array(5);
   add_transition.foo = 0;
-  add_transition[0] = new Object(); // For FAST_ELEMENT transition to be created
+  add_transition[0] = new Object();  // For FAST_ELEMENT transition to be created
   testExactMapHoisting3(new Array(5));
+  testExactMapHoisting3(new Array(5));  // Call twice to make sure that second
+                                        // store is a transition and not
+                                        // optimistically MONOMORPHIC
   %OptimizeFunctionOnNextCall(testExactMapHoisting3);
   testExactMapHoisting3(new Array(5));
   testExactMapHoisting3(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting3));
+  assertOptimized(testExactMapHoisting3);
+  %ClearFunctionTypeFeedback(testExactMapHoisting3);
 
   function testDominatingTransitionHoisting1(a) {
     var object = new Object();
@@ -149,11 +154,21 @@
     } while (--count > 3);
   }
 
+  /*
   testDominatingTransitionHoisting1(new Array(5));
+  testDominatingTransitionHoisting1(new Array(5));  // Call twice to make sure
+                                                    // that second store is a
+                                                    // transition and not
+                                                    // optimistically MONOMORPHIC
   %OptimizeFunctionOnNextCall(testDominatingTransitionHoisting1);
   testDominatingTransitionHoisting1(new Array(5));
   testDominatingTransitionHoisting1(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testDominatingTransitionHoisting1));
+  // TODO(verwaest) With current changes the elements transition gets hoisted
+  // above the access, causing a deopt. We should update the type of access
+  // rather than forbid hoisting the transition.
+  assertOptimized(testDominatingTransitionHoisting1);
+  %ClearFunctionTypeFeedback(testDominatingTransitionHoisting1);
+  */
 
   function testHoistingWithSideEffect(a) {
     var object = new Object();
@@ -166,10 +181,14 @@
   }
 
   testHoistingWithSideEffect(new Array(5));
+  testHoistingWithSideEffect(new Array(5));  // Call twice to make sure that
+                                             // second store is a transition and
+                                             // not optimistically MONOMORPHIC
   %OptimizeFunctionOnNextCall(testHoistingWithSideEffect);
   testHoistingWithSideEffect(new Array(5));
   testHoistingWithSideEffect(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testHoistingWithSideEffect));
+  assertOptimized(testHoistingWithSideEffect);
+  %ClearFunctionTypeFeedback(testHoistingWithSideEffect);
 
   function testStraightLineDupeElinination(a,b,c,d,e,f) {
     var count = 3;
@@ -179,7 +198,7 @@
       a[1] = c;
       a[2] = d;
       assertTrue(true);
-      a[3] = e; // TransitionElementsKind should be eliminated despite call.
+      a[3] = e;  // TransitionElementsKind should be eliminated despite call.
       a[4] = f;
     } while (--count > 3);
   }
@@ -205,7 +224,13 @@
   testStraightLineDupeElinination(new Array(5),0,0,0,.5,0);
   testStraightLineDupeElinination(new Array(5),0,0,0,0,.5);
   %OptimizeFunctionOnNextCall(testStraightLineDupeElinination);
-  testStraightLineDupeElinination(new Array(5));
-  testStraightLineDupeElinination(new Array(5));
-  assertTrue(2 != %GetOptimizationStatus(testStraightLineDupeElinination));
+  testStraightLineDupeElinination(new Array(5),0,0,0,0,0);
+  testStraightLineDupeElinination(new Array(5),0,0,0,0,0);
+  assertOptimized(testStraightLineDupeElinination);
+  %ClearFunctionTypeFeedback(testStraightLineDupeElinination);
 }
+
+// The test is called in a test wrapper that has type feedback cleared to
+// prevent the influence of allocation-sites, which learn from transitions.
+test_wrapper();
+%ClearFunctionTypeFeedback(test_wrapper);