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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 DCHECK(ok); | 165 DCHECK(ok); |
166 return func_index; | 166 return func_index; |
167 } | 167 } |
168 | 168 |
169 const OffsetTable &GetOffsetTable(const TransLocation *loc) { | 169 const OffsetTable &GetOffsetTable(const TransLocation *loc) { |
170 int func_index = loc->line; | 170 int func_index = loc->line; |
171 auto it = offset_tables_.find(func_index); | 171 auto it = offset_tables_.find(func_index); |
172 if (it != offset_tables_.end()) return it->second; | 172 if (it != offset_tables_.end()) return it->second; |
173 | 173 |
174 v8::Isolate *isolate = loc->translation->isolate_; | 174 v8::Isolate *isolate = loc->translation->isolate_; |
175 std::pair<std::string, OffsetTable> disassembly = | 175 DebugInterface::WasmDisassembly disassembly_result = |
176 DebugInterface::DisassembleWasmFunction(isolate, script_.Get(isolate), | 176 DebugInterface::DisassembleWasmFunction(isolate, script_.Get(isolate), |
177 func_index); | 177 func_index); |
178 | 178 |
179 it = offset_tables_ | 179 it = offset_tables_ |
180 .insert(std::make_pair(func_index, std::move(disassembly.second))) | 180 .insert(std::make_pair(func_index, |
| 181 std::move(disassembly_result.offset_table))) |
181 .first; | 182 .first; |
182 | 183 |
183 String16 fake_script_id = GetFakeScriptId(loc); | 184 String16 fake_script_id = GetFakeScriptId(loc); |
184 String16 fake_script_url = GetFakeScriptUrl(loc); | 185 String16 fake_script_url = GetFakeScriptUrl(loc); |
185 String16 source(disassembly.first.data(), disassembly.first.length()); | 186 String16 source(disassembly_result.disassembly.data(), |
| 187 disassembly_result.disassembly.length()); |
186 std::unique_ptr<V8DebuggerScript> fake_script(new V8DebuggerScript( | 188 std::unique_ptr<V8DebuggerScript> fake_script(new V8DebuggerScript( |
187 fake_script_id, std::move(fake_script_url), source)); | 189 fake_script_id, std::move(fake_script_url), source)); |
188 | 190 |
189 loc->translation->AddFakeScript(std::move(fake_script), this, | 191 loc->translation->AddFakeScript(std::move(fake_script), this, |
190 loc->context_group_id); | 192 loc->context_group_id); |
191 | 193 |
192 return it->second; | 194 return it->second; |
193 } | 195 } |
194 | 196 |
195 const OffsetTable *GetReverseTable(int func_index) { | 197 const OffsetTable *GetReverseTable(int func_index) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 int context_group_id) { | 303 int context_group_id) { |
302 bool inserted = | 304 bool inserted = |
303 fake_scripts_.insert(std::make_pair(fake_script->scriptId(), translator)) | 305 fake_scripts_.insert(std::make_pair(fake_script->scriptId(), translator)) |
304 .second; | 306 .second; |
305 DCHECK(inserted); | 307 DCHECK(inserted); |
306 USE(inserted); | 308 USE(inserted); |
307 V8DebuggerAgentImpl *agent = | 309 V8DebuggerAgentImpl *agent = |
308 debugger_->inspector()->enabledDebuggerAgentForGroup(context_group_id); | 310 debugger_->inspector()->enabledDebuggerAgentForGroup(context_group_id); |
309 agent->didParseSource(std::move(fake_script), true); | 311 agent->didParseSource(std::move(fake_script), true); |
310 } | 312 } |
OLD | NEW |