OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/messages.h" | 5 #include "src/messages.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 MaybeHandle<FixedArray> GetStackFrames(Isolate* isolate, | 492 MaybeHandle<FixedArray> GetStackFrames(Isolate* isolate, |
493 Handle<Object> raw_stack) { | 493 Handle<Object> raw_stack) { |
494 DCHECK(raw_stack->IsJSArray()); | 494 DCHECK(raw_stack->IsJSArray()); |
495 Handle<JSArray> raw_stack_array = Handle<JSArray>::cast(raw_stack); | 495 Handle<JSArray> raw_stack_array = Handle<JSArray>::cast(raw_stack); |
496 | 496 |
497 DCHECK(raw_stack_array->elements()->IsFixedArray()); | 497 DCHECK(raw_stack_array->elements()->IsFixedArray()); |
498 Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements())); | 498 Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements())); |
499 | 499 |
500 const int frame_count = elems->FrameCount(); | 500 const int frame_count = elems->FrameCount(); |
501 | 501 |
502 int sloppy_frames = elems->SloppyFrameCount(); | |
503 | |
504 Handle<FixedArray> frames = isolate->factory()->NewFixedArray(frame_count); | 502 Handle<FixedArray> frames = isolate->factory()->NewFixedArray(frame_count); |
505 for (int i = 0; i < frame_count; i++) { | 503 for (int i = 0; i < frame_count; i++) { |
| 504 const int flags = elems->Flags(i)->value(); |
506 Handle<AbstractCode> code(elems->Code(i), isolate); | 505 Handle<AbstractCode> code(elems->Code(i), isolate); |
507 Handle<Smi> pc(elems->Offset(i), isolate); | 506 Handle<Smi> pc(elems->Offset(i), isolate); |
508 | 507 Handle<Object> strict = |
509 sloppy_frames--; | 508 isolate->factory()->ToBoolean(flags & FrameArray::kIsStrict); |
510 Handle<Object> strict = isolate->factory()->ToBoolean(sloppy_frames < 0); | |
511 | 509 |
512 if (elems->IsWasmFrame(i)) { | 510 if (elems->IsWasmFrame(i)) { |
513 Handle<Object> wasm_obj(elems->WasmObject(i), isolate); | 511 Handle<Object> wasm_obj(elems->WasmObject(i), isolate); |
514 Handle<Smi> wasm_fun_ix(elems->WasmFunctionIndex(i), isolate); | 512 Handle<Smi> wasm_fun_ix(elems->WasmFunctionIndex(i), isolate); |
515 | 513 |
516 Handle<Object> pos((pc->value() < 0) | 514 Handle<Object> pos((pc->value() < 0) |
517 ? Smi::FromInt(-1 - pc->value()) | 515 ? Smi::FromInt(-1 - pc->value()) |
518 : Smi::FromInt(code->SourcePosition(pc->value())), | 516 : Smi::FromInt(code->SourcePosition(pc->value())), |
519 isolate); | 517 isolate); |
520 | 518 |
521 Handle<Object> callsite; | 519 Handle<Object> callsite; |
522 ASSIGN_RETURN_ON_EXCEPTION( | 520 ASSIGN_RETURN_ON_EXCEPTION( |
523 isolate, callsite, | 521 isolate, callsite, |
524 CallSiteUtils::Construct(isolate, wasm_obj, wasm_fun_ix, pos, strict), | 522 CallSiteUtils::Construct(isolate, wasm_obj, wasm_fun_ix, pos, strict), |
525 FixedArray); | 523 FixedArray); |
526 | 524 |
527 frames->set(i, *callsite); | 525 frames->set(i, *callsite); |
528 } else { | 526 } else { |
529 Handle<Object> recv(elems->Receiver(i), isolate); | 527 Handle<Object> recv(elems->Receiver(i), isolate); |
530 Handle<Object> fun(elems->Function(i), isolate); | 528 Handle<Object> fun(elems->Function(i), isolate); |
531 Handle<Object> pos(Smi::FromInt(code->SourcePosition(pc->value())), | 529 Handle<Object> pos(Smi::FromInt(code->SourcePosition(pc->value())), |
532 isolate); | 530 isolate); |
533 | 531 |
| 532 if (flags & FrameArray::kForceConstructor) { |
| 533 recv = handle(isolate->heap()->call_site_constructor_symbol()); |
| 534 } |
| 535 |
534 Handle<Object> callsite; | 536 Handle<Object> callsite; |
535 ASSIGN_RETURN_ON_EXCEPTION( | 537 ASSIGN_RETURN_ON_EXCEPTION( |
536 isolate, callsite, | 538 isolate, callsite, |
537 CallSiteUtils::Construct(isolate, recv, fun, pos, strict), | 539 CallSiteUtils::Construct(isolate, recv, fun, pos, strict), |
538 FixedArray); | 540 FixedArray); |
539 | 541 |
540 frames->set(i, *callsite); | 542 frames->set(i, *callsite); |
541 } | 543 } |
542 } | 544 } |
543 | 545 |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 builder.AppendCString(" ("); | 1192 builder.AppendCString(" ("); |
1191 RETURN_ON_EXCEPTION( | 1193 RETURN_ON_EXCEPTION( |
1192 isolate, AppendFileLocation(isolate, recv, &call_site, &builder), String); | 1194 isolate, AppendFileLocation(isolate, recv, &call_site, &builder), String); |
1193 builder.AppendCString(")"); | 1195 builder.AppendCString(")"); |
1194 | 1196 |
1195 RETURN_RESULT(isolate, builder.Finish(), String); | 1197 RETURN_RESULT(isolate, builder.Finish(), String); |
1196 } | 1198 } |
1197 | 1199 |
1198 } // namespace internal | 1200 } // namespace internal |
1199 } // namespace v8 | 1201 } // namespace v8 |
OLD | NEW |