#include "src/execution/messages.h"
#include <memory>
#include "src/api/api-inl.h"
#include "src/ast/ast.h"
#include "src/ast/prettyprinter.h"
#include "src/execution/execution.h"
#include "src/execution/frames-inl.h"
#include "src/execution/frames.h"
#include "src/execution/isolate-inl.h"
#include "src/execution/isolate.h"
#include "src/handles/maybe-handles.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/property-descriptor.h"
#include "src/objects/struct-inl.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/parsing.h"
#include "src/roots/roots.h"
#include "src/strings/string-builder-inl.h"
namespace v8 {
namespace internal {
MessageLocation::MessageLocation(Handle<Script> script, int start_pos,
int end_pos)
: … { … }
MessageLocation::MessageLocation(Handle<Script> script, int start_pos,
int end_pos, Handle<SharedFunctionInfo> shared)
: … { … }
MessageLocation::MessageLocation(Handle<Script> script,
Handle<SharedFunctionInfo> shared,
int bytecode_offset)
: … { … }
MessageLocation::MessageLocation()
: … { … }
void MessageHandler::DefaultMessageReport(Isolate* isolate,
const MessageLocation* loc,
DirectHandle<Object> message_obj) { … }
Handle<JSMessageObject> MessageHandler::MakeMessageObject(
Isolate* isolate, MessageTemplate message, const MessageLocation* location,
DirectHandle<Object> argument, DirectHandle<FixedArray> stack_frames) { … }
void MessageHandler::ReportMessage(Isolate* isolate, const MessageLocation* loc,
DirectHandle<JSMessageObject> message) { … }
void MessageHandler::ReportMessageNoExceptions(
Isolate* isolate, const MessageLocation* loc, DirectHandle<Object> message,
v8::Local<v8::Value> api_exception_obj) { … }
Handle<String> MessageHandler::GetMessage(Isolate* isolate,
DirectHandle<Object> data) { … }
std::unique_ptr<char[]> MessageHandler::GetLocalizedMessage(
Isolate* isolate, DirectHandle<Object> data) { … }
namespace {
MaybeHandle<JSArray> GetStackFrames(Isolate* isolate,
DirectHandle<FixedArray> frames) { … }
MaybeHandle<Object> AppendErrorString(Isolate* isolate, Handle<Object> error,
IncrementalStringBuilder* builder) { … }
class V8_NODISCARD PrepareStackTraceScope { … };
}
MaybeHandle<Object> ErrorUtils::FormatStackTrace(
Isolate* isolate, Handle<JSObject> error, DirectHandle<Object> raw_stack) { … }
Handle<String> MessageFormatter::Format(
Isolate* isolate, MessageTemplate index,
base::Vector<const DirectHandle<Object>> args) { … }
const char* MessageFormatter::TemplateString(MessageTemplate index) { … }
MaybeHandle<String> MessageFormatter::TryFormat(
Isolate* isolate, MessageTemplate index,
base::Vector<const DirectHandle<String>> args) { … }
MaybeHandle<JSObject> ErrorUtils::Construct(Isolate* isolate,
Handle<JSFunction> target,
Handle<Object> new_target,
DirectHandle<Object> message,
Handle<Object> options) { … }
MaybeHandle<JSObject> ErrorUtils::Construct(
Isolate* isolate, Handle<JSFunction> target, Handle<Object> new_target,
DirectHandle<Object> message, Handle<Object> options, FrameSkipMode mode,
Handle<Object> caller, StackTraceCollection stack_trace_collection) { … }
namespace {
MaybeHandle<String> GetStringPropertyOrDefault(Isolate* isolate,
Handle<JSReceiver> recv,
Handle<String> key,
Handle<String> default_str) { … }
}
MaybeHandle<String> ErrorUtils::ToString(Isolate* isolate,
Handle<Object> receiver,
ToStringMessageSource message_source) { … }
Handle<JSObject> ErrorUtils::MakeGenericError(
Isolate* isolate, Handle<JSFunction> constructor, MessageTemplate index,
base::Vector<const DirectHandle<Object>> args, FrameSkipMode mode) { … }
Handle<JSObject> ErrorUtils::ShadowRealmConstructTypeErrorCopy(
Isolate* isolate, Handle<Object> original, MessageTemplate index,
base::Vector<const DirectHandle<Object>> args) { … }
namespace {
bool ComputeLocation(Isolate* isolate, MessageLocation* target) { … }
Handle<String> BuildDefaultCallSite(Isolate* isolate, Handle<Object> object) { … }
Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object,
MessageLocation* location,
CallPrinter::ErrorHint* hint) { … }
MessageTemplate UpdateErrorTemplate(CallPrinter::ErrorHint hint,
MessageTemplate default_id) { … }
}
Handle<JSObject> ErrorUtils::NewIteratorError(Isolate* isolate,
Handle<Object> source) { … }
Tagged<Object> ErrorUtils::ThrowSpreadArgError(Isolate* isolate,
MessageTemplate id,
Handle<Object> object) { … }
Handle<JSObject> ErrorUtils::NewCalledNonCallableError(Isolate* isolate,
Handle<Object> source) { … }
Handle<JSObject> ErrorUtils::NewConstructedNonConstructable(
Isolate* isolate, Handle<Object> source) { … }
Tagged<Object> ErrorUtils::ThrowLoadFromNullOrUndefined(
Isolate* isolate, Handle<Object> object, MaybeDirectHandle<Object> key) { … }
bool ErrorUtils::HasErrorStackSymbolOwnProperty(Isolate* isolate,
Handle<JSObject> object) { … }
ErrorUtils::StackPropertyLookupResult ErrorUtils::GetErrorStackProperty(
Isolate* isolate, Handle<JSReceiver> maybe_error_object) { … }
MaybeHandle<Object> ErrorUtils::GetFormattedStack(
Isolate* isolate, Handle<JSObject> maybe_error_object) { … }
void ErrorUtils::SetFormattedStack(Isolate* isolate,
Handle<JSObject> maybe_error_object,
Handle<Object> formatted_stack) { … }
MaybeHandle<Object> ErrorUtils::CaptureStackTrace(Isolate* isolate,
Handle<JSObject> object,
FrameSkipMode mode,
Handle<Object> caller) { … }
}
}