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

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

Issue 1637923002: [wasm] Factor out WasmModuleInstance from ModuleEnv. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Finish comment. Created 4 years, 10 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/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-module.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/macro-assembler.h" 5 #include "src/macro-assembler.h"
6 #include "src/objects.h" 6 #include "src/objects.h"
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/wasm/decoder.h" 9 #include "src/wasm/decoder.h"
10 #include "src/wasm/module-decoder.h" 10 #include "src/wasm/module-decoder.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 case kDeclFunctions: { 96 case kDeclFunctions: {
97 // Functions require a signature table first. 97 // Functions require a signature table first.
98 CheckForPreviousSection(sections, kDeclSignatures, true); 98 CheckForPreviousSection(sections, kDeclSignatures, true);
99 int length; 99 int length;
100 uint32_t functions_count = u32v(&length, "functions count"); 100 uint32_t functions_count = u32v(&length, "functions count");
101 module->functions->reserve(SafeReserve(functions_count)); 101 module->functions->reserve(SafeReserve(functions_count));
102 // Set up module environment for verification. 102 // Set up module environment for verification.
103 ModuleEnv menv; 103 ModuleEnv menv;
104 menv.module = module; 104 menv.module = module;
105 menv.globals_area = 0; 105 menv.instance = nullptr;
106 menv.mem_start = 0;
107 menv.mem_end = 0;
108 menv.function_code = nullptr;
109 menv.asm_js = asm_js_; 106 menv.asm_js = asm_js_;
110 // Decode functions. 107 // Decode functions.
111 for (uint32_t i = 0; i < functions_count; i++) { 108 for (uint32_t i = 0; i < functions_count; i++) {
112 if (failed()) break; 109 if (failed()) break;
113 TRACE("DecodeFunction[%d] module+%d\n", i, 110 TRACE("DecodeFunction[%d] module+%d\n", i,
114 static_cast<int>(pc_ - start_)); 111 static_cast<int>(pc_ - start_));
115 112
116 module->functions->push_back( 113 module->functions->push_back(
117 {nullptr, 0, 0, 0, 0, 0, 0, false, false}); 114 {nullptr, 0, 0, 0, 0, 0, 0, false, false});
118 WasmFunction* function = &module->functions->back(); 115 WasmFunction* function = &module->functions->back();
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 if (function_start > function_end) return FunctionError("start > end"); 554 if (function_start > function_end) return FunctionError("start > end");
558 if (size > kMaxFunctionSize) 555 if (size > kMaxFunctionSize)
559 return FunctionError("size > maximum function size"); 556 return FunctionError("size > maximum function size");
560 WasmFunction* function = new WasmFunction(); 557 WasmFunction* function = new WasmFunction();
561 ModuleDecoder decoder(zone, function_start, function_end, false); 558 ModuleDecoder decoder(zone, function_start, function_end, false);
562 return decoder.DecodeSingleFunction(module_env, function); 559 return decoder.DecodeSingleFunction(module_env, function);
563 } 560 }
564 } // namespace wasm 561 } // namespace wasm
565 } // namespace internal 562 } // namespace internal
566 } // namespace v8 563 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698