Commit 03924dbf authored by jgruber's avatar jgruber Committed by Commit bot

Move FormatStackTrace to ErrorUtils

BUG=

Review-Url: https://codereview.chromium.org/2206203002
Cr-Commit-Position: refs/heads/master@{#38294}
parent b3ba7b81
......@@ -1171,7 +1171,7 @@ void Accessors::ErrorStackGetter(
// property.
Handle<Object> formatted_stack_trace;
if (!FormatStackTrace(isolate, holder, stack_trace)
if (!ErrorUtils::FormatStackTrace(isolate, holder, stack_trace)
.ToHandle(&formatted_stack_trace)) {
isolate->OptionalRescheduleException(false);
return;
......
......@@ -60,7 +60,7 @@ BUILTIN(ErrorCaptureStackTrace) {
Handle<Object> formatted_stack_trace;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, formatted_stack_trace,
FormatStackTrace(isolate, object, stack_trace));
ErrorUtils::FormatStackTrace(isolate, object, stack_trace));
PropertyDescriptor desc;
desc.set_configurable(true);
......
......@@ -586,8 +586,10 @@ class PrepareStackTraceScope {
} // namespace
MaybeHandle<Object> FormatStackTrace(Isolate* isolate, Handle<JSObject> error,
Handle<Object> raw_stack) {
// static
MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate,
Handle<JSObject> error,
Handle<Object> raw_stack) {
// Create JS CallSite objects from the raw stack frame array.
Handle<FixedArray> frames;
......
......@@ -76,11 +76,6 @@ class CallSite {
uint32_t wasm_func_index_ = static_cast<uint32_t>(-1);
};
// Formats a textual stack trace from the given structured stack trace.
// Note that this can call arbitrary JS code through Error.prepareStackTrace.
MaybeHandle<Object> FormatStackTrace(Isolate* isolate, Handle<JSObject> error,
Handle<Object> stack_trace);
// Determines how stack trace collection skips frames.
enum FrameSkipMode {
// Unconditionally skips the first frame. Used e.g. when the Error constructor
......@@ -104,6 +99,12 @@ class ErrorUtils : public AllStatic {
Isolate* isolate, Handle<JSFunction> constructor, int template_index,
Handle<Object> arg0, Handle<Object> arg1, Handle<Object> arg2,
FrameSkipMode mode);
// Formats a textual stack trace from the given structured stack trace.
// Note that this can call arbitrary JS code through Error.prepareStackTrace.
static MaybeHandle<Object> FormatStackTrace(Isolate* isolate,
Handle<JSObject> error,
Handle<Object> stack_trace);
};
class CallSiteUtils : public AllStatic {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment