OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 419 } |
420 } | 420 } |
421 elements->set(cursor++, *recv); | 421 elements->set(cursor++, *recv); |
422 elements->set(cursor++, *fun); | 422 elements->set(cursor++, *fun); |
423 elements->set(cursor++, *abstract_code); | 423 elements->set(cursor++, *abstract_code); |
424 elements->set(cursor++, *offset); | 424 elements->set(cursor++, *offset); |
425 frames_seen++; | 425 frames_seen++; |
426 } | 426 } |
427 } break; | 427 } break; |
428 | 428 |
| 429 case StackFrame::BUILTIN_EXIT: { |
| 430 BuiltinExitFrame* exit_frame = BuiltinExitFrame::cast(frame); |
| 431 Handle<JSFunction> fun = handle(exit_frame->function(), this); |
| 432 Handle<Code> code = handle(exit_frame->LookupCode(), this); |
| 433 int offset = |
| 434 static_cast<int>(exit_frame->pc() - code->instruction_start()); |
| 435 |
| 436 // For now, builtin exit frames do not pass along a receiver. |
| 437 elements = MaybeGrow(this, elements, cursor, cursor + 4); |
| 438 elements->set(cursor++, *factory()->undefined_value()); |
| 439 elements->set(cursor++, *fun); |
| 440 elements->set(cursor++, *code); |
| 441 elements->set(cursor++, Smi::FromInt(offset)); |
| 442 frames_seen++; |
| 443 } break; |
| 444 |
429 case StackFrame::WASM: { | 445 case StackFrame::WASM: { |
430 WasmFrame* wasm_frame = WasmFrame::cast(frame); | 446 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
431 Code* code = wasm_frame->unchecked_code(); | 447 Code* code = wasm_frame->unchecked_code(); |
432 Handle<AbstractCode> abstract_code = | 448 Handle<AbstractCode> abstract_code = |
433 Handle<AbstractCode>(AbstractCode::cast(code)); | 449 Handle<AbstractCode>(AbstractCode::cast(code)); |
434 int offset = | 450 int offset = |
435 static_cast<int>(wasm_frame->pc() - code->instruction_start()); | 451 static_cast<int>(wasm_frame->pc() - code->instruction_start()); |
436 elements = MaybeGrow(this, elements, cursor, cursor + 4); | 452 elements = MaybeGrow(this, elements, cursor, cursor + 4); |
437 elements->set(cursor++, wasm_frame->wasm_obj()); | 453 elements->set(cursor++, wasm_frame->wasm_obj()); |
438 elements->set(cursor++, Smi::FromInt(wasm_frame->function_index())); | 454 elements->set(cursor++, Smi::FromInt(wasm_frame->function_index())); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 610 } |
595 | 611 |
596 if (!constructor_key_.is_null()) { | 612 if (!constructor_key_.is_null()) { |
597 Handle<Object> is_constructor_obj = factory()->ToBoolean(is_constructor); | 613 Handle<Object> is_constructor_obj = factory()->ToBoolean(is_constructor); |
598 JSObject::AddProperty(stack_frame, constructor_key_, is_constructor_obj, | 614 JSObject::AddProperty(stack_frame, constructor_key_, is_constructor_obj, |
599 NONE); | 615 NONE); |
600 } | 616 } |
601 return stack_frame; | 617 return stack_frame; |
602 } | 618 } |
603 | 619 |
| 620 Handle<JSObject> NewStackFrameObject(BuiltinExitFrame* frame) { |
| 621 Handle<JSObject> stack_frame = |
| 622 factory()->NewJSObject(isolate_->object_function()); |
| 623 Handle<JSFunction> fun = handle(frame->function(), isolate_); |
| 624 if (!function_key_.is_null()) { |
| 625 Handle<Object> fun_name = JSFunction::GetDebugName(fun); |
| 626 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); |
| 627 } |
| 628 |
| 629 // We don't have a script and hence cannot set line and col positions. |
| 630 DCHECK(!fun->shared()->script()->IsScript()); |
| 631 |
| 632 return stack_frame; |
| 633 } |
| 634 |
604 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { | 635 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { |
605 Handle<JSObject> stack_frame = | 636 Handle<JSObject> stack_frame = |
606 factory()->NewJSObject(isolate_->object_function()); | 637 factory()->NewJSObject(isolate_->object_function()); |
607 | 638 |
608 if (!function_key_.is_null()) { | 639 if (!function_key_.is_null()) { |
609 Handle<String> name = wasm::GetWasmFunctionName( | 640 Handle<String> name = wasm::GetWasmFunctionName( |
610 isolate_, handle(frame->wasm_obj(), isolate_), | 641 isolate_, handle(frame->wasm_obj(), isolate_), |
611 frame->function_index()); | 642 frame->function_index()); |
612 JSObject::AddProperty(stack_frame, function_key_, name, NONE); | 643 JSObject::AddProperty(stack_frame, function_key_, name, NONE); |
613 } | 644 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 Handle<JSFunction> fun = frames[i].function(); | 753 Handle<JSFunction> fun = frames[i].function(); |
723 // Filter frames from other security contexts. | 754 // Filter frames from other security contexts. |
724 if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && | 755 if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && |
725 !this->context()->HasSameSecurityTokenAs(fun->context())) | 756 !this->context()->HasSameSecurityTokenAs(fun->context())) |
726 continue; | 757 continue; |
727 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(frames[i]); | 758 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(frames[i]); |
728 stack_trace_elems->set(frames_seen, *new_frame_obj); | 759 stack_trace_elems->set(frames_seen, *new_frame_obj); |
729 frames_seen++; | 760 frames_seen++; |
730 } | 761 } |
731 } else { | 762 } else { |
| 763 DCHECK(frame->is_wasm()); |
732 WasmFrame* wasm_frame = WasmFrame::cast(frame); | 764 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
733 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(wasm_frame); | 765 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(wasm_frame); |
734 stack_trace_elems->set(frames_seen, *new_frame_obj); | 766 stack_trace_elems->set(frames_seen, *new_frame_obj); |
735 frames_seen++; | 767 frames_seen++; |
736 } | 768 } |
737 } | 769 } |
738 | 770 |
739 stack_trace->set_length(Smi::FromInt(frames_seen)); | 771 stack_trace->set_length(Smi::FromInt(frames_seen)); |
740 return stack_trace; | 772 return stack_trace; |
741 } | 773 } |
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 // Then check whether this scope intercepts. | 3074 // Then check whether this scope intercepts. |
3043 if ((flag & intercept_mask_)) { | 3075 if ((flag & intercept_mask_)) { |
3044 intercepted_flags_ |= flag; | 3076 intercepted_flags_ |= flag; |
3045 return true; | 3077 return true; |
3046 } | 3078 } |
3047 return false; | 3079 return false; |
3048 } | 3080 } |
3049 | 3081 |
3050 } // namespace internal | 3082 } // namespace internal |
3051 } // namespace v8 | 3083 } // namespace v8 |
OLD | NEW |