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

Side by Side Diff: src/wasm/wasm-module.h

Issue 1916403002: [wasm] Add tests for function name encoding (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-3
Patch Set: address titzer's comments Created 4 years, 7 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 | « no previous file | test/cctest/cctest.gyp » ('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 #ifndef V8_WASM_MODULE_H_ 5 #ifndef V8_WASM_MODULE_H_
6 #define V8_WASM_MODULE_H_ 6 #define V8_WASM_MODULE_H_
7 7
8 #include "src/wasm/wasm-opcodes.h" 8 #include "src/wasm/wasm-opcodes.h"
9 #include "src/wasm/wasm-result.h" 9 #include "src/wasm/wasm-result.h"
10 10
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 214
215 // Get a string stored in the module bytes representing a function name. 215 // Get a string stored in the module bytes representing a function name.
216 WasmName GetNameOrNull(WasmFunction* function) const { 216 WasmName GetNameOrNull(WasmFunction* function) const {
217 return GetNameOrNull(function->name_offset, function->name_length); 217 return GetNameOrNull(function->name_offset, function->name_length);
218 } 218 }
219 219
220 // Checks the given offset range is contained within the module bytes. 220 // Checks the given offset range is contained within the module bytes.
221 bool BoundsCheck(uint32_t start, uint32_t end) const { 221 bool BoundsCheck(uint32_t start, uint32_t end) const {
222 size_t size = module_end - module_start; 222 size_t size = module_end - module_start;
223 return start < size && end < size; 223 return start <= size && end <= size;
224 } 224 }
225 225
226 // Creates a new instantiation of the module in the given isolate. 226 // Creates a new instantiation of the module in the given isolate.
227 MaybeHandle<JSObject> Instantiate(Isolate* isolate, Handle<JSObject> ffi, 227 MaybeHandle<JSObject> Instantiate(Isolate* isolate, Handle<JSObject> ffi,
228 Handle<JSArrayBuffer> memory); 228 Handle<JSArrayBuffer> memory);
229 }; 229 };
230 230
231 // An instantiated WASM module, including memory, function table, etc. 231 // An instantiated WASM module, including memory, function table, etc.
232 struct WasmModuleInstance { 232 struct WasmModuleInstance {
233 WasmModule* module; // static representation of the module. 233 WasmModule* module; // static representation of the module.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Extract a function name from the given wasm object. 337 // Extract a function name from the given wasm object.
338 // Returns undefined if the function is unnamed or the function index is 338 // Returns undefined if the function is unnamed or the function index is
339 // invalid. 339 // invalid.
340 Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index); 340 Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index);
341 341
342 } // namespace wasm 342 } // namespace wasm
343 } // namespace internal 343 } // namespace internal
344 } // namespace v8 344 } // namespace v8
345 345
346 #endif // V8_WASM_MODULE_H_ 346 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698