V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
type-hints.h
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  kString,
23  kBigInt,
24  kAny
25 };
26 
27 inline size_t hash_value(BinaryOperationHint hint) {
28  return static_cast<unsigned>(hint);
29 }
30 
31 std::ostream& operator<<(std::ostream&, BinaryOperationHint);
32 
33 // Type hints for an compare operation.
34 enum class CompareOperationHint : uint8_t {
35  kNone,
36  kSignedSmall,
37  kNumber,
38  kNumberOrOddball,
39  kInternalizedString,
40  kString,
41  kSymbol,
42  kBigInt,
43  kReceiver,
44  kReceiverOrNullOrUndefined,
45  kAny
46 };
47 
48 inline size_t hash_value(CompareOperationHint hint) {
49  return static_cast<unsigned>(hint);
50 }
51 
52 std::ostream& operator<<(std::ostream&, CompareOperationHint);
53 
54 // Type hints for for..in statements.
55 enum class ForInHint : uint8_t {
56  kNone,
57  kEnumCacheKeysAndIndices,
58  kEnumCacheKeys,
59  kAny
60 };
61 
62 std::ostream& operator<<(std::ostream&, ForInHint);
63 
64 enum StringAddFlags {
65  // Omit both parameter checks.
66  STRING_ADD_CHECK_NONE,
67  // Convert parameters when check fails (instead of throwing an exception).
68  STRING_ADD_CONVERT_LEFT,
69  STRING_ADD_CONVERT_RIGHT,
70 };
71 
72 std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags);
73 
74 } // namespace internal
75 } // namespace v8
76 
77 #endif // V8_TYPE_HINTS_H_
Definition: libplatform.h:13