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

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

Issue 2629883002: [wasm] Add tests for breakpoints (Closed)
Patch Set: Fix bug in wasm-debug.cc Created 3 years, 11 months 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
OLDNEW
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/assembler-inl.h" 5 #include "src/assembler-inl.h"
6 #include "src/assert-scope.h" 6 #include "src/assert-scope.h"
7 #include "src/compiler/wasm-compiler.h" 7 #include "src/compiler/wasm-compiler.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/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 16 matching lines...) Expand all
27 WasmInterpreter interpreter_; 27 WasmInterpreter interpreter_;
28 Isolate *isolate_; 28 Isolate *isolate_;
29 29
30 public: 30 public:
31 // Initialize in the right order, using helper methods to make this possible. 31 // Initialize in the right order, using helper methods to make this possible.
32 // WasmInterpreter has to be allocated in place, since it is not movable. 32 // WasmInterpreter has to be allocated in place, since it is not movable.
33 InterpreterHandle(Isolate *isolate, WasmDebugInfo *debug_info) 33 InterpreterHandle(Isolate *isolate, WasmDebugInfo *debug_info)
34 : instance_(debug_info->wasm_instance()->compiled_module()->module()), 34 : instance_(debug_info->wasm_instance()->compiled_module()->module()),
35 interpreter_(GetBytesEnv(&instance_, debug_info), &allocator_), 35 interpreter_(GetBytesEnv(&instance_, debug_info), &allocator_),
36 isolate_(isolate) { 36 isolate_(isolate) {
37 Handle<JSArrayBuffer> mem_buffer = 37 if (debug_info->wasm_instance()->has_memory_buffer()) {
38 handle(debug_info->wasm_instance()->memory_buffer(), isolate); 38 JSArrayBuffer *mem_buffer = debug_info->wasm_instance()->memory_buffer();
39 if (mem_buffer->IsUndefined(isolate)) { 39 instance_.mem_start =
40 reinterpret_cast<byte *>(mem_buffer->backing_store());
titzer 2017/01/16 13:55:27 byte* instead of byte * (I guess clang-format is
Clemens Hammacher 2017/01/16 18:51:30 Fixed with http://crrev.com/2635003002 and http://
41 CHECK(mem_buffer->byte_length()->ToUint32(&instance_.mem_size));
42 } else {
40 DCHECK_EQ(0, instance_.module->min_mem_pages); 43 DCHECK_EQ(0, instance_.module->min_mem_pages);
41 instance_.mem_start = nullptr; 44 instance_.mem_start = nullptr;
42 instance_.mem_size = 0; 45 instance_.mem_size = 0;
43 } else {
44 instance_.mem_start =
45 reinterpret_cast<byte *>(mem_buffer->backing_store());
46 CHECK(mem_buffer->byte_length()->ToUint32(&instance_.mem_size));
47 } 46 }
48 } 47 }
49 48
50 static ModuleBytesEnv GetBytesEnv(WasmInstance *instance, 49 static ModuleBytesEnv GetBytesEnv(WasmInstance *instance,
51 WasmDebugInfo *debug_info) { 50 WasmDebugInfo *debug_info) {
52 // Return raw pointer into heap. The WasmInterpreter will make its own copy 51 // Return raw pointer into heap. The WasmInterpreter will make its own copy
53 // of this data anyway, and there is no heap allocation in-between. 52 // of this data anyway, and there is no heap allocation in-between.
54 SeqOneByteString *bytes_str = 53 SeqOneByteString *bytes_str =
55 debug_info->wasm_instance()->compiled_module()->module_bytes(); 54 debug_info->wasm_instance()->compiled_module()->module_bytes();
56 Vector<const byte> bytes(bytes_str->GetChars(), bytes_str->length()); 55 Vector<const byte> bytes(bytes_str->GetChars(), bytes_str->length());
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return interp_handle->GetInterpretedStack(frame_pointer); 306 return interp_handle->GetInterpretedStack(frame_pointer);
308 } 307 }
309 308
310 std::unique_ptr<wasm::InterpretedFrame> WasmDebugInfo::GetInterpretedFrame( 309 std::unique_ptr<wasm::InterpretedFrame> WasmDebugInfo::GetInterpretedFrame(
311 Handle<WasmDebugInfo> debug_info, Address frame_pointer, int idx) { 310 Handle<WasmDebugInfo> debug_info, Address frame_pointer, int idx) {
312 InterpreterHandle *interp_handle = 311 InterpreterHandle *interp_handle =
313 GetOrCreateInterpreterHandle(debug_info->GetIsolate(), debug_info); 312 GetOrCreateInterpreterHandle(debug_info->GetIsolate(), debug_info);
314 return std::unique_ptr<wasm::InterpretedFrame>(new wasm::InterpretedFrame( 313 return std::unique_ptr<wasm::InterpretedFrame>(new wasm::InterpretedFrame(
315 interp_handle->GetInterpretedFrame(frame_pointer, idx))); 314 interp_handle->GetInterpretedFrame(frame_pointer, idx)));
316 } 315 }
OLDNEW
« no previous file with comments | « no previous file | test/cctest/wasm/test-wasm-breakpoints.cc » ('j') | test/cctest/wasm/test-wasm-breakpoints.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698