Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: src/messages.cc

Issue 2270783002: Add new FrameArray type (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 5d033189634d28dc863f243fadf57dc34acefe7c..bf0126c19785d9f7611e2ef75eeb47e2af587ca9 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -495,44 +495,52 @@ MaybeHandle<FixedArray> GetStackFrames(Isolate* isolate,
Handle<JSArray> raw_stack_array = Handle<JSArray>::cast(raw_stack);
DCHECK(raw_stack_array->elements()->IsFixedArray());
- Handle<FixedArray> raw_stack_elements =
- handle(FixedArray::cast(raw_stack_array->elements()), isolate);
+ Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements()));
- const int raw_stack_len = raw_stack_elements->length();
- DCHECK(raw_stack_len % 4 == 1); // Multiples of 4 plus sloppy frames count.
- const int frame_count = (raw_stack_len - 1) / 4;
+ const int frame_count = elems->FrameCount();
- Handle<Object> sloppy_frames_obj =
- FixedArray::get(*raw_stack_elements, 0, isolate);
- int sloppy_frames = Handle<Smi>::cast(sloppy_frames_obj)->value();
+ int sloppy_frames = elems->SloppyFrameCount();
- int dst_ix = 0;
Handle<FixedArray> frames = isolate->factory()->NewFixedArray(frame_count);
- for (int i = 1; i < raw_stack_len; i += 4) {
- Handle<Object> recv = FixedArray::get(*raw_stack_elements, i, isolate);
- Handle<Object> fun = FixedArray::get(*raw_stack_elements, i + 1, isolate);
- Handle<AbstractCode> code = Handle<AbstractCode>::cast(
- FixedArray::get(*raw_stack_elements, i + 2, isolate));
- Handle<Smi> pc =
- Handle<Smi>::cast(FixedArray::get(*raw_stack_elements, i + 3, isolate));
-
- Handle<Object> pos =
- (fun->IsSmi() && pc->value() < 0)
- ? handle(Smi::FromInt(-1 - pc->value()), isolate)
- : handle(Smi::FromInt(code->SourcePosition(pc->value())), isolate);
+ for (int i = 0; i < frame_count; i++) {
+ Handle<AbstractCode> code(elems->Code(i), isolate);
+ Handle<Smi> pc(elems->Offset(i), isolate);
sloppy_frames--;
Handle<Object> strict = isolate->factory()->ToBoolean(sloppy_frames < 0);
- Handle<Object> callsite;
- ASSIGN_RETURN_ON_EXCEPTION(
- isolate, callsite,
- CallSiteUtils::Construct(isolate, recv, fun, pos, strict), FixedArray);
+ if (elems->IsWasmFrame(i)) {
+ Handle<Object> wasm_obj(elems->WasmObject(i), isolate);
+ Handle<Smi> wasm_fun_ix(elems->WasmFunctionIndex(i), isolate);
+
+ Handle<Object> pos((pc->value() < 0)
+ ? Smi::FromInt(-1 - pc->value())
+ : Smi::FromInt(code->SourcePosition(pc->value())),
+ isolate);
- frames->set(dst_ix++, *callsite);
+ Handle<Object> callsite;
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, callsite,
+ CallSiteUtils::Construct(isolate, wasm_obj, wasm_fun_ix, pos, strict),
+ FixedArray);
+
+ frames->set(i, *callsite);
+ } else {
+ Handle<Object> recv(elems->Receiver(i), isolate);
+ Handle<Object> fun(elems->Function(i), isolate);
+ Handle<Object> pos(Smi::FromInt(code->SourcePosition(pc->value())),
+ isolate);
+
+ Handle<Object> callsite;
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, callsite,
+ CallSiteUtils::Construct(isolate, recv, fun, pos, strict),
+ FixedArray);
+
+ frames->set(i, *callsite);
+ }
}
- DCHECK_EQ(frame_count, dst_ix);
return frames;
}
« no previous file with comments | « src/isolate.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698