LCOV - code coverage report
Current view: top level - src - type-hints.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 5 83 6.0 %
Date: 2017-10-20 Functions: 1 8 12.5 %

          Line data    Source code
       1             : // Copyright 2015 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             : #include "src/type-hints.h"
       6             : 
       7             : namespace v8 {
       8             : namespace internal {
       9             : 
      10           0 : std::ostream& operator<<(std::ostream& os, BinaryOperationHint hint) {
      11           0 :   switch (hint) {
      12             :     case BinaryOperationHint::kNone:
      13           0 :       return os << "None";
      14             :     case BinaryOperationHint::kSignedSmall:
      15           0 :       return os << "SignedSmall";
      16             :     case BinaryOperationHint::kSignedSmallInputs:
      17           0 :       return os << "SignedSmallInputs";
      18             :     case BinaryOperationHint::kSigned32:
      19           0 :       return os << "Signed32";
      20             :     case BinaryOperationHint::kNumber:
      21           0 :       return os << "Number";
      22             :     case BinaryOperationHint::kNumberOrOddball:
      23           0 :       return os << "NumberOrOddball";
      24             :     case BinaryOperationHint::kString:
      25           0 :       return os << "String";
      26             :     case BinaryOperationHint::kAny:
      27           0 :       return os << "Any";
      28             :   }
      29           0 :   UNREACHABLE();
      30             : }
      31             : 
      32           0 : std::ostream& operator<<(std::ostream& os, CompareOperationHint hint) {
      33           0 :   switch (hint) {
      34             :     case CompareOperationHint::kNone:
      35           0 :       return os << "None";
      36             :     case CompareOperationHint::kSignedSmall:
      37           0 :       return os << "SignedSmall";
      38             :     case CompareOperationHint::kNumber:
      39           0 :       return os << "Number";
      40             :     case CompareOperationHint::kNumberOrOddball:
      41           0 :       return os << "NumberOrOddball";
      42             :     case CompareOperationHint::kInternalizedString:
      43           0 :       return os << "InternalizedString";
      44             :     case CompareOperationHint::kString:
      45           0 :       return os << "String";
      46             :     case CompareOperationHint::kSymbol:
      47           0 :       return os << "Symbol";
      48             :     case CompareOperationHint::kReceiver:
      49           0 :       return os << "Receiver";
      50             :     case CompareOperationHint::kAny:
      51           0 :       return os << "Any";
      52             :   }
      53           0 :   UNREACHABLE();
      54             : }
      55             : 
      56           0 : std::ostream& operator<<(std::ostream& os, ForInHint hint) {
      57           0 :   switch (hint) {
      58             :     case ForInHint::kNone:
      59           0 :       return os << "None";
      60             :     case ForInHint::kEnumCacheKeys:
      61           0 :       return os << "EnumCacheKeys";
      62             :     case ForInHint::kEnumCacheKeysAndIndices:
      63           0 :       return os << "EnumCacheKeysAndIndices";
      64             :     case ForInHint::kAny:
      65           0 :       return os << "Any";
      66             :   }
      67           0 :   UNREACHABLE();
      68             : }
      69             : 
      70           0 : std::ostream& operator<<(std::ostream& os, ToBooleanHint hint) {
      71           0 :   switch (hint) {
      72             :     case ToBooleanHint::kNone:
      73           0 :       return os << "None";
      74             :     case ToBooleanHint::kUndefined:
      75           0 :       return os << "Undefined";
      76             :     case ToBooleanHint::kBoolean:
      77           0 :       return os << "Boolean";
      78             :     case ToBooleanHint::kNull:
      79           0 :       return os << "Null";
      80             :     case ToBooleanHint::kSmallInteger:
      81           0 :       return os << "SmallInteger";
      82             :     case ToBooleanHint::kReceiver:
      83           0 :       return os << "Receiver";
      84             :     case ToBooleanHint::kString:
      85           0 :       return os << "String";
      86             :     case ToBooleanHint::kSymbol:
      87           0 :       return os << "Symbol";
      88             :     case ToBooleanHint::kHeapNumber:
      89           0 :       return os << "HeapNumber";
      90             :     case ToBooleanHint::kAny:
      91           0 :       return os << "Any";
      92             :     case ToBooleanHint::kNeedsMap:
      93           0 :       return os << "NeedsMap";
      94             :   }
      95           0 :   UNREACHABLE();
      96             : }
      97             : 
      98           0 : std::string ToString(ToBooleanHint hint) {
      99           0 :   switch (hint) {
     100             :     case ToBooleanHint::kNone:
     101           0 :       return "None";
     102             :     case ToBooleanHint::kUndefined:
     103           0 :       return "Undefined";
     104             :     case ToBooleanHint::kBoolean:
     105           0 :       return "Boolean";
     106             :     case ToBooleanHint::kNull:
     107           0 :       return "Null";
     108             :     case ToBooleanHint::kSmallInteger:
     109           0 :       return "SmallInteger";
     110             :     case ToBooleanHint::kReceiver:
     111           0 :       return "Receiver";
     112             :     case ToBooleanHint::kString:
     113           0 :       return "String";
     114             :     case ToBooleanHint::kSymbol:
     115           0 :       return "Symbol";
     116             :     case ToBooleanHint::kHeapNumber:
     117           0 :       return "HeapNumber";
     118             :     case ToBooleanHint::kAny:
     119           0 :       return "Any";
     120             :     case ToBooleanHint::kNeedsMap:
     121           0 :       return "NeedsMap";
     122             :   }
     123           0 :   UNREACHABLE();
     124             : }
     125             : 
     126           0 : std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) {
     127           0 :   if (hints == ToBooleanHint::kAny) return os << "Any";
     128           0 :   if (hints == ToBooleanHint::kNone) return os << "None";
     129             :   bool first = true;
     130           0 :   for (ToBooleanHints::mask_type i = 0; i < sizeof(i) * 8; ++i) {
     131           0 :     ToBooleanHint const hint = static_cast<ToBooleanHint>(1u << i);
     132           0 :     if (hints & hint) {
     133           0 :       if (!first) os << "|";
     134             :       first = false;
     135           0 :       os << hint;
     136             :     }
     137             :   }
     138             :   return os;
     139             : }
     140             : 
     141           0 : std::string ToString(ToBooleanHints hints) {
     142           0 :   if (hints == ToBooleanHint::kAny) return "Any";
     143           0 :   if (hints == ToBooleanHint::kNone) return "None";
     144             :   std::string ret;
     145             :   bool first = true;
     146           0 :   for (ToBooleanHints::mask_type i = 0; i < sizeof(i) * 8; ++i) {
     147           0 :     ToBooleanHint const hint = static_cast<ToBooleanHint>(1u << i);
     148           0 :     if (hints & hint) {
     149           0 :       if (!first) ret += "|";
     150             :       first = false;
     151           0 :       ret += ToString(hint);
     152             :     }
     153             :   }
     154             :   return ret;
     155             : }
     156             : 
     157          93 : std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags) {
     158          93 :   switch (flags) {
     159             :     case STRING_ADD_CHECK_NONE:
     160          31 :       return os << "CheckNone";
     161             :     case STRING_ADD_CHECK_LEFT:
     162           0 :       return os << "CheckLeft";
     163             :     case STRING_ADD_CHECK_RIGHT:
     164           0 :       return os << "CheckRight";
     165             :     case STRING_ADD_CHECK_BOTH:
     166           0 :       return os << "CheckBoth";
     167             :     case STRING_ADD_CONVERT_LEFT:
     168          31 :       return os << "ConvertLeft";
     169             :     case STRING_ADD_CONVERT_RIGHT:
     170          31 :       return os << "ConvertRight";
     171             :     case STRING_ADD_CONVERT:
     172             :       break;
     173             :   }
     174           0 :   UNREACHABLE();
     175             : }
     176             : 
     177             : }  // namespace internal
     178             : }  // namespace v8

Generated by: LCOV version 1.10