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

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

Issue 1709653002: [wasm] Add support for import section. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: delete the import_code vector Created 4 years, 10 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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::ostream& operator<<(std::ostream& os, const FunctionSig& function);
70 70
71 // TODO(titzer): Renumber all the opcodes to fill in holes.
72
71 // Control expressions and blocks. 73 // Control expressions and blocks.
72 #define FOREACH_CONTROL_OPCODE(V) \ 74 #define FOREACH_CONTROL_OPCODE(V) \
73 V(Nop, 0x00, _) \ 75 V(Nop, 0x00, _) \
74 V(Block, 0x01, _) \ 76 V(Block, 0x01, _) \
75 V(Loop, 0x02, _) \ 77 V(Loop, 0x02, _) \
76 V(If, 0x03, _) \ 78 V(If, 0x03, _) \
77 V(IfElse, 0x04, _) \ 79 V(IfElse, 0x04, _) \
78 V(Select, 0x05, _) \ 80 V(Select, 0x05, _) \
79 V(Br, 0x06, _) \ 81 V(Br, 0x06, _) \
80 V(BrIf, 0x07, _) \ 82 V(BrIf, 0x07, _) \
81 V(TableSwitch, 0x08, _) \ 83 V(TableSwitch, 0x08, _) \
82 V(Return, 0x14, _) \ 84 V(Return, 0x14, _) \
83 V(Unreachable, 0x15, _) 85 V(Unreachable, 0x15, _)
84 // TODO(titzer): numbering
85 86
86 // Constants, locals, globals, and calls. 87 // Constants, locals, globals, and calls.
87 #define FOREACH_MISC_OPCODE(V) \ 88 #define FOREACH_MISC_OPCODE(V) \
88 V(I8Const, 0x09, _) \ 89 V(I8Const, 0x09, _) \
89 V(I32Const, 0x0a, _) \ 90 V(I32Const, 0x0a, _) \
90 V(I64Const, 0x0b, _) \ 91 V(I64Const, 0x0b, _) \
91 V(F64Const, 0x0c, _) \ 92 V(F64Const, 0x0c, _) \
92 V(F32Const, 0x0d, _) \ 93 V(F32Const, 0x0d, _) \
93 V(GetLocal, 0x0e, _) \ 94 V(GetLocal, 0x0e, _) \
94 V(SetLocal, 0x0f, _) \ 95 V(SetLocal, 0x0f, _) \
95 V(LoadGlobal, 0x10, _) \ 96 V(LoadGlobal, 0x10, _) \
96 V(StoreGlobal, 0x11, _) \ 97 V(StoreGlobal, 0x11, _) \
97 V(CallFunction, 0x12, _) \ 98 V(CallFunction, 0x12, _) \
98 V(CallIndirect, 0x13, _) 99 V(CallIndirect, 0x13, _) \
100 V(CallImport, 0x1F, _)
99 101
100 // Load memory expressions. 102 // Load memory expressions.
101 #define FOREACH_LOAD_MEM_OPCODE(V) \ 103 #define FOREACH_LOAD_MEM_OPCODE(V) \
102 V(I32LoadMem8S, 0x20, i_i) \ 104 V(I32LoadMem8S, 0x20, i_i) \
103 V(I32LoadMem8U, 0x21, i_i) \ 105 V(I32LoadMem8U, 0x21, i_i) \
104 V(I32LoadMem16S, 0x22, i_i) \ 106 V(I32LoadMem16S, 0x22, i_i) \
105 V(I32LoadMem16U, 0x23, i_i) \ 107 V(I32LoadMem16U, 0x23, i_i) \
106 V(I64LoadMem8S, 0x24, l_i) \ 108 V(I64LoadMem8S, 0x24, l_i) \
107 V(I64LoadMem8U, 0x25, l_i) \ 109 V(I64LoadMem8U, 0x25, l_i) \
108 V(I64LoadMem16S, 0x26, l_i) \ 110 V(I64LoadMem16S, 0x26, l_i) \
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 default: 469 default:
468 return "<unknown>"; 470 return "<unknown>";
469 } 471 }
470 } 472 }
471 }; 473 };
472 } // namespace wasm 474 } // namespace wasm
473 } // namespace internal 475 } // namespace internal
474 } // namespace v8 476 } // namespace v8
475 477
476 #endif // V8_WASM_OPCODES_H_ 478 #endif // V8_WASM_OPCODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698