Roll V8 back to 3.6

Roll back to V8 3.6 to fix x86 build, we don't have ucontext.h.

This reverts commits:
5d4cdbf7a67d3662fa0bee4efdb7edd8daec9b0b
c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9
592a9fc1d8ea420377a2e7efd0600e20b058be2b

Bug: 5688872
Change-Id: Ic961bb5e65b778e98bbfb71cce71d99fa949e995
diff --git a/test/mjsunit/debug-evaluate-locals-optimized.js b/test/mjsunit/debug-evaluate-locals-optimized.js
index c88a683..c3cd5eb 100644
--- a/test/mjsunit/debug-evaluate-locals-optimized.js
+++ b/test/mjsunit/debug-evaluate-locals-optimized.js
@@ -1,4 +1,4 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
+// Copyright 2008 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,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-debug-as debug --expose-gc --allow-natives-syntax --inline-construct
+// Flags: --expose-debug-as debug --allow-natives-syntax
 // Get the Debug object exposed from the debug context global object.
 Debug = debug.Debug
 
@@ -34,17 +34,6 @@
 
 var testingConstructCall = false;
 
-var expected = [
-  { locals: {a0: 1, b0: 2}, args: { names: ["i", "x0", "y0"], values: [0, 3, 4] } },
-  { locals: {a1: 3, b1: 4}, args: { names: ["i", "x1", "y1"], values: [1, 5, 6] } },
-  { locals: {a2: 5, b2: 6}, args: { names: ["i"], values: [2] } },
-  { locals: {a3: 7, b3: 8}, args: { names: ["i", "x3", "y3", "z3"], values: [3, 9, 10, undefined] } },
-  { locals: {a4: 9, b4: 10}, args: { names: ["i", "x4", "y4"], values: [4, 11, 12] } }
-];
-
-function arraySum(arr) {
-  return arr.reduce(function (a, b) { return a + b; }, 0);
-}
 
 function listener(event, exec_state, event_data, data) {
   try {
@@ -55,63 +44,42 @@
       for (var i = 0; i < exec_state.frameCount(); i++) {
         var frame = exec_state.frame(i);
         if (i < exec_state.frameCount() - 1) {
-          var expected_args = expected[i].args;
-          var expected_locals = expected[i].locals;
+          var expected_a = i * 2 + 1;
+          var expected_b = i * 2 + 2;
+          var expected_x = (i + 1) * 2 + 1;
+          var expected_y = (i + 1) * 2 + 2;
 
-          // All frames except the bottom one have expected locals.
-          var locals = {};
-          for (var j = 0; j < frame.localCount(); j++) {
-            locals[frame.localName(j)] = frame.localValue(j).value();
-          }
-          assertPropertiesEqual(expected_locals, locals);
+          // All frames except the bottom one has normal variables a and b.
+          var a = ('a' === frame.localName(0)) ? 0 : 1;
+          var b = 1 - a;
+          assertEquals('a', frame.localName(a));
+          assertEquals('b', frame.localName(b));
+          assertEquals(expected_a, frame.localValue(a).value());
+          assertEquals(expected_b, frame.localValue(b).value());
 
-          // All frames except the bottom one have expected arguments.
-          for (var j = 0; j < expected_args.names.length; j++) {
-            assertEquals(expected_args.names[j], frame.argumentName(j));
-            assertEquals(expected_args.values[j], frame.argumentValue(j).value());
-          }
+          // All frames except the bottom one has arguments variables x and y.
+          assertEquals('x', frame.argumentName(0));
+          assertEquals('y', frame.argumentName(1));
+          assertEquals(expected_x, frame.argumentValue(0).value());
+          assertEquals(expected_y, frame.argumentValue(1).value());
 
           // All frames except the bottom one have two scopes.
           assertEquals(2, frame.scopeCount());
           assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType());
           assertEquals(debug.ScopeType.Global, frame.scope(1).scopeType());
-
-          Object.keys(expected_locals).forEach(function (name) {
-            assertEquals(expected_locals[name], frame.scope(0).scopeObject().value()[name]);
-          });
-
-          for (var j = 0; j < expected_args.names.length; j++) {
-            var arg_name = expected_args.names[j];
-            var arg_value = expected_args.values[j];
-            assertEquals(arg_value, frame.scope(0).scopeObject().value()[arg_name]);
-          }
+          assertEquals(expected_a, frame.scope(0).scopeObject().value()['a']);
+          assertEquals(expected_b, frame.scope(0).scopeObject().value()['b']);
+          assertEquals(expected_x, frame.scope(0).scopeObject().value()['x']);
+          assertEquals(expected_y, frame.scope(0).scopeObject().value()['y']);
 
           // Evaluate in the inlined frame.
-          Object.keys(expected_locals).forEach(function (name) {
-            assertEquals(expected_locals[name], frame.evaluate(name).value());
-          });
-
-          for (var j = 0; j < expected_args.names.length; j++) {
-            var arg_name = expected_args.names[j];
-            var arg_value = expected_args.values[j];
-            assertEquals(arg_value, frame.evaluate(arg_name).value());
-            assertEquals(arg_value, frame.evaluate('arguments['+j+']').value());
-          }
-
-          var expected_args_sum = arraySum(expected_args.values);
-          var expected_locals_sum =
-              arraySum(Object.keys(expected_locals).
-                       map(function (k) { return expected_locals[k]; }));
-
-          assertEquals(expected_locals_sum + expected_args_sum,
-                       frame.evaluate(Object.keys(expected_locals).join('+') + ' + ' +
-                                      expected_args.names.join('+')).value());
-
-          var arguments_sum = expected_args.names.map(function(_, idx) {
-            return "arguments[" + idx + "]";
-          }).join('+');
-          assertEquals(expected_args_sum,
-                       frame.evaluate(arguments_sum).value());
+          assertEquals(expected_a, frame.evaluate('a').value());
+          assertEquals(expected_x, frame.evaluate('x').value());
+          assertEquals(expected_x, frame.evaluate('arguments[0]').value());
+          assertEquals(expected_a + expected_b + expected_x + expected_y,
+                       frame.evaluate('a + b + x + y').value());
+          assertEquals(expected_x + expected_y,
+                       frame.evaluate('arguments[0] + arguments[1]').value());
         } else {
           // The bottom frame only have the global scope.
           assertEquals(1, frame.scopeCount());
@@ -130,13 +98,7 @@
         }
 
         // Check for construct call.
-        if (i == 4) {
-          assertEquals(testingConstructCall, frame.isConstructCall());
-        } else if (i == 2) {
-          assertTrue(frame.isConstructCall());
-        } else {
-          assertFalse(frame.isConstructCall());
-        }
+        assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
 
         // When function f is optimized (1 means YES, see runtime.cc) we
         // expect an optimized frame for f with g1, g2 and g3 inlined.
@@ -159,59 +121,54 @@
       listenerComplete = true;
     }
   } catch (e) {
-    exception = e.toString() + e.stack;
+    exception = e.stack;
   };
 };
 
