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

Side by Side Diff: src/wasm/wasm-opcodes.h

Issue 1608743006: [wasm] Verify boundaries of data segments when decoding modules. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/wasm-module.cc ('k') | src/wasm/wasm-opcodes.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_OPCODES_H_ 5 #ifndef V8_WASM_OPCODES_H_
6 #define V8_WASM_OPCODES_H_ 6 #define V8_WASM_OPCODES_H_
7 7
8 #include "src/machine-type.h" 8 #include "src/machine-type.h"
9 #include "src/signature.h" 9 #include "src/signature.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Alignment annotations for memory accesses. 59 // Alignment annotations for memory accesses.
60 enum Alignment { kAligned = 0, kUnaligned = 1 }; 60 enum Alignment { kAligned = 0, kUnaligned = 1 };
61 61
62 // Bitfields for the various annotations for memory accesses. 62 // Bitfields for the various annotations for memory accesses.
63 typedef BitField<Alignment, 7, 1> AlignmentField; 63 typedef BitField<Alignment, 7, 1> AlignmentField;
64 typedef BitField<Atomicity, 5, 2> AtomicityField; 64 typedef BitField<Atomicity, 5, 2> AtomicityField;
65 typedef BitField<bool, 4, 1> OffsetField; 65 typedef BitField<bool, 4, 1> OffsetField;
66 }; 66 };
67 67
68 typedef Signature<LocalType> FunctionSig; 68 typedef Signature<LocalType> FunctionSig;
69 std::ostream& operator<<(std::ostream& os, const FunctionSig& function);
69 70
70 // Control expressions and blocks. 71 // Control expressions and blocks.
71 #define FOREACH_CONTROL_OPCODE(V) \ 72 #define FOREACH_CONTROL_OPCODE(V) \
72 V(Nop, 0x00, _) \ 73 V(Nop, 0x00, _) \
73 V(Block, 0x01, _) \ 74 V(Block, 0x01, _) \
74 V(Loop, 0x02, _) \ 75 V(Loop, 0x02, _) \
75 V(If, 0x03, _) \ 76 V(If, 0x03, _) \
76 V(IfElse, 0x04, _) \ 77 V(IfElse, 0x04, _) \
77 V(Select, 0x05, _) \ 78 V(Select, 0x05, _) \
78 V(Br, 0x06, _) \ 79 V(Br, 0x06, _) \
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } else if (type == MachineType::Float32()) { 392 } else if (type == MachineType::Float32()) {
392 return kAstF32; 393 return kAstF32;
393 } else if (type == MachineType::Float64()) { 394 } else if (type == MachineType::Float64()) {
394 return kAstF64; 395 return kAstF64;
395 } else { 396 } else {
396 UNREACHABLE(); 397 UNREACHABLE();
397 return kAstI32; 398 return kAstI32;
398 } 399 }
399 } 400 }
400 401
401 // TODO(titzer): remove this method
402 static WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { 402 static WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
403 if (type == MachineType::Int8()) { 403 if (type == MachineType::Int8()) {
404 return store ? kExprI32StoreMem8 : kExprI32LoadMem8S; 404 return store ? kExprI32StoreMem8 : kExprI32LoadMem8S;
405 } else if (type == MachineType::Uint8()) { 405 } else if (type == MachineType::Uint8()) {
406 return store ? kExprI32StoreMem8 : kExprI32LoadMem8U; 406 return store ? kExprI32StoreMem8 : kExprI32LoadMem8U;
407 } else if (type == MachineType::Int16()) { 407 } else if (type == MachineType::Int16()) {
408 return store ? kExprI32StoreMem16 : kExprI32LoadMem16S; 408 return store ? kExprI32StoreMem16 : kExprI32LoadMem16S;
409 } else if (type == MachineType::Uint16()) { 409 } else if (type == MachineType::Uint16()) {
410 return store ? kExprI32StoreMem16 : kExprI32LoadMem16U; 410 return store ? kExprI32StoreMem16 : kExprI32LoadMem16U;
411 } else if (type == MachineType::Int32()) { 411 } else if (type == MachineType::Int32()) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 default: 467 default:
468 return "<unknown>"; 468 return "<unknown>";
469 } 469 }
470 } 470 }
471 }; 471 };
472 } // namespace wasm 472 } // namespace wasm
473 } // namespace internal 473 } // namespace internal
474 } // namespace v8 474 } // namespace v8
475 475
476 #endif // V8_WASM_OPCODES_H_ 476 #endif // V8_WASM_OPCODES_H_
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | src/wasm/wasm-opcodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698