v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
call-site-info.h
Go to the documentation of this file.
1// Copyright 2018 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_CALL_SITE_INFO_H_
6#define V8_OBJECTS_CALL_SITE_INFO_H_
7
8#include <optional>
9
10#include "src/objects/struct.h"
11#include "torque-generated/bit-fields.h"
12
13// Has to be the last include (doesn't have include guards):
15
16namespace v8::internal {
17
18class MessageLocation;
19class WasmInstanceObject;
20class StructBodyDescriptor;
21
22#include "torque-generated/src/objects/call-site-info-tq.inc"
23
24class CallSiteInfo : public TorqueGeneratedCallSiteInfo<CallSiteInfo, Struct> {
25 public:
27 DEFINE_TORQUE_GENERATED_CALL_SITE_INFO_FLAGS()
28
29#if V8_ENABLE_WEBASSEMBLY
30 inline bool IsWasm() const;
31 inline bool IsAsmJsWasm() const;
32 inline bool IsAsmJsAtNumberConversion() const;
33#if V8_ENABLE_DRUMBRAKE
34 inline bool IsWasmInterpretedFrame() const;
35#endif // V8_ENABLE_DRUMBRAKE
36 inline bool IsBuiltin() const;
37#endif // V8_ENABLE_WEBASSEMBLY
38
39 inline bool IsStrict() const;
40 inline bool IsConstructor() const;
41 inline bool IsAsync() const;
42 bool IsEval() const;
43 bool IsUserJavaScript() const;
45 bool IsMethodCall() const;
46 bool IsToplevel() const;
47 bool IsPromiseAll() const;
48 bool IsPromiseAllSettled() const;
49 bool IsPromiseAny() const;
50 bool IsNative() const;
51
54
55 // Dispatched behavior.
57
58 // Used to signal that the requested field is unknown.
59 static constexpr int kUnknown = kNoSourcePosition;
60
63
66
67 // Returns the script ID if one is attached,
68 // Message::kNoScriptIdInfo otherwise.
71 int GetScriptId() const;
76
86
87#if V8_ENABLE_WEBASSEMBLY
88 // These methods are only valid for Wasm and asm.js Wasm frames.
89 uint32_t GetWasmFunctionIndex() const;
90 Tagged<WasmInstanceObject> GetWasmInstance() const;
91 static DirectHandle<Object> GetWasmModuleName(
93#endif // V8_ENABLE_WEBASSEMBLY
94
95 // Returns the 0-based source position, which is the offset into the
96 // Script in case of JavaScript and Asm.js, and the wire byte offset
97 // in the module in case of actual Wasm. In case of async promise
98 // combinator frames, this returns the index of the promise.
100
101 // Attempts to fill the |location| based on the |info|, and avoids
102 // triggering source position table building for JavaScript frames.
104 MessageLocation* location);
105
106 class BodyDescriptor;
107
108 private:
110
111 std::optional<Tagged<Script>> GetScript() const;
113
115};
116
119 IncrementalStringBuilder* builder);
122 Isolate* isolate, DirectHandle<CallSiteInfo> frame);
123
124} // namespace v8::internal
125
127
128#endif // V8_OBJECTS_CALL_SITE_INFO_H_
NEVER_READ_ONLY_SPACE bool IsStrict() const
static DirectHandle< String > GetScriptHash(DirectHandle< CallSiteInfo > info)
static int GetEnclosingColumnNumber(DirectHandle< CallSiteInfo > info)
static V8_EXPORT_PRIVATE int GetLineNumber(DirectHandle< CallSiteInfo > info)
Tagged< Object > GetScriptName() const
Tagged< SharedFunctionInfo > GetSharedFunctionInfo() const
void set_code_object(Tagged< HeapObject > code, WriteBarrierMode mode)
static Handle< PrimitiveHeapObject > GetEvalOrigin(DirectHandle< CallSiteInfo > info)
static DirectHandle< String > GetFunctionDebugName(DirectHandle< CallSiteInfo > info)
Tagged< HeapObject > code_object(IsolateForSandbox isolate) const
static int ComputeSourcePosition(DirectHandle< CallSiteInfo > info, int offset)
std::optional< Tagged< Script > > GetScript() const
static V8_EXPORT_PRIVATE int GetColumnNumber(DirectHandle< CallSiteInfo > info)
static constexpr int kUnknown
Tagged< Object > GetScriptSource() const
static int GetEnclosingLineNumber(DirectHandle< CallSiteInfo > info)
static bool ComputeLocation(DirectHandle< CallSiteInfo > info, MessageLocation *location)
Tagged< Object > GetScriptSourceMappingURL() const
static DirectHandle< Object > GetTypeName(DirectHandle< CallSiteInfo > info)
static int GetSourcePosition(DirectHandle< CallSiteInfo > info)
bool IsSubjectToDebugging() const
static V8_EXPORT_PRIVATE DirectHandle< PrimitiveHeapObject > GetFunctionName(DirectHandle< CallSiteInfo > info)
static DirectHandle< Object > GetMethodName(DirectHandle< CallSiteInfo > info)
Tagged< Object > GetScriptNameOrSourceURL() const
int32_t offset
constexpr int kNoSourcePosition
Definition globals.h:850
void SerializeCallSiteInfo(Isolate *isolate, DirectHandle< CallSiteInfo > frame, IncrementalStringBuilder *builder)
#define DECL_VERIFIER(Name)
#define NEVER_READ_ONLY_SPACE
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define V8_EXPORT_PRIVATE
Definition macros.h:460