Chromium Code Reviews| Index: src/messages.cc |
| diff --git a/src/messages.cc b/src/messages.cc |
| index 5d033189634d28dc863f243fadf57dc34acefe7c..1b6817589988764087e3ddf9a3e851cdab7bbb77 100644 |
| --- a/src/messages.cc |
| +++ b/src/messages.cc |
| @@ -495,44 +495,55 @@ 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 = |
|
Toon Verwaest
2016/08/23 13:14:08
elems(FrameArray::cast ...) as you do in other pla
jgruber
2016/08/23 15:32:13
Done.
|
| + handle(FrameArray::cast(raw_stack_array->elements()), isolate); |
| - 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 = Smi::cast(elems->get(0))->value(); |
|
Toon Verwaest
2016/08/23 13:14:08
This should probably be a proper elems->sloppy_fra
jgruber
2016/08/23 15:32:13
Done, but replacing sloppy_frames by an addition f
|
| - 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 = handle(elems->Code(i), isolate); |
|
Toon Verwaest
2016/08/23 13:14:08
Handle<Abstractcode> code(elems->Code(i), isolate)
jgruber
2016/08/23 15:32:13
Done.
|
| + Handle<Smi> pc = handle(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 = handle(elems->WasmObject(i), isolate); |
| + Handle<Smi> wasm_fun_ix = handle(elems->WasmFunctionIndex(i), isolate); |
| + |
| + Handle<Object> pos = |
|
Toon Verwaest
2016/08/23 13:14:08
This should probably become something like WasmCal
jgruber
2016/08/23 15:32:13
Ack, this will happen once we have separate JS and
|
| + (pc->value() < 0) |
| + ? handle(Smi::FromInt(-1 - pc->value()), isolate) |
| + : handle(Smi::FromInt(code->SourcePosition(pc->value())), |
| + isolate); |
| + |
| + 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 = handle(elems->Receiver(i), isolate); |
| + Handle<Object> fun = handle(elems->Function(i), isolate); |
| + |
| + Handle<Object> pos = |
| + handle(Smi::FromInt(code->SourcePosition(pc->value())), isolate); |
| - frames->set(dst_ix++, *callsite); |
| + 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; |
| } |