OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/messages.h" | 5 #include "src/messages.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 code_ = handle(array->Code(frame_ix), isolate); | 628 code_ = handle(array->Code(frame_ix), isolate); |
629 offset_ = array->Offset(frame_ix)->value(); | 629 offset_ = array->Offset(frame_ix)->value(); |
630 } | 630 } |
631 | 631 |
632 Handle<Object> WasmStackFrame::GetFunction() const { | 632 Handle<Object> WasmStackFrame::GetFunction() const { |
633 Handle<Object> obj(Smi::FromInt(wasm_func_index_), isolate_); | 633 Handle<Object> obj(Smi::FromInt(wasm_func_index_), isolate_); |
634 return obj; | 634 return obj; |
635 } | 635 } |
636 | 636 |
637 Handle<Object> WasmStackFrame::GetFunctionName() { | 637 Handle<Object> WasmStackFrame::GetFunctionName() { |
638 return wasm::GetWasmFunctionNameOrNull(isolate_, wasm_instance_, | 638 Handle<wasm::WasmCompiledModule> compiled_module( |
| 639 wasm::GetCompiledModule(JSObject::cast(*wasm_instance_)), isolate_); |
| 640 return wasm::GetWasmFunctionNameOrNull(isolate_, compiled_module, |
639 wasm_func_index_); | 641 wasm_func_index_); |
640 } | 642 } |
641 | 643 |
642 MaybeHandle<String> WasmStackFrame::ToString() { | 644 MaybeHandle<String> WasmStackFrame::ToString() { |
643 IncrementalStringBuilder builder(isolate_); | 645 IncrementalStringBuilder builder(isolate_); |
644 | 646 |
645 Handle<Object> name = GetFunctionName(); | 647 Handle<Object> name = GetFunctionName(); |
646 if (name->IsNull(isolate_)) { | 648 if (name->IsNull(isolate_)) { |
647 builder.AppendCString("<WASM UNNAMED>"); | 649 builder.AppendCString("<WASM UNNAMED>"); |
648 } else { | 650 } else { |
(...skipping 27 matching lines...) Expand all Loading... |
676 return isolate_->global_proxy(); | 678 return isolate_->global_proxy(); |
677 } | 679 } |
678 | 680 |
679 Handle<Object> AsmJsWasmStackFrame::GetFunction() const { | 681 Handle<Object> AsmJsWasmStackFrame::GetFunction() const { |
680 // TODO(clemensh): Return lazily created JSFunction. | 682 // TODO(clemensh): Return lazily created JSFunction. |
681 return Null(); | 683 return Null(); |
682 } | 684 } |
683 | 685 |
684 Handle<Object> AsmJsWasmStackFrame::GetFileName() { | 686 Handle<Object> AsmJsWasmStackFrame::GetFileName() { |
685 Handle<Script> script = | 687 Handle<Script> script = |
686 wasm::GetAsmWasmScript(Handle<JSObject>::cast(wasm_instance_)); | 688 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
| 689 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); |
687 return handle(script->name(), isolate_); | 690 return handle(script->name(), isolate_); |
688 } | 691 } |
689 | 692 |
690 Handle<Object> AsmJsWasmStackFrame::GetFunctionName() { | |
691 return wasm::GetWasmFunctionNameOrNull(isolate_, wasm_instance_, | |
692 wasm_func_index_); | |
693 } | |
694 | |
695 Handle<Object> AsmJsWasmStackFrame::GetScriptNameOrSourceUrl() { | 693 Handle<Object> AsmJsWasmStackFrame::GetScriptNameOrSourceUrl() { |
696 Handle<Script> script = | 694 Handle<Script> script = |
697 wasm::GetAsmWasmScript(Handle<JSObject>::cast(wasm_instance_)); | 695 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
| 696 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); |
698 return ScriptNameOrSourceUrl(script, isolate_); | 697 return ScriptNameOrSourceUrl(script, isolate_); |
699 } | 698 } |
700 | 699 |
701 int AsmJsWasmStackFrame::GetPosition() const { | 700 int AsmJsWasmStackFrame::GetPosition() const { |
702 DCHECK_LE(0, offset_); | 701 DCHECK_LE(0, offset_); |
703 int byte_offset = code_->SourcePosition(offset_); | 702 int byte_offset = code_->SourcePosition(offset_); |
704 return wasm::GetAsmWasmSourcePosition(Handle<JSObject>::cast(wasm_instance_), | 703 return wasm::GetAsmWasmSourcePosition(Handle<JSObject>::cast(wasm_instance_), |
705 wasm_func_index_, byte_offset); | 704 wasm_func_index_, byte_offset); |
706 } | 705 } |
707 | 706 |
708 int AsmJsWasmStackFrame::GetLineNumber() { | 707 int AsmJsWasmStackFrame::GetLineNumber() { |
709 DCHECK_LE(0, GetPosition()); | 708 DCHECK_LE(0, GetPosition()); |
710 Handle<Script> script = | 709 Handle<Script> script = |
711 wasm::GetAsmWasmScript(Handle<JSObject>::cast(wasm_instance_)); | 710 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
| 711 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); |
712 return Script::GetLineNumber(script, GetPosition()) + 1; | 712 return Script::GetLineNumber(script, GetPosition()) + 1; |
713 } | 713 } |
714 | 714 |
715 int AsmJsWasmStackFrame::GetColumnNumber() { | 715 int AsmJsWasmStackFrame::GetColumnNumber() { |
716 DCHECK_LE(0, GetPosition()); | 716 DCHECK_LE(0, GetPosition()); |
717 Handle<Script> script = | 717 Handle<Script> script = |
718 wasm::GetAsmWasmScript(Handle<JSObject>::cast(wasm_instance_)); | 718 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
| 719 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); |
719 return Script::GetColumnNumber(script, GetPosition()) + 1; | 720 return Script::GetColumnNumber(script, GetPosition()) + 1; |
720 } | 721 } |
721 | 722 |
722 MaybeHandle<String> AsmJsWasmStackFrame::ToString() { | 723 MaybeHandle<String> AsmJsWasmStackFrame::ToString() { |
723 // The string should look exactly as the respective javascript frame string. | 724 // The string should look exactly as the respective javascript frame string. |
724 // Keep this method in line to JSStackFrame::ToString(). | 725 // Keep this method in line to JSStackFrame::ToString(). |
725 | 726 |
726 IncrementalStringBuilder builder(isolate_); | 727 IncrementalStringBuilder builder(isolate_); |
727 | 728 |
728 Handle<Object> function_name = GetFunctionName(); | 729 Handle<Object> function_name = GetFunctionName(); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 DCHECK(mode != SKIP_UNTIL_SEEN); | 1181 DCHECK(mode != SKIP_UNTIL_SEEN); |
1181 | 1182 |
1182 Handle<Object> no_caller; | 1183 Handle<Object> no_caller; |
1183 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); | 1184 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); |
1184 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, | 1185 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, |
1185 no_caller, false); | 1186 no_caller, false); |
1186 } | 1187 } |
1187 | 1188 |
1188 } // namespace internal | 1189 } // namespace internal |
1189 } // namespace v8 | 1190 } // namespace v8 |
OLD | NEW |