Import Cobalt 16.154703
diff --git a/src/v8/test/intl/date-format/invalid-time.js b/src/v8/test/intl/date-format/invalid-time.js
new file mode 100644
index 0000000..ef62545
--- /dev/null
+++ b/src/v8/test/intl/date-format/invalid-time.js
@@ -0,0 +1,20 @@
+// 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.
+
+var df = new Intl.DateTimeFormat();
+
+assertThrows("df.format(Infinity)", RangeError);
+assertThrows("df.formatToParts(Infinity)", RangeError);
+assertThrows("df.format(-Infinity)", RangeError);
+assertThrows("df.formatToParts(-Infinity)", RangeError);
+assertThrows("df.format(NaN)", RangeError);
+assertThrows("df.formatToParts(NaN)", RangeError);
+
+// https://crbug.com/774833
+var df2 = new Intl.DateTimeFormat('en', {'hour': 'numeric'});
+Date.prototype.valueOf = "ponies";
+assertEquals(df.format(Date.now()), df.format());
+assertEquals(df2.format(Date.now()), df2.format());
+assertEquals(df.formatToParts(Date.now()), df.formatToParts());
+assertEquals(df2.formatToParts(Date.now()), df2.formatToParts());
diff --git a/src/v8/test/intl/general/invalid-locale.js b/src/v8/test/intl/general/invalid-locale.js
new file mode 100644
index 0000000..c85ed83
--- /dev/null
+++ b/src/v8/test/intl/general/invalid-locale.js
@@ -0,0 +1,39 @@
+// 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.
+
+// Make sure that invalid locales throw RangeError
+
+var invalid_locales = ["arcdefghl-Latn", "fil-Latn-kxx", "fr-Latn-CAK",
+                       "en-Latin-US", "en-a-foo-9charlong", "en-a-b",
+                      ];
+
+for (let locale  of invalid_locales) {
+  assertThrows("var nf = new Intl.NumberFormat('" + locale + "')", RangeError);
+}
+
+var not_so_long_locales = [
+  "bs-u-nu-bzcu-cab-cabs-avnlubs-avnihu-zcu-cab-cbs-avnllubs-avnihq-zcu-cab-cbs-ubs-avnihu-cabs-flus-xxd-vnluy",
+  "bs-u-nu-bzcu-cab-cabs-avnlubs-avnihu-zcu-cab-cbs-avnllubs-avnihq-zcu-cab-cbs-ubs-avnihu-cabs-flus-xxd",
+  "bs-u-nu-bzcu-cab-cabs-avnlubs-avnihu-zcu",
+];
+
+for (let locale  of not_so_long_locales) {
+  assertEquals((new Intl.NumberFormat(locale)).resolvedOptions().numberingSystem,
+      "latn");
+}
+
+// The point of this test is to make sure that there's no ill-effect with too
+// long a locale name. Because, thhere's no provision in the Ecma 402 on the
+// length limit of a locale ID and BCP 47 (RFC 5646 section 2.1). So, it's
+// a spec violation to treat this as invalid. See TODO(jshin) comment
+// in Runtime_CanonicalizeLanguageTag in runtime-intl.cc .
+var overlong_locales = [
+   "he-up-a-caiaup-araup-ai-pdu-sp-bs-up-arscna-zeieiaup-araup-arscia-rews-us-up-arscna-zeieiaup-araup-arsciap-arscna-zeieiaup-araup-arscie-u-sp-bs-uaup-arscia",
+   "he-up-a-caiaup-araup-ai-pdu-sp-bs-up-arscna-zeieiaup-araup-arscia-rews-us-up-arscna-zeieiaup-araup-arsciap-arscna-zeieiaup-araup-arscie-u-sp-bs-uaup-arscia-xyza",
+   "bs-u-nu-bzcu-cab-cabs-avnlubs-avnihu-zcu-cab-cbs-avnllubs-avnihq-zcu-cab-cbs-ubs-avnihu-cabs-flus-xxd-vnluy-abcd",
+];
+
+for (let locale  of overlong_locales) {
+  assertThrows("var nf = new Intl.NumberFormat('" + locale + "')", RangeError)
+}
diff --git a/src/v8/test/intl/number-format/format-currency.js b/src/v8/test/intl/number-format/format-currency.js
index 004c566..97e49f9 100755
--- a/src/v8/test/intl/number-format/format-currency.js
+++ b/src/v8/test/intl/number-format/format-currency.js
@@ -16,4 +16,4 @@
 
 var nf_EUR = new Intl.NumberFormat(['pt'], {style: 'currency', currency: 'EUR'});
 
-assertEquals("€1.000,00", nf_EUR.format(1000.00));
+assertEquals("€\u00a01.000,00", nf_EUR.format(1000.00));
diff --git a/src/v8/test/intl/testcfg.py b/src/v8/test/intl/testcfg.py
index c7f17bb..87aece3 100644
--- a/src/v8/test/intl/testcfg.py
+++ b/src/v8/test/intl/testcfg.py
@@ -26,18 +26,11 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
-import re
 
 from testrunner.local import testsuite
 from testrunner.objects import testcase
 
-FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
-
-class IntlTestSuite(testsuite.TestSuite):
-
-  def __init__(self, name, root):
-    super(IntlTestSuite, self).__init__(name, root)
-
+class TestSuite(testsuite.TestSuite):
   def ListTests(self, context):
     tests = []
     for dirname, dirs, files in os.walk(self.root):
@@ -52,35 +45,42 @@
           fullpath = os.path.join(dirname, filename)
           relpath = fullpath[len(self.root) + 1 : -3]
           testname = relpath.replace(os.path.sep, "/")
-          test = testcase.TestCase(self, testname)
+          test = self._create_test(testname)
           tests.append(test)
     return tests
 
-  def GetFlagsForTestCase(self, testcase, context):
-    source = self.GetSourceForTest(testcase)
-    flags = ["--allow-natives-syntax"] + context.mode_flags
-    flags_match = re.findall(FLAGS_PATTERN, source)
-    for match in flags_match:
-      flags += match.strip().split()
+  def _test_class(self):
+    return TestCase
 
-    files = []
-    files.append(os.path.join(self.root, "assert.js"))
-    files.append(os.path.join(self.root, "utils.js"))
-    files.append(os.path.join(self.root, "regexp-prepare.js"))
-    files.append(os.path.join(self.root, testcase.path + self.suffix()))
-    files.append(os.path.join(self.root, "regexp-assert.js"))
 
-    flags += files
-    if context.isolates:
-      flags.append("--isolate")
-      flags += files
+class TestCase(testcase.TestCase):
+  def __init__(self, *args, **kwargs):
+    super(TestCase, self).__init__(*args, **kwargs)
 
-    return testcase.flags + flags
+    self._source_flags = self._parse_source_flags()
 
-  def GetSourceForTest(self, testcase):
-    filename = os.path.join(self.root, testcase.path + self.suffix())
-    with open(filename) as f:
-      return f.read()
+  def _get_files_params(self, ctx):
+    files = map(lambda f: os.path.join(self.suite.root, f), [
+        'assert.js',
+        'utils.js',
+        'regexp-prepare.js',
+        self.path + self._get_suffix(),
+        'regexp-assert.js',
+    ])
+
+    if ctx.isolates:
+      files += ['--isolate'] + files
+    return files
+
+  def _get_source_flags(self):
+    return self._source_flags
+
+  def _get_suite_flags(self, ctx):
+    return ['--allow-natives-syntax']
+
+  def _get_source_path(self):
+    return os.path.join(self.suite.root, self.path + self._get_suffix())
+
 
 def GetSuite(name, root):
-  return IntlTestSuite(name, root)
+  return TestSuite(name, root)