[refactor] Rename StackFrameInfo to CallSiteInfo.

This is the second step in the refactoring to make v8::StackFrame
more lightweight and usable for (long time storage) by the V8
inspector (see https://bit.ly/v8-stack-frame for an overview).

This is a purely mechanical change without any functional aspects.
The intention is to make the use case for the CallSiteInfo objects
clear, namely to serve as the backing store for the CallSite objects
exposed via the Error.prepareStackTrace() API and used under the
hood to implement the error.stack accessor.

Doc: https://bit.ly/v8-stack-frame
Bug: chromium:1258599, chromium:1278647, chromium:1278650
Change-Id: I39dffd1f1a8e5158ddc56f2a0a2b1b28321f487a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3300138
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78361}
This commit is contained in:
Benedikt Meurer 2021-12-14 06:47:56 +01:00 committed by V8 LUCI CQ
parent 7476acb90f
commit 4ecf143801
31 changed files with 229 additions and 236 deletions

View File

@ -832,6 +832,7 @@ filegroup(
"src/objects/api-callbacks.tq",
"src/objects/arguments.tq",
"src/objects/bigint.tq",
"src/objects/call-site-info.tq",
"src/objects/cell.tq",
"src/objects/code.tq",
"src/objects/contexts.tq",
@ -878,7 +879,6 @@ filegroup(
"src/objects/script.tq",
"src/objects/shared-function-info.tq",
"src/objects/source-text-module.tq",
"src/objects/stack-frame-info.tq",
"src/objects/string.tq",
"src/objects/struct.tq",
"src/objects/swiss-hash-table-helpers.tq",
@ -1549,6 +1549,9 @@ filegroup(
"src/objects/bigint-inl.h",
"src/objects/bigint.cc",
"src/objects/bigint.h",
"src/objects/call-site-info-inl.h",
"src/objects/call-site-info.cc",
"src/objects/call-site-info.h",
"src/objects/cell-inl.h",
"src/objects/cell.h",
"src/objects/code-inl.h",
@ -1727,9 +1730,6 @@ filegroup(
"src/objects/source-text-module.cc",
"src/objects/source-text-module.h",
"src/objects/source-text-module-inl.h",
"src/objects/stack-frame-info-inl.h",
"src/objects/stack-frame-info.cc",
"src/objects/stack-frame-info.h",
"src/objects/string-comparator.cc",
"src/objects/string-comparator.h",
"src/objects/string-inl.h",

View File

@ -1716,6 +1716,7 @@ torque_files = [
"src/objects/api-callbacks.tq",
"src/objects/arguments.tq",
"src/objects/bigint.tq",
"src/objects/call-site-info.tq",
"src/objects/cell.tq",
"src/objects/code.tq",
"src/objects/contexts.tq",
@ -1762,7 +1763,6 @@ torque_files = [
"src/objects/script.tq",
"src/objects/shared-function-info.tq",
"src/objects/source-text-module.tq",
"src/objects/stack-frame-info.tq",
"src/objects/string.tq",
"src/objects/struct.tq",
"src/objects/swiss-hash-table-helpers.tq",
@ -3066,6 +3066,8 @@ v8_header_set("v8_internal_headers") {
"src/objects/backing-store.h",
"src/objects/bigint-inl.h",
"src/objects/bigint.h",
"src/objects/call-site-info-inl.h",
"src/objects/call-site-info.h",
"src/objects/cell-inl.h",
"src/objects/cell.h",
"src/objects/code-inl.h",
@ -3213,8 +3215,6 @@ v8_header_set("v8_internal_headers") {
"src/objects/smi.h",
"src/objects/source-text-module-inl.h",
"src/objects/source-text-module.h",
"src/objects/stack-frame-info-inl.h",
"src/objects/stack-frame-info.h",
"src/objects/string-comparator.h",
"src/objects/string-inl.h",
"src/objects/string-set-inl.h",
@ -4205,6 +4205,7 @@ v8_source_set("v8_base_without_compiler") {
"src/numbers/math-random.cc",
"src/objects/backing-store.cc",
"src/objects/bigint.cc",
"src/objects/call-site-info.cc",
"src/objects/code-kind.cc",
"src/objects/code.cc",
"src/objects/compilation-cache-table.cc",
@ -4250,7 +4251,6 @@ v8_source_set("v8_base_without_compiler") {
"src/objects/scope-info.cc",
"src/objects/shared-function-info.cc",
"src/objects/source-text-module.cc",
"src/objects/stack-frame-info.cc",
"src/objects/string-comparator.cc",
"src/objects/string-table.cc",
"src/objects/string.cc",

View File

@ -12,10 +12,10 @@
#include "src/execution/protectors.h"
#include "src/handles/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/objects/call-site-info.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/js-weak-refs.h"
#include "src/objects/objects-inl.h"
#include "src/objects/stack-frame-info.h"
namespace v8 {
@ -101,7 +101,7 @@ MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature)
MAKE_TO_LOCAL(MessageToLocal, Object, Message)
MAKE_TO_LOCAL(PromiseToLocal, JSObject, Promise)
MAKE_TO_LOCAL(StackTraceToLocal, FixedArray, StackTrace)
MAKE_TO_LOCAL(StackFrameToLocal, StackFrameInfo, StackFrame)
MAKE_TO_LOCAL(StackFrameToLocal, CallSiteInfo, StackFrame)
MAKE_TO_LOCAL(NumberToLocal, Object, Number)
MAKE_TO_LOCAL(IntegerToLocal, Object, Integer)
MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32)

View File

@ -78,6 +78,7 @@
#include "src/logging/tracing-flags.h"
#include "src/numbers/conversions-inl.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/contexts.h"
#include "src/objects/embedder-data-array-inl.h"
#include "src/objects/embedder-data-slot-inl.h"
@ -100,7 +101,6 @@
#include "src/objects/shared-function-info.h"
#include "src/objects/slots.h"
#include "src/objects/smi.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/synthetic-module-inl.h"
#include "src/objects/templates.h"
#include "src/objects/value-serializer.h"
@ -3229,8 +3229,8 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, std::ostream& out) {
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
uint32_t index) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
i::Handle<i::StackFrameInfo> frame(
i::StackFrameInfo::cast(Utils::OpenHandle(this)->get(index)), isolate);
i::Handle<i::CallSiteInfo> frame(
i::CallSiteInfo::cast(Utils::OpenHandle(this)->get(index)), isolate);
return Utils::StackFrameToLocal(frame);
}
@ -3251,11 +3251,11 @@ Local<StackTrace> StackTrace::CurrentStackTrace(Isolate* isolate,
// --- S t a c k F r a m e ---
int StackFrame::GetLineNumber() const {
return i::StackFrameInfo::GetLineNumber(Utils::OpenHandle(this));
return i::CallSiteInfo::GetLineNumber(Utils::OpenHandle(this));
}
int StackFrame::GetColumn() const {
return i::StackFrameInfo::GetColumnNumber(Utils::OpenHandle(this));
return i::CallSiteInfo::GetColumnNumber(Utils::OpenHandle(this));
}
int StackFrame::GetScriptId() const {
@ -3306,7 +3306,7 @@ Local<String> StackFrame::GetFunctionName() const {
i::GetWasmFunctionDebugName(isolate, instance, func_index));
}
#endif // V8_ENABLE_WEBASSEMBLY
auto name = i::StackFrameInfo::GetFunctionName(self);
auto name = i::CallSiteInfo::GetFunctionName(self);
if (!name->IsString()) return {};
return Local<String>::Cast(Utils::ToLocal(name));
}

View File

@ -131,7 +131,7 @@ class RegisteredExtension {
V(Context, Context) \
V(External, Object) \
V(StackTrace, FixedArray) \
V(StackFrame, StackFrameInfo) \
V(StackFrame, CallSiteInfo) \
V(Proxy, JSProxy) \
V(debug::GeneratorObject, JSGeneratorObject) \
V(debug::Script, Script) \
@ -227,7 +227,7 @@ class Utils {
static inline Local<StackTrace> StackTraceToLocal(
v8::internal::Handle<v8::internal::FixedArray> obj);
static inline Local<StackFrame> StackFrameToLocal(
v8::internal::Handle<v8::internal::StackFrameInfo> obj);
v8::internal::Handle<v8::internal::CallSiteInfo> obj);
static inline Local<Number> NumberToLocal(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<Integer> IntegerToLocal(

View File

@ -773,7 +773,7 @@ void Accessors::ErrorStackGetter(
Handle<JSObject>::cast(Utils::OpenHandle(*info.Holder()));
// Retrieve the stack trace. It can either be structured data in the form of
// a FixedArray of StackFrameInfo objects, an already formatted stack trace
// a FixedArray of CallSiteInfo objects, an already formatted stack trace
// (string) or whatever the "prepareStackTrace" callback produced.
Handle<Object> stack_trace;

View File

@ -9,6 +9,7 @@
#include 'src/heap/factory-inl.h'
#include 'src/objects/arguments.h'
#include 'src/objects/bigint.h'
#include 'src/objects/call-site-info.h'
#include 'src/objects/elements-kind.h'
#include 'src/objects/free-space.h'
#include 'src/objects/js-function.h'
@ -18,7 +19,6 @@
#include 'src/objects/js-weak-refs.h'
#include 'src/objects/objects.h'
#include 'src/objects/source-text-module.h'
#include 'src/objects/stack-frame-info.h'
#include 'src/objects/synthetic-module.h'
#include 'src/objects/template-objects.h'
#include 'src/torque/runtime-support.h'

View File

@ -6,8 +6,8 @@
#include "src/builtins/builtins.h"
#include "src/heap/heap-inl.h" // For ToBoolean.
#include "src/logging/counters.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/stack-frame-info-inl.h"
namespace v8 {
namespace internal {
@ -15,7 +15,7 @@ namespace internal {
#define CHECK_CALLSITE(frame, method) \
CHECK_RECEIVER(JSObject, receiver, method); \
LookupIterator it(isolate, receiver, \
isolate->factory()->call_site_frame_info_symbol(), \
isolate->factory()->call_site_info_symbol(), \
LookupIterator::OWN_SKIP_INTERCEPTOR); \
if (it.state() != LookupIterator::DATA) { \
THROW_NEW_ERROR_RETURN_FAILURE( \
@ -23,7 +23,7 @@ namespace internal {
NewTypeError(MessageTemplate::kCallSiteMethod, \
isolate->factory()->NewStringFromAsciiChecked(method))); \
} \
Handle<StackFrameInfo> frame = Handle<StackFrameInfo>::cast(it.GetDataValue())
Handle<CallSiteInfo> frame = Handle<CallSiteInfo>::cast(it.GetDataValue())
namespace {
Object PositiveNumberOrNull(int value, Isolate* isolate) {
@ -36,27 +36,27 @@ Object PositiveNumberOrNull(int value, Isolate* isolate) {
BUILTIN(CallSitePrototypeGetColumnNumber) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getColumnNumber");
return PositiveNumberOrNull(StackFrameInfo::GetColumnNumber(frame), isolate);
return PositiveNumberOrNull(CallSiteInfo::GetColumnNumber(frame), isolate);
}
BUILTIN(CallSitePrototypeGetEnclosingColumnNumber) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getEnclosingColumnNumber");
return PositiveNumberOrNull(StackFrameInfo::GetEnclosingColumnNumber(frame),
return PositiveNumberOrNull(CallSiteInfo::GetEnclosingColumnNumber(frame),
isolate);
}
BUILTIN(CallSitePrototypeGetEnclosingLineNumber) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getEnclosingLineNumber");
return PositiveNumberOrNull(StackFrameInfo::GetEnclosingLineNumber(frame),
return PositiveNumberOrNull(CallSiteInfo::GetEnclosingLineNumber(frame),
isolate);
}
BUILTIN(CallSitePrototypeGetEvalOrigin) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getEvalOrigin");
return *StackFrameInfo::GetEvalOrigin(frame);
return *CallSiteInfo::GetEvalOrigin(frame);
}
BUILTIN(CallSitePrototypeGetFileName) {
@ -80,25 +80,25 @@ BUILTIN(CallSitePrototypeGetFunction) {
BUILTIN(CallSitePrototypeGetFunctionName) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getFunctionName");
return *StackFrameInfo::GetFunctionName(frame);
return *CallSiteInfo::GetFunctionName(frame);
}
BUILTIN(CallSitePrototypeGetLineNumber) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getLineNumber");
return PositiveNumberOrNull(StackFrameInfo::GetLineNumber(frame), isolate);
return PositiveNumberOrNull(CallSiteInfo::GetLineNumber(frame), isolate);
}
BUILTIN(CallSitePrototypeGetMethodName) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getMethodName");
return *StackFrameInfo::GetMethodName(frame);
return *CallSiteInfo::GetMethodName(frame);
}
BUILTIN(CallSitePrototypeGetPosition) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getPosition");
return Smi::FromInt(StackFrameInfo::GetSourcePosition(frame));
return Smi::FromInt(CallSiteInfo::GetSourcePosition(frame));
}
BUILTIN(CallSitePrototypeGetPromiseIndex) {
@ -107,7 +107,7 @@ BUILTIN(CallSitePrototypeGetPromiseIndex) {
if (!frame->IsPromiseAll() && !frame->IsPromiseAny()) {
return ReadOnlyRoots(isolate).null_value();
}
return Smi::FromInt(StackFrameInfo::GetSourcePosition(frame));
return Smi::FromInt(CallSiteInfo::GetSourcePosition(frame));
}
BUILTIN(CallSitePrototypeGetScriptNameOrSourceURL) {
@ -132,7 +132,7 @@ BUILTIN(CallSitePrototypeGetThis) {
BUILTIN(CallSitePrototypeGetTypeName) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "getTypeName");
return *StackFrameInfo::GetTypeName(frame);
return *CallSiteInfo::GetTypeName(frame);
}
BUILTIN(CallSitePrototypeIsAsync) {
@ -174,7 +174,7 @@ BUILTIN(CallSitePrototypeIsToplevel) {
BUILTIN(CallSitePrototypeToString) {
HandleScope scope(isolate);
CHECK_CALLSITE(frame, "toString");
RETURN_RESULT_OR_FAILURE(isolate, SerializeStackFrameInfo(isolate, frame));
RETURN_RESULT_OR_FAILURE(isolate, SerializeCallSiteInfo(isolate, frame));
}
#undef CHECK_CALLSITE

View File

@ -15,8 +15,8 @@
#include "src/debug/debug-type-profile.h"
#include "src/debug/debug.h"
#include "src/execution/vm-state-inl.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/js-generator-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/profiler/heap-profiler.h"
#include "src/strings/string-builder-inl.h"

View File

@ -16,6 +16,7 @@
#include "src/objects/allocation-site-inl.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/debug-objects-inl.h"
@ -69,7 +70,6 @@
#include "src/objects/oddball-inl.h"
#include "src/objects/promise-inl.h"
#include "src/objects/property-descriptor-object-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/struct-inl.h"
#include "src/objects/swiss-name-dictionary-inl.h"
#include "src/objects/synthetic-module-inl.h"
@ -1784,8 +1784,8 @@ void PreparseData::PreparseDataVerify(Isolate* isolate) {
}
}
void StackFrameInfo::StackFrameInfoVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::StackFrameInfoVerify(*this, isolate);
void CallSiteInfo::CallSiteInfoVerify(Isolate* isolate) {
TorqueGeneratedClassVerifiers::CallSiteInfoVerify(*this, isolate);
#if V8_ENABLE_WEBASSEMBLY
CHECK_IMPLIES(IsAsmJsWasm(), IsWasm());
CHECK_IMPLIES(IsWasm(), receiver_or_instance().IsWasmInstanceObject());

View File

@ -73,6 +73,7 @@
#include "src/logging/runtime-call-stats-scope.h"
#include "src/numbers/hash-seed-inl.h"
#include "src/objects/backing-store.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/elements.h"
#include "src/objects/feedback-vector.h"
#include "src/objects/hash-table-inl.h"
@ -87,7 +88,6 @@
#include "src/objects/slots.h"
#include "src/objects/smi.h"
#include "src/objects/source-text-module-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/visitors.h"
#include "src/profiler/heap-profiler.h"
#include "src/profiler/tracing-cpu-profiler.h"
@ -706,8 +706,8 @@ class StackTraceBuilder {
void AppendAsyncFrame(Handle<JSGeneratorObject> generator_object) {
Handle<JSFunction> function(generator_object->function(), isolate_);
if (!IsVisibleInStackTrace(function)) return;
int flags = StackFrameInfo::kIsAsync;
if (IsStrictFrame(function)) flags |= StackFrameInfo::kIsStrict;
int flags = CallSiteInfo::kIsAsync;
if (IsStrictFrame(function)) flags |= CallSiteInfo::kIsStrict;
Handle<Object> receiver(generator_object->receiver(), isolate_);
Handle<BytecodeArray> code(function->shared().GetBytecodeArray(isolate_),
@ -732,7 +732,7 @@ class StackTraceBuilder {
Handle<JSFunction> combinator) {
if (!IsVisibleInStackTrace(combinator)) return;
int flags =
StackFrameInfo::kIsAsync | StackFrameInfo::kIsSourcePositionComputed;
CallSiteInfo::kIsAsync | CallSiteInfo::kIsSourcePositionComputed;
Handle<Object> receiver(combinator->native_context().promise_function(),
isolate_);
@ -756,8 +756,8 @@ class StackTraceBuilder {
int flags = 0;
Handle<JSFunction> function = summary.function();
if (IsStrictFrame(function)) flags |= StackFrameInfo::kIsStrict;
if (summary.is_constructor()) flags |= StackFrameInfo::kIsConstructor;
if (IsStrictFrame(function)) flags |= CallSiteInfo::kIsStrict;
if (summary.is_constructor()) flags |= CallSiteInfo::kIsConstructor;
AppendFrame(summary.receiver(), function, summary.abstract_code(),
summary.code_offset(), flags, summary.parameters());
@ -767,11 +767,11 @@ class StackTraceBuilder {
void AppendWasmFrame(FrameSummary::WasmFrameSummary const& summary) {
if (summary.code()->kind() != wasm::WasmCode::kWasmFunction) return;
Handle<WasmInstanceObject> instance = summary.wasm_instance();
int flags = StackFrameInfo::kIsWasm;
int flags = CallSiteInfo::kIsWasm;
if (instance->module_object().is_asm_js()) {
flags |= StackFrameInfo::kIsAsmJsWasm;
flags |= CallSiteInfo::kIsAsmJsWasm;
if (summary.at_to_number_conversion()) {
flags |= StackFrameInfo::kIsAsmJsAtNumberConversion;
flags |= CallSiteInfo::kIsAsmJsAtNumberConversion;
}
}
@ -870,7 +870,7 @@ class StackTraceBuilder {
// (e.g. the receiver in RegExp constructor frames).
receiver_or_instance = isolate_->factory()->undefined_value();
}
auto info = isolate_->factory()->NewStackFrameInfo(
auto info = isolate_->factory()->NewCallSiteInfo(
receiver_or_instance, function, code, offset, flags, parameters);
elements_->set(index_++, *info);
}
@ -2203,8 +2203,8 @@ void Isolate::PrintCurrentStackTrace(std::ostream& out) {
IncrementalStringBuilder builder(this);
for (int i = 0; i < frames->length(); ++i) {
Handle<StackFrameInfo> frame(StackFrameInfo::cast(frames->get(i)), this);
SerializeStackFrameInfo(this, frame, &builder);
Handle<CallSiteInfo> frame(CallSiteInfo::cast(frames->get(i)), this);
SerializeCallSiteInfo(this, frame, &builder);
}
Handle<String> stack_trace = builder.Finish().ToHandleChecked();
@ -2276,8 +2276,8 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
if (!property->IsFixedArray()) return false;
Handle<FixedArray> stack = Handle<FixedArray>::cast(property);
for (int i = 0; i < stack->length(); i++) {
Handle<StackFrameInfo> frame(StackFrameInfo::cast(stack->get(i)), this);
if (StackFrameInfo::ComputeLocation(frame, target)) return true;
Handle<CallSiteInfo> frame(CallSiteInfo::cast(stack->get(i)), this);
if (CallSiteInfo::ComputeLocation(frame, target)) return true;
}
return false;
}

View File

@ -15,9 +15,9 @@
#include "src/execution/frames.h"
#include "src/execution/isolate-inl.h"
#include "src/logging/runtime-call-stats-scope.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/struct-inl.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/parsing.h"
@ -223,18 +223,17 @@ MaybeHandle<JSArray> GetStackFrames(Isolate* isolate,
Handle<JSFunction> constructor = isolate->callsite_function();
Handle<FixedArray> sites = isolate->factory()->NewFixedArray(frame_count);
for (int i = 0; i < frame_count; ++i) {
Handle<StackFrameInfo> frame(StackFrameInfo::cast(frames->get(i)), isolate);
Handle<CallSiteInfo> frame(CallSiteInfo::cast(frames->get(i)), isolate);
Handle<JSObject> site;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, site,
JSObject::New(constructor, constructor, Handle<AllocationSite>::null()),
JSArray);
RETURN_ON_EXCEPTION(
isolate,
JSObject::SetOwnPropertyIgnoreAttributes(
site, isolate->factory()->call_site_frame_info_symbol(), frame,
DONT_ENUM),
JSArray);
RETURN_ON_EXCEPTION(isolate,
JSObject::SetOwnPropertyIgnoreAttributes(
site, isolate->factory()->call_site_info_symbol(),
frame, DONT_ENUM),
JSArray);
sites->set(i, *site);
}
@ -371,8 +370,8 @@ MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate,
for (int i = 0; i < elems->length(); ++i) {
builder.AppendCStringLiteral("\n at ");
Handle<StackFrameInfo> frame(StackFrameInfo::cast(elems->get(i)), isolate);
SerializeStackFrameInfo(isolate, frame, &builder);
Handle<CallSiteInfo> frame(CallSiteInfo::cast(elems->get(i)), isolate);
SerializeCallSiteInfo(isolate, frame, &builder);
if (isolate->has_pending_exception()) {
// CallSite.toString threw. Parts of the current frame might have been

View File

@ -38,6 +38,7 @@
#include "src/objects/api-callbacks.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/embedder-data-array-inl.h"
@ -59,7 +60,6 @@
#include "src/objects/promise-inl.h"
#include "src/objects/property-descriptor-object-inl.h"
#include "src/objects/scope-info.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/string-set-inl.h"
#include "src/objects/struct-inl.h"
#include "src/objects/synthetic-module-inl.h"
@ -3341,12 +3341,12 @@ Handle<BreakPoint> Factory::NewBreakPoint(int id, Handle<String> condition) {
return handle(new_break_point, isolate());
}
Handle<StackFrameInfo> Factory::NewStackFrameInfo(
Handle<CallSiteInfo> Factory::NewCallSiteInfo(
Handle<Object> receiver_or_instance, Handle<Object> function,
Handle<HeapObject> code_object, int code_offset_or_source_position,
int flags, Handle<FixedArray> parameters) {
auto info = NewStructInternal<StackFrameInfo>(STACK_FRAME_INFO_TYPE,
AllocationType::kYoung);
auto info = NewStructInternal<CallSiteInfo>(CALL_SITE_INFO_TYPE,
AllocationType::kYoung);
DisallowGarbageCollection no_gc;
info.set_receiver_or_instance(*receiver_or_instance, SKIP_WRITE_BARRIER);
info.set_function(*function, SKIP_WRITE_BARRIER);

View File

@ -36,6 +36,7 @@ class BreakPointInfo;
class CallableTask;
class CallbackTask;
class CallHandlerInfo;
class CallSiteInfo;
class Expression;
class EmbedderDataArray;
class ArrayBoilerplateDescription;
@ -62,7 +63,6 @@ class PromiseResolveThenableJobTask;
class RegExpMatchInfo;
class ScriptContextTable;
class SourceTextModule;
class StackFrameInfo;
class StringSet;
class StoreHandler;
class SyntheticModule;
@ -395,12 +395,12 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
Handle<BreakPointInfo> NewBreakPointInfo(int source_position);
Handle<BreakPoint> NewBreakPoint(int id, Handle<String> condition);
Handle<StackFrameInfo> NewStackFrameInfo(Handle<Object> receiver_or_instance,
Handle<Object> function,
Handle<HeapObject> code_object,
int code_offset_or_source_position,
int flags,
Handle<FixedArray> parameters);
Handle<CallSiteInfo> NewCallSiteInfo(Handle<Object> receiver_or_instance,
Handle<Object> function,
Handle<HeapObject> code_object,
int code_offset_or_source_position,
int flags,
Handle<FixedArray> parameters);
// Allocate various microtasks.
Handle<CallableTask> NewCallableTask(Handle<JSReceiver> callable,

View File

@ -13,6 +13,7 @@
#include "src/init/setup-isolate.h"
#include "src/interpreter/interpreter.h"
#include "src/objects/arguments.h"
#include "src/objects/call-site-info.h"
#include "src/objects/cell-inl.h"
#include "src/objects/contexts.h"
#include "src/objects/data-handler.h"
@ -37,7 +38,6 @@
#include "src/objects/shared-function-info.h"
#include "src/objects/smi.h"
#include "src/objects/source-text-module.h"
#include "src/objects/stack-frame-info.h"
#include "src/objects/string.h"
#include "src/objects/synthetic-module.h"
#include "src/objects/template-objects-inl.h"

View File

@ -415,7 +415,7 @@
#define PRIVATE_SYMBOL_LIST_GENERATOR(V, _) \
V(_, array_buffer_wasm_memory_symbol) \
V(_, call_site_frame_info_symbol) \
V(_, call_site_info_symbol) \
V(_, console_context_id_symbol) \
V(_, console_context_name_symbol) \
V(_, class_fields_symbol) \

View File

@ -14,6 +14,7 @@
#include "src/objects/api-callbacks-inl.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint-inl.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/code-inl.h"
#include "src/objects/compilation-cache-table-inl.h"
@ -72,7 +73,6 @@
#include "src/objects/shared-function-info-inl.h"
#include "src/objects/slots-atomic-inl.h"
#include "src/objects/slots-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/string-inl.h"
#include "src/objects/string-set-inl.h"
#include "src/objects/string-table-inl.h"

View File

@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_STACK_FRAME_INFO_INL_H_
#define V8_OBJECTS_STACK_FRAME_INFO_INL_H_
#include "src/objects/stack-frame-info.h"
#ifndef V8_OBJECTS_CALL_SITE_INFO_INL_H_
#define V8_OBJECTS_CALL_SITE_INFO_INL_H_
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/call-site-info.h"
#include "src/objects/objects-inl.h"
#include "src/objects/struct-inl.h"
@ -17,22 +16,22 @@
namespace v8 {
namespace internal {
#include "torque-generated/src/objects/stack-frame-info-tq-inl.inc"
#include "torque-generated/src/objects/call-site-info-tq-inl.inc"
TQ_OBJECT_CONSTRUCTORS_IMPL(StackFrameInfo)
NEVER_READ_ONLY_SPACE_IMPL(StackFrameInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(CallSiteInfo)
NEVER_READ_ONLY_SPACE_IMPL(CallSiteInfo)
#if V8_ENABLE_WEBASSEMBLY
BOOL_GETTER(StackFrameInfo, flags, IsWasm, IsWasmBit::kShift)
BOOL_GETTER(StackFrameInfo, flags, IsAsmJsWasm, IsAsmJsWasmBit::kShift)
BOOL_GETTER(StackFrameInfo, flags, IsAsmJsAtNumberConversion,
BOOL_GETTER(CallSiteInfo, flags, IsWasm, IsWasmBit::kShift)
BOOL_GETTER(CallSiteInfo, flags, IsAsmJsWasm, IsAsmJsWasmBit::kShift)
BOOL_GETTER(CallSiteInfo, flags, IsAsmJsAtNumberConversion,
IsAsmJsAtNumberConversionBit::kShift)
#endif // V8_ENABLE_WEBASSEMBLY
BOOL_GETTER(StackFrameInfo, flags, IsStrict, IsStrictBit::kShift)
BOOL_GETTER(StackFrameInfo, flags, IsConstructor, IsConstructorBit::kShift)
BOOL_GETTER(StackFrameInfo, flags, IsAsync, IsAsyncBit::kShift)
BOOL_GETTER(CallSiteInfo, flags, IsStrict, IsStrictBit::kShift)
BOOL_GETTER(CallSiteInfo, flags, IsConstructor, IsConstructorBit::kShift)
BOOL_GETTER(CallSiteInfo, flags, IsAsync, IsAsyncBit::kShift)
DEF_GETTER(StackFrameInfo, code_object, HeapObject) {
DEF_GETTER(CallSiteInfo, code_object, HeapObject) {
HeapObject value = TorqueGeneratedClass::code_object(cage_base);
// The |code_object| field can contain many types of objects, but only CodeT
// values have to be converted to Code.
@ -42,7 +41,7 @@ DEF_GETTER(StackFrameInfo, code_object, HeapObject) {
return value;
}
void StackFrameInfo::set_code_object(HeapObject code, WriteBarrierMode mode) {
void CallSiteInfo::set_code_object(HeapObject code, WriteBarrierMode mode) {
// The |code_object| field can contain many types of objects, but only Code
// values have to be converted to CodeT.
if (V8_EXTERNAL_CODE_SPACE_BOOL && code.IsCode()) {
@ -57,4 +56,4 @@ void StackFrameInfo::set_code_object(HeapObject code, WriteBarrierMode mode) {
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_STACK_FRAME_INFO_INL_H_
#endif // V8_OBJECTS_CALL_SITE_INFO_INL_H_

View File

@ -2,63 +2,63 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/objects/stack-frame-info.h"
#include "src/objects/call-site-info.h"
#include "src/base/strings.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/strings/string-builder-inl.h"
namespace v8 {
namespace internal {
bool StackFrameInfo::IsPromiseAll() const {
bool CallSiteInfo::IsPromiseAll() const {
if (!IsAsync()) return false;
JSFunction fun = JSFunction::cast(function());
return fun == fun.native_context().promise_all();
}
bool StackFrameInfo::IsPromiseAny() const {
bool CallSiteInfo::IsPromiseAny() const {
if (!IsAsync()) return false;
JSFunction fun = JSFunction::cast(function());
return fun == fun.native_context().promise_any();
}
bool StackFrameInfo::IsNative() const {
bool CallSiteInfo::IsNative() const {
if (auto script = GetScript()) {
return script->type() == Script::TYPE_NATIVE;
}
return false;
}
bool StackFrameInfo::IsEval() const {
bool CallSiteInfo::IsEval() const {
if (auto script = GetScript()) {
return script->compilation_type() == Script::COMPILATION_TYPE_EVAL;
}
return false;
}
bool StackFrameInfo::IsUserJavaScript() const {
bool CallSiteInfo::IsUserJavaScript() const {
#if V8_ENABLE_WEBASSEMBLY
if (IsWasm()) return false;
#endif // V8_ENABLE_WEBASSEMBLY
return GetSharedFunctionInfo().IsUserJavaScript();
}
bool StackFrameInfo::IsMethodCall() const {
bool CallSiteInfo::IsMethodCall() const {
#if V8_ENABLE_WEBASSEMBLY
if (IsWasm()) return false;
#endif // V8_ENABLE_WEBASSEMBLY
return !IsToplevel() && !IsConstructor();
}
bool StackFrameInfo::IsToplevel() const {
bool CallSiteInfo::IsToplevel() const {
return receiver_or_instance().IsJSGlobalProxy() ||
receiver_or_instance().IsNullOrUndefined();
}
// static
int StackFrameInfo::GetLineNumber(Handle<StackFrameInfo> info) {
int CallSiteInfo::GetLineNumber(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (info->IsWasm() && !info->IsAsmJsWasm()) {
@ -78,7 +78,7 @@ int StackFrameInfo::GetLineNumber(Handle<StackFrameInfo> info) {
}
// static
int StackFrameInfo::GetColumnNumber(Handle<StackFrameInfo> info) {
int CallSiteInfo::GetColumnNumber(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
int position = GetSourcePosition(info);
#if V8_ENABLE_WEBASSEMBLY
@ -100,7 +100,7 @@ int StackFrameInfo::GetColumnNumber(Handle<StackFrameInfo> info) {
}
// static
int StackFrameInfo::GetEnclosingLineNumber(Handle<StackFrameInfo> info) {
int CallSiteInfo::GetEnclosingLineNumber(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (info->IsWasm() && !info->IsAsmJsWasm()) {
@ -125,7 +125,7 @@ int StackFrameInfo::GetEnclosingLineNumber(Handle<StackFrameInfo> info) {
}
// static
int StackFrameInfo::GetEnclosingColumnNumber(Handle<StackFrameInfo> info) {
int CallSiteInfo::GetEnclosingColumnNumber(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (info->IsWasm() && !info->IsAsmJsWasm()) {
@ -151,28 +151,28 @@ int StackFrameInfo::GetEnclosingColumnNumber(Handle<StackFrameInfo> info) {
return Script::GetColumnNumber(script, position) + 1;
}
int StackFrameInfo::GetScriptId() const {
int CallSiteInfo::GetScriptId() const {
if (auto script = GetScript()) {
return script->id();
}
return Message::kNoScriptIdInfo;
}
Object StackFrameInfo::GetScriptName() const {
Object CallSiteInfo::GetScriptName() const {
if (auto script = GetScript()) {
return script->name();
}
return ReadOnlyRoots(GetIsolate()).null_value();
}
Object StackFrameInfo::GetScriptNameOrSourceURL() const {
Object CallSiteInfo::GetScriptNameOrSourceURL() const {
if (auto script = GetScript()) {
return script->GetNameOrSourceURL();
}
return ReadOnlyRoots(GetIsolate()).null_value();
}
Object StackFrameInfo::GetScriptSource() const {
Object CallSiteInfo::GetScriptSource() const {
if (auto script = GetScript()) {
if (script->HasValidSource()) {
return script->source();
@ -181,7 +181,7 @@ Object StackFrameInfo::GetScriptSource() const {
return ReadOnlyRoots(GetIsolate()).null_value();
}
Object StackFrameInfo::GetScriptSourceMappingURL() const {
Object CallSiteInfo::GetScriptSourceMappingURL() const {
if (auto script = GetScript()) {
return script->source_mapping_url();
}
@ -242,8 +242,8 @@ MaybeHandle<String> FormatEvalOrigin(Isolate* isolate, Handle<Script> script) {
} // namespace
// static
Handle<PrimitiveHeapObject> StackFrameInfo::GetEvalOrigin(
Handle<StackFrameInfo> info) {
Handle<PrimitiveHeapObject> CallSiteInfo::GetEvalOrigin(
Handle<CallSiteInfo> info) {
auto isolate = info->GetIsolate();
Handle<Script> script;
if (!GetScript(isolate, info).ToHandle(&script) ||
@ -254,7 +254,7 @@ Handle<PrimitiveHeapObject> StackFrameInfo::GetEvalOrigin(
}
// static
Handle<Object> StackFrameInfo::GetFunctionName(Handle<StackFrameInfo> info) {
Handle<Object> CallSiteInfo::GetFunctionName(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (info->IsWasm()) {
@ -370,7 +370,7 @@ PrimitiveHeapObject InferMethodName(Isolate* isolate, JSReceiver receiver,
} // namespace
// static
Handle<Object> StackFrameInfo::GetMethodName(Handle<StackFrameInfo> info) {
Handle<Object> CallSiteInfo::GetMethodName(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
Handle<Object> receiver_or_instance(info->receiver_or_instance(), isolate);
#if V8_ENABLE_WEBASSEMBLY
@ -436,7 +436,7 @@ Handle<Object> StackFrameInfo::GetMethodName(Handle<StackFrameInfo> info) {
}
// static
Handle<Object> StackFrameInfo::GetTypeName(Handle<StackFrameInfo> info) {
Handle<Object> CallSiteInfo::GetTypeName(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
if (!info->IsMethodCall()) {
return isolate->factory()->null_value();
@ -452,18 +452,18 @@ Handle<Object> StackFrameInfo::GetTypeName(Handle<StackFrameInfo> info) {
}
#if V8_ENABLE_WEBASSEMBLY
uint32_t StackFrameInfo::GetWasmFunctionIndex() const {
uint32_t CallSiteInfo::GetWasmFunctionIndex() const {
DCHECK(IsWasm());
return Smi::ToInt(Smi::cast(function()));
}
WasmInstanceObject StackFrameInfo::GetWasmInstance() const {
WasmInstanceObject CallSiteInfo::GetWasmInstance() const {
DCHECK(IsWasm());
return WasmInstanceObject::cast(receiver_or_instance());
}
// static
Handle<Object> StackFrameInfo::GetWasmModuleName(Handle<StackFrameInfo> info) {
Handle<Object> CallSiteInfo::GetWasmModuleName(Handle<CallSiteInfo> info) {
Isolate* isolate = info->GetIsolate();
if (info->IsWasm()) {
Handle<String> name;
@ -479,7 +479,7 @@ Handle<Object> StackFrameInfo::GetWasmModuleName(Handle<StackFrameInfo> info) {
#endif // V8_ENABLE_WEBASSEMBLY
// static
int StackFrameInfo::GetSourcePosition(Handle<StackFrameInfo> info) {
int CallSiteInfo::GetSourcePosition(Handle<CallSiteInfo> info) {
if (info->flags() & kIsSourcePositionComputed) {
return info->code_offset_or_source_position();
}
@ -493,8 +493,8 @@ int StackFrameInfo::GetSourcePosition(Handle<StackFrameInfo> info) {
}
// static
bool StackFrameInfo::ComputeLocation(Handle<StackFrameInfo> info,
MessageLocation* location) {
bool CallSiteInfo::ComputeLocation(Handle<CallSiteInfo> info,
MessageLocation* location) {
Isolate* isolate = info->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (info->IsWasm()) {
@ -523,8 +523,7 @@ bool StackFrameInfo::ComputeLocation(Handle<StackFrameInfo> info,
}
// static
int StackFrameInfo::ComputeSourcePosition(Handle<StackFrameInfo> info,
int offset) {
int CallSiteInfo::ComputeSourcePosition(Handle<CallSiteInfo> info, int offset) {
Isolate* isolate = info->GetIsolate();
#if V8_ENABLE_WEBASSEMBLY
if (info->IsWasm()) {
@ -541,7 +540,7 @@ int StackFrameInfo::ComputeSourcePosition(Handle<StackFrameInfo> info,
return AbstractCode::cast(info->code_object()).SourcePosition(offset);
}
base::Optional<Script> StackFrameInfo::GetScript() const {
base::Optional<Script> CallSiteInfo::GetScript() const {
#if V8_ENABLE_WEBASSEMBLY
if (IsWasm()) {
return GetWasmInstance().module_object().script();
@ -552,7 +551,7 @@ base::Optional<Script> StackFrameInfo::GetScript() const {
return base::nullopt;
}
SharedFunctionInfo StackFrameInfo::GetSharedFunctionInfo() const {
SharedFunctionInfo CallSiteInfo::GetSharedFunctionInfo() const {
#if V8_ENABLE_WEBASSEMBLY
DCHECK(!IsWasm());
#endif // V8_ENABLE_WEBASSEMBLY
@ -560,8 +559,8 @@ SharedFunctionInfo StackFrameInfo::GetSharedFunctionInfo() const {
}
// static
MaybeHandle<Script> StackFrameInfo::GetScript(Isolate* isolate,
Handle<StackFrameInfo> info) {
MaybeHandle<Script> CallSiteInfo::GetScript(Isolate* isolate,
Handle<CallSiteInfo> info) {
if (auto script = info->GetScript()) {
return handle(*script, isolate);
}
@ -574,13 +573,13 @@ bool IsNonEmptyString(Handle<Object> object) {
return (object->IsString() && String::cast(*object).length() > 0);
}
void AppendFileLocation(Isolate* isolate, Handle<StackFrameInfo> frame,
void AppendFileLocation(Isolate* isolate, Handle<CallSiteInfo> frame,
IncrementalStringBuilder* builder) {
Handle<Object> script_name_or_source_url(frame->GetScriptNameOrSourceURL(),
isolate);
if (!script_name_or_source_url->IsString() && frame->IsEval()) {
builder->AppendString(
Handle<String>::cast(StackFrameInfo::GetEvalOrigin(frame)));
Handle<String>::cast(CallSiteInfo::GetEvalOrigin(frame)));
// Expecting source position to follow.
builder->AppendCStringLiteral(", ");
}
@ -594,12 +593,12 @@ void AppendFileLocation(Isolate* isolate, Handle<StackFrameInfo> frame,
builder->AppendCStringLiteral("<anonymous>");
}
int line_number = StackFrameInfo::GetLineNumber(frame);
int line_number = CallSiteInfo::GetLineNumber(frame);
if (line_number != Message::kNoLineNumberInfo) {
builder->AppendCharacter(':');
builder->AppendInt(line_number);
int column_number = StackFrameInfo::GetColumnNumber(frame);
int column_number = CallSiteInfo::GetColumnNumber(frame);
if (column_number != Message::kNoColumnInfo) {
builder->AppendCharacter(':');
builder->AppendInt(column_number);
@ -644,11 +643,11 @@ bool StringEndsWithMethodName(Isolate* isolate, Handle<String> subject,
return true;
}
void AppendMethodCall(Isolate* isolate, Handle<StackFrameInfo> frame,
void AppendMethodCall(Isolate* isolate, Handle<CallSiteInfo> frame,
IncrementalStringBuilder* builder) {
Handle<Object> type_name = StackFrameInfo::GetTypeName(frame);
Handle<Object> method_name = StackFrameInfo::GetMethodName(frame);
Handle<Object> function_name = StackFrameInfo::GetFunctionName(frame);
Handle<Object> type_name = CallSiteInfo::GetTypeName(frame);
Handle<Object> method_name = CallSiteInfo::GetMethodName(frame);
Handle<Object> function_name = CallSiteInfo::GetFunctionName(frame);
if (IsNonEmptyString(function_name)) {
Handle<String> function_string = Handle<String>::cast(function_name);
@ -684,16 +683,16 @@ void AppendMethodCall(Isolate* isolate, Handle<StackFrameInfo> frame,
}
}
void SerializeJSStackFrame(Isolate* isolate, Handle<StackFrameInfo> frame,
void SerializeJSStackFrame(Isolate* isolate, Handle<CallSiteInfo> frame,
IncrementalStringBuilder* builder) {
Handle<Object> function_name = StackFrameInfo::GetFunctionName(frame);
Handle<Object> function_name = CallSiteInfo::GetFunctionName(frame);
if (frame->IsAsync()) {
builder->AppendCStringLiteral("async ");
if (frame->IsPromiseAll() || frame->IsPromiseAny()) {
builder->AppendCStringLiteral("Promise.");
builder->AppendString(Handle<String>::cast(function_name));
builder->AppendCStringLiteral(" (index ");
builder->AppendInt(StackFrameInfo::GetSourcePosition(frame));
builder->AppendInt(CallSiteInfo::GetSourcePosition(frame));
builder->AppendCharacter(')');
return;
}
@ -719,10 +718,10 @@ void SerializeJSStackFrame(Isolate* isolate, Handle<StackFrameInfo> frame,
}
#if V8_ENABLE_WEBASSEMBLY
void SerializeWasmStackFrame(Isolate* isolate, Handle<StackFrameInfo> frame,
void SerializeWasmStackFrame(Isolate* isolate, Handle<CallSiteInfo> frame,
IncrementalStringBuilder* builder) {
Handle<Object> module_name = StackFrameInfo::GetWasmModuleName(frame);
Handle<Object> function_name = StackFrameInfo::GetFunctionName(frame);
Handle<Object> module_name = CallSiteInfo::GetWasmModuleName(frame);
Handle<Object> function_name = CallSiteInfo::GetFunctionName(frame);
const bool has_name = !module_name->IsNull() || !function_name->IsNull();
if (has_name) {
if (module_name->IsNull()) {
@ -752,7 +751,7 @@ void SerializeWasmStackFrame(Isolate* isolate, Handle<StackFrameInfo> frame,
char buffer[16];
SNPrintF(base::ArrayVector(buffer), "0x%x",
StackFrameInfo::GetColumnNumber(frame) - 1);
CallSiteInfo::GetColumnNumber(frame) - 1);
builder->AppendCString(buffer);
if (has_name) builder->AppendCharacter(')');
@ -761,8 +760,8 @@ void SerializeWasmStackFrame(Isolate* isolate, Handle<StackFrameInfo> frame,
} // namespace
void SerializeStackFrameInfo(Isolate* isolate, Handle<StackFrameInfo> frame,
IncrementalStringBuilder* builder) {
void SerializeCallSiteInfo(Isolate* isolate, Handle<CallSiteInfo> frame,
IncrementalStringBuilder* builder) {
#if V8_ENABLE_WEBASSEMBLY
if (frame->IsWasm() && !frame->IsAsmJsWasm()) {
SerializeWasmStackFrame(isolate, frame, builder);
@ -772,10 +771,10 @@ void SerializeStackFrameInfo(Isolate* isolate, Handle<StackFrameInfo> frame,
SerializeJSStackFrame(isolate, frame, builder);
}
MaybeHandle<String> SerializeStackFrameInfo(Isolate* isolate,
Handle<StackFrameInfo> frame) {
MaybeHandle<String> SerializeCallSiteInfo(Isolate* isolate,
Handle<CallSiteInfo> frame) {
IncrementalStringBuilder builder(isolate);
SerializeStackFrameInfo(isolate, frame, &builder);
SerializeCallSiteInfo(isolate, frame, &builder);
return builder.Finish();
}

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_STACK_FRAME_INFO_H_
#define V8_OBJECTS_STACK_FRAME_INFO_H_
#ifndef V8_OBJECTS_CALL_SITE_INFO_H_
#define V8_OBJECTS_CALL_SITE_INFO_H_
#include "src/objects/struct.h"
#include "torque-generated/bit-fields.h"
@ -18,12 +18,12 @@ class MessageLocation;
class WasmInstanceObject;
class StructBodyDescriptor;
#include "torque-generated/src/objects/stack-frame-info-tq.inc"
#include "torque-generated/src/objects/call-site-info-tq.inc"
class StackFrameInfo
: public TorqueGeneratedStackFrameInfo<StackFrameInfo, Struct> {
class CallSiteInfo : public TorqueGeneratedCallSiteInfo<CallSiteInfo, Struct> {
public:
NEVER_READ_ONLY_SPACE
DEFINE_TORQUE_GENERATED_CALL_SITE_INFO_FLAGS()
#if V8_ENABLE_WEBASSEMBLY
inline bool IsWasm() const;
@ -45,16 +45,16 @@ class StackFrameInfo
DECL_ACCESSORS(code_object, HeapObject)
// Dispatched behavior.
DECL_VERIFIER(StackFrameInfo)
DECL_VERIFIER(CallSiteInfo)
// Used to signal that the requested field is unknown.
static constexpr int kUnknown = kNoSourcePosition;
V8_EXPORT_PRIVATE static int GetLineNumber(Handle<StackFrameInfo> info);
V8_EXPORT_PRIVATE static int GetColumnNumber(Handle<StackFrameInfo> info);
V8_EXPORT_PRIVATE static int GetLineNumber(Handle<CallSiteInfo> info);
V8_EXPORT_PRIVATE static int GetColumnNumber(Handle<CallSiteInfo> info);
static int GetEnclosingLineNumber(Handle<StackFrameInfo> info);
static int GetEnclosingColumnNumber(Handle<StackFrameInfo> info);
static int GetEnclosingLineNumber(Handle<CallSiteInfo> info);
static int GetEnclosingColumnNumber(Handle<CallSiteInfo> info);
// Returns the script ID if one is attached,
// Message::kNoScriptIdInfo otherwise.
@ -64,58 +64,54 @@ class StackFrameInfo
Object GetScriptSource() const;
Object GetScriptSourceMappingURL() const;
static Handle<PrimitiveHeapObject> GetEvalOrigin(Handle<StackFrameInfo> info);
static Handle<PrimitiveHeapObject> GetEvalOrigin(Handle<CallSiteInfo> info);
V8_EXPORT_PRIVATE static Handle<Object> GetFunctionName(
Handle<StackFrameInfo> info);
static Handle<Object> GetMethodName(Handle<StackFrameInfo> info);
static Handle<Object> GetTypeName(Handle<StackFrameInfo> info);
Handle<CallSiteInfo> info);
static Handle<Object> GetMethodName(Handle<CallSiteInfo> info);
static Handle<Object> GetTypeName(Handle<CallSiteInfo> info);
#if V8_ENABLE_WEBASSEMBLY
// These methods are only valid for Wasm and asm.js Wasm frames.
uint32_t GetWasmFunctionIndex() const;
WasmInstanceObject GetWasmInstance() const;
static Handle<Object> GetWasmModuleName(Handle<StackFrameInfo> info);
static Handle<Object> GetWasmModuleName(Handle<CallSiteInfo> info);
#endif // V8_ENABLE_WEBASSEMBLY
// Returns the 0-based source position, which is the offset into the
// Script in case of JavaScript and Asm.js, and the bytecode offset
// in the module in case of actual Wasm. In case of async promise
// combinator frames, this returns the index of the promise.
static int GetSourcePosition(Handle<StackFrameInfo> info);
static int GetSourcePosition(Handle<CallSiteInfo> info);
// Attempts to fill the |location| based on the |info|, and avoids
// triggering source position table building for JavaScript frames.
static bool ComputeLocation(Handle<StackFrameInfo> info,
static bool ComputeLocation(Handle<CallSiteInfo> info,
MessageLocation* location);
using BodyDescriptor = StructBodyDescriptor;
private:
// Bit position in the flag, from least significant bit position.
DEFINE_TORQUE_GENERATED_STACK_FRAME_INFO_FLAGS()
friend class StackTraceBuilder;
static int ComputeSourcePosition(Handle<StackFrameInfo> info, int offset);
static int ComputeSourcePosition(Handle<CallSiteInfo> info, int offset);
base::Optional<Script> GetScript() const;
SharedFunctionInfo GetSharedFunctionInfo() const;
static MaybeHandle<Script> GetScript(Isolate* isolate,
Handle<StackFrameInfo> info);
Handle<CallSiteInfo> info);
TQ_OBJECT_CONSTRUCTORS(StackFrameInfo)
TQ_OBJECT_CONSTRUCTORS(CallSiteInfo)
};
class IncrementalStringBuilder;
void SerializeStackFrameInfo(Isolate* isolate, Handle<StackFrameInfo> frame,
IncrementalStringBuilder* builder);
void SerializeCallSiteInfo(Isolate* isolate, Handle<CallSiteInfo> frame,
IncrementalStringBuilder* builder);
V8_EXPORT_PRIVATE
MaybeHandle<String> SerializeStackFrameInfo(Isolate* isolate,
Handle<StackFrameInfo> frame);
MaybeHandle<String> SerializeCallSiteInfo(Isolate* isolate,
Handle<CallSiteInfo> frame);
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_STACK_FRAME_INFO_H_
#endif // V8_OBJECTS_CALL_SITE_INFO_H_

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
bitfield struct StackFrameInfoFlags extends uint31 {
bitfield struct CallSiteInfoFlags extends uint31 {
is_wasm: bool: 1 bit;
is_asm_js_wasm: bool: 1 bit; // Implies that is_wasm bit is set.
is_strict: bool: 1 bit;
@ -14,11 +14,11 @@ bitfield struct StackFrameInfoFlags extends uint31 {
is_source_position_computed: bool: 1 bit;
}
extern class StackFrameInfo extends Struct {
extern class CallSiteInfo extends Struct {
receiver_or_instance: JSAny;
function: JSFunction|Smi;
code_object: HeapObject;
code_offset_or_source_position: Smi;
flags: SmiTagged<StackFrameInfoFlags>;
flags: SmiTagged<CallSiteInfoFlags>;
parameters: FixedArray;
}

View File

@ -11,6 +11,7 @@
#include "src/ic/handler-configuration.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint.h"
#include "src/objects/call-site-info.h"
#include "src/objects/cell.h"
#include "src/objects/data-handler.h"
#include "src/objects/fixed-array.h"
@ -26,7 +27,6 @@
#include "src/objects/ordered-hash-table-inl.h"
#include "src/objects/property-descriptor-object.h"
#include "src/objects/source-text-module.h"
#include "src/objects/stack-frame-info.h"
#include "src/objects/swiss-name-dictionary-inl.h"
#include "src/objects/synthetic-module.h"
#include "src/objects/template-objects.h"

View File

@ -140,6 +140,7 @@ namespace internal {
V(_, BREAK_POINT_INFO_TYPE, BreakPointInfo, break_point_info) \
V(_, CACHED_TEMPLATE_OBJECT_TYPE, CachedTemplateObject, \
cached_template_object) \
V(_, CALL_SITE_INFO_TYPE, CallSiteInfo, call_site_info) \
V(_, CLASS_POSITIONS_TYPE, ClassPositions, class_positions) \
V(_, DEBUG_INFO_TYPE, DebugInfo, debug_info) \
V(_, ENUM_CACHE_TYPE, EnumCache, enum_cache) \
@ -159,7 +160,6 @@ namespace internal {
V(_, SCRIPT_OR_MODULE_TYPE, ScriptOrModule, script_or_module) \
V(_, SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE, SourceTextModuleInfoEntry, \
module_info_entry) \
V(_, STACK_FRAME_INFO_TYPE, StackFrameInfo, stack_frame_info) \
V(_, TEMPLATE_OBJECT_DESCRIPTION_TYPE, TemplateObjectDescription, \
template_object_description) \
V(_, TUPLE2_TYPE, Tuple2, tuple2) \

View File

@ -49,6 +49,7 @@
#include "src/objects/api-callbacks.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/code-inl.h"
#include "src/objects/compilation-cache-table-inl.h"
@ -110,7 +111,6 @@
#include "src/objects/property-descriptor.h"
#include "src/objects/prototype.h"
#include "src/objects/slots-atomic-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/string-comparator.h"
#include "src/objects/string-set-inl.h"
#include "src/objects/struct-inl.h"

View File

@ -175,7 +175,7 @@
// - BreakPoint
// - BreakPointInfo
// - CachedTemplateObject
// - StackFrameInfo
// - CallSiteInfo
// - CodeCache
// - PropertyDescriptorObject
// - PrototypeInfo

View File

@ -31,9 +31,9 @@
#include "src/base/platform/wrappers.h"
#include "src/builtins/builtins.h"
#include "src/compiler/wasm-compiler.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/js-collection-inl.h"
#include "src/objects/managed-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/wasm/leb-helper.h"
#include "src/wasm/module-instantiate.h"
#include "src/wasm/wasm-arguments.h"
@ -1040,11 +1040,11 @@ own<Instance> GetInstance(StoreImpl* store,
own<Frame> CreateFrameFromInternal(i::Handle<i::FixedArray> frames, int index,
i::Isolate* isolate, StoreImpl* store) {
i::Handle<i::StackFrameInfo> frame(
i::StackFrameInfo::cast(frames->get(index)), isolate);
i::Handle<i::CallSiteInfo> frame(i::CallSiteInfo::cast(frames->get(index)),
isolate);
i::Handle<i::WasmInstanceObject> instance(frame->GetWasmInstance(), isolate);
uint32_t func_index = frame->GetWasmFunctionIndex();
size_t module_offset = i::StackFrameInfo::GetSourcePosition(frame);
size_t module_offset = i::CallSiteInfo::GetSourcePosition(frame);
size_t func_offset = module_offset - i::wasm::GetWasmFunctionOffset(
instance->module(), func_index);
return own<Frame>(seal<Frame>(new (std::nothrow) FrameImpl(

View File

@ -55,6 +55,7 @@
#include "src/heap/safepoint.h"
#include "src/ic/ic.h"
#include "src/numbers/hash-seed-inl.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/elements.h"
#include "src/objects/field-type.h"
#include "src/objects/heap-number-inl.h"
@ -63,7 +64,6 @@
#include "src/objects/managed-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/slots.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/transitions.h"
#include "src/regexp/regexp.h"
#include "src/snapshot/snapshot.h"
@ -3567,7 +3567,7 @@ void DetailedErrorStackTraceTest(const char* src,
}
FixedArray ParametersOf(Handle<FixedArray> stack_trace, int frame_index) {
return StackFrameInfo::cast(stack_trace->get(frame_index)).parameters();
return CallSiteInfo::cast(stack_trace->get(frame_index)).parameters();
}
// * Test interpreted function error

View File

@ -5,7 +5,7 @@
#include "include/v8-function.h"
#include "src/api/api-inl.h"
#include "src/codegen/assembler-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/call-site-info-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
#include "test/cctest/wasm/wasm-run-utils.h"
@ -212,11 +212,11 @@ WASM_COMPILED_EXEC_TEST(CollectDetailedWasmStack_WasmUrl) {
Handle<FixedArray> stack_trace_object =
isolate->GetDetailedStackTrace(Handle<JSObject>::cast(exception));
CHECK(!stack_trace_object.is_null());
Handle<StackFrameInfo> stack_frame(
StackFrameInfo::cast(stack_trace_object->get(0)), isolate);
Handle<CallSiteInfo> stack_frame(
CallSiteInfo::cast(stack_trace_object->get(0)), isolate);
MaybeHandle<String> maybe_stack_trace_str =
SerializeStackFrameInfo(isolate, stack_frame);
SerializeCallSiteInfo(isolate, stack_frame);
CHECK(!maybe_stack_trace_str.is_null());
Handle<String> stack_trace_str = maybe_stack_trace_str.ToHandleChecked();

View File

@ -5,7 +5,7 @@
#include "include/v8-function.h"
#include "src/api/api-inl.h"
#include "src/codegen/assembler-inl.h"
#include "src/objects/stack-frame-info-inl.h"
#include "src/objects/call-site-info-inl.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
@ -53,12 +53,12 @@ void CheckExceptionInfos(v8::internal::Isolate* isolate, Handle<Object> exc,
CHECK_EQ(N, stack->length());
for (int i = 0; i < N; ++i) {
Handle<StackFrameInfo> info(StackFrameInfo::cast(stack->get(i)), isolate);
auto func_name = Handle<String>::cast(StackFrameInfo::GetFunctionName(info))
->ToCString();
Handle<CallSiteInfo> info(CallSiteInfo::cast(stack->get(i)), isolate);
auto func_name =
Handle<String>::cast(CallSiteInfo::GetFunctionName(info))->ToCString();
CHECK_CSTREQ(excInfos[i].func_name, func_name.get());
CHECK_EQ(excInfos[i].line_nr, StackFrameInfo::GetLineNumber(info));
CHECK_EQ(excInfos[i].column, StackFrameInfo::GetColumnNumber(info));
CHECK_EQ(excInfos[i].line_nr, CallSiteInfo::GetLineNumber(info));
CHECK_EQ(excInfos[i].column, CallSiteInfo::GetColumnNumber(info));
}
}

View File

@ -117,6 +117,7 @@ export const CATEGORIES = new Map([
'BOILERPLATE_PROPERTY_DICTIONARY_TYPE',
'BYTE_ARRAY_TYPE',
'CALL_HANDLER_INFO_TYPE',
'CALL_SITE_INFO_TYPE',
'CELL_TYPE',
'CODE_STUBS_TABLE_TYPE',
'CONTEXT_EXTENSION_TYPE',
@ -148,7 +149,6 @@ export const CATEGORIES = new Map([
'SCRIPT_SHARED_FUNCTION_INFOS_TYPE',
'SERIALIZED_OBJECTS_TYPE',
'SINGLE_CHARACTER_STRING_CACHE_TYPE',
'STACK_FRAME_INFO_TYPE',
'STRING_SPLIT_CACHE_TYPE',
'STRING_TABLE_TYPE',
'TRANSITION_ARRAY_TYPE',

View File

@ -55,23 +55,23 @@ INSTANCE_TYPES = {
151: "BREAK_POINT_INFO_TYPE",
152: "CACHED_TEMPLATE_OBJECT_TYPE",
153: "CALL_HANDLER_INFO_TYPE",
154: "CLASS_POSITIONS_TYPE",
155: "DEBUG_INFO_TYPE",
156: "ENUM_CACHE_TYPE",
157: "FEEDBACK_CELL_TYPE",
158: "FUNCTION_TEMPLATE_RARE_DATA_TYPE",
159: "INTERCEPTOR_INFO_TYPE",
160: "INTERPRETER_DATA_TYPE",
161: "MODULE_REQUEST_TYPE",
162: "PROMISE_CAPABILITY_TYPE",
163: "PROMISE_REACTION_TYPE",
164: "PROPERTY_DESCRIPTOR_OBJECT_TYPE",
165: "PROTOTYPE_INFO_TYPE",
166: "REG_EXP_BOILERPLATE_DESCRIPTION_TYPE",
167: "SCRIPT_TYPE",
168: "SCRIPT_OR_MODULE_TYPE",
169: "SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE",
170: "STACK_FRAME_INFO_TYPE",
154: "CALL_SITE_INFO_TYPE",
155: "CLASS_POSITIONS_TYPE",
156: "DEBUG_INFO_TYPE",
157: "ENUM_CACHE_TYPE",
158: "FEEDBACK_CELL_TYPE",
159: "FUNCTION_TEMPLATE_RARE_DATA_TYPE",
160: "INTERCEPTOR_INFO_TYPE",
161: "INTERPRETER_DATA_TYPE",
162: "MODULE_REQUEST_TYPE",
163: "PROMISE_CAPABILITY_TYPE",
164: "PROMISE_REACTION_TYPE",
165: "PROPERTY_DESCRIPTOR_OBJECT_TYPE",
166: "PROTOTYPE_INFO_TYPE",
167: "REG_EXP_BOILERPLATE_DESCRIPTION_TYPE",
168: "SCRIPT_TYPE",
169: "SCRIPT_OR_MODULE_TYPE",
170: "SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE",
171: "TEMPLATE_OBJECT_DESCRIPTION_TYPE",
172: "TUPLE2_TYPE",
173: "WASM_CONTINUATION_OBJECT_TYPE",
@ -266,7 +266,7 @@ KNOWN_MAPS = {
("read_only_space", 0x02159): (131, "NullMap"),
("read_only_space", 0x02181): (229, "StrongDescriptorArrayMap"),
("read_only_space", 0x021a9): (258, "WeakArrayListMap"),
("read_only_space", 0x021ed): (156, "EnumCacheMap"),
("read_only_space", 0x021ed): (157, "EnumCacheMap"),
("read_only_space", 0x02221): (176, "FixedArrayMap"),
("read_only_space", 0x0226d): (8, "OneByteInternalizedStringMap"),
("read_only_space", 0x022b9): (242, "FreeSpaceMap"),
@ -307,13 +307,13 @@ KNOWN_MAPS = {
("read_only_space", 0x02a89): (237, "CoverageInfoMap"),
("read_only_space", 0x02ab1): (191, "FixedDoubleArrayMap"),
("read_only_space", 0x02ad9): (179, "GlobalDictionaryMap"),
("read_only_space", 0x02b01): (157, "ManyClosuresCellMap"),
("read_only_space", 0x02b01): (158, "ManyClosuresCellMap"),
("read_only_space", 0x02b29): (246, "MegaDomHandlerMap"),
("read_only_space", 0x02b51): (176, "ModuleInfoMap"),
("read_only_space", 0x02b79): (180, "NameDictionaryMap"),
("read_only_space", 0x02ba1): (157, "NoClosuresCellMap"),
("read_only_space", 0x02ba1): (158, "NoClosuresCellMap"),
("read_only_space", 0x02bc9): (181, "NumberDictionaryMap"),
("read_only_space", 0x02bf1): (157, "OneClosureCellMap"),
("read_only_space", 0x02bf1): (158, "OneClosureCellMap"),
("read_only_space", 0x02c19): (182, "OrderedHashMapMap"),
("read_only_space", 0x02c41): (183, "OrderedHashSetMap"),
("read_only_space", 0x02c69): (184, "OrderedNameDictionaryMap"),
@ -363,7 +363,7 @@ KNOWN_MAPS = {
("read_only_space", 0x03349): (131, "SelfReferenceMarkerMap"),
("read_only_space", 0x03371): (131, "BasicBlockCountersMarkerMap"),
("read_only_space", 0x033b5): (147, "ArrayBoilerplateDescriptionMap"),
("read_only_space", 0x034b5): (159, "InterceptorInfoMap"),
("read_only_space", 0x034b5): (160, "InterceptorInfoMap"),
("read_only_space", 0x05d29): (132, "PromiseFulfillReactionJobTaskMap"),
("read_only_space", 0x05d51): (133, "PromiseRejectReactionJobTaskMap"),
("read_only_space", 0x05d79): (134, "CallableTaskMap"),
@ -381,20 +381,20 @@ KNOWN_MAPS = {
("read_only_space", 0x05f59): (150, "BreakPointMap"),
("read_only_space", 0x05f81): (151, "BreakPointInfoMap"),
("read_only_space", 0x05fa9): (152, "CachedTemplateObjectMap"),
("read_only_space", 0x05fd1): (154, "ClassPositionsMap"),
("read_only_space", 0x05ff9): (155, "DebugInfoMap"),
("read_only_space", 0x06021): (158, "FunctionTemplateRareDataMap"),
("read_only_space", 0x06049): (160, "InterpreterDataMap"),
("read_only_space", 0x06071): (161, "ModuleRequestMap"),
("read_only_space", 0x06099): (162, "PromiseCapabilityMap"),
("read_only_space", 0x060c1): (163, "PromiseReactionMap"),
("read_only_space", 0x060e9): (164, "PropertyDescriptorObjectMap"),
("read_only_space", 0x06111): (165, "PrototypeInfoMap"),
("read_only_space", 0x06139): (166, "RegExpBoilerplateDescriptionMap"),
("read_only_space", 0x06161): (167, "ScriptMap"),
("read_only_space", 0x06189): (168, "ScriptOrModuleMap"),
("read_only_space", 0x061b1): (169, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x061d9): (170, "StackFrameInfoMap"),
("read_only_space", 0x05fd1): (154, "CallSiteInfoMap"),
("read_only_space", 0x05ff9): (155, "ClassPositionsMap"),
("read_only_space", 0x06021): (156, "DebugInfoMap"),
("read_only_space", 0x06049): (159, "FunctionTemplateRareDataMap"),
("read_only_space", 0x06071): (161, "InterpreterDataMap"),
("read_only_space", 0x06099): (162, "ModuleRequestMap"),
("read_only_space", 0x060c1): (163, "PromiseCapabilityMap"),
("read_only_space", 0x060e9): (164, "PromiseReactionMap"),
("read_only_space", 0x06111): (165, "PropertyDescriptorObjectMap"),
("read_only_space", 0x06139): (166, "PrototypeInfoMap"),
("read_only_space", 0x06161): (167, "RegExpBoilerplateDescriptionMap"),
("read_only_space", 0x06189): (168, "ScriptMap"),
("read_only_space", 0x061b1): (169, "ScriptOrModuleMap"),
("read_only_space", 0x061d9): (170, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x06201): (171, "TemplateObjectDescriptionMap"),
("read_only_space", 0x06229): (172, "Tuple2Map"),
("read_only_space", 0x06251): (173, "WasmContinuationObjectMap"),