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

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

Issue 1787733002: [wasm] Fix OpcodeLength() calculation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/ast-decoder.cc » ('j') | src/wasm/ast-decoder.cc » ('J')
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_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 28 matching lines...) Expand all
39 inline ImmI8Operand(Decoder* decoder, const byte* pc) { 39 inline ImmI8Operand(Decoder* decoder, const byte* pc) {
40 value = bit_cast<int8_t>(decoder->checked_read_u8(pc, 1, "immi8")); 40 value = bit_cast<int8_t>(decoder->checked_read_u8(pc, 1, "immi8"));
41 length = 1; 41 length = 1;
42 } 42 }
43 }; 43 };
44 44
45 struct ImmI32Operand { 45 struct ImmI32Operand {
46 int32_t value; 46 int32_t value;
47 int length; 47 int length;
48 inline ImmI32Operand(Decoder* decoder, const byte* pc) { 48 inline ImmI32Operand(Decoder* decoder, const byte* pc) {
49 value = 49 value = decoder->checked_read_i32v(pc, 1, &length, "immi32");
50 bit_cast<int32_t>(decoder->checked_read_i32v(pc, 1, &length, "immi32"));
51 } 50 }
52 }; 51 };
53 52
54 struct ImmI64Operand { 53 struct ImmI64Operand {
55 int64_t value; 54 int64_t value;
56 int length; 55 int length;
57 inline ImmI64Operand(Decoder* decoder, const byte* pc) { 56 inline ImmI64Operand(Decoder* decoder, const byte* pc) {
58 value = 57 value = decoder->checked_read_i64v(pc, 1, &length, "immi64");
59 bit_cast<int64_t>(decoder->checked_read_i64v(pc, 1, &length, "immi64"));
60 } 58 }
61 }; 59 };
62 60
63 struct ImmF32Operand { 61 struct ImmF32Operand {
64 float value; 62 float value;
65 int length; 63 int length;
66 inline ImmF32Operand(Decoder* decoder, const byte* pc) { 64 inline ImmF32Operand(Decoder* decoder, const byte* pc) {
67 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32")); 65 value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32"));
68 length = 4; 66 length = 4;
69 } 67 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 int OpcodeLength(const byte* pc, const byte* end); 225 int OpcodeLength(const byte* pc, const byte* end);
228 226
229 // Computes the arity (number of sub-nodes) of the opcode at the given address. 227 // Computes the arity (number of sub-nodes) of the opcode at the given address.
230 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc, 228 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc,
231 const byte* end); 229 const byte* end);
232 } // namespace wasm 230 } // namespace wasm
233 } // namespace internal 231 } // namespace internal
234 } // namespace v8 232 } // namespace v8
235 233
236 #endif // V8_WASM_AST_DECODER_H_ 234 #endif // V8_WASM_AST_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | src/wasm/ast-decoder.cc » ('j') | src/wasm/ast-decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698