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

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

Issue 2526783002: [base] Define CHECK comparison for signed vs. unsigned (Closed)
Patch Set: Rebase Created 4 years 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-interpreter.cc ('k') | src/wasm/wasm-module.cc » ('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 <memory> 8 #include <memory>
9 9
10 #include "src/api.h" 10 #include "src/api.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 : module_bytes(start, static_cast<int>(end - start)) { 270 : module_bytes(start, static_cast<int>(end - start)) {
271 DCHECK_GE(kMaxInt, end - start); 271 DCHECK_GE(kMaxInt, end - start);
272 } 272 }
273 273
274 const Vector<const byte> module_bytes; 274 const Vector<const byte> module_bytes;
275 275
276 // Get a string stored in the module bytes representing a name. 276 // Get a string stored in the module bytes representing a name.
277 WasmName GetName(uint32_t offset, uint32_t length) const { 277 WasmName GetName(uint32_t offset, uint32_t length) const {
278 if (length == 0) return {"<?>", 3}; // no name. 278 if (length == 0) return {"<?>", 3}; // no name.
279 CHECK(BoundsCheck(offset, length)); 279 CHECK(BoundsCheck(offset, length));
280 DCHECK_GE(static_cast<int>(length), 0); 280 DCHECK_GE(length, 0);
281 return Vector<const char>::cast( 281 return Vector<const char>::cast(
282 module_bytes.SubVector(offset, offset + length)); 282 module_bytes.SubVector(offset, offset + length));
283 } 283 }
284 284
285 // Get a string stored in the module bytes representing a function name. 285 // Get a string stored in the module bytes representing a function name.
286 WasmName GetName(const WasmFunction* function) const { 286 WasmName GetName(const WasmFunction* function) const {
287 return GetName(function->name_offset, function->name_length); 287 return GetName(function->name_offset, function->name_length);
288 } 288 }
289 289
290 // Get a string stored in the module bytes representing a name. 290 // Get a string stored in the module bytes representing a name.
291 WasmName GetNameOrNull(uint32_t offset, uint32_t length) const { 291 WasmName GetNameOrNull(uint32_t offset, uint32_t length) const {
292 if (offset == 0 && length == 0) return {NULL, 0}; // no name. 292 if (offset == 0 && length == 0) return {NULL, 0}; // no name.
293 CHECK(BoundsCheck(offset, length)); 293 CHECK(BoundsCheck(offset, length));
294 DCHECK_GE(static_cast<int>(length), 0); 294 DCHECK_GE(length, 0);
295 return Vector<const char>::cast( 295 return Vector<const char>::cast(
296 module_bytes.SubVector(offset, offset + length)); 296 module_bytes.SubVector(offset, offset + length));
297 } 297 }
298 298
299 // Get a string stored in the module bytes representing a function name. 299 // Get a string stored in the module bytes representing a function name.
300 WasmName GetNameOrNull(const WasmFunction* function) const { 300 WasmName GetNameOrNull(const WasmFunction* function) const {
301 return GetNameOrNull(function->name_offset, function->name_length); 301 return GetNameOrNull(function->name_offset, function->name_length);
302 } 302 }
303 303
304 // Checks the given offset range is contained within the module bytes. 304 // Checks the given offset range is contained within the module bytes.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); 466 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj);
467 void ValidateOrphanedInstance(Isolate* isolate, 467 void ValidateOrphanedInstance(Isolate* isolate,
468 Handle<WasmInstanceObject> instance); 468 Handle<WasmInstanceObject> instance);
469 469
470 } // namespace testing 470 } // namespace testing
471 } // namespace wasm 471 } // namespace wasm
472 } // namespace internal 472 } // namespace internal
473 } // namespace v8 473 } // namespace v8
474 474
475 #endif // V8_WASM_MODULE_H_ 475 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698