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/wasm/wasm-objects.cc

Issue 2509323002: [wasm] Implement frame printing for debug (Closed)
Patch Set: What's wrong about constexpr?? 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
« src/frames.cc ('K') | « src/wasm/wasm-objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-objects.h" 5 #include "src/wasm/wasm-objects.h"
6 #include "src/wasm/wasm-module.h" 6 #include "src/wasm/wasm-module.h"
7 7
8 #define TRACE(...) \ 8 #define TRACE(...) \
9 do { \ 9 do { \
10 if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \ 10 if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 isolate->factory()->NewFixedArray(PropertyIndices::Count, TENURED); 305 isolate->factory()->NewFixedArray(PropertyIndices::Count, TENURED);
306 // WasmCompiledModule::cast would fail since module bytes are not set yet. 306 // WasmCompiledModule::cast would fail since module bytes are not set yet.
307 Handle<WasmCompiledModule> compiled_module( 307 Handle<WasmCompiledModule> compiled_module(
308 reinterpret_cast<WasmCompiledModule*>(*ret), isolate); 308 reinterpret_cast<WasmCompiledModule*>(*ret), isolate);
309 compiled_module->InitId(); 309 compiled_module->InitId();
310 compiled_module->set_module_wrapper(module_wrapper); 310 compiled_module->set_module_wrapper(module_wrapper);
311 return compiled_module; 311 return compiled_module;
312 } 312 }
313 313
314 wasm::WasmModule* WasmCompiledModule::module() const { 314 wasm::WasmModule* WasmCompiledModule::module() const {
315 return reinterpret_cast<WasmModuleWrapper*>(*module_wrapper())->get(); 315 return reinterpret_cast<WasmModuleWrapper*>(ptr_to_module_wrapper())->get();
316 } 316 }
317 317
318 void WasmCompiledModule::InitId() { 318 void WasmCompiledModule::InitId() {
319 #if DEBUG 319 #if DEBUG
320 static uint32_t instance_id_counter = 0; 320 static uint32_t instance_id_counter = 0;
321 set(kID_instance_id, Smi::FromInt(instance_id_counter++)); 321 set(kID_instance_id, Smi::FromInt(instance_id_counter++));
322 TRACE("New compiled module id: %d\n", instance_id()); 322 TRACE("New compiled module id: %d\n", instance_id());
323 #endif 323 #endif
324 } 324 }
325 325
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 #endif 358 #endif
359 } 359 }
360 360
361 uint32_t WasmCompiledModule::mem_size() const { 361 uint32_t WasmCompiledModule::mem_size() const {
362 return has_memory() ? memory()->byte_length()->Number() : default_mem_size(); 362 return has_memory() ? memory()->byte_length()->Number() : default_mem_size();
363 } 363 }
364 364
365 uint32_t WasmCompiledModule::default_mem_size() const { 365 uint32_t WasmCompiledModule::default_mem_size() const {
366 return min_mem_pages() * WasmModule::kPageSize; 366 return min_mem_pages() * WasmModule::kPageSize;
367 } 367 }
368
369 Vector<const uint8_t> WasmCompiledModule::GetRawFunctionName(
370 uint32_t func_index) {
371 DCHECK_GT(module()->functions.size(), func_index);
372 WasmFunction& function = module()->functions[func_index];
373 SeqOneByteString* bytes = ptr_to_module_bytes();
374 DCHECK_GE(static_cast<size_t>(bytes->length()), function.name_offset);
375 DCHECK_GE(static_cast<size_t>(bytes->length() - function.name_offset),
376 function.name_length);
377 return Vector<const uint8_t>(bytes->GetCharsAddress() + function.name_offset,
378 function.name_length);
379 }
OLDNEW
« src/frames.cc ('K') | « src/wasm/wasm-objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698