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

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

Issue 2526783002: [base] Define CHECK comparison for signed vs. unsigned (Closed)
Patch Set: Rebase & refactor for windows 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
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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 WasmModule() : WasmModule(nullptr, nullptr) {} 223 WasmModule() : WasmModule(nullptr, nullptr) {}
224 WasmModule(Zone* owned_zone, const byte* module_start); 224 WasmModule(Zone* owned_zone, const byte* module_start);
225 ~WasmModule() { 225 ~WasmModule() {
226 if (owned_zone) delete owned_zone; 226 if (owned_zone) delete owned_zone;
227 } 227 }
228 228
229 // Get a string stored in the module bytes representing a name. 229 // Get a string stored in the module bytes representing a name.
230 WasmName GetName(uint32_t offset, uint32_t length) const { 230 WasmName GetName(uint32_t offset, uint32_t length) const {
231 if (length == 0) return {"<?>", 3}; // no name. 231 if (length == 0) return {"<?>", 3}; // no name.
232 CHECK(BoundsCheck(offset, offset + length)); 232 CHECK(BoundsCheck(offset, offset + length));
233 DCHECK_GE(static_cast<int>(length), 0); 233 DCHECK_GE(length, 0);
234 return {reinterpret_cast<const char*>(module_start + offset), 234 return {reinterpret_cast<const char*>(module_start + offset),
235 static_cast<int>(length)}; 235 static_cast<int>(length)};
236 } 236 }
237 237
238 // Get a string stored in the module bytes representing a function name. 238 // Get a string stored in the module bytes representing a function name.
239 WasmName GetName(WasmFunction* function) const { 239 WasmName GetName(WasmFunction* function) const {
240 return GetName(function->name_offset, function->name_length); 240 return GetName(function->name_offset, function->name_length);
241 } 241 }
242 242
243 // Get a string stored in the module bytes representing a name. 243 // Get a string stored in the module bytes representing a name.
244 WasmName GetNameOrNull(uint32_t offset, uint32_t length) const { 244 WasmName GetNameOrNull(uint32_t offset, uint32_t length) const {
245 if (offset == 0 && length == 0) return {NULL, 0}; // no name. 245 if (offset == 0 && length == 0) return {NULL, 0}; // no name.
246 CHECK(BoundsCheck(offset, offset + length)); 246 CHECK(BoundsCheck(offset, offset + length));
247 DCHECK_GE(static_cast<int>(length), 0); 247 DCHECK_GE(length, 0);
248 return {reinterpret_cast<const char*>(module_start + offset), 248 return {reinterpret_cast<const char*>(module_start + offset),
249 static_cast<int>(length)}; 249 static_cast<int>(length)};
250 } 250 }
251 251
252 // Get a string stored in the module bytes representing a function name. 252 // Get a string stored in the module bytes representing a function name.
253 WasmName GetNameOrNull(const WasmFunction* function) const { 253 WasmName GetNameOrNull(const WasmFunction* function) const {
254 return GetNameOrNull(function->name_offset, function->name_length); 254 return GetNameOrNull(function->name_offset, function->name_length);
255 } 255 }
256 256
257 // Checks the given offset range is contained within the module bytes. 257 // Checks the given offset range is contained within the module bytes.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); 441 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj);
442 void ValidateOrphanedInstance(Isolate* isolate, 442 void ValidateOrphanedInstance(Isolate* isolate,
443 Handle<WasmInstanceObject> instance); 443 Handle<WasmInstanceObject> instance);
444 444
445 } // namespace testing 445 } // namespace testing
446 } // namespace wasm 446 } // namespace wasm
447 } // namespace internal 447 } // namespace internal
448 } // namespace v8 448 } // namespace v8
449 449
450 #endif // V8_WASM_MODULE_H_ 450 #endif // V8_WASM_MODULE_H_
OLDNEW
« src/base/logging.h ('K') | « 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