| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 544 |
| 545 if (it.is_wasm()) { | 545 if (it.is_wasm()) { |
| 546 // Create the details array (no dynamic information for wasm). | 546 // Create the details array (no dynamic information for wasm). |
| 547 Handle<FixedArray> details = | 547 Handle<FixedArray> details = |
| 548 isolate->factory()->NewFixedArray(kFrameDetailsFirstDynamicIndex); | 548 isolate->factory()->NewFixedArray(kFrameDetailsFirstDynamicIndex); |
| 549 | 549 |
| 550 // Add the frame id. | 550 // Add the frame id. |
| 551 details->set(kFrameDetailsFrameIdIndex, *frame_id); | 551 details->set(kFrameDetailsFrameIdIndex, *frame_id); |
| 552 | 552 |
| 553 // Add the function name. | 553 // Add the function name. |
| 554 Handle<Object> wasm_instance(it.wasm_frame()->wasm_instance(), isolate); | 554 Handle<Object> wasm_instance_or_undef(it.wasm_frame()->wasm_instance(), |
| 555 isolate); |
| 555 int func_index = it.wasm_frame()->function_index(); | 556 int func_index = it.wasm_frame()->function_index(); |
| 556 Handle<String> func_name = | 557 Handle<String> func_name = |
| 557 wasm::GetWasmFunctionName(isolate, wasm_instance, func_index); | 558 wasm::GetWasmFunctionName(isolate, wasm_instance_or_undef, func_index); |
| 558 details->set(kFrameDetailsFunctionIndex, *func_name); | 559 details->set(kFrameDetailsFunctionIndex, *func_name); |
| 559 | 560 |
| 560 // Add the script wrapper | 561 // Add the script wrapper |
| 561 Handle<Object> script_wrapper = | 562 Handle<Object> script_wrapper = |
| 562 Script::GetWrapper(frame_inspector.GetScript()); | 563 Script::GetWrapper(frame_inspector.GetScript()); |
| 563 details->set(kFrameDetailsScriptIndex, *script_wrapper); | 564 details->set(kFrameDetailsScriptIndex, *script_wrapper); |
| 564 | 565 |
| 565 // Add the arguments count. | 566 // Add the arguments count. |
| 566 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero); | 567 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero); |
| 567 | 568 |
| 568 // Add the locals count | 569 // Add the locals count |
| 569 details->set(kFrameDetailsLocalCountIndex, Smi::kZero); | 570 details->set(kFrameDetailsLocalCountIndex, Smi::kZero); |
| 570 | 571 |
| 571 // Add the source position. | 572 // Add the source position. |
| 572 // For wasm, it is function-local, so translate it to a module-relative | 573 // For wasm, it is function-local, so translate it to a module-relative |
| 573 // position, such that together with the script it uniquely identifies the | 574 // position, such that together with the script it uniquely identifies the |
| 574 // position. | 575 // position. |
| 575 Handle<Object> positionValue; | 576 Handle<Object> positionValue; |
| 576 if (position != kNoSourcePosition) { | 577 if (position != kNoSourcePosition && |
| 578 !wasm_instance_or_undef->IsUndefined(isolate)) { |
| 577 int translated_position = position; | 579 int translated_position = position; |
| 578 if (!wasm::WasmIsAsmJs(*wasm_instance, isolate)) { | 580 if (!wasm::WasmIsAsmJs(*wasm_instance_or_undef, isolate)) { |
| 579 Handle<WasmCompiledModule> compiled_module( | 581 Handle<WasmCompiledModule> compiled_module( |
| 580 wasm::GetCompiledModule(JSObject::cast(*wasm_instance)), isolate); | 582 WasmInstanceObject::cast(*wasm_instance_or_undef) |
| 583 ->get_compiled_module(), |
| 584 isolate); |
| 581 translated_position += | 585 translated_position += |
| 582 wasm::GetFunctionCodeOffset(compiled_module, func_index); | 586 wasm::GetFunctionCodeOffset(compiled_module, func_index); |
| 583 } | 587 } |
| 584 details->set(kFrameDetailsSourcePositionIndex, | 588 details->set(kFrameDetailsSourcePositionIndex, |
| 585 Smi::FromInt(translated_position)); | 589 Smi::FromInt(translated_position)); |
| 586 } | 590 } |
| 587 | 591 |
| 588 // Add the constructor information. | 592 // Add the constructor information. |
| 589 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false)); | 593 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false)); |
| 590 | 594 |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 } | 1908 } |
| 1905 | 1909 |
| 1906 | 1910 |
| 1907 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1911 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 1908 UNIMPLEMENTED(); | 1912 UNIMPLEMENTED(); |
| 1909 return NULL; | 1913 return NULL; |
| 1910 } | 1914 } |
| 1911 | 1915 |
| 1912 } // namespace internal | 1916 } // namespace internal |
| 1913 } // namespace v8 | 1917 } // namespace v8 |
| OLD | NEW |