Import Cobalt 16.154703
diff --git a/src/v8/gypfiles/all.gyp b/src/v8/gypfiles/all.gyp
index bc9d965..2f9cf85 100644
--- a/src/v8/gypfiles/all.gyp
+++ b/src/v8/gypfiles/all.gyp
@@ -33,6 +33,7 @@
             '../test/benchmarks/benchmarks.gyp:*',
             '../test/debugger/debugger.gyp:*',
             '../test/default.gyp:*',
+            '../test/d8_default.gyp:*',
             '../test/intl/intl.gyp:*',
             '../test/message/message.gyp:*',
             '../test/mjsunit/mjsunit.gyp:*',
@@ -46,7 +47,7 @@
             '../tools/gcmole/run_gcmole.gyp:*',
             '../tools/jsfunfuzz/jsfunfuzz.gyp:*',
             '../tools/run-deopt-fuzzer.gyp:*',
-            '../tools/run-valgrind.gyp:*',
+            '../tools/run-num-fuzzer.gyp:*',
           ],
         }],
       ]
diff --git a/src/v8/gypfiles/features.gypi b/src/v8/gypfiles/features.gypi
index 81d21bc..d285ee2 100644
--- a/src/v8/gypfiles/features.gypi
+++ b/src/v8/gypfiles/features.gypi
@@ -33,6 +33,9 @@
       'v8_target_arch%': '<(target_arch)',
     },
 
+    # Allows the embedder to add a custom suffix to the version string.
+    'v8_embedder_string%': '',
+
     'v8_enable_disassembler%': 0,
 
     'v8_promise_internal_field_count%': 0,
