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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 if (it.is_wasm()) { | 520 if (it.is_wasm()) { |
521 // Create the details array (no dynamic information for wasm). | 521 // Create the details array (no dynamic information for wasm). |
522 Handle<FixedArray> details = | 522 Handle<FixedArray> details = |
523 isolate->factory()->NewFixedArray(kFrameDetailsFirstDynamicIndex); | 523 isolate->factory()->NewFixedArray(kFrameDetailsFirstDynamicIndex); |
524 | 524 |
525 // Add the frame id. | 525 // Add the frame id. |
526 details->set(kFrameDetailsFrameIdIndex, *frame_id); | 526 details->set(kFrameDetailsFrameIdIndex, *frame_id); |
527 | 527 |
528 // Add the function name. | 528 // Add the function name. |
529 Handle<Object> wasm_instance_or_undef(it.wasm_frame()->wasm_instance(), | 529 Handle<WasmCompiledModule> compiled_module( |
530 isolate); | 530 it.wasm_frame()->wasm_instance()->get_compiled_module(), isolate); |
531 int func_index = it.wasm_frame()->function_index(); | 531 int func_index = it.wasm_frame()->function_index(); |
532 Handle<String> func_name = | 532 Handle<String> func_name = WasmCompiledModule::GetFunctionName( |
533 wasm::GetWasmFunctionName(isolate, wasm_instance_or_undef, func_index); | 533 isolate, compiled_module, func_index); |
534 details->set(kFrameDetailsFunctionIndex, *func_name); | 534 details->set(kFrameDetailsFunctionIndex, *func_name); |
535 | 535 |
536 // Add the script wrapper | 536 // Add the script wrapper |
537 Handle<Object> script_wrapper = | 537 Handle<Object> script_wrapper = |
538 Script::GetWrapper(frame_inspector.GetScript()); | 538 Script::GetWrapper(frame_inspector.GetScript()); |
539 details->set(kFrameDetailsScriptIndex, *script_wrapper); | 539 details->set(kFrameDetailsScriptIndex, *script_wrapper); |
540 | 540 |
541 // Add the arguments count. | 541 // Add the arguments count. |
542 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero); | 542 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero); |
543 | 543 |
544 // Add the locals count | 544 // Add the locals count |
545 details->set(kFrameDetailsLocalCountIndex, Smi::kZero); | 545 details->set(kFrameDetailsLocalCountIndex, Smi::kZero); |
546 | 546 |
547 // Add the source position. | 547 // Add the source position. |
548 // For wasm, it is function-local, so translate it to a module-relative | 548 // For wasm, it is function-local, so translate it to a module-relative |
549 // position, such that together with the script it uniquely identifies the | 549 // position, such that together with the script it uniquely identifies the |
550 // position. | 550 // position. |
551 Handle<Object> positionValue; | 551 Handle<Object> positionValue; |
552 if (position != kNoSourcePosition && | 552 if (position != kNoSourcePosition) { |
553 !wasm_instance_or_undef->IsUndefined(isolate)) { | |
554 int translated_position = position; | 553 int translated_position = position; |
555 if (!wasm::WasmIsAsmJs(*wasm_instance_or_undef, isolate)) { | 554 // No further translation needed for asm.js modules. |
556 Handle<WasmCompiledModule> compiled_module( | 555 if (!compiled_module->is_asm_js()) { |
557 WasmInstanceObject::cast(*wasm_instance_or_undef) | |
558 ->get_compiled_module(), | |
559 isolate); | |
560 translated_position += | 556 translated_position += |
561 wasm::GetFunctionCodeOffset(compiled_module, func_index); | 557 wasm::GetFunctionCodeOffset(compiled_module, func_index); |
562 } | 558 } |
563 details->set(kFrameDetailsSourcePositionIndex, | 559 details->set(kFrameDetailsSourcePositionIndex, |
564 Smi::FromInt(translated_position)); | 560 Smi::FromInt(translated_position)); |
565 } | 561 } |
566 | 562 |
567 // Add the constructor information. | 563 // Add the constructor information. |
568 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false)); | 564 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false)); |
569 | 565 |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 } | 1919 } |
1924 | 1920 |
1925 | 1921 |
1926 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1922 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
1927 UNIMPLEMENTED(); | 1923 UNIMPLEMENTED(); |
1928 return NULL; | 1924 return NULL; |
1929 } | 1925 } |
1930 | 1926 |
1931 } // namespace internal | 1927 } // namespace internal |
1932 } // namespace v8 | 1928 } // namespace v8 |
OLD | NEW |