v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
code.h
Go to the documentation of this file.
1// Copyright 2017 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_OBJECTS_CODE_H_
6#define V8_OBJECTS_CODE_H_
7
10#include "src/objects/struct.h"
12
13// Has to be the last include (doesn't have include guards):
15
16namespace v8 {
17namespace internal {
18
19class BytecodeArray;
20class CodeDesc;
21class CodeWrapper;
22class Factory;
23template <typename Impl>
24class FactoryBase;
25class LocalFactory;
26class SafepointEntry;
27class RootVisitor;
28
29enum class Builtin;
30enum class LazyDeoptimizeReason : uint8_t;
31
32// Code is a container for data fields related to its associated
33// {InstructionStream} object. Since {InstructionStream} objects reside on
34// write-protected pages within the heap, its header fields need to be
35// immutable. Every InstructionStream object has an associated Code object,
36// but not every Code object has an InstructionStream (e.g. for builtins).
37//
38// Embedded builtins consist of on-heap Code objects, with an out-of-line body
39// section. Accessors (e.g. InstructionStart), redirect to the off-heap area.
40// Metadata table offsets remain relative to MetadataStart(), i.e. they point
41// into the off-heap metadata section. The off-heap layout is described in
42// detail in the EmbeddedData class, but at a high level one can assume a
43// dedicated, out-of-line, instruction and metadata section for each embedded
44// builtin:
45//
46// +--------------------------+ <-- InstructionStart()
47// | off-heap instructions |
48// | ... |
49// +--------------------------+ <-- InstructionEnd()
50//
51// +--------------------------+ <-- MetadataStart() (MS)
52// | off-heap metadata |
53// | ... | <-- MS + handler_table_offset()
54// | | <-- MS + constant_pool_offset()
55// | | <-- MS + code_comments_offset()
56// | | <-- MS + builtin_jump_table_info_offset()
57// | | <-- MS + unwinding_info_offset()
58// +--------------------------+ <-- MetadataEnd()
59//
60// When the sandbox is enabled, Code objects are allocated outside the sandbox
61// and referenced through indirect pointers, so they need to inherit from
62// ExposedTrustedObject.
63class Code : public ExposedTrustedObject {
64 public:
65 // When V8_EXTERNAL_CODE_SPACE is enabled, InstructionStream objects are
66 // allocated in a separate pointer compression cage instead of the cage where
67 // all the other objects are allocated.
68 inline PtrComprCageBase code_cage_base() const;
69
70 // Back-reference to the InstructionStream object.
71 //
72 // Note the cage-less accessor versions may not be called if the current Code
73 // object is InReadOnlySpace. That may only be the case for Code objects
74 // representing builtins, or in other words, Code objects for which
75 // has_instruction_stream() is never true.
76 DECL_GETTER(instruction_stream, Tagged<InstructionStream>)
78 DECL_ACCESSORS(raw_instruction_stream, Tagged<Object>)
79 DECL_RELAXED_GETTER(raw_instruction_stream, Tagged<Object>)
80 // An unchecked accessor to be used during GC.
82
83 // Whether this Code object has an associated InstructionStream (embedded
84 // builtins don't).
85 inline bool has_instruction_stream() const;
86 inline bool has_instruction_stream(RelaxedLoadTag) const;
87
88 // The start of the associated instruction stream. Points either into an
89 // on-heap InstructionStream object, or to the beginning of an embedded
90 // builtin.
91 DECL_GETTER(instruction_start, Address)
92 DECL_PRIMITIVE_ACCESSORS(instruction_size, int)
93 inline Address instruction_end() const;
94
95 inline CodeEntrypointTag entrypoint_tag() const;
96
101 Address entry);
103 inline void UpdateInstructionStart(IsolateForSandbox isolate,
105
107 bool is_turbofanned);
108
109 // Clear uninitialized padding space. This ensures that the snapshot content
110 // is deterministic.
111 inline void clear_padding();
112
113 // Flushes the instruction cache for the executable instructions of this code
114 // object. Make sure to call this while the code is still writable.
115 void FlushICache() const;
116
117 DECL_PRIMITIVE_ACCESSORS(can_have_weak_objects, bool)
118 DECL_PRIMITIVE_GETTER(marked_for_deoptimization, bool)
119
120 DECL_PRIMITIVE_ACCESSORS(metadata_size, int)
121 // [handler_table_offset]: The offset where the exception handler table
122 // starts.
123 DECL_PRIMITIVE_ACCESSORS(handler_table_offset, int)
124 // [builtin_jump_table_info offset]: Offset of the builtin jump table info.
125 DECL_PRIMITIVE_ACCESSORS(builtin_jump_table_info_offset, int32_t)
126 // [unwinding_info_offset]: Offset of the unwinding info section.
127 DECL_PRIMITIVE_ACCESSORS(unwinding_info_offset, int32_t)
128 // [deoptimization_data]: Array containing data for deopt for non-baseline
129 // code.
130 DECL_ACCESSORS(deoptimization_data, Tagged<ProtectedFixedArray>)
131 // [parameter_count]: The number of formal parameters, including the
132 // receiver. Currently only available for optimized functions.
133 // TODO(saelo): make this always available. This is just a matter of figuring
134 // out how to obtain the parameter count during code generation when no
135 // BytecodeArray is available from which it can be copied.
137 inline uint16_t parameter_count_without_receiver() const;
138 DECL_PRIMITIVE_ACCESSORS(wasm_js_tagged_parameter_count, uint16_t)
139 DECL_PRIMITIVE_ACCESSORS(wasm_js_first_tagged_parameter, uint16_t)
140
141 // Whether this type of Code uses deoptimization data, in which case the
142 // deoptimization_data field will be populated.
143 inline bool uses_deoptimization_data() const;
144
145 // If neither deoptimization data nor bytecode/interpreter data are used
146 // (e.g. for builtin code), the respective field will contain Smi::zero().
149
150 // [bytecode_or_interpreter_data]: BytecodeArray or InterpreterData for
151 // baseline code.
156 // [source_position_table]: ByteArray for the source positions table for
157 // non-baseline code.
158 DECL_ACCESSORS(source_position_table, Tagged<TrustedByteArray>)
159 // [bytecode_offset_table]: ByteArray for the bytecode offset for baseline
160 // code.
161 DECL_ACCESSORS(bytecode_offset_table, Tagged<TrustedByteArray>)
162
164 inline bool has_source_position_table() const;
165 inline bool has_bytecode_offset_table() const;
167
168 DECL_PRIMITIVE_ACCESSORS(inlined_bytecode_size, unsigned)
170 // [code_comments_offset]: Offset of the code comment section.
171 DECL_PRIMITIVE_ACCESSORS(code_comments_offset, int)
172 // [constant_pool offset]: Offset of the constant pool.
173 DECL_PRIMITIVE_ACCESSORS(constant_pool_offset, int)
174 // [wrapper] The CodeWrapper for this Code. When the sandbox is enabled, the
175 // Code object lives in trusted space outside of the sandbox, but the wrapper
176 // object lives inside the main heap and therefore inside the sandbox. As
177 // such, the wrapper object can be used in cases where a Code object needs to
178 // be referenced alongside other tagged pointer references (so for example
179 // inside a FixedArray).
181
182 // Unchecked accessors to be used during GC.
184
186
187 inline CodeKind kind() const;
188
189 inline void set_builtin_id(Builtin builtin_id);
190 inline Builtin builtin_id() const;
191 inline bool is_builtin() const;
192
193 inline bool is_optimized_code() const;
194 inline bool is_wasm_code() const;
195
196 inline bool is_interpreter_trampoline_builtin() const;
197 inline bool is_baseline_trampoline_builtin() const;
198 inline bool is_baseline_leave_frame_builtin() const;
199
200 // Tells whether the code checks the tiering state in the function's feedback
201 // vector.
202 // TODO(olivfi, 42204201): Remove this once leaptiering is enabled everywhere.
203 inline bool checks_tiering_state() const;
204
205 // Tells whether the outgoing parameters of this code are tagged pointers.
206 inline bool has_tagged_outgoing_params() const;
207
208 // [is_maglevved]: Tells whether the code object was generated by the
209 // Maglev optimizing compiler.
210 inline bool is_maglevved() const;
211
212 // [is_turbofanned]: Tells whether the code object was generated by the
213 // TurboFan optimizing compiler.
214 inline bool is_turbofanned() const;
215
216 // [is_context_specialized]: Tells whether the code object was specialized to
217 // a constant context.
218 inline bool is_context_specialized() const;
219
220 // [uses_safepoint_table]: Whether this InstructionStream object uses
221 // safepoint tables (note the table may still be empty, see
222 // has_safepoint_table).
223 inline bool uses_safepoint_table() const;
224
225 // [stack_slots]: If {uses_safepoint_table()}, the number of stack slots
226 // reserved in the code prologue; otherwise 0.
227 inline uint32_t stack_slots() const;
228
230 Isolate* isolate, Tagged<SharedFunctionInfo> sfi) const;
231 int SourcePosition(int offset) const;
232 int SourceStatementPosition(int offset) const;
233
234 inline Address safepoint_table_address() const;
235 inline int safepoint_table_size() const;
236 inline bool has_safepoint_table() const;
237
238 inline Address handler_table_address() const;
239 inline int handler_table_size() const;
240 inline bool has_handler_table() const;
241
242 inline Address constant_pool() const;
243 inline int constant_pool_size() const;
244 inline bool has_constant_pool() const;
245
246 inline Address code_comments() const;
247 inline int code_comments_size() const;
248 inline bool has_code_comments() const;
249
250 inline Address builtin_jump_table_info() const;
251 inline int builtin_jump_table_info_size() const;
252 inline bool has_builtin_jump_table_info() const;
253
254 inline Address unwinding_info_start() const;
255 inline Address unwinding_info_end() const;
256 inline int unwinding_info_size() const;
257 inline bool has_unwinding_info() const;
258
259 inline uint8_t* relocation_start() const;
260 inline uint8_t* relocation_end() const;
261 inline int relocation_size() const;
262
263 inline int safepoint_table_offset() const { return 0; }
264
265 inline Address body_start() const;
266 inline Address body_end() const;
267 inline int body_size() const;
268
269 inline Address metadata_start() const;
270 inline Address metadata_end() const;
271
272#ifdef V8_ENABLE_LEAPTIERING
273 inline void set_js_dispatch_handle(JSDispatchHandle handle);
274 inline JSDispatchHandle js_dispatch_handle() const;
275#endif // V8_ENABLE_LEAPTIERING
276
277 // The size of the associated InstructionStream object, if it exists.
278 inline int InstructionStreamObjectSize() const;
279
280 // TODO(jgruber): This function tries to account for various parts of the
281 // object graph, but is incomplete. Take it as a lower bound for the memory
282 // associated with this Code object.
283 inline int SizeIncludingMetadata() const;
284
285 // The following functions include support for short builtin calls:
286 //
287 // When builtins un-embedding is enabled for the Isolate
288 // (see Isolate::is_short_builtin_calls_enabled()) then both embedded and
289 // un-embedded builtins might be exeuted and thus two kinds of |pc|s might
290 // appear on the stack.
291 // Unlike the paremeterless versions of the functions above the below variants
292 // ensure that the instruction start correspond to the given |pc| value.
293 // Thus for off-heap trampoline InstructionStream objects the result might be
294 // the instruction start/end of the embedded code stream or of un-embedded
295 // one. For normal InstructionStream objects these functions just return the
296 // instruction_start/end() values.
297 // TODO(11527): remove these versions once the full solution is ready.
298 inline Address InstructionStart(Isolate* isolate, Address pc) const;
299 inline Address InstructionEnd(Isolate* isolate, Address pc) const;
300 inline bool contains(Isolate* isolate, Address pc) const;
301 inline int GetOffsetFromInstructionStart(Isolate* isolate, Address pc) const;
302 // Support for short builtin calls END.
303
306
307 inline void SetMarkedForDeoptimization(Isolate* isolate,
308 LazyDeoptimizeReason reason);
310 LazyDeoptimizeReason reason);
311
312 inline bool CanContainWeakObjects();
313 inline bool IsWeakObject(Tagged<HeapObject> object);
314 static inline bool IsWeakObjectInOptimizedCode(Tagged<HeapObject> object);
316 Tagged<Object> object);
317
318 // This function should be called only from GC.
320
321 // [embedded_objects_cleared]: If CodeKindIsOptimizedJSFunction(kind), tells
322 // whether the embedded objects in the code marked for deoptimization were
323 // cleared. Note that embedded_objects_cleared() implies
324 // marked_for_deoptimization().
325 inline bool embedded_objects_cleared() const;
326 inline void set_embedded_objects_cleared(bool flag);
327
328 bool IsIsolateIndependent(Isolate* isolate);
329
331 int bytecode_offset, Tagged<BytecodeArray> bytecodes);
332
333 inline uintptr_t GetBaselineEndPCForBytecodeOffset(
334 int bytecode_offset, Tagged<BytecodeArray> bytecodes);
335
336 // Returns true if the function is inlined in the code.
338
339 // Returns the PC of the next bytecode in execution order.
340 // If the bytecode at the given offset is JumpLoop, the PC of the jump target
341 // is returned. Other jumps are not allowed.
342 // For other bytecodes this is equivalent to
343 // GetBaselineEndPCForBytecodeOffset.
345 int bytecode_offset, Tagged<BytecodeArray> bytecodes);
346
347 inline int GetBytecodeOffsetForBaselinePC(Address baseline_pc,
348 Tagged<BytecodeArray> bytecodes);
349
351
353
354#ifdef ENABLE_DISASSEMBLER
355 V8_EXPORT_PRIVATE void Disassemble(const char* name, std::ostream& os,
356 Isolate* isolate,
357 Address current_pc = kNullAddress);
358 V8_EXPORT_PRIVATE void DisassembleOnlyCode(const char* name, std::ostream& os,
359 Isolate* isolate,
360 Address current_pc,
361 size_t range_limit);
362#endif // ENABLE_DISASSEMBLER
363
364#ifdef OBJECT_PRINT
365 void CodePrint(std::ostream& os, const char* name = nullptr,
366 Address current_pc = kNullAddress);
367#endif
368
370
371// Layout description.
372#define CODE_DATA_FIELDS(V) \
373 /* The deoptimization_data_or_interpreter_data field contains: */ \
374 /* - A DeoptimizationData for optimized code (maglev or turbofan) */ \
375 /* - A BytecodeArray or InterpreterData for baseline code */ \
376 /* - Smi::zero() for all other types of code (e.g. builtin) */ \
377 V(kDeoptimizationDataOrInterpreterDataOffset, kTaggedSize) \
378 /* This field contains: */ \
379 /* - A bytecode offset table (trusted byte array) for baseline code */ \
380 /* - A (possibly empty) source position table (trusted byte array) for */ \
381 /* most other types of code */ \
382 /* - Smi::zero() for embedded builtin code (in RO space) */ \
383 /* TODO(saelo) once we have a trusted RO space, we could instead use */ \
384 /* empty_trusted_byte_array to avoid using Smi::zero() at all. */ \
385 V(kPositionTableOffset, kTaggedSize) \
386 /* Strong pointer fields. */ \
387 V(kStartOfStrongFieldsOffset, 0) \
388 V(kWrapperOffset, kTaggedSize) \
389 V(kEndOfStrongFieldsWithMainCageBaseOffset, 0) \
390 /* The InstructionStream field is special: it uses code_cage_base. */ \
391 V(kInstructionStreamOffset, kTaggedSize) \
392 V(kEndOfStrongFieldsOffset, 0) \
393 /* Untagged data not directly visited by GC starts here. */ \
394 /* When the sandbox is off, the instruction_start field contains a raw */ \
395 /* pointer to the first instruction of this Code. */ \
396 /* If the sandbox is on, this field does not exist. Instead, the */ \
397 /* instruction_start is stored in this Code's code pointer table entry */ \
398 /* referenced via the kSelfIndirectPointerOffset field */ \
399 V(kInstructionStartOffset, V8_ENABLE_SANDBOX_BOOL ? 0 : kSystemPointerSize) \
400 /* The serializer needs to copy bytes starting from here verbatim. */ \
401 V(kDispatchHandleOffset, \
402 V8_ENABLE_LEAPTIERING_BOOL ? kJSDispatchHandleSize : 0) \
403 V(kFlagsOffset, kUInt32Size) \
404 V(kInstructionSizeOffset, kIntSize) \
405 V(kMetadataSizeOffset, kIntSize) \
406 /* TODO(jgruber): TF-specific fields could be merged with builtin_id. */ \
407 V(kInlinedBytecodeSizeOffset, kIntSize) \
408 V(kOsrOffsetOffset, kInt32Size) \
409 V(kHandlerTableOffsetOffset, kIntSize) \
410 V(kUnwindingInfoOffsetOffset, kInt32Size) \
411 V(kConstantPoolOffsetOffset, V8_EMBEDDED_CONSTANT_POOL_BOOL ? kIntSize : 0) \
412 V(kCodeCommentsOffsetOffset, kIntSize) \
413 V(kBuiltinJumpTableInfoOffsetOffset, \
414 V8_BUILTIN_JUMP_TABLE_INFO_BOOL ? kInt32Size : 0) \
415 /* This field is currently only used during deoptimization. If this space */ \
416 /* is ever needed for other purposes, it would probably be possible to */ \
417 /* obtain the parameter count from the BytecodeArray instead. */ \
418 V(kParameterCountOffset, kUInt16Size) \
419 /* TODO(jgruber): 12 bits would suffice, steal from here if needed. */ \
420 V(kBuiltinIdOffset, kInt16Size) \
421 V(kUnalignedSize, OBJECT_POINTER_PADDING(kUnalignedSize)) \
422 /* Total size. */ \
423 V(kSize, 0)
424
427
428#undef CODE_DATA_FIELDS
429
430#ifdef V8_EXTERNAL_CODE_SPACE
431 template <typename T>
432 using ExternalCodeField =
434#else
435 template <typename T>
436 using ExternalCodeField = TaggedField<T, kInstructionStreamOffset>;
437#endif // V8_EXTERNAL_CODE_SPACE
438
439 class BodyDescriptor;
440
441 // Flags layout.
442#define FLAGS_BIT_FIELDS(V, _) \
443 V(KindField, CodeKind, 4, _) \
444 V(IsTurbofannedField, bool, 1, _) \
445 V(IsContextSpecializedField, bool, 1, _) \
446 V(MarkedForDeoptimizationField, bool, 1, _) \
447 V(EmbeddedObjectsClearedField, bool, 1, _) \
448 V(CanHaveWeakObjectsField, bool, 1, _)
450#undef FLAGS_BIT_FIELDS
451 static_assert(FLAGS_BIT_FIELDS_Ranges::kBitsCount <=
452 FIELD_SIZE(kFlagsOffset) * kBitsPerByte);
453 static_assert(kCodeKindCount <= KindField::kNumValues);
454
455 // The {marked_for_deoptimization} field is accessed from generated code.
457 MarkedForDeoptimizationField::kShift;
458 static const int kIsTurbofannedBit = IsTurbofannedField::kShift;
459
460 static const int kArgumentsBits = 16;
461 // Slightly less than 2^kArgumentBits-1 to allow for extra implicit arguments
462 // on the call nodes without overflowing the uint16_t input_count.
463 static const int kMaxArguments = (1 << kArgumentsBits) - 10;
464
465 private:
466 DECL_PRIMITIVE_SETTER(marked_for_deoptimization, bool)
467
468 inline void set_instruction_start(IsolateForSandbox isolate, Address value);
469
470 // TODO(jgruber): These field names are incomplete, we've squashed in more
471 // overloaded contents in the meantime. Update the field names.
474
477 // End of bytecode equals the start of the next bytecode.
478 // We need it when we deoptimize to the next bytecode (lazy deopt or deopt
479 // of non-topmost frame).
481 };
482 inline uintptr_t GetBaselinePCForBytecodeOffset(
483 int bytecode_offset, BytecodeToPCPosition position,
484 Tagged<BytecodeArray> bytecodes);
485
486 template <typename IsolateT>
487 friend class Deserializer;
488 friend Factory;
491
493};
494
495// A Code object when used in situations where gc might be in progress. The
496// underlying pointer is guaranteed to be a Code object.
497//
498// Semantics around Code and InstructionStream objects are quite delicate when
499// GC is in progress and objects are currently being moved, because the
500// tightly-coupled object pair {Code,InstructionStream} are conceptually
501// treated as a single object in our codebase, and we frequently convert
502// between the two. However, during GC, extra care must be taken when accessing
503// the `Code::instruction_stream` and `InstructionStream::code` slots because
504// they may contain forwarding pointers.
505//
506// This class a) clarifies at use sites that we're dealing with a Code object
507// in a situation that requires special semantics, and b) safely implements
508// related functions.
509//
510// Note that both the underlying Code object and the associated
511// InstructionStream may be forwarding pointers, thus type checks and normal
512// (checked) casts do not work on GcSafeCode.
513class GcSafeCode : public HeapObject {
514 public:
515 // Use with care, this casts away knowledge that we're dealing with a
516 // special-semantics object.
517 inline Tagged<Code> UnsafeCastToCode() const;
518
519 // Safe accessors (these just forward to Code methods).
521 inline Address instruction_end() const;
522 inline bool is_builtin() const;
523 inline Builtin builtin_id() const;
524 inline CodeKind kind() const;
528 inline bool has_instruction_stream() const;
529 inline bool is_maglevved() const;
530 inline bool is_turbofanned() const;
531 inline bool has_tagged_outgoing_params() const;
532 inline bool marked_for_deoptimization() const;
534 inline Address constant_pool() const;
536 inline uint32_t stack_slots() const;
537
538 inline int GetOffsetFromInstructionStart(Isolate* isolate, Address pc) const;
539 inline Address InstructionStart(Isolate* isolate, Address pc) const;
540 inline Address InstructionEnd(Isolate* isolate, Address pc) const;
541 inline bool CanDeoptAt(Isolate* isolate, Address pc) const;
543 PtrComprCageBase code_cage_base) const;
544 // The two following accessors repurpose the InlinedBytecodeSize field, see
545 // comment in code-inl.h.
546 inline uint16_t wasm_js_tagged_parameter_count() const;
547 inline uint16_t wasm_js_first_tagged_parameter() const;
548
549 private:
551};
552
553// A CodeWrapper wraps a Code but lives inside the sandbox. This can be useful
554// for example when a reference to a Code needs to be stored along other tagged
555// pointers inside an array or similar container datastructure.
556class CodeWrapper : public Struct {
557 public:
559
562
563#define FIELD_LIST(V) \
564 V(kCodeOffset, kCodePointerSize) \
565 V(kHeaderSize, 0) \
566 V(kSize, 0)
567
568 DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, FIELD_LIST)
569#undef FIELD_LIST
570
571 class BodyDescriptor;
572
574};
575
576} // namespace internal
577} // namespace v8
578
580
581#endif // V8_OBJECTS_CODE_H_
#define DEFINE_BIT_FIELDS(LIST_MACRO)
Definition bit-field.h:126
int16_t parameter_count
Definition builtins.cc:67
OBJECT_CONSTRUCTORS(CodeWrapper, Struct)
void set_instruction_start(IsolateForSandbox isolate, Address value)
Definition code-inl.h:817
SafepointEntry GetSafepointEntry(Isolate *isolate, Address pc)
Definition code.cc:102
Address builtin_jump_table_info() const
Definition code-inl.h:646
bool checks_tiering_state() const
Definition code-inl.h:411
bool has_source_position_table() const
Definition code-inl.h:179
Tagged< InstructionStream > unchecked_instruction_stream() const
Definition code-inl.h:777
int InstructionStreamObjectSize() const
Definition code-inl.h:319
void TraceMarkForDeoptimization(Isolate *isolate, LazyDeoptimizeReason reason)
Definition code.cc:337
bool is_baseline_trampoline_builtin() const
Definition code-inl.h:924
uintptr_t GetBaselinePCForBytecodeOffset(int bytecode_offset, BytecodeToPCPosition position, Tagged< BytecodeArray > bytecodes)
Definition code-inl.h:347
CodeEntrypointTag entrypoint_tag() const
Definition code-inl.h:826
bool CanContainWeakObjects()
Definition code-inl.h:675
uint16_t parameter_count_without_receiver() const
Definition code-inl.h:98
int handler_table_size() const
Definition code-inl.h:272
uint32_t stack_slots() const
Definition code-inl.h:491
Address InstructionStart(Isolate *isolate, Address pc) const
Definition code-inl.h:236
bool uses_safepoint_table() const
Definition code-inl.h:487
Address body_start() const
Definition code-inl.h:212
static const int kIsTurbofannedBit
Definition code.h:458
void set_embedded_objects_cleared(bool flag)
Definition code-inl.h:578
Address unwinding_info_end() const
Definition code-inl.h:662
void SetInstructionStreamAndInstructionStart(IsolateForSandbox isolate, Tagged< InstructionStream > code, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition code-inl.h:846
void initialize_flags(CodeKind kind, bool is_context_specialized, bool is_turbofanned)
Definition code-inl.h:882
static Tagged< Code > FromTargetAddress(Address address)
Definition code-inl.h:671
Address metadata_end() const
Definition code-inl.h:254
Address instruction_end() const
Definition code-inl.h:218
bool is_turbofanned() const
Definition code-inl.h:437
static const int kMarkedForDeoptimizationBit
Definition code.h:456
Tagged< Object > raw_deoptimization_data_or_interpreter_data() const
Definition code.cc:25
void clear_source_position_table_and_bytecode_offset_table()
Definition code-inl.h:191
CodeKind kind() const
Definition code-inl.h:332
int unwinding_info_size() const
Definition code-inl.h:664
bool has_deoptimization_data_or_interpreter_data() const
Definition code-inl.h:126
void SetMarkedForDeoptimization(Isolate *isolate, LazyDeoptimizeReason reason)
Definition code-inl.h:513
bool has_tagged_outgoing_params() const
Definition code-inl.h:424
int code_comments_size() const
Definition code-inl.h:623
int safepoint_table_offset() const
Definition code.h:263
bool Inlines(Tagged< SharedFunctionInfo > sfi)
Definition code.cc:165
int constant_pool_size() const
Definition code-inl.h:278
Address constant_pool() const
Definition code-inl.h:614
DEFINE_FIELD_OFFSET_CONSTANTS(ExposedTrustedObject::kHeaderSize, CODE_DATA_FIELDS) template< typename T > using ExternalCodeField
bool is_wasm_code() const
Definition code-inl.h:595
void set_bytecode_or_interpreter_data(Tagged< TrustedObject > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition code-inl.h:135
int SourcePosition(int offset) const
Definition code.cc:67
uintptr_t GetBaselineStartPCForBytecodeOffset(int bytecode_offset, Tagged< BytecodeArray > bytecodes)
Definition code-inl.h:377
int SizeIncludingMetadata() const
Definition code-inl.h:323
bool contains(Isolate *isolate, Address pc) const
Definition code-inl.h:313
bool IsWeakObject(Tagged< HeapObject > object)
Definition code-inl.h:679
bool is_builtin() const
Definition code-inl.h:914
Address handler_table_address() const
Definition code-inl.h:268
uintptr_t GetBaselineEndPCForBytecodeOffset(int bytecode_offset, Tagged< BytecodeArray > bytecodes)
Definition code-inl.h:383
uintptr_t GetBaselinePCForNextExecutedBytecode(int bytecode_offset, Tagged< BytecodeArray > bytecodes)
Definition code-inl.h:389
int body_size() const
Definition code-inl.h:216
static const int kMaxArguments
Definition code.h:463
Tagged< TrustedObject > bytecode_or_interpreter_data() const
Definition code-inl.h:131
uint8_t * relocation_end() const
Definition code-inl.h:301
bool is_optimized_code() const
Definition code-inl.h:916
friend Factory
Definition code.h:488
bool has_unwinding_info() const
Definition code-inl.h:668
bool is_interpreter_trampoline_builtin() const
Definition code-inl.h:920
Address InstructionEnd(Isolate *isolate, Address pc) const
Definition code-inl.h:244
MaglevSafepointEntry GetMaglevSafepointEntry(Isolate *isolate, Address pc)
Definition code.cc:108
int safepoint_table_size() const
Definition code-inl.h:262
Address body_end() const
Definition code-inl.h:214
int relocation_size() const
Definition code-inl.h:307
void SetInstructionStartForOffHeapBuiltin(IsolateForSandbox isolate, Address entry)
Definition code-inl.h:853
bool has_constant_pool() const
Definition code-inl.h:288
Address safepoint_table_address() const
Definition code-inl.h:258
OBJECT_CONSTRUCTORS(Code, ExposedTrustedObject)
Address unwinding_info_start() const
Definition code-inl.h:658
bool is_context_specialized() const
Definition code-inl.h:433
void set_builtin_id(Builtin builtin_id)
Definition code-inl.h:898
bool has_handler_table() const
Definition code-inl.h:276
int GetOffsetFromInstructionStart(Isolate *isolate, Address pc) const
Definition code-inl.h:248
bool has_safepoint_table() const
Definition code-inl.h:266
void FlushICache() const
Definition code.cc:63
void ClearInstructionStartForSerialization(IsolateForSandbox isolate)
Definition code-inl.h:859
int SourceStatementPosition(int offset) const
Definition code.cc:85
bool is_baseline_leave_frame_builtin() const
Definition code-inl.h:928
Tagged< ProtectedFixedArray > unchecked_deoptimization_data() const
Definition code-inl.h:290
static bool IsWeakObjectInOptimizedCode(Tagged< HeapObject > object)
Definition code-inl.h:683
int builtin_jump_table_info_size() const
Definition code-inl.h:650
void IterateDeoptimizationLiterals(RootVisitor *v)
Definition code-inl.h:702
Tagged< TrustedByteArray > SourcePositionTable(Isolate *isolate, Tagged< SharedFunctionInfo > sfi) const
Definition code-inl.h:197
Address code_comments() const
Definition code-inl.h:619
bool uses_deoptimization_data() const
Definition code-inl.h:118
int GetBytecodeOffsetForBaselinePC(Address baseline_pc, Tagged< BytecodeArray > bytecodes)
Definition code-inl.h:334
static bool IsWeakObjectInDeoptimizationLiteralArray(Tagged< Object > object)
Definition code-inl.h:693
uint8_t * relocation_start() const
Definition code-inl.h:295
bool has_code_comments() const
Definition code-inl.h:627
bool embedded_objects_cleared() const
Definition code-inl.h:574
bool is_maglevved() const
Definition code-inl.h:441
Tagged< Object > raw_position_table() const
Definition code.cc:30
void UpdateInstructionStart(IsolateForSandbox isolate, Tagged< InstructionStream > istream)
Definition code-inl.h:869
PtrComprCageBase code_cage_base() const
Definition code-inl.h:761
bool IsIsolateIndependent(Isolate *isolate)
Definition code.cc:115
void ClearEmbeddedObjectsAndJSDispatchHandles(Heap *heap)
Definition code.cc:34
Address metadata_start() const
Definition code-inl.h:222
Builtin builtin_id() const
Definition code-inl.h:904
void clear_deoptimization_data_and_interpreter_data()
Definition code-inl.h:122
static const int kArgumentsBits
Definition code.h:460
bool has_builtin_jump_table_info() const
Definition code-inl.h:654
bool has_bytecode_offset_table() const
Definition code-inl.h:186
bool has_instruction_stream() const
Definition code-inl.h:739
bool has_source_position_table_or_bytecode_offset_table() const
Definition code-inl.h:175
bool is_interpreter_trampoline_builtin() const
uint16_t wasm_js_tagged_parameter_count() const
Address InstructionEnd(Isolate *isolate, Address pc) const
Definition code-inl.h:67
Address constant_pool() const
Address instruction_end() const
bool CanDeoptAt(Isolate *isolate, Address pc) const
Definition code-inl.h:71
uint32_t stack_slots() const
Tagged< Object > raw_instruction_stream() const
OBJECT_CONSTRUCTORS(GcSafeCode, HeapObject)
Builtin builtin_id() const
CodeKind kind() const
bool is_turbofanned() const
Address InstructionStart(Isolate *isolate, Address pc) const
Definition code-inl.h:63
Tagged< Code > UnsafeCastToCode() const
Definition code-inl.h:31
bool has_instruction_stream() const
bool is_baseline_trampoline_builtin() const
uint16_t wasm_js_first_tagged_parameter() const
int GetOffsetFromInstructionStart(Isolate *isolate, Address pc) const
Definition code-inl.h:58
Address safepoint_table_address() const
bool marked_for_deoptimization() const
Address instruction_start() const
bool has_tagged_outgoing_params() const
bool is_baseline_leave_frame_builtin() const
Address address() const
#define FLAGS_BIT_FIELDS(V, _)
Definition code.h:442
#define CODE_DATA_FIELDS(V)
Definition code.h:372
int32_t offset
int position
Definition liveedit.cc:290
#define FIELD_LIST(V)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Definition handles-inl.h:72
constexpr int kBitsPerByte
Definition globals.h:682
@ UPDATE_WRITE_BARRIER
Definition objects.h:55
static constexpr int kCodeKindCount
Definition code-kind.h:42
static constexpr Address kNullAddress
Definition v8-internal.h:53
#define DECL_ACCESSORS(name,...)
#define DECL_GETTER(name,...)
#define DECL_CODE_POINTER_ACCESSORS(name)
#define DECL_VERIFIER(Name)
#define DECL_PRIMITIVE_GETTER(name, type)
#define DECL_RELAXED_GETTER(name,...)
#define DECL_PRIMITIVE_ACCESSORS(name, type)
#define DECL_RELAXED_UINT32_ACCESSORS(name)
#define DECL_PRIMITIVE_SETTER(name, type)
#define DECL_PRINTER(Name)
#define V8_EXPORT_PRIVATE
Definition macros.h:460
#define FIELD_SIZE(Name)
Definition utils.h:259
#define DEFINE_FIELD_OFFSET_CONSTANTS(StartOffset, LIST_MACRO)
Definition utils.h:242