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

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

Issue 2512833003: [wasm] Translate locations to positions properly (Closed)
Patch Set: Address comment 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/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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 uint32_t func_index) { 370 uint32_t func_index) {
371 DCHECK_GT(module()->functions.size(), func_index); 371 DCHECK_GT(module()->functions.size(), func_index);
372 WasmFunction& function = module()->functions[func_index]; 372 WasmFunction& function = module()->functions[func_index];
373 SeqOneByteString* bytes = ptr_to_module_bytes(); 373 SeqOneByteString* bytes = ptr_to_module_bytes();
374 DCHECK_GE(static_cast<size_t>(bytes->length()), function.name_offset); 374 DCHECK_GE(static_cast<size_t>(bytes->length()), function.name_offset);
375 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); 376 function.name_length);
377 return Vector<const uint8_t>(bytes->GetCharsAddress() + function.name_offset, 377 return Vector<const uint8_t>(bytes->GetCharsAddress() + function.name_offset,
378 function.name_length); 378 function.name_length);
379 } 379 }
380
381 int WasmCompiledModule::GetFunctionOffset(uint32_t func_index) const {
382 std::vector<WasmFunction>& functions = module()->functions;
383 if (static_cast<uint32_t>(func_index) >= functions.size()) return -1;
384 DCHECK_GE(static_cast<uint32_t>(kMaxInt),
385 functions[func_index].code_start_offset);
386 return static_cast<int>(functions[func_index].code_start_offset);
387 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698