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

Side by Side Diff: src/wasm/decoder.h

Issue 2093823003: [wasm] Deleting unused parameter from function "consume_u32v" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « src/wasm/ast-decoder.cc ('k') | src/wasm/module-decoder.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_DECODER_H_ 5 #ifndef V8_WASM_DECODER_H_
6 #define V8_WASM_DECODER_H_ 6 #define V8_WASM_DECODER_H_
7 7
8 #include "src/base/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/base/smart-pointers.h" 9 #include "src/base/smart-pointers.h"
10 #include "src/flags.h" 10 #include "src/flags.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (checkAvailable(4)) { 197 if (checkAvailable(4)) {
198 uint32_t val = read_u32(pc_); 198 uint32_t val = read_u32(pc_);
199 TRACE("%02x %02x %02x %02x = %u\n", pc_[0], pc_[1], pc_[2], pc_[3], val); 199 TRACE("%02x %02x %02x %02x = %u\n", pc_[0], pc_[1], pc_[2], pc_[3], val);
200 pc_ += 4; 200 pc_ += 4;
201 return val; 201 return val;
202 } 202 }
203 return traceOffEnd<uint32_t>(); 203 return traceOffEnd<uint32_t>();
204 } 204 }
205 205
206 // Reads a LEB128 variable-length 32-bit integer and advances {pc_}. 206 // Reads a LEB128 variable-length 32-bit integer and advances {pc_}.
207 uint32_t consume_u32v(int* length, const char* name = nullptr) { 207 uint32_t consume_u32v(const char* name = nullptr) {
208 TRACE(" +%d %-20s: ", static_cast<int>(pc_ - start_), 208 TRACE(" +%d %-20s: ", static_cast<int>(pc_ - start_),
209 name ? name : "varint"); 209 name ? name : "varint");
210
211 if (checkAvailable(1)) { 210 if (checkAvailable(1)) {
212 const byte* pos = pc_; 211 const byte* pos = pc_;
213 const byte* end = pc_ + 5; 212 const byte* end = pc_ + 5;
214 if (end > limit_) end = limit_; 213 if (end > limit_) end = limit_;
215 214
216 uint32_t result = 0; 215 uint32_t result = 0;
217 int shift = 0; 216 int shift = 0;
218 byte b = 0; 217 byte b = 0;
219 while (pc_ < end) { 218 while (pc_ < end) {
220 b = *pc_++; 219 b = *pc_++;
221 TRACE("%02x ", b); 220 TRACE("%02x ", b);
222 result = result | ((b & 0x7F) << shift); 221 result = result | ((b & 0x7F) << shift);
223 if ((b & 0x80) == 0) break; 222 if ((b & 0x80) == 0) break;
224 shift += 7; 223 shift += 7;
225 } 224 }
226 225
227 *length = static_cast<int>(pc_ - pos); 226 int length = static_cast<int>(pc_ - pos);
228 if (pc_ == end && (b & 0x80)) { 227 if (pc_ == end && (b & 0x80)) {
229 error(pc_ - 1, "varint too large"); 228 error(pc_ - 1, "varint too large");
230 } else if (*length == 0) { 229 } else if (length == 0) {
231 error(pc_, "varint of length 0"); 230 error(pc_, "varint of length 0");
232 } else { 231 } else {
233 TRACE("= %u\n", result); 232 TRACE("= %u\n", result);
234 } 233 }
235 return result; 234 return result;
236 } 235 }
237 return traceOffEnd<uint32_t>(); 236 return traceOffEnd<uint32_t>();
238 } 237 }
239 238
240 // Consume {size} bytes and send them to the bit bucket, advancing {pc_}. 239 // Consume {size} bytes and send them to the bit bucket, advancing {pc_}.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 return result; 401 return result;
403 } 402 }
404 }; 403 };
405 404
406 #undef TRACE 405 #undef TRACE
407 } // namespace wasm 406 } // namespace wasm
408 } // namespace internal 407 } // namespace internal
409 } // namespace v8 408 } // namespace v8
410 409
411 #endif // V8_WASM_DECODER_H_ 410 #endif // V8_WASM_DECODER_H_
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698