Commit 93d6356c authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[stack-trace] Remove JSArray wrapper for simple stack traces

This CL changes the Symbol "stack_trace_symbol" to directly hold a
FrameArray instead of wrapping it with a JSArray first.

Bug: v8:9115
Change-Id: I2ac0b1fb380211568abdc6d9f50431c405349dec
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1564060Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60801}
parent a35d999b
......@@ -1111,7 +1111,7 @@ Handle<Object> CaptureStackTrace(Isolate* isolate, Handle<Object> caller,
// TODO(yangguo): Queue this structured stack trace for preprocessing on GC.
if (options.capture_result == CaptureStackTraceOptions::RAW_FRAME_ARRAY) {
return isolate->factory()->NewJSArrayWithElements(builder.GetElements());
return builder.GetElements();
}
return builder.GetElementsAsStackTraceFrameArray();
}
......@@ -2110,11 +2110,9 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
Handle<Name> key = factory()->stack_trace_symbol();
Handle<Object> property =
JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key);
if (!property->IsJSArray()) return false;
Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
if (!property->IsFixedArray()) return false;
Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements()),
this);
Handle<FrameArray> elements = Handle<FrameArray>::cast(property);
const int frame_count = elements->FrameCount();
for (int i = 0; i < frame_count; i++) {
......
......@@ -974,12 +974,8 @@ class PrepareStackTraceScope {
MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate,
Handle<JSObject> error,
Handle<Object> raw_stack) {
DCHECK(raw_stack->IsJSArray());
Handle<JSArray> raw_stack_array = Handle<JSArray>::cast(raw_stack);
DCHECK(raw_stack_array->elements()->IsFixedArray());
Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements()),
isolate);
DCHECK(raw_stack->IsFixedArray());
Handle<FrameArray> elems = Handle<FrameArray>::cast(raw_stack);
const bool in_recursion = isolate->formatting_stack_trace();
if (!in_recursion) {
......
......@@ -3553,12 +3553,8 @@ void DetailedErrorStackTraceTest(const char* src,
Isolate* isolate = CcTest::i_isolate();
Handle<Name> key = isolate->factory()->stack_trace_symbol();
Handle<FrameArray> stack_trace(
FrameArray::cast(
Handle<JSArray>::cast(
Object::GetProperty(isolate, exception, key).ToHandleChecked())
->elements()),
isolate);
Handle<FrameArray> stack_trace(Handle<FrameArray>::cast(
Object::GetProperty(isolate, exception, key).ToHandleChecked()));
test(stack_trace);
}
......@@ -5150,8 +5146,8 @@ TEST(PreprocessStackTrace) {
Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
CHECK(pos->IsSmi());
Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace);
int array_length = Smi::ToInt(stack_trace_array->length());
Handle<FrameArray> frame_array = Handle<FrameArray>::cast(stack_trace);
int array_length = frame_array->FrameCount();
for (int i = 0; i < array_length; i++) {
Handle<Object> element =
Object::GetElement(isolate, stack_trace, i).ToHandleChecked();
......
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