LCOV - code coverage report
Current view: top level - src/runtime - runtime-intl.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 17 17 100.0 %
Date: 2019-04-19 Functions: 5 9 55.6 %

          Line data    Source code
       1             : // Copyright 2014 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_INTL_SUPPORT
       6             : #error Internationalization is expected to be enabled.
       7             : #endif  // V8_INTL_SUPPORT
       8             : 
       9             : #include <cmath>
      10             : #include <memory>
      11             : 
      12             : #include "src/api-inl.h"
      13             : #include "src/api-natives.h"
      14             : #include "src/arguments-inl.h"
      15             : #include "src/counters.h"
      16             : #include "src/date.h"
      17             : #include "src/global-handles.h"
      18             : #include "src/heap/factory.h"
      19             : #include "src/isolate-inl.h"
      20             : #include "src/objects/intl-objects.h"
      21             : #include "src/objects/js-array-inl.h"
      22             : #include "src/objects/js-collator-inl.h"
      23             : #include "src/objects/js-date-time-format-inl.h"
      24             : #include "src/objects/js-list-format-inl.h"
      25             : #include "src/objects/js-list-format.h"
      26             : #include "src/objects/js-number-format-inl.h"
      27             : #include "src/objects/js-plural-rules-inl.h"
      28             : #include "src/objects/managed.h"
      29             : #include "src/runtime/runtime-utils.h"
      30             : #include "src/utils.h"
      31             : 
      32             : namespace v8 {
      33             : namespace internal {
      34             : 
      35             : // ecma402 #sec-formatlist
      36        7452 : RUNTIME_FUNCTION(Runtime_FormatList) {
      37             :   HandleScope scope(isolate);
      38             :   DCHECK_EQ(2, args.length());
      39        3726 :   CONVERT_ARG_HANDLE_CHECKED(JSListFormat, list_format, 0);
      40        3726 :   CONVERT_ARG_HANDLE_CHECKED(JSArray, list, 1);
      41        7452 :   RETURN_RESULT_OR_FAILURE(
      42             :       isolate, JSListFormat::FormatList(isolate, list_format, list));
      43             : }
      44             : 
      45             : // ecma402 #sec-formatlisttoparts
      46        7920 : RUNTIME_FUNCTION(Runtime_FormatListToParts) {
      47             :   HandleScope scope(isolate);
      48             :   DCHECK_EQ(2, args.length());
      49        3960 :   CONVERT_ARG_HANDLE_CHECKED(JSListFormat, list_format, 0);
      50        3960 :   CONVERT_ARG_HANDLE_CHECKED(JSArray, list, 1);
      51        7920 :   RETURN_RESULT_OR_FAILURE(
      52             :       isolate, JSListFormat::FormatListToParts(isolate, list_format, list));
      53             : }
      54             : 
      55        5348 : RUNTIME_FUNCTION(Runtime_StringToLowerCaseIntl) {
      56             :   HandleScope scope(isolate);
      57             :   DCHECK_EQ(args.length(), 1);
      58        2674 :   CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
      59        2674 :   s = String::Flatten(isolate, s);
      60        5348 :   RETURN_RESULT_OR_FAILURE(isolate, Intl::ConvertToLower(isolate, s));
      61             : }
      62             : 
      63          96 : RUNTIME_FUNCTION(Runtime_StringToUpperCaseIntl) {
      64             :   HandleScope scope(isolate);
      65             :   DCHECK_EQ(args.length(), 1);
      66          48 :   CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
      67          48 :   s = String::Flatten(isolate, s);
      68          96 :   RETURN_RESULT_OR_FAILURE(isolate, Intl::ConvertToUpper(isolate, s));
      69             : }
      70             : 
      71             : }  // namespace internal
      72      122036 : }  // namespace v8

Generated by: LCOV version 1.10