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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 frame->set_function_name(*name); | 674 frame->set_function_name(*name); |
675 } | 675 } |
676 if (options_ & StackTrace::kIsConstructor) { | 676 if (options_ & StackTrace::kIsConstructor) { |
677 frame->set_is_constructor(summ.is_constructor()); | 677 frame->set_is_constructor(summ.is_constructor()); |
678 } | 678 } |
679 auto new_cache = | 679 auto new_cache = |
680 UnseededNumberDictionary::AtNumberPut(cache, code_offset, frame); | 680 UnseededNumberDictionary::AtNumberPut(cache, code_offset, frame); |
681 if (*new_cache != *cache) { | 681 if (*new_cache != *cache) { |
682 PutCache(source_position_table, cache); | 682 PutCache(source_position_table, cache); |
683 } | 683 } |
| 684 frame->set_is_wasm(false); |
684 return frame; | 685 return frame; |
685 } | 686 } |
686 | 687 |
687 Handle<StackFrameInfo> NewStackFrameObject( | 688 Handle<StackFrameInfo> NewStackFrameObject( |
688 const FrameSummary::WasmFrameSummary& summ) { | 689 const FrameSummary::WasmFrameSummary& summ) { |
689 Handle<StackFrameInfo> info = factory()->NewStackFrameInfo(); | 690 Handle<StackFrameInfo> info = factory()->NewStackFrameInfo(); |
690 | 691 |
691 if (options_ & StackTrace::kFunctionName) { | 692 if (options_ & StackTrace::kFunctionName) { |
692 Handle<WasmCompiledModule> compiled_module( | 693 Handle<WasmCompiledModule> compiled_module( |
693 summ.wasm_instance()->compiled_module(), isolate_); | 694 summ.wasm_instance()->compiled_module(), isolate_); |
694 Handle<String> name = WasmCompiledModule::GetFunctionName( | 695 Handle<String> name = WasmCompiledModule::GetFunctionName( |
695 isolate_, compiled_module, summ.function_index()); | 696 isolate_, compiled_module, summ.function_index()); |
696 info->set_function_name(*name); | 697 info->set_function_name(*name); |
697 } | 698 } |
698 // Encode the function index as line number (1-based). | 699 // Encode the function index as line number (1-based). |
699 if (options_ & StackTrace::kLineNumber) { | 700 if (options_ & StackTrace::kLineNumber) { |
700 info->set_line_number(summ.function_index() + 1); | 701 info->set_line_number(summ.function_index() + 1); |
701 } | 702 } |
702 // Encode the byte offset as column (1-based). | 703 // Encode the byte offset as column (1-based). |
703 if (options_ & StackTrace::kColumnOffset) { | 704 if (options_ & StackTrace::kColumnOffset) { |
704 int position = summ.byte_offset(); | 705 int position = summ.byte_offset(); |
705 // Make position 1-based. | 706 // Make position 1-based. |
706 if (position >= 0) ++position; | 707 if (position >= 0) ++position; |
707 info->set_column_number(position); | 708 info->set_column_number(position); |
708 } | 709 } |
709 if (options_ & StackTrace::kScriptId) { | 710 if (options_ & StackTrace::kScriptId) { |
710 info->set_script_id(summ.script()->id()); | 711 info->set_script_id(summ.script()->id()); |
711 } | 712 } |
| 713 info->set_is_wasm(true); |
712 return info; | 714 return info; |
713 } | 715 } |
714 | 716 |
715 private: | 717 private: |
716 inline Factory* factory() { return isolate_->factory(); } | 718 inline Factory* factory() { return isolate_->factory(); } |
717 | 719 |
718 Handle<UnseededNumberDictionary> GetCache( | 720 Handle<UnseededNumberDictionary> GetCache( |
719 Handle<ByteArray> source_position_table) { | 721 Handle<ByteArray> source_position_table) { |
720 Handle<WeakHashTable> table_to_cache(isolate_->heap()->stack_frame_cache()); | 722 Handle<WeakHashTable> table_to_cache(isolate_->heap()->stack_frame_cache()); |
721 Object* maybe_cache = table_to_cache->Lookup(source_position_table); | 723 Object* maybe_cache = table_to_cache->Lookup(source_position_table); |
(...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3702 // Then check whether this scope intercepts. | 3704 // Then check whether this scope intercepts. |
3703 if ((flag & intercept_mask_)) { | 3705 if ((flag & intercept_mask_)) { |
3704 intercepted_flags_ |= flag; | 3706 intercepted_flags_ |= flag; |
3705 return true; | 3707 return true; |
3706 } | 3708 } |
3707 return false; | 3709 return false; |
3708 } | 3710 } |
3709 | 3711 |
3710 } // namespace internal | 3712 } // namespace internal |
3711 } // namespace v8 | 3713 } // namespace v8 |
OLD | NEW |