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

Side by Side Diff: src/wasm/module-decoder.cc

Issue 2612643002: [wasm] simplify dependencies between graph builder and function decoder (Closed)
Patch Set: 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
« no previous file with comments | « src/wasm/function-body-decoder.cc ('k') | test/cctest/wasm/wasm-run-utils.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 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/module-decoder.h" 5 #include "src/wasm/module-decoder.h"
6 6
7 #include "src/base/functional.h" 7 #include "src/base/functional.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/flags.h" 9 #include "src/flags.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 756 }
757 757
758 // Verifies the body (code) of a given function. 758 // Verifies the body (code) of a given function.
759 void VerifyFunctionBody(uint32_t func_num, ModuleBytesEnv* menv, 759 void VerifyFunctionBody(uint32_t func_num, ModuleBytesEnv* menv,
760 WasmFunction* function) { 760 WasmFunction* function) {
761 if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) { 761 if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) {
762 OFStream os(stdout); 762 OFStream os(stdout);
763 os << "Verifying WASM function " << WasmFunctionName(function, menv) 763 os << "Verifying WASM function " << WasmFunctionName(function, menv)
764 << std::endl; 764 << std::endl;
765 } 765 }
766 FunctionBody body = {menv, function->sig, start_, 766 FunctionBody body = {function->sig, start_,
767 start_ + function->code_start_offset, 767 start_ + function->code_start_offset,
768 start_ + function->code_end_offset}; 768 start_ + function->code_end_offset};
769 DecodeResult result = VerifyWasmCode(module_zone->allocator(), body); 769 DecodeResult result =
770 VerifyWasmCode(module_zone->allocator(),
771 menv == nullptr ? nullptr : menv->module, body);
770 if (result.failed()) { 772 if (result.failed()) {
771 // Wrap the error message from the function decoder. 773 // Wrap the error message from the function decoder.
772 std::ostringstream str; 774 std::ostringstream str;
773 str << "in function " << WasmFunctionName(function, menv) << ": "; 775 str << "in function " << WasmFunctionName(function, menv) << ": ";
774 str << result; 776 str << result;
775 std::string strval = str.str(); 777 std::string strval = str.str();
776 const char* raw = strval.c_str(); 778 const char* raw = strval.c_str();
777 size_t len = strlen(raw); 779 size_t len = strlen(raw);
778 char* buffer = new char[len]; 780 char* buffer = new char[len];
779 strncpy(buffer, raw, len); 781 strncpy(buffer, raw, len);
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 table.push_back(std::move(func_asm_offsets)); 1223 table.push_back(std::move(func_asm_offsets));
1222 } 1224 }
1223 if (decoder.more()) decoder.error("unexpected additional bytes"); 1225 if (decoder.more()) decoder.error("unexpected additional bytes");
1224 1226
1225 return decoder.toResult(std::move(table)); 1227 return decoder.toResult(std::move(table));
1226 } 1228 }
1227 1229
1228 } // namespace wasm 1230 } // namespace wasm
1229 } // namespace internal 1231 } // namespace internal
1230 } // namespace v8 1232 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/function-body-decoder.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698