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 : #ifndef V8_TYPE_HINTS_H_
6 : #define V8_TYPE_HINTS_H_
7 :
8 : #include "src/base/flags.h"
9 : #include "src/utils.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 :
14 : // Type hints for an binary operation.
15 : enum class BinaryOperationHint : uint8_t {
16 : kNone,
17 : kSignedSmall,
18 : kSignedSmallInputs,
19 : kSigned32,
20 : kNumber,
21 : kNumberOrOddball,
22 : kConsOneByteString,
23 : kConsTwoByteString,
24 : kConsString,
25 : kString,
26 : kBigInt,
27 : kAny
28 : };
29 :
30 : inline size_t hash_value(BinaryOperationHint hint) {
31 0 : return static_cast<unsigned>(hint);
32 : }
33 :
34 : std::ostream& operator<<(std::ostream&, BinaryOperationHint);
35 :
36 : // Type hints for an compare operation.
37 : enum class CompareOperationHint : uint8_t {
38 : kNone,
39 : kSignedSmall,
40 : kNumber,
41 : kNumberOrOddball,
42 : kInternalizedString,
43 : kString,
44 : kSymbol,
45 : kBigInt,
46 : kReceiver,
47 : kReceiverOrNullOrUndefined,
48 : kAny
49 : };
50 :
51 : inline size_t hash_value(CompareOperationHint hint) {
52 118913 : return static_cast<unsigned>(hint);
53 : }
54 :
55 : std::ostream& operator<<(std::ostream&, CompareOperationHint);
56 :
57 : // Type hints for for..in statements.
58 : enum class ForInHint : uint8_t {
59 : kNone,
60 : kEnumCacheKeysAndIndices,
61 : kEnumCacheKeys,
62 : kAny
63 : };
64 :
65 : std::ostream& operator<<(std::ostream&, ForInHint);
66 :
67 : enum StringAddFlags {
68 : // Omit both parameter checks.
69 : STRING_ADD_CHECK_NONE,
70 : // Convert parameters when check fails (instead of throwing an exception).
71 : STRING_ADD_CONVERT_LEFT,
72 : STRING_ADD_CONVERT_RIGHT,
73 : };
74 :
75 : std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags);
76 :
77 : } // namespace internal
78 : } // namespace v8
79 :
80 : #endif // V8_TYPE_HINTS_H_
|