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/wasm/wasm-debug.h" | 5 #include "src/wasm/wasm-debug.h" |
6 | 6 |
7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 isolate->factory()->NewStringFromAsciiChecked(buffer, TENURED); | 155 isolate->factory()->NewStringFromAsciiChecked(buffer, TENURED); |
156 script->set_source_url(*source_url); | 156 script->set_source_url(*source_url); |
157 | 157 |
158 int func_bytes_len = | 158 int func_bytes_len = |
159 GetFunctionOffsetAndLength(debug_info, func_index).second; | 159 GetFunctionOffsetAndLength(debug_info, func_index).second; |
160 Handle<FixedArray> line_ends = isolate->factory()->NewFixedArray(1, TENURED); | 160 Handle<FixedArray> line_ends = isolate->factory()->NewFixedArray(1, TENURED); |
161 line_ends->set(0, Smi::FromInt(func_bytes_len)); | 161 line_ends->set(0, Smi::FromInt(func_bytes_len)); |
162 line_ends->set_map(isolate->heap()->fixed_cow_array_map()); | 162 line_ends->set_map(isolate->heap()->fixed_cow_array_map()); |
163 script->set_line_ends(*line_ends); | 163 script->set_line_ends(*line_ends); |
164 | 164 |
165 isolate->debug()->OnAfterCompile(script); | 165 // TODO(clemensh): Register with the debugger. Note that we cannot call into |
| 166 // JS at this point since this function is called from within stack trace |
| 167 // collection (which means we cannot call Debug::OnAfterCompile in its |
| 168 // current form). See crbug.com/641065. |
| 169 if (false) isolate->debug()->OnAfterCompile(script); |
166 | 170 |
167 return *script; | 171 return *script; |
168 } | 172 } |
169 | 173 |
170 Handle<String> WasmDebugInfo::DisassembleFunction( | 174 Handle<String> WasmDebugInfo::DisassembleFunction( |
171 Handle<WasmDebugInfo> debug_info, int func_index) { | 175 Handle<WasmDebugInfo> debug_info, int func_index) { |
172 std::ostringstream disassembly_os; | 176 std::ostringstream disassembly_os; |
173 | 177 |
174 { | 178 { |
175 Vector<const uint8_t> bytes_vec = GetFunctionBytes(debug_info, func_index); | 179 Vector<const uint8_t> bytes_vec = GetFunctionBytes(debug_info, func_index); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 int idx = 0; | 225 int idx = 0; |
222 for (std::tuple<uint32_t, int, int> elem : offset_table_vec) { | 226 for (std::tuple<uint32_t, int, int> elem : offset_table_vec) { |
223 offset_table->set(idx++, Smi::FromInt(std::get<0>(elem))); | 227 offset_table->set(idx++, Smi::FromInt(std::get<0>(elem))); |
224 offset_table->set(idx++, Smi::FromInt(std::get<1>(elem))); | 228 offset_table->set(idx++, Smi::FromInt(std::get<1>(elem))); |
225 offset_table->set(idx++, Smi::FromInt(std::get<2>(elem))); | 229 offset_table->set(idx++, Smi::FromInt(std::get<2>(elem))); |
226 } | 230 } |
227 DCHECK_EQ(idx, offset_table->length()); | 231 DCHECK_EQ(idx, offset_table->length()); |
228 | 232 |
229 return offset_table; | 233 return offset_table; |
230 } | 234 } |
OLD | NEW |