Merge V8 5.2.361.47  DO NOT MERGE

https://chromium.googlesource.com/v8/v8/+/5.2.361.47

FPIIM-449

Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/test/mjsunit/ignition/elided-instruction-no-ignition.js b/test/mjsunit/ignition/elided-instruction-no-ignition.js
index d31150b..50ad528 100644
--- a/test/mjsunit/ignition/elided-instruction-no-ignition.js
+++ b/test/mjsunit/ignition/elided-instruction-no-ignition.js
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Flags: --expose-debug-as debug
+// Flags: --no-ignition --expose-debug-as debug
 
 Debug = debug.Debug
 
diff --git a/test/mjsunit/ignition/elided-instruction.js b/test/mjsunit/ignition/elided-instruction.js
index 807974b..a047f41 100644
--- a/test/mjsunit/ignition/elided-instruction.js
+++ b/test/mjsunit/ignition/elided-instruction.js
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Flags: --expose-debug-as debug
+// Flags: --ignition --expose-debug-as debug
 
 Debug = debug.Debug
 
diff --git a/test/mjsunit/ignition/ignition-statistics-extension.js b/test/mjsunit/ignition/ignition-statistics-extension.js
new file mode 100644
index 0000000..43d05c9
--- /dev/null
+++ b/test/mjsunit/ignition/ignition-statistics-extension.js
@@ -0,0 +1,62 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --ignition --trace-ignition-dispatches
+
+assertEquals(typeof getIgnitionDispatchCounters, "function");
+
+var old_dispatch_counters = getIgnitionDispatchCounters();
+
+// Check that old_dispatch_counters is a non-empty object of objects, such that
+// the value of each property in the inner objects is a number.
+
+assertEquals(typeof old_dispatch_counters, "object");
+assertTrue(Object.getOwnPropertyNames(old_dispatch_counters).length > 0);
+for (var source_bytecode in old_dispatch_counters) {
+  var counters_row = old_dispatch_counters[source_bytecode];
+  assertEquals(typeof counters_row, "object");
+  for (var counter in counters_row) {
+    assertEquals(typeof counters_row[counter], "number");
+  }
+}
+
+// Do something
+function f(x) { return x*x; }
+f(42);
+
+var new_dispatch_counters = getIgnitionDispatchCounters();
+
+var old_source_bytecodes = Object.getOwnPropertyNames(old_dispatch_counters);
+var new_source_bytecodes = Object.getOwnPropertyNames(new_dispatch_counters);
+var common_source_bytecodes = new_source_bytecodes.filter(function (name) {
+  return old_source_bytecodes.indexOf(name) > -1;
+});
+
+// Check that the keys on the outer objects are the same
+assertEquals(common_source_bytecodes, old_source_bytecodes);
+assertEquals(common_source_bytecodes, new_source_bytecodes);
+
+common_source_bytecodes.forEach(function (source_bytecode) {
+  var new_counters_row = new_dispatch_counters[source_bytecode];
+  var old_counters_row = old_dispatch_counters[source_bytecode];
+
+  var old_destination_bytecodes = Object.getOwnPropertyNames(old_counters_row);
+  var new_destination_bytecodes = Object.getOwnPropertyNames(new_counters_row);
+
+  // Check that all the keys in old_ are in new_ too
+  old_destination_bytecodes.forEach(function (name) {
+    assertTrue(new_destination_bytecodes.indexOf(name) > -1);
+  });
+
+  // Check that for each source-destination pair, the counter has either
+  // appeared (was undefined before calling f()), is unchanged, or incremented.
+  new_destination_bytecodes.forEach(function (destination_bytecode) {
+    var new_counter = new_counters_row[destination_bytecode];
+    var old_counter = old_counters_row[destination_bytecode];
+    assertTrue(typeof new_counter === "number");
+    if (typeof old_counter === "number") {
+      assertTrue(new_counter >= old_counter);
+    }
+  });
+});
diff --git a/test/mjsunit/ignition/regress-599001-verifyheap.js b/test/mjsunit/ignition/regress-599001-verifyheap.js
index 5aa2efd..ce5b46d 100644
--- a/test/mjsunit/ignition/regress-599001-verifyheap.js
+++ b/test/mjsunit/ignition/regress-599001-verifyheap.js
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Flags: --verify-heap --expose-gc
+// Flags: --ignition --verify-heap --expose-gc
 
 // Tests that verify heap works for BytecodeArrays in the large object space.