| 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 Script::COMPILATION_TYPE_EVAL); | 694 Script::COMPILATION_TYPE_EVAL); |
| 695 } | 695 } |
| 696 if (options_ & StackTrace::kFunctionName) { | 696 if (options_ & StackTrace::kFunctionName) { |
| 697 Handle<String> name = summ.FunctionName(); | 697 Handle<String> name = summ.FunctionName(); |
| 698 frame->set_function_name(*name); | 698 frame->set_function_name(*name); |
| 699 } | 699 } |
| 700 if (options_ & StackTrace::kIsConstructor) { | 700 if (options_ & StackTrace::kIsConstructor) { |
| 701 frame->set_is_constructor(summ.is_constructor()); | 701 frame->set_is_constructor(summ.is_constructor()); |
| 702 } | 702 } |
| 703 frame->set_is_wasm(false); | 703 frame->set_is_wasm(false); |
| 704 frame->set_options(options_); |
| 704 return frame; | 705 return frame; |
| 705 } | 706 } |
| 706 | 707 |
| 707 Handle<StackFrameInfo> NewStackFrameObject( | 708 Handle<StackFrameInfo> NewStackFrameObject( |
| 708 const FrameSummary::WasmFrameSummary& summ) { | 709 const FrameSummary::WasmFrameSummary& summ) { |
| 709 Handle<StackFrameInfo> info = factory()->NewStackFrameInfo(); | 710 Handle<StackFrameInfo> info = factory()->NewStackFrameInfo(); |
| 710 | 711 |
| 711 if (options_ & StackTrace::kFunctionName) { | 712 if (options_ & StackTrace::kFunctionName) { |
| 712 Handle<WasmCompiledModule> compiled_module( | 713 Handle<WasmCompiledModule> compiled_module( |
| 713 summ.wasm_instance()->compiled_module(), isolate_); | 714 summ.wasm_instance()->compiled_module(), isolate_); |
| 714 Handle<String> name = WasmCompiledModule::GetFunctionName( | 715 Handle<String> name = WasmCompiledModule::GetFunctionName( |
| 715 isolate_, compiled_module, summ.function_index()); | 716 isolate_, compiled_module, summ.function_index()); |
| 716 info->set_function_name(*name); | 717 info->set_function_name(*name); |
| 717 } | 718 } |
| 718 // Encode the function index as line number (1-based). | 719 // Encode the function index as line number (1-based). |
| 719 if (options_ & StackTrace::kLineNumber) { | 720 if (options_ & StackTrace::kLineNumber) { |
| 720 info->set_line_number(summ.function_index() + 1); | 721 info->set_line_number(summ.function_index() + 1); |
| 721 } | 722 } |
| 722 // Encode the byte offset as column (1-based). | 723 // Encode the byte offset as column (1-based). |
| 723 if (options_ & StackTrace::kColumnOffset) { | 724 if (options_ & StackTrace::kColumnOffset) { |
| 724 int position = summ.byte_offset(); | 725 int position = summ.byte_offset(); |
| 725 // Make position 1-based. | 726 // Make position 1-based. |
| 726 if (position >= 0) ++position; | 727 if (position >= 0) ++position; |
| 727 info->set_column_number(position); | 728 info->set_column_number(position); |
| 728 } | 729 } |
| 729 if (options_ & StackTrace::kScriptId) { | 730 if (options_ & StackTrace::kScriptId) { |
| 730 info->set_script_id(summ.script()->id()); | 731 info->set_script_id(summ.script()->id()); |
| 731 } | 732 } |
| 732 info->set_is_wasm(true); | 733 info->set_is_wasm(true); |
| 734 info->set_options(options_); |
| 733 return info; | 735 return info; |
| 734 } | 736 } |
| 735 | 737 |
| 736 private: | 738 private: |
| 737 inline Factory* factory() { return isolate_->factory(); } | 739 inline Factory* factory() { return isolate_->factory(); } |
| 738 | 740 |
| 739 Isolate* isolate_; | 741 Isolate* isolate_; |
| 740 StackTrace::StackTraceOptions options_; | 742 StackTrace::StackTraceOptions options_; |
| 741 }; | 743 }; |
| 742 | 744 |
| (...skipping 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 // Then check whether this scope intercepts. | 3745 // Then check whether this scope intercepts. |
| 3744 if ((flag & intercept_mask_)) { | 3746 if ((flag & intercept_mask_)) { |
| 3745 intercepted_flags_ |= flag; | 3747 intercepted_flags_ |= flag; |
| 3746 return true; | 3748 return true; |
| 3747 } | 3749 } |
| 3748 return false; | 3750 return false; |
| 3749 } | 3751 } |
| 3750 | 3752 |
| 3751 } // namespace internal | 3753 } // namespace internal |
| 3752 } // namespace v8 | 3754 } // namespace v8 |
| OLD | NEW |