15#define CHECK_CALLSITE(frame, method) \
16 CHECK_RECEIVER(JSObject, receiver, method); \
17 LookupIterator it(isolate, receiver, \
18 isolate->factory()->call_site_info_symbol(), \
19 LookupIterator::OWN_SKIP_INTERCEPTOR); \
20 if (it.state() != LookupIterator::DATA) { \
21 THROW_NEW_ERROR_RETURN_FAILURE( \
23 NewTypeError(MessageTemplate::kCallSiteMethod, \
24 isolate->factory()->NewStringFromAsciiChecked(method))); \
26 auto frame = Cast<CallSiteInfo>(it.GetDataValue())
31 if (value > 0)
return *isolate->factory()->NewNumberFromInt(value);
32 return ReadOnlyRoots(isolate).null_value();
41BUILTIN(CallSitePrototypeGetColumnNumber) {
47BUILTIN(CallSitePrototypeGetEnclosingColumnNumber) {
54BUILTIN(CallSitePrototypeGetEnclosingLineNumber) {
70 return frame->GetScriptName();
74 static const char method_name[] =
"getFunction";
80 if (NativeContextIsForShadowRealm(isolate->raw_native_context()) ||
81 (IsJSFunction(frame->function()) &&
82 NativeContextIsForShadowRealm(
87 MessageTemplate::kCallSiteMethodUnsupportedInShadowRealm,
88 isolate->factory()->NewStringFromAsciiChecked(method_name)));
90 if (frame->IsStrict() ||
91 (IsJSFunction(frame->function()) &&
96 return frame->function();
99BUILTIN(CallSitePrototypeGetFunctionName) {
126 if (!frame->IsPromiseAll() && !frame->IsPromiseAny() &&
127 !frame->IsPromiseAllSettled()) {
139BUILTIN(CallSitePrototypeGetScriptNameOrSourceURL) {
142 return frame->GetScriptNameOrSourceURL();
146 static const char method_name[] =
"getThis";
152 if (NativeContextIsForShadowRealm(isolate->raw_native_context()) ||
153 (IsJSFunction(frame->function()) &&
154 NativeContextIsForShadowRealm(
159 MessageTemplate::kCallSiteMethodUnsupportedInShadowRealm,
160 isolate->factory()->NewStringFromAsciiChecked(method_name)));
162 if (frame->IsStrict())
return ReadOnlyRoots(isolate).undefined_value();
164#if V8_ENABLE_WEBASSEMBLY
165 if (frame->IsAsmJsWasm()) {
166 return frame->GetWasmInstance()
167 ->trusted_data(isolate)
172 return frame->receiver_or_instance();
184 return isolate->heap()->ToBoolean(frame->IsAsync());
190 return isolate->heap()->ToBoolean(frame->IsConstructor());
196 return isolate->heap()->ToBoolean(frame->IsEval());
202 return isolate->heap()->ToBoolean(frame->IsNative());
208 return isolate->heap()->ToBoolean(frame->IsPromiseAll());
214 return isolate->heap()->ToBoolean(frame->IsToplevel());
#define CHECK_CALLSITE(frame, method)
@ kCallSiteAPIGetFunctionSloppyCall
@ kCallSiteAPIGetThisSloppyCall
static DirectHandle< String > GetScriptHash(DirectHandle< CallSiteInfo > info)
static int GetEnclosingColumnNumber(DirectHandle< CallSiteInfo > info)
static V8_EXPORT_PRIVATE int GetLineNumber(DirectHandle< CallSiteInfo > info)
static Handle< PrimitiveHeapObject > GetEvalOrigin(DirectHandle< CallSiteInfo > info)
static V8_EXPORT_PRIVATE int GetColumnNumber(DirectHandle< CallSiteInfo > info)
static int GetEnclosingLineNumber(DirectHandle< CallSiteInfo > info)
static DirectHandle< Object > GetTypeName(DirectHandle< CallSiteInfo > info)
static int GetSourcePosition(DirectHandle< CallSiteInfo > info)
static V8_EXPORT_PRIVATE DirectHandle< PrimitiveHeapObject > GetFunctionName(DirectHandle< CallSiteInfo > info)
static DirectHandle< Object > GetMethodName(DirectHandle< CallSiteInfo > info)
static constexpr Tagged< Smi > FromInt(int value)
#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call)
#define RETURN_RESULT_OR_FAILURE(isolate, call)
void SerializeCallSiteInfo(Isolate *isolate, DirectHandle< CallSiteInfo > frame, IncrementalStringBuilder *builder)
!IsContextMap !IsContextMap Tagged< NativeContext >
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)