-for (var i = 0; i < 4; i++) f(expected.length - 1, 11, 12);
+f();f();f();
 %OptimizeFunctionOnNextCall(f);
-f(expected.length - 1, 11, 12);
+f();
 
 // Add the debug event listener.
 Debug.setListener(listener);
 
-function h(i, x0, y0) {
-  var a0 = expected[i].locals.a0;
-  var b0 = expected[i].locals.b0;
+function h(x, y) {
+  var a = 1;
+  var b = 2;
   debugger;  // Breakpoint.
-}
+};
 
-function g3(i, x1, y1) {
-  var a1 = expected[i].locals.a1;
-  var b1 = expected[i].locals.b1;
-  h(i - 1, a1, b1);
-}
+function g3(x, y) {
+  var a = 3;
+  var b = 4;
+  h(a, b);
+};
 
-function g2(i) {
-  var a2 = expected[i].locals.a2;
-  var b2 = expected[i].locals.b2;
-  g3(i - 1, a2, b2);
-}
+function g2(x, y) {
+  var a = 5;
+  var b = 6;
+  g3(a, b);
+};
 
-function g1(i, x3, y3, z3) {
-  var a3 = expected[i].locals.a3;
-  var b3 = expected[i].locals.b3;
-  new g2(i - 1, a3, b3);
-}
+function g1(x, y) {
+  var a = 7;
+  var b = 8;
+  g2(a, b);
+};
 
-function f(i, x4, y4) {
-  var a4 = expected[i].locals.a4;
-  var b4 = expected[i].locals.b4;
-  g1(i - 1, a4, b4);
-}
+function f(x, y) {
+  var a = 9;
+  var b = 10;
+  g1(a, b);
+};
 
 // Test calling f normally and as a constructor.
-f(expected.length - 1, 11, 12);
-f(expected.length - 1, 11, 12, 0);
+f(11, 12);
 testingConstructCall = true;
-new f(expected.length - 1, 11, 12);
-new f(expected.length - 1, 11, 12, 0);
+new f(11, 12);
 
-// Make sure that the debug event listener was invoked.
+// Make sure that the debug event listener vas invoked.
 assertFalse(exception, "exception in listener " + exception)
 assertTrue(listenerComplete);
 
-// Throw away type information for next run.
-gc();
-
 Debug.setListener(null);