v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bytecode-flags-and-tokens.h
Go to the documentation of this file.
1// Copyright 2016 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_INTERPRETER_BYTECODE_FLAGS_AND_TOKENS_H_
6#define V8_INTERPRETER_BYTECODE_FLAGS_AND_TOKENS_H_
7
10
11namespace v8 {
12namespace internal {
13
14// Forward declarations.
15class Literal;
16class AstStringConstants;
17
18namespace interpreter {
19
21 public:
24
25 static uint8_t Encode(bool use_fast_shallow_clone, int runtime_flags);
26
27 private:
29};
30
32 public:
35
36 static uint8_t Encode(int runtime_flags, bool fast_clone_supported);
37
38 private:
40};
41
43 public:
46
47 static uint8_t Encode(bool pretenure, bool is_function_scope,
48 bool might_always_turbofan);
49
50 private:
52};
53
54#define TYPEOF_LITERAL_LIST(V) \
55 V(Number, number) \
56 V(String, string) \
57 V(Symbol, symbol) \
58 V(Boolean, boolean) \
59 V(BigInt, bigint) \
60 V(Undefined, undefined) \
61 V(Function, function) \
62 V(Object, object) \
63 V(Other, other)
64
66 public:
67 enum class LiteralFlag : uint8_t {
68#define DECLARE_LITERAL_FLAG(name, _) k##name,
70#undef DECLARE_LITERAL_FLAG
71 };
72
73 static LiteralFlag GetFlagForLiteral(const AstStringConstants* ast_constants,
74 Literal* literal);
75 static uint8_t Encode(LiteralFlag literal_flag);
76 static LiteralFlag Decode(uint8_t raw_flag);
77
78 static const char* ToString(LiteralFlag literal_flag);
79
80 private:
82};
83
85 public:
89
90 static uint8_t Encode(LanguageMode language_mode,
91 LookupHoistingMode lookup_hoisting_mode);
92
93 static LanguageMode GetLanguageMode(uint8_t flags);
94 static bool IsLookupHoistingMode(uint8_t flags);
95
96 private:
98};
99
101 // Fixed value tokens for paths we know we need.
102 // Fallthrough is set to -1 to make it the fallthrough case of the jump table,
103 // where the remaining cases start at 0.
105 // TODO(leszeks): Rethrow being 0 makes it use up a valuable LdaZero, which
106 // means that other commands (such as break or return) have to use LdaSmi.
107 // This can very slightly bloat bytecode, so perhaps token values should all
108 // be shifted down by 1.
109 kRethrowToken = 0
110};
111
112} // namespace interpreter
113} // namespace internal
114} // namespace v8
115
116#endif // V8_INTERPRETER_BYTECODE_FLAGS_AND_TOKENS_H_
#define TYPEOF_LITERAL_LIST(V)
static constexpr U kNumValues
Definition bit-field.h:43
static uint8_t Encode(bool use_fast_shallow_clone, int runtime_flags)
DISALLOW_IMPLICIT_CONSTRUCTORS(CreateArrayLiteralFlags)
static uint8_t Encode(bool pretenure, bool is_function_scope, bool might_always_turbofan)
DISALLOW_IMPLICIT_CONSTRUCTORS(CreateObjectLiteralFlags)
static uint8_t Encode(int runtime_flags, bool fast_clone_supported)
static uint8_t Encode(LanguageMode language_mode, LookupHoistingMode lookup_hoisting_mode)
static uint8_t Encode(LiteralFlag literal_flag)
static LiteralFlag GetFlagForLiteral(const AstStringConstants *ast_constants, Literal *literal)
static LiteralFlag Decode(uint8_t raw_flag)
static const char * ToString(LiteralFlag literal_flag)
FunctionLiteral * literal
Definition liveedit.cc:294
static const size_t LanguageModeSize
Definition globals.h:753