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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 frame->set_function_name(*function_name); | 710 frame->set_function_name(*function_name); |
711 frame->set_is_constructor(summ.is_constructor()); | 711 frame->set_is_constructor(summ.is_constructor()); |
712 frame->set_is_wasm(false); | 712 frame->set_is_wasm(false); |
713 if (!FLAG_optimize_for_size) { | 713 if (!FLAG_optimize_for_size) { |
714 auto new_cache = | 714 auto new_cache = |
715 UnseededNumberDictionary::AtNumberPut(cache, code_offset, frame); | 715 UnseededNumberDictionary::AtNumberPut(cache, code_offset, frame); |
716 if (*new_cache != *cache || !maybe_cache->IsUnseededNumberDictionary()) { | 716 if (*new_cache != *cache || !maybe_cache->IsUnseededNumberDictionary()) { |
717 AbstractCode::SetStackFrameCache(summ.abstract_code(), new_cache); | 717 AbstractCode::SetStackFrameCache(summ.abstract_code(), new_cache); |
718 } | 718 } |
719 } | 719 } |
| 720 frame->set_id(next_id()); |
720 return frame; | 721 return frame; |
721 } | 722 } |
722 | 723 |
723 Handle<StackFrameInfo> NewStackFrameObject( | 724 Handle<StackFrameInfo> NewStackFrameObject( |
724 const FrameSummary::WasmFrameSummary& summ) { | 725 const FrameSummary::WasmFrameSummary& summ) { |
725 Handle<StackFrameInfo> info = factory()->NewStackFrameInfo(); | 726 Handle<StackFrameInfo> info = factory()->NewStackFrameInfo(); |
726 | 727 |
727 Handle<WasmCompiledModule> compiled_module( | 728 Handle<WasmCompiledModule> compiled_module( |
728 summ.wasm_instance()->compiled_module(), isolate_); | 729 summ.wasm_instance()->compiled_module(), isolate_); |
729 Handle<String> name = WasmCompiledModule::GetFunctionName( | 730 Handle<String> name = WasmCompiledModule::GetFunctionName( |
730 isolate_, compiled_module, summ.function_index()); | 731 isolate_, compiled_module, summ.function_index()); |
731 info->set_function_name(*name); | 732 info->set_function_name(*name); |
732 // Encode the function index as line number (1-based). | 733 // Encode the function index as line number (1-based). |
733 info->set_line_number(summ.function_index() + 1); | 734 info->set_line_number(summ.function_index() + 1); |
734 // Encode the byte offset as column (1-based). | 735 // Encode the byte offset as column (1-based). |
735 int position = summ.byte_offset(); | 736 int position = summ.byte_offset(); |
736 // Make position 1-based. | 737 // Make position 1-based. |
737 if (position >= 0) ++position; | 738 if (position >= 0) ++position; |
738 info->set_column_number(position); | 739 info->set_column_number(position); |
739 info->set_script_id(summ.script()->id()); | 740 info->set_script_id(summ.script()->id()); |
740 info->set_is_wasm(true); | 741 info->set_is_wasm(true); |
| 742 info->set_id(next_id()); |
741 return info; | 743 return info; |
742 } | 744 } |
743 | 745 |
744 private: | 746 private: |
745 inline Factory* factory() { return isolate_->factory(); } | 747 inline Factory* factory() { return isolate_->factory(); } |
746 | 748 |
| 749 int next_id() const { |
| 750 int id = isolate_->last_stack_frame_info_id() + 1; |
| 751 isolate_->set_last_stack_frame_info_id(id); |
| 752 return id; |
| 753 } |
| 754 |
747 Isolate* isolate_; | 755 Isolate* isolate_; |
748 }; | 756 }; |
749 | 757 |
750 Handle<FixedArray> Isolate::CaptureCurrentStackTrace( | 758 Handle<FixedArray> Isolate::CaptureCurrentStackTrace( |
751 int frame_limit, StackTrace::StackTraceOptions options) { | 759 int frame_limit, StackTrace::StackTraceOptions options) { |
752 DisallowJavascriptExecution no_js(this); | 760 DisallowJavascriptExecution no_js(this); |
753 CaptureStackTraceHelper helper(this); | 761 CaptureStackTraceHelper helper(this); |
754 | 762 |
755 // Ensure no negative values. | 763 // Ensure no negative values. |
756 int limit = Max(frame_limit, 0); | 764 int limit = Max(frame_limit, 0); |
(...skipping 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3770 // Then check whether this scope intercepts. | 3778 // Then check whether this scope intercepts. |
3771 if ((flag & intercept_mask_)) { | 3779 if ((flag & intercept_mask_)) { |
3772 intercepted_flags_ |= flag; | 3780 intercepted_flags_ |= flag; |
3773 return true; | 3781 return true; |
3774 } | 3782 } |
3775 return false; | 3783 return false; |
3776 } | 3784 } |
3777 | 3785 |
3778 } // namespace internal | 3786 } // namespace internal |
3779 } // namespace v8 | 3787 } // namespace v8 |
OLD | NEW |