OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/debug/debug-evaluate.h" | 8 #include "src/debug/debug-evaluate.h" |
9 #include "src/debug/debug-frames.h" | 9 #include "src/debug/debug-frames.h" |
10 #include "src/debug/debug-scopes.h" | 10 #include "src/debug/debug-scopes.h" |
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 return Smi::FromInt(-1); | 1631 return Smi::FromInt(-1); |
1632 } else { | 1632 } else { |
1633 return Smi::cast(line_ends_array->get(line)); | 1633 return Smi::cast(line_ends_array->get(line)); |
1634 } | 1634 } |
1635 } | 1635 } |
1636 | 1636 |
1637 static Handle<Object> GetJSPositionInfo(Handle<Script> script, int position, | 1637 static Handle<Object> GetJSPositionInfo(Handle<Script> script, int position, |
1638 Script::OffsetFlag offset_flag, | 1638 Script::OffsetFlag offset_flag, |
1639 Isolate* isolate) { | 1639 Isolate* isolate) { |
1640 Script::PositionInfo info; | 1640 Script::PositionInfo info; |
1641 if (!script->GetPositionInfo(position, &info, offset_flag)) { | 1641 if (!Script::GetPositionInfo(script, position, &info, offset_flag)) { |
1642 return isolate->factory()->null_value(); | 1642 return isolate->factory()->null_value(); |
1643 } | 1643 } |
1644 | 1644 |
1645 Handle<String> source = handle(String::cast(script->source()), isolate); | 1645 Handle<String> source = handle(String::cast(script->source()), isolate); |
1646 Handle<String> sourceText = script->type() == Script::TYPE_WASM | 1646 Handle<String> sourceText = script->type() == Script::TYPE_WASM |
1647 ? isolate->factory()->empty_string() | 1647 ? isolate->factory()->empty_string() |
1648 : isolate->factory()->NewSubString( | 1648 : isolate->factory()->NewSubString( |
1649 source, info.line_start, info.line_end); | 1649 source, info.line_start, info.line_end); |
1650 | 1650 |
1651 Handle<JSObject> jsinfo = | 1651 Handle<JSObject> jsinfo = |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 Script::InitLineEnds(script); | 1698 Script::InitLineEnds(script); |
1699 | 1699 |
1700 FixedArray* line_ends_array = FixedArray::cast(script->line_ends()); | 1700 FixedArray* line_ends_array = FixedArray::cast(script->line_ends()); |
1701 const int line_count = line_ends_array->length(); | 1701 const int line_count = line_ends_array->length(); |
1702 | 1702 |
1703 int position; | 1703 int position; |
1704 if (line == 0) { | 1704 if (line == 0) { |
1705 position = offset + column; | 1705 position = offset + column; |
1706 } else { | 1706 } else { |
1707 Script::PositionInfo info; | 1707 Script::PositionInfo info; |
1708 if (!script->GetPositionInfo(offset, &info, Script::NO_OFFSET) || | 1708 if (!Script::GetPositionInfo(script, offset, &info, Script::NO_OFFSET) || |
1709 info.line + line >= line_count) { | 1709 info.line + line >= line_count) { |
1710 return isolate->factory()->null_value(); | 1710 return isolate->factory()->null_value(); |
1711 } | 1711 } |
1712 | 1712 |
1713 const int offset_line = info.line + line; | 1713 const int offset_line = info.line + line; |
1714 const int offset_line_position = | 1714 const int offset_line_position = |
1715 (offset_line == 0) | 1715 (offset_line == 0) |
1716 ? 0 | 1716 ? 0 |
1717 : Smi::cast(line_ends_array->get(offset_line - 1))->value() + 1; | 1717 : Smi::cast(line_ends_array->get(offset_line - 1))->value() + 1; |
1718 position = offset_line_position + column; | 1718 position = offset_line_position + column; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 Handle<Script> script = Handle<Script>(Script::cast(script_val->value())); | 1923 Handle<Script> script = Handle<Script>(Script::cast(script_val->value())); |
1924 | 1924 |
1925 Handle<wasm::WasmDebugInfo> debug_info = | 1925 Handle<wasm::WasmDebugInfo> debug_info = |
1926 wasm::GetDebugInfo(handle(script->wasm_instance(), isolate)); | 1926 wasm::GetDebugInfo(handle(script->wasm_instance(), isolate)); |
1927 return *wasm::WasmDebugInfo::DisassembleFunction( | 1927 return *wasm::WasmDebugInfo::DisassembleFunction( |
1928 debug_info, script->wasm_function_index()); | 1928 debug_info, script->wasm_function_index()); |
1929 } | 1929 } |
1930 | 1930 |
1931 } // namespace internal | 1931 } // namespace internal |
1932 } // namespace v8 | 1932 } // namespace v8 |
OLD | NEW |