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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 732 } |
733 | 733 |
734 Handle<Object> AsmJsWasmStackFrame::GetFunction() const { | 734 Handle<Object> AsmJsWasmStackFrame::GetFunction() const { |
735 // TODO(clemensh): Return lazily created JSFunction. | 735 // TODO(clemensh): Return lazily created JSFunction. |
736 return Null(); | 736 return Null(); |
737 } | 737 } |
738 | 738 |
739 Handle<Object> AsmJsWasmStackFrame::GetFileName() { | 739 Handle<Object> AsmJsWasmStackFrame::GetFileName() { |
740 Handle<Script> script = | 740 Handle<Script> script = |
741 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); | 741 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
742 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); | 742 DCHECK(script->IsUserJavaScript()); |
743 return handle(script->name(), isolate_); | 743 return handle(script->name(), isolate_); |
744 } | 744 } |
745 | 745 |
746 Handle<Object> AsmJsWasmStackFrame::GetScriptNameOrSourceUrl() { | 746 Handle<Object> AsmJsWasmStackFrame::GetScriptNameOrSourceUrl() { |
747 Handle<Script> script = | 747 Handle<Script> script = |
748 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); | 748 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
749 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); | 749 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); |
750 return ScriptNameOrSourceUrl(script, isolate_); | 750 return ScriptNameOrSourceUrl(script, isolate_); |
751 } | 751 } |
752 | 752 |
753 int AsmJsWasmStackFrame::GetPosition() const { | 753 int AsmJsWasmStackFrame::GetPosition() const { |
754 DCHECK_LE(0, offset_); | 754 DCHECK_LE(0, offset_); |
755 int byte_offset = code_->SourcePosition(offset_); | 755 int byte_offset = code_->SourcePosition(offset_); |
756 Handle<WasmCompiledModule> compiled_module( | 756 Handle<WasmCompiledModule> compiled_module( |
757 WasmInstanceObject::cast(*wasm_instance_)->compiled_module(), isolate_); | 757 WasmInstanceObject::cast(*wasm_instance_)->compiled_module(), isolate_); |
758 DCHECK_LE(0, byte_offset); | 758 DCHECK_LE(0, byte_offset); |
759 return WasmCompiledModule::GetAsmJsSourcePosition( | 759 return WasmCompiledModule::GetAsmJsSourcePosition( |
760 compiled_module, wasm_func_index_, static_cast<uint32_t>(byte_offset), | 760 compiled_module, wasm_func_index_, static_cast<uint32_t>(byte_offset), |
761 is_at_number_conversion_); | 761 is_at_number_conversion_); |
762 } | 762 } |
763 | 763 |
764 int AsmJsWasmStackFrame::GetLineNumber() { | 764 int AsmJsWasmStackFrame::GetLineNumber() { |
765 DCHECK_LE(0, GetPosition()); | 765 DCHECK_LE(0, GetPosition()); |
766 Handle<Script> script = | 766 Handle<Script> script = |
767 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); | 767 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
768 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); | 768 DCHECK(script->IsUserJavaScript()); |
769 return Script::GetLineNumber(script, GetPosition()) + 1; | 769 return Script::GetLineNumber(script, GetPosition()) + 1; |
770 } | 770 } |
771 | 771 |
772 int AsmJsWasmStackFrame::GetColumnNumber() { | 772 int AsmJsWasmStackFrame::GetColumnNumber() { |
773 DCHECK_LE(0, GetPosition()); | 773 DCHECK_LE(0, GetPosition()); |
774 Handle<Script> script = | 774 Handle<Script> script = |
775 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); | 775 wasm::GetScript(Handle<JSObject>::cast(wasm_instance_)); |
776 DCHECK_EQ(Script::TYPE_NORMAL, script->type()); | 776 DCHECK(script->IsUserJavaScript()); |
777 return Script::GetColumnNumber(script, GetPosition()) + 1; | 777 return Script::GetColumnNumber(script, GetPosition()) + 1; |
778 } | 778 } |
779 | 779 |
780 MaybeHandle<String> AsmJsWasmStackFrame::ToString() { | 780 MaybeHandle<String> AsmJsWasmStackFrame::ToString() { |
781 // The string should look exactly as the respective javascript frame string. | 781 // The string should look exactly as the respective javascript frame string. |
782 // Keep this method in line to JSStackFrame::ToString(). | 782 // Keep this method in line to JSStackFrame::ToString(). |
783 | 783 |
784 IncrementalStringBuilder builder(isolate_); | 784 IncrementalStringBuilder builder(isolate_); |
785 | 785 |
786 Handle<Object> function_name = GetFunctionName(); | 786 Handle<Object> function_name = GetFunctionName(); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 DCHECK(mode != SKIP_UNTIL_SEEN); | 1242 DCHECK(mode != SKIP_UNTIL_SEEN); |
1243 | 1243 |
1244 Handle<Object> no_caller; | 1244 Handle<Object> no_caller; |
1245 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); | 1245 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); |
1246 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, | 1246 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, |
1247 no_caller, false); | 1247 no_caller, false); |
1248 } | 1248 } |
1249 | 1249 |
1250 } // namespace internal | 1250 } // namespace internal |
1251 } // namespace v8 | 1251 } // namespace v8 |
OLD | NEW |