OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/inspector/wasm-translation.h" | 5 #include "src/inspector/wasm-translation.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
10 #include "src/inspector/protocol/Debugger.h" | 10 #include "src/inspector/protocol/Debugger.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 int column) | 29 int column) |
30 : translation(translation), | 30 : translation(translation), |
31 script_id(script_id), | 31 script_id(script_id), |
32 line(line), | 32 line(line), |
33 column(column) {} | 33 column(column) {} |
34 }; | 34 }; |
35 | 35 |
36 virtual void Init(Isolate*, WasmTranslation*, V8DebuggerAgentImpl*) = 0; | 36 virtual void Init(Isolate*, WasmTranslation*, V8DebuggerAgentImpl*) = 0; |
37 virtual void Translate(TransLocation*) = 0; | 37 virtual void Translate(TransLocation*) = 0; |
38 virtual void TranslateBack(TransLocation*) = 0; | 38 virtual void TranslateBack(TransLocation*) = 0; |
39 virtual ~TranslatorImpl() {} | |
39 | 40 |
40 class RawTranslator; | 41 class RawTranslator; |
41 class DisassemblingTranslator; | 42 class DisassemblingTranslator; |
42 }; | 43 }; |
43 | 44 |
44 class WasmTranslation::TranslatorImpl::RawTranslator | 45 class WasmTranslation::TranslatorImpl::RawTranslator |
45 : public WasmTranslation::TranslatorImpl { | 46 : public WasmTranslation::TranslatorImpl { |
46 public: | 47 public: |
47 void Init(Isolate*, WasmTranslation*, V8DebuggerAgentImpl*) {} | 48 void Init(Isolate*, WasmTranslation*, V8DebuggerAgentImpl*) {} |
48 void Translate(TransLocation*) {} | 49 void Translate(TransLocation*) {} |
49 void TranslateBack(TransLocation*) {} | 50 void TranslateBack(TransLocation*) {} |
50 }; | 51 }; |
51 | 52 |
52 class WasmTranslation::TranslatorImpl::DisassemblingTranslator | 53 class WasmTranslation::TranslatorImpl::DisassemblingTranslator |
53 : public WasmTranslation::TranslatorImpl { | 54 : public WasmTranslation::TranslatorImpl { |
54 using OffsetTable = debug::WasmDisassembly::OffsetTable; | 55 using OffsetTable = debug::WasmDisassembly::OffsetTable; |
55 | 56 |
56 public: | 57 public: |
57 DisassemblingTranslator(Isolate* isolate, Local<debug::WasmScript> script) | 58 DisassemblingTranslator(Isolate* isolate, Local<debug::WasmScript> script) |
58 : script_(isolate, script) {} | 59 : script_(isolate, script) {} |
59 | 60 |
60 void Init(Isolate* isolate, WasmTranslation* translation, | 61 void Init(Isolate* isolate, WasmTranslation* translation, |
61 V8DebuggerAgentImpl* agent) override { | 62 V8DebuggerAgentImpl* agent) override { |
62 // Register fake scripts for each function in this wasm module/script. | 63 // Register fake scripts for each function in this wasm module/script. |
63 Handle<debug::WasmScript> script = script_.Get(isolate); | 64 Local<debug::WasmScript> script = script_.Get(isolate); |
dgozman
2017/02/02 17:22:18
How is Handle accessible in this code? Do we inclu
kozy
2017/02/02 17:57:34
I found one suspicious dependency - src/conversion
| |
64 int num_functions = script->NumFunctions(); | 65 int num_functions = script->NumFunctions(); |
65 int num_imported_functions = script->NumImportedFunctions(); | 66 int num_imported_functions = script->NumImportedFunctions(); |
66 DCHECK_LE(0, num_imported_functions); | 67 DCHECK_LE(0, num_imported_functions); |
67 DCHECK_LE(0, num_functions); | 68 DCHECK_LE(0, num_functions); |
68 DCHECK_GE(num_functions, num_imported_functions); | 69 DCHECK_GE(num_functions, num_imported_functions); |
69 String16 script_id = String16::fromInteger(script->Id()); | 70 String16 script_id = String16::fromInteger(script->Id()); |
70 for (int func_idx = num_imported_functions; func_idx < num_functions; | 71 for (int func_idx = num_imported_functions; func_idx < num_functions; |
71 ++func_idx) { | 72 ++func_idx) { |
72 AddFakeScript(isolate, script_id, func_idx, translation, agent); | 73 AddFakeScript(isolate, script_id, func_idx, translation, agent); |
73 } | 74 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 *column_number = trans_loc.column; | 318 *column_number = trans_loc.column; |
318 | 319 |
319 return true; | 320 return true; |
320 } | 321 } |
321 | 322 |
322 void WasmTranslation::AddFakeScript(const String16& scriptId, | 323 void WasmTranslation::AddFakeScript(const String16& scriptId, |
323 TranslatorImpl* translator) { | 324 TranslatorImpl* translator) { |
324 DCHECK_EQ(0, fake_scripts_.count(scriptId)); | 325 DCHECK_EQ(0, fake_scripts_.count(scriptId)); |
325 fake_scripts_.insert(std::make_pair(scriptId, translator)); | 326 fake_scripts_.insert(std::make_pair(scriptId, translator)); |
326 } | 327 } |
OLD | NEW |