Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 2493823003: [wasm] Allocate a single script per wasm module (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/wasm/module-decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 Script::GetWrapper(frame_inspector.GetScript()); 562 Script::GetWrapper(frame_inspector.GetScript());
563 details->set(kFrameDetailsScriptIndex, *script_wrapper); 563 details->set(kFrameDetailsScriptIndex, *script_wrapper);
564 564
565 // Add the arguments count. 565 // Add the arguments count.
566 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero); 566 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero);
567 567
568 // Add the locals count 568 // Add the locals count
569 details->set(kFrameDetailsLocalCountIndex, Smi::kZero); 569 details->set(kFrameDetailsLocalCountIndex, Smi::kZero);
570 570
571 // Add the source position. 571 // Add the source position.
572 // 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.
575 Handle<Object> positionValue;
572 if (position != kNoSourcePosition) { 576 if (position != kNoSourcePosition) {
573 details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position)); 577 int translated_position = position;
578 if (!wasm::WasmIsAsmJs(*wasm_instance, isolate)) {
579 Handle<WasmCompiledModule> compiled_module(
580 wasm::GetCompiledModule(JSObject::cast(*wasm_instance)), isolate);
581 translated_position +=
582 wasm::GetFunctionCodeOffset(compiled_module, func_index);
583 }
584 details->set(kFrameDetailsSourcePositionIndex,
585 Smi::FromInt(translated_position));
574 } 586 }
575 587
576 // Add the constructor information. 588 // Add the constructor information.
577 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false)); 589 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false));
578 590
579 // Add the at return information. 591 // Add the at return information.
580 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(false)); 592 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(false));
581 593
582 // Add flags to indicate information on whether this frame is 594 // Add flags to indicate information on whether this frame is
583 // bit 0: invoked in the debugger context. 595 // bit 0: invoked in the debugger context.
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 SealHandleScope shs(isolate); 1902 SealHandleScope shs(isolate);
1891 return Smi::FromInt(isolate->debug()->is_active()); 1903 return Smi::FromInt(isolate->debug()->is_active());
1892 } 1904 }
1893 1905
1894 1906
1895 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1907 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1896 UNIMPLEMENTED(); 1908 UNIMPLEMENTED();
1897 return NULL; 1909 return NULL;
1898 } 1910 }
1899 1911
1900 // TODO(5530): Remove once uses in debug.js are gone.
1901 RUNTIME_FUNCTION(Runtime_GetWasmFunctionOffsetTable) {
1902 DCHECK(args.length() == 1);
1903 HandleScope scope(isolate);
1904 CONVERT_ARG_CHECKED(JSValue, script_val, 0);
1905
1906 CHECK(script_val->value()->IsScript());
1907 Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
1908
1909 Handle<WasmDebugInfo> debug_info =
1910 wasm::GetDebugInfo(handle(script->wasm_instance(), isolate));
1911 Handle<FixedArray> elements = WasmDebugInfo::GetFunctionOffsetTable(
1912 debug_info, script->wasm_function_index());
1913 return *isolate->factory()->NewJSArrayWithElements(elements);
1914 }
1915
1916 // TODO(5530): Remove once uses in debug.js are gone.
1917 RUNTIME_FUNCTION(Runtime_DisassembleWasmFunction) {
1918 DCHECK(args.length() == 1);
1919 HandleScope scope(isolate);
1920 CONVERT_ARG_CHECKED(JSValue, script_val, 0);
1921
1922 CHECK(script_val->value()->IsScript());
1923 Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
1924
1925 Handle<WasmDebugInfo> debug_info =
1926 wasm::GetDebugInfo(handle(script->wasm_instance(), isolate));
1927 return *WasmDebugInfo::DisassembleFunction(debug_info,
1928 script->wasm_function_index());
1929 }
1930
1931 } // namespace internal 1912 } // namespace internal
1932 } // namespace v8 1913 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/wasm/module-decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698