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

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
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(), menv->module, body);
770 if (result.failed()) { 771 if (result.failed()) {
771 // Wrap the error message from the function decoder. 772 // Wrap the error message from the function decoder.
772 std::ostringstream str; 773 std::ostringstream str;
773 str << "in function " << WasmFunctionName(function, menv) << ": "; 774 str << "in function " << WasmFunctionName(function, menv) << ": ";
774 str << result; 775 str << result;
775 std::string strval = str.str(); 776 std::string strval = str.str();
776 const char* raw = strval.c_str(); 777 const char* raw = strval.c_str();
777 size_t len = strlen(raw); 778 size_t len = strlen(raw);
778 char* buffer = new char[len]; 779 char* buffer = new char[len];
779 strncpy(buffer, raw, len); 780 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)); 1222 table.push_back(std::move(func_asm_offsets));
1222 } 1223 }
1223 if (decoder.more()) decoder.error("unexpected additional bytes"); 1224 if (decoder.more()) decoder.error("unexpected additional bytes");
1224 1225
1225 return decoder.toResult(std::move(table)); 1226 return decoder.toResult(std::move(table));
1226 } 1227 }
1227 1228
1228 } // namespace wasm 1229 } // namespace wasm
1229 } // namespace internal 1230 } // namespace internal
1230 } // namespace v8 1231 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698