type-hints.cc 2.73 KB
Newer Older
1 2 3 4
// Copyright 2015 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.

5
#include "src/objects/type-hints.h"
6 7 8 9

namespace v8 {
namespace internal {

10
std::ostream& operator<<(std::ostream& os, BinaryOperationHint hint) {
11
  switch (hint) {
12
    case BinaryOperationHint::kNone:
13
      return os << "None";
14
    case BinaryOperationHint::kSignedSmall:
15
      return os << "SignedSmall";
16 17
    case BinaryOperationHint::kSignedSmallInputs:
      return os << "SignedSmallInputs";
18
    case BinaryOperationHint::kSigned32:
19
      return os << "Signed32";
20 21
    case BinaryOperationHint::kNumber:
      return os << "Number";
22
    case BinaryOperationHint::kNumberOrOddball:
23
      return os << "NumberOrOddball";
24 25
    case BinaryOperationHint::kString:
      return os << "String";
26 27
    case BinaryOperationHint::kBigInt:
      return os << "BigInt";
28
    case BinaryOperationHint::kAny:
29 30 31 32 33
      return os << "Any";
  }
  UNREACHABLE();
}

34
std::ostream& operator<<(std::ostream& os, CompareOperationHint hint) {
35
  switch (hint) {
36
    case CompareOperationHint::kNone:
37
      return os << "None";
38
    case CompareOperationHint::kSignedSmall:
39
      return os << "SignedSmall";
40
    case CompareOperationHint::kNumber:
41
      return os << "Number";
42 43
    case CompareOperationHint::kNumberOrBoolean:
      return os << "NumberOrBoolean";
44
    case CompareOperationHint::kNumberOrOddball:
45
      return os << "NumberOrOddball";
46 47
    case CompareOperationHint::kInternalizedString:
      return os << "InternalizedString";
48 49
    case CompareOperationHint::kString:
      return os << "String";
50 51
    case CompareOperationHint::kSymbol:
      return os << "Symbol";
52 53
    case CompareOperationHint::kBigInt:
      return os << "BigInt";
54 55
    case CompareOperationHint::kReceiver:
      return os << "Receiver";
56 57
    case CompareOperationHint::kReceiverOrNullOrUndefined:
      return os << "ReceiverOrNullOrUndefined";
58
    case CompareOperationHint::kAny:
59
      return os << "Any";
60 61 62 63 64 65 66 67 68 69 70 71 72 73
  }
  UNREACHABLE();
}

std::ostream& operator<<(std::ostream& os, ForInHint hint) {
  switch (hint) {
    case ForInHint::kNone:
      return os << "None";
    case ForInHint::kEnumCacheKeys:
      return os << "EnumCacheKeys";
    case ForInHint::kEnumCacheKeysAndIndices:
      return os << "EnumCacheKeysAndIndices";
    case ForInHint::kAny:
      return os << "Any";
74 75 76 77
  }
  UNREACHABLE();
}

78 79 80 81 82 83 84 85 86 87 88 89
std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags) {
  switch (flags) {
    case STRING_ADD_CHECK_NONE:
      return os << "CheckNone";
    case STRING_ADD_CONVERT_LEFT:
      return os << "ConvertLeft";
    case STRING_ADD_CONVERT_RIGHT:
      return os << "ConvertRight";
  }
  UNREACHABLE();
}

90 91
}  // namespace internal
}  // namespace v8