Lines Matching refs:pc

60   Decoder(const byte* start, const byte* pc, const byte* end,
62 : start_(start), pc_(pc), end_(end), buffer_offset_(buffer_offset) {
63 DCHECK_LE(start, pc);
64 DCHECK_LE(pc, end);
70 // Ensures there are at least {length} bytes left to read, starting at {pc}.
71 bool validate_size(const byte* pc, uint32_t length, const char* msg) {
72 DCHECK_LE(start_, pc);
73 if (V8_UNLIKELY(pc > end_ || length > static_cast<uint32_t>(end_ - pc))) {
74 error(pc, msg);
82 uint8_t read_u8(const byte* pc, const char* msg = "expected 1 byte") {
83 return read_little_endian<uint8_t, validate>(pc, msg);
88 uint16_t read_u16(const byte* pc, const char* msg = "expected 2 bytes") {
89 return read_little_endian<uint16_t, validate>(pc, msg);
94 uint32_t read_u32(const byte* pc, const char* msg = "expected 4 bytes") {
95 return read_little_endian<uint32_t, validate>(pc, msg);
100 uint64_t read_u64(const byte* pc, const char* msg = "expected 8 bytes") {
101 return read_little_endian<uint64_t, validate>(pc, msg);
106 uint32_t read_u32v(const byte* pc, uint32_t* length,
108 return read_leb<uint32_t, validate, kNoTrace>(pc, length, name);
113 int32_t read_i32v(const byte* pc, uint32_t* length,
115 return read_leb<int32_t, validate, kNoTrace>(pc, length, name);
120 uint64_t read_u64v(const byte* pc, uint32_t* length,
122 return read_leb<uint64_t, validate, kNoTrace>(pc, length, name);
127 int64_t read_i64v(const byte* pc, uint32_t* length,
129 return read_leb<int64_t, validate, kNoTrace>(pc, length, name);
134 int64_t read_i33v(const byte* pc, uint32_t* length,
136 return read_leb<int64_t, validate, kNoTrace, 33>(pc, length, name);
141 WasmOpcode read_prefixed_opcode(const byte* pc) {
143 return read_prefixed_opcode<validate>(pc, &len);
150 WasmOpcode read_prefixed_opcode(const byte* pc, uint32_t* length,
155 index = read_u32v<validate>(pc + 1, length, "prefixed opcode index");
160 errorf(pc, "Invalid prefixed opcode %d", index);
166 return static_cast<WasmOpcode>((*pc) << 8 | index);
252 void V8_NOINLINE error(const uint8_t* pc, const char* msg) {
253 errorf(pc_offset(pc), "%s", msg);
275 errorf(const uint8_t* pc, const char* format, ...) {
278 verrorf(pc_offset(pc), format, args);
328 const byte* pc() const { return pc_; }
333 uint32_t V8_INLINE pc_offset(const uint8_t* pc) const {
334 DCHECK_LE(start_, pc);
335 DCHECK_GE(kMaxUInt32 - buffer_offset_, pc - start_);
336 return static_cast<uint32_t>(pc - start_) + buffer_offset_;
349 // Check if the byte at {offset} from the current pc equals {expected}.
376 IntType read_little_endian(const byte* pc, const char* msg) {
378 DCHECK(validate_size(pc, sizeof(IntType), msg));
379 } else if (!validate_size(pc, sizeof(IntType), msg)) {
382 return base::ReadLittleEndianValue<IntType>(reinterpret_cast<Address>(pc));
402 V8_INLINE IntType read_leb(const byte* pc, uint32_t* length,
408 if ((!validate || V8_LIKELY(pc < end_)) && !(*pc & 0x80)) {
409 TRACE_IF(trace, "%02x ", *pc);
411 IntType result = *pc;
422 return read_leb_slowpath<IntType, validate, trace, size_in_bits>(pc, length,
428 V8_NOINLINE IntType read_leb_slowpath(const byte* pc, uint32_t* length,
431 return read_leb_tail<IntType, validate, trace, size_in_bits, 0>(pc, length,
437 V8_INLINE IntType read_leb_tail(const byte* pc, uint32_t* length,
444 const bool at_end = validate && pc >= end_;
447 DCHECK_LT(pc, end_);
448 b = *pc;
460 next_byte_index>(pc + 1, length, name, result);
466 errorf(pc, "expected %s", name);
491 error(pc, "extra bits in varint");