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

Unified Diff: src/wasm/leb-helper.h

Issue 2627613002: [wasm] Refactor call site patching (Closed)
Patch Set: Fix minor bug on arm64 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/leb-helper.h
diff --git a/src/wasm/leb-helper.h b/src/wasm/leb-helper.h
index 0e4ba3418c3ba87ccc6298b69b3a3e7bc99d0a87..c3a74fdad7d1fba5f030ba4b974bcff7c32e8c83 100644
--- a/src/wasm/leb-helper.h
+++ b/src/wasm/leb-helper.h
@@ -5,6 +5,11 @@
#ifndef V8_WASM_LEB_HELPER_H_
#define V8_WASM_LEB_HELPER_H_
+#include <cstddef> // size_t
+#include <cstdint> // int32_t, ...
+
+#include "src/base/logging.h"
+
namespace v8 {
namespace internal {
namespace wasm {
@@ -125,6 +130,23 @@ class LEBHelper {
}
return size;
}
+
+ static inline uint32_t read_u32v(const uint8_t* src) {
+ return read_u32v(&src);
+ }
+
+ static inline uint32_t read_u32v(const uint8_t** src) {
+ uint32_t result = 0;
+ int shift = 0;
+ uint8_t b;
+ do {
+ b = *((*src)++);
+ DCHECK_GE(28, shift);
+ result = result | (static_cast<uint32_t>(b & 0x7F) << shift);
+ shift += 7;
+ } while ((b & 0x80) != 0);
+ return result;
+ }
};
} // namespace wasm
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698