OLD | NEW |
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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } else { | 201 } else { |
202 TRACE("= %u\n", result); | 202 TRACE("= %u\n", result); |
203 } | 203 } |
204 return result; | 204 return result; |
205 } | 205 } |
206 return traceOffEnd<uint32_t>(); | 206 return traceOffEnd<uint32_t>(); |
207 } | 207 } |
208 | 208 |
209 // Consume {size} bytes and send them to the bit bucket, advancing {pc_}. | 209 // Consume {size} bytes and send them to the bit bucket, advancing {pc_}. |
210 void consume_bytes(int size) { | 210 void consume_bytes(int size) { |
| 211 TRACE(" +%d %-20s: %d bytes\n", static_cast<int>(pc_ - start_), "skip", |
| 212 size); |
211 if (checkAvailable(size)) { | 213 if (checkAvailable(size)) { |
212 pc_ += size; | 214 pc_ += size; |
213 } else { | 215 } else { |
214 pc_ = limit_; | 216 pc_ = limit_; |
215 } | 217 } |
216 } | 218 } |
217 | 219 |
218 // Check that at least {size} bytes exist between {pc_} and {limit_}. | 220 // Check that at least {size} bytes exist between {pc_} and {limit_}. |
219 bool checkAvailable(int size) { | 221 bool checkAvailable(int size) { |
220 intptr_t pc_overflow_value = std::numeric_limits<intptr_t>::max() - size; | 222 intptr_t pc_overflow_value = std::numeric_limits<intptr_t>::max() - size; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 return result; | 373 return result; |
372 } | 374 } |
373 }; | 375 }; |
374 | 376 |
375 #undef TRACE | 377 #undef TRACE |
376 } // namespace wasm | 378 } // namespace wasm |
377 } // namespace internal | 379 } // namespace internal |
378 } // namespace v8 | 380 } // namespace v8 |
379 | 381 |
380 #endif // V8_WASM_DECODER_H_ | 382 #endif // V8_WASM_DECODER_H_ |
OLD | NEW |