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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_LEB_HELPER_H_ 5 #ifndef V8_WASM_LEB_HELPER_H_
6 #define V8_WASM_LEB_HELPER_H_ 6 #define V8_WASM_LEB_HELPER_H_
7 7
8 #include <cstddef> // size_t
9 #include <cstdint> // int32_t, ...
10
11 #include "src/base/logging.h"
12
8 namespace v8 { 13 namespace v8 {
9 namespace internal { 14 namespace internal {
10 namespace wasm { 15 namespace wasm {
11 16
12 static const size_t kPaddedVarInt32Size = 5; 17 static const size_t kPaddedVarInt32Size = 5;
13 static const size_t kMaxVarInt32Size = 5; 18 static const size_t kMaxVarInt32Size = 5;
14 19
15 class LEBHelper { 20 class LEBHelper {
16 public: 21 public:
17 // Write a 32-bit unsigned LEB to {dest}, updating {dest} to point after 22 // Write a 32-bit unsigned LEB to {dest}, updating {dest} to point after
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 val >>= 7; 123 val >>= 7;
119 } 124 }
120 } else { 125 } else {
121 while ((val >> 6) != -1) { 126 while ((val >> 6) != -1) {
122 size++; 127 size++;
123 val >>= 7; 128 val >>= 7;
124 } 129 }
125 } 130 }
126 return size; 131 return size;
127 } 132 }
133
134 static inline uint32_t read_u32v(const uint8_t* src) {
135 return read_u32v(&src);
136 }
137
138 static inline uint32_t read_u32v(const uint8_t** src) {
139 uint32_t result = 0;
140 int shift = 0;
141 uint8_t b;
142 do {
143 b = *((*src)++);
144 DCHECK_GE(28, shift);
145 result = result | (static_cast<uint32_t>(b & 0x7F) << shift);
146 shift += 7;
147 } while ((b & 0x80) != 0);
148 return result;
149 }
128 }; 150 };
129 151
130 } // namespace wasm 152 } // namespace wasm
131 } // namespace internal 153 } // namespace internal
132 } // namespace v8 154 } // namespace v8
133 155
134 #endif // V8_WASM_LEB_HELPER_H_ 156 #endif // V8_WASM_LEB_HELPER_H_
OLDNEW
« 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