@@ -89,6 +92,9 @@
   },
   'target_defaults': {
     'conditions': [
+      ['v8_embedder_string!=""', {
+        'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',],
+      }],
       ['v8_enable_disassembler==1', {
         'defines': ['ENABLE_DISASSEMBLER',],
       }],
@@ -152,7 +158,7 @@
       },  # Debug
       'Release': {
         'variables': {
-          'v8_enable_handle_zapping%': 1,
+          'v8_enable_handle_zapping%': 0,
         },
         'conditions': [
           ['v8_enable_handle_zapping==1', {
diff --git a/src/v8/gypfiles/gyp_v8 b/src/v8/gypfiles/gyp_v8
index e419b5e..5215f51 100755
--- a/src/v8/gypfiles/gyp_v8
+++ b/src/v8/gypfiles/gyp_v8
@@ -108,19 +108,14 @@
 if __name__ == '__main__':
   args = sys.argv[1:]
 
-  gyp_chromium_no_action = os.environ.get('GYP_CHROMIUM_NO_ACTION')
-  if gyp_chromium_no_action == '1':
-    print 'Skipping gyp_v8 due to GYP_CHROMIUM_NO_ACTION env var.'
+  gyp_chromium_no_action = os.environ.get('GYP_CHROMIUM_NO_ACTION', '1')
+  if gyp_chromium_no_action != '0':
+    print 'GYP is now disabled by default.\n'
+    print 'If you really want to run this, set the environment variable '
+    print 'GYP_CHROMIUM_NO_ACTION=0.'
     sys.exit(0)
 
   running_as_hook = '--running-as-hook'
-  if running_as_hook in args and gyp_chromium_no_action != '0':
-    print 'GYP is now disabled by default in runhooks.\n'
-    print 'If you really want to run this, either run '
-    print '`python gypfiles/gyp_v8` explicitly by hand '
-    print 'or set the environment variable GYP_CHROMIUM_NO_ACTION=0.'
-    sys.exit(0)
-
   if running_as_hook in args:
     args.remove(running_as_hook)
 
diff --git a/src/v8/gypfiles/isolate.gypi b/src/v8/gypfiles/isolate.gypi
index 11b0570..3e85b53 100644
--- a/src/v8/gypfiles/isolate.gypi
+++ b/src/v8/gypfiles/isolate.gypi
@@ -74,13 +74,13 @@
         '--config-variable', 'gcmole=<(gcmole)',
         '--config-variable', 'has_valgrind=<(has_valgrind)',
         '--config-variable', 'icu_use_data_file_flag=<(icu_use_data_file_flag)',
-        '--config-variable', 'is_gn=0',
         '--config-variable', 'msan=<(msan)',
         '--config-variable', 'tsan=<(tsan)',
         '--config-variable', 'coverage=<(coverage)',
         '--config-variable', 'sanitizer_coverage=<(sanitizer_coverage)',
         '--config-variable', 'component=<(component)',
         '--config-variable', 'target_arch=<(target_arch)',
+        '--config-variable', 'ubsan_vptr=0',
         '--config-variable', 'v8_use_external_startup_data=<(v8_use_external_startup_data)',
         '--config-variable', 'v8_use_snapshot=<(v8_use_snapshot)',
       ],
diff --git a/src/v8/gypfiles/run-tests-legacy.py b/src/v8/gypfiles/run-tests-legacy.py
new file mode 100755
index 0000000..f1ea478
--- /dev/null
+++ b/src/v8/gypfiles/run-tests-legacy.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# Copyright 2017 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.
+
+"""
+Legacy test-runner wrapper supporting a product of multiple architectures and
+modes.
+"""
+
+import argparse
+import itertools
+from os.path import abspath, dirname, join
+import subprocess
+import sys
+
+BASE_DIR = dirname(dirname(abspath(__file__)))
+RUN_TESTS = join(BASE_DIR, 'tools', 'run-tests.py')
+
+def main():
+  parser = argparse.ArgumentParser(description='Legacy test-runner wrapper')
+  parser.add_argument(
+      '--arch', help='Comma-separated architectures to run tests on')
+  parser.add_argument(
+      '--mode', help='Comma-separated modes to run tests on')
+  parser.add_argument(
+      '--arch-and-mode',
+      help='Architecture and mode in the format \'arch.mode\'',
+  )
+
+  args, remaining_args = parser.parse_known_args(sys.argv)
+  if (args.arch or args.mode) and args.arch_and_mode:
+    parser.error('The flags --arch-and-mode and --arch/--mode are exclusive.')
+  arch = (args.arch or 'ia32,x64,arm').split(',')
+  mode = (args.mode or 'release,debug').split(',')
+  if args.arch_and_mode:
+    arch_and_mode = map(
+        lambda am: am.split('.'),
+        args.arch_and_mode.split(','))
+    arch = map(lambda am: am[0], arch_and_mode)
+    mode = map(lambda am: am[1], arch_and_mode)
+
+  ret_code = 0
+  for a, m in itertools.product(arch, mode):
+    ret_code |= subprocess.check_call(
+        [RUN_TESTS] + remaining_args[1:] + ['--arch', a, '--mode', m])
+  return ret_code
+
+if __name__ == '__main__':
+  sys.exit(main())
diff --git a/src/v8/gypfiles/standalone.gypi b/src/v8/gypfiles/standalone.gypi
index 63930d8..ec47f1c 100644
--- a/src/v8/gypfiles/standalone.gypi
+++ b/src/v8/gypfiles/standalone.gypi
@@ -296,7 +296,7 @@
           'variables': {
             # The Android toolchain needs to use the absolute path to the NDK
             # because it is used at different levels in the GYP files.
-            'android_ndk_root%': '<(base_dir)/third_party/android_tools/ndk/',
+            'android_ndk_root%': '<(base_dir)/third_party/android_ndk/',
             'android_host_arch%': "<!(uname -m | sed -e 's/i[3456]86/x86/')",
             # Version of the NDK. Used to ensure full rebuilds on NDK rolls.
             'android_ndk_version%': 'r12b',
@@ -439,6 +439,7 @@
         '-Wno-undefined-var-template',
         # TODO(yangguo): issue 5258
         '-Wno-nonportable-include-path',
+        '-Wno-tautological-constant-compare',
       ],
       'conditions':[
         ['OS=="android"', {
@@ -783,6 +784,11 @@
               # over the place.
               '-fno-strict-aliasing',
             ],
+          }, {
+            'cflags' : [
+              # TODO(hans): https://crbug.com/767059
+              '-Wno-tautological-constant-compare',
+            ],
           }],
           [ 'clang==1 and (v8_target_arch=="x64" or v8_target_arch=="arm64" \
             or v8_target_arch=="mips64el")', {
diff --git a/src/v8/gypfiles/toolchain.gypi b/src/v8/gypfiles/toolchain.gypi
index 5733d2d..80844ce 100644
--- a/src/v8/gypfiles/toolchain.gypi
+++ b/src/v8/gypfiles/toolchain.gypi
@@ -32,6 +32,7 @@
     'msvs_use_common_release': 0,
     'clang%': 0,
     'asan%': 0,
+    'cfi_vptr%': 0,
     'lsan%': 0,
     'msan%': 0,
     'tsan%': 0,