LCOV - code coverage report
Current view: top level - src - char-predicates.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 11 11 100.0 %
Date: 2019-04-17 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // Copyright 2011 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 "src/char-predicates.h"
      10             : 
      11             : #include "unicode/uchar.h"
      12             : #include "unicode/urename.h"
      13             : 
      14             : namespace v8 {
      15             : namespace internal {
      16             : 
      17             : // ES#sec-names-and-keywords Names and Keywords
      18             : // UnicodeIDStart, '$', '_' and '\'
      19     4997896 : bool IsIdentifierStartSlow(uc32 c) {
      20             :   // cannot use u_isIDStart because it does not work for
      21             :   // Other_ID_Start characters.
      22     4997896 :   return u_hasBinaryProperty(c, UCHAR_ID_START) ||
      23     4996422 :          (c < 0x60 && (c == '$' || c == '\\' || c == '_'));
      24             : }
      25             : 
      26             : // ES#sec-names-and-keywords Names and Keywords
      27             : // UnicodeIDContinue, '$', '_', '\', ZWJ, and ZWNJ
      28        3934 : bool IsIdentifierPartSlow(uc32 c) {
      29             :   // Can't use u_isIDPart because it does not work for
      30             :   // Other_ID_Continue characters.
      31        6948 :   return u_hasBinaryProperty(c, UCHAR_ID_CONTINUE) ||
      32        6578 :          (c < 0x60 && (c == '$' || c == '\\' || c == '_')) || c == 0x200C ||
      33        3934 :          c == 0x200D;
      34             : }
      35             : 
      36             : // ES#sec-white-space White Space
      37             : // gC=Zs, U+0009, U+000B, U+000C, U+FEFF
      38     3434855 : bool IsWhiteSpaceSlow(uc32 c) {
      39     6857540 :   return (u_charType(c) == U_SPACE_SEPARATOR) ||
      40     3584006 :          (c < 0x0D && (c == 0x09 || c == 0x0B || c == 0x0C)) || c == 0xFEFF;
      41             : }
      42             : 
      43             : }  // namespace internal
      44      121996 : }  // namespace v8

Generated by: LCOV version 1.10