| 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 return stack_frame; |
| 629 } |
| 630 |
| 604 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { | 631 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { |
| 605 Handle<JSObject> stack_frame = | 632 Handle<JSObject> stack_frame = |
| 606 factory()->NewJSObject(isolate_->object_function()); | 633 factory()->NewJSObject(isolate_->object_function()); |
| 607 | 634 |
| 608 if (!function_key_.is_null()) { | 635 if (!function_key_.is_null()) { |
| 609 Handle<String> name = wasm::GetWasmFunctionName( | 636 Handle<String> name = wasm::GetWasmFunctionName( |
| 610 isolate_, handle(frame->wasm_obj(), isolate_), | 637 isolate_, handle(frame->wasm_obj(), isolate_), |
| 611 frame->function_index()); | 638 frame->function_index()); |
| 612 JSObject::AddProperty(stack_frame, function_key_, name, NONE); | 639 JSObject::AddProperty(stack_frame, function_key_, name, NONE); |
| 613 } | 640 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { | 748 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { |
| 722 Handle<JSFunction> fun = frames[i].function(); | 749 Handle<JSFunction> fun = frames[i].function(); |
| 723 // Filter frames from other security contexts. | 750 // Filter frames from other security contexts. |
| 724 if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && | 751 if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && |
| 725 !this->context()->HasSameSecurityTokenAs(fun->context())) | 752 !this->context()->HasSameSecurityTokenAs(fun->context())) |
| 726 continue; | 753 continue; |
| 727 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(frames[i]); | 754 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(frames[i]); |
| 728 stack_trace_elems->set(frames_seen, *new_frame_obj); | 755 stack_trace_elems->set(frames_seen, *new_frame_obj); |
| 729 frames_seen++; | 756 frames_seen++; |
| 730 } | 757 } |
| 758 } else if (frame->is_builtin_exit()) { |
| 759 BuiltinExitFrame* exit_frame = BuiltinExitFrame::cast(frame); |
| 760 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(exit_frame); |
| 761 stack_trace_elems->set(frames_seen, *new_frame_obj); |
| 762 frames_seen++; |
| 731 } else { | 763 } else { |
| 764 DCHECK(frame->is_wasm()); |
| 732 WasmFrame* wasm_frame = WasmFrame::cast(frame); | 765 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
| 733 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(wasm_frame); | 766 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(wasm_frame); |
| 734 stack_trace_elems->set(frames_seen, *new_frame_obj); | 767 stack_trace_elems->set(frames_seen, *new_frame_obj); |
| 735 frames_seen++; | 768 frames_seen++; |
| 736 } | 769 } |
| 737 } | 770 } |
| 738 | 771 |
| 739 stack_trace->set_length(Smi::FromInt(frames_seen)); | 772 stack_trace->set_length(Smi::FromInt(frames_seen)); |
| 740 return stack_trace; | 773 return stack_trace; |
| 741 } | 774 } |
| (...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3058 // Then check whether this scope intercepts. | 3091 // Then check whether this scope intercepts. |
| 3059 if ((flag & intercept_mask_)) { | 3092 if ((flag & intercept_mask_)) { |
| 3060 intercepted_flags_ |= flag; | 3093 intercepted_flags_ |= flag; |
| 3061 return true; | 3094 return true; |
| 3062 } | 3095 } |
| 3063 return false; | 3096 return false; |
| 3064 } | 3097 } |
| 3065 | 3098 |
| 3066 } // namespace internal | 3099 } // namespace internal |
| 3067 } // namespace v8 | 3100 } // namespace v8 |
| OLD | NEW |