Chromium Code Reviews| 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_AST_DECODER_H_ | 5 #ifndef V8_WASM_AST_DECODER_H_ |
| 6 #define V8_WASM_AST_DECODER_H_ | 6 #define V8_WASM_AST_DECODER_H_ |
| 7 | 7 |
| 8 #include "src/signature.h" | 8 #include "src/signature.h" |
| 9 #include "src/wasm/decoder.h" | 9 #include "src/wasm/decoder.h" |
| 10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 inline uint32_t read_entry(Decoder* decoder, unsigned i) { | 178 inline uint32_t read_entry(Decoder* decoder, unsigned i) { |
| 179 DCHECK(i <= table_count); | 179 DCHECK(i <= table_count); |
| 180 return table ? decoder->read_u32(table + i * sizeof(uint32_t)) : 0; | 180 return table ? decoder->read_u32(table + i * sizeof(uint32_t)) : 0; |
| 181 } | 181 } |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 struct MemoryAccessOperand { | 184 struct MemoryAccessOperand { |
| 185 uint32_t alignment; | 185 uint32_t alignment; |
| 186 uint32_t offset; | 186 uint32_t offset; |
| 187 unsigned length; | 187 unsigned length; |
| 188 inline MemoryAccessOperand(Decoder* decoder, const byte* pc) { | 188 inline MemoryAccessOperand(Decoder* decoder, const byte* pc, |
| 189 uint32_t max_alignment) { | |
| 189 unsigned alignment_length; | 190 unsigned alignment_length; |
| 190 alignment = | 191 alignment = |
| 191 decoder->checked_read_u32v(pc, 1, &alignment_length, "alignment"); | 192 decoder->checked_read_u32v(pc, 1, &alignment_length, "alignment"); |
| 193 if (max_alignment < alignment) { | |
| 194 decoder->error(pc, | |
|
titzer
2016/09/02 07:46:23
How about printing the expected maximum and the ac
ahaas
2016/09/02 11:35:45
Done.
| |
| 195 "alignment must be less or equal to natural alignment"); | |
| 196 } | |
| 192 unsigned offset_length; | 197 unsigned offset_length; |
| 193 offset = decoder->checked_read_u32v(pc, 1 + alignment_length, | 198 offset = decoder->checked_read_u32v(pc, 1 + alignment_length, |
| 194 &offset_length, "offset"); | 199 &offset_length, "offset"); |
| 195 length = alignment_length + offset_length; | 200 length = alignment_length + offset_length; |
| 196 } | 201 } |
| 197 }; | 202 }; |
| 198 | 203 |
| 199 struct ReturnArityOperand { | 204 struct ReturnArityOperand { |
| 200 uint32_t arity; | 205 uint32_t arity; |
| 201 unsigned length; | 206 unsigned length; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 } | 337 } |
| 333 | 338 |
| 334 bool has_next() { return pc_ < end_; } | 339 bool has_next() { return pc_ < end_; } |
| 335 }; | 340 }; |
| 336 | 341 |
| 337 } // namespace wasm | 342 } // namespace wasm |
| 338 } // namespace internal | 343 } // namespace internal |
| 339 } // namespace v8 | 344 } // namespace v8 |
| 340 | 345 |
| 341 #endif // V8_WASM_AST_DECODER_H_ | 346 #endif // V8_WASM_AST_DECODER_H_ |
| OLD | NEW |