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

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

Issue 2009553002: Add Wasm SIMD opcodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix shuffle/swizzle signatures Created 4 years, 6 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/module-decoder.cc ('k') | no next file » | 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
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace wasm { 13 namespace wasm {
14 14
15 // Binary encoding of local types. 15 // Binary encoding of local types.
16 enum LocalTypeCode { 16 enum LocalTypeCode {
17 kLocalVoid = 0, 17 kLocalVoid = 0,
18 kLocalI32 = 1, 18 kLocalI32 = 1,
19 kLocalI64 = 2, 19 kLocalI64 = 2,
20 kLocalF32 = 3, 20 kLocalF32 = 3,
21 kLocalF64 = 4 21 kLocalF64 = 4,
22 kLocalS128 = 5
22 }; 23 };
23 24
24 // Binary encoding of memory types. 25 // Binary encoding of memory types.
25 enum MemTypeCode { 26 enum MemTypeCode {
26 kMemI8 = 0, 27 kMemI8 = 0,
27 kMemU8 = 1, 28 kMemU8 = 1,
28 kMemI16 = 2, 29 kMemI16 = 2,
29 kMemU16 = 3, 30 kMemU16 = 3,
30 kMemI32 = 4, 31 kMemI32 = 4,
31 kMemU32 = 5, 32 kMemU32 = 5,
32 kMemI64 = 6, 33 kMemI64 = 6,
33 kMemU64 = 7, 34 kMemU64 = 7,
34 kMemF32 = 8, 35 kMemF32 = 8,
35 kMemF64 = 9 36 kMemF64 = 9,
37 kMemS128 = 10
36 }; 38 };
37 39
38 // We reuse the internal machine type to represent WebAssembly AST types. 40 // We reuse the internal machine type to represent WebAssembly AST types.
39 // A typedef improves readability without adding a whole new type system. 41 // A typedef improves readability without adding a whole new type system.
40 typedef MachineRepresentation LocalType; 42 typedef MachineRepresentation LocalType;
41 const LocalType kAstStmt = MachineRepresentation::kNone; 43 const LocalType kAstStmt = MachineRepresentation::kNone;
42 const LocalType kAstI32 = MachineRepresentation::kWord32; 44 const LocalType kAstI32 = MachineRepresentation::kWord32;
43 const LocalType kAstI64 = MachineRepresentation::kWord64; 45 const LocalType kAstI64 = MachineRepresentation::kWord64;
44 const LocalType kAstF32 = MachineRepresentation::kFloat32; 46 const LocalType kAstF32 = MachineRepresentation::kFloat32;
45 const LocalType kAstF64 = MachineRepresentation::kFloat64; 47 const LocalType kAstF64 = MachineRepresentation::kFloat64;
48 const LocalType kAstS128 = MachineRepresentation::kSimd128;
46 // We use kTagged here because kNone is already used by kAstStmt. 49 // We use kTagged here because kNone is already used by kAstStmt.
47 const LocalType kAstEnd = MachineRepresentation::kTagged; 50 const LocalType kAstEnd = MachineRepresentation::kTagged;
48 51
49 typedef Signature<LocalType> FunctionSig; 52 typedef Signature<LocalType> FunctionSig;
50 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); 53 std::ostream& operator<<(std::ostream& os, const FunctionSig& function);
51 54
52 typedef Vector<const char> WasmName; 55 typedef Vector<const char> WasmName;
53 56
54 typedef int WasmCodePosition; 57 typedef int WasmCodePosition;
55 const WasmCodePosition kNoCodePosition = -1; 58 const WasmCodePosition kNoCodePosition = -1;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 V(I64StoreMem8, 0x30, l_il) \ 111 V(I64StoreMem8, 0x30, l_il) \
109 V(I64StoreMem16, 0x31, l_il) \ 112 V(I64StoreMem16, 0x31, l_il) \
110 V(I64StoreMem32, 0x32, l_il) \ 113 V(I64StoreMem32, 0x32, l_il) \
111 V(I32StoreMem, 0x33, i_ii) \ 114 V(I32StoreMem, 0x33, i_ii) \
112 V(I64StoreMem, 0x34, l_il) \ 115 V(I64StoreMem, 0x34, l_il) \
113 V(F32StoreMem, 0x35, f_if) \ 116 V(F32StoreMem, 0x35, f_if) \
114 V(F64StoreMem, 0x36, d_id) 117 V(F64StoreMem, 0x36, d_id)
115 118
116 // Load memory expressions. 119 // Load memory expressions.
117 #define FOREACH_MISC_MEM_OPCODE(V) \ 120 #define FOREACH_MISC_MEM_OPCODE(V) \
118 V(MemorySize, 0x3b, i_v) \ 121 V(GrowMemory, 0x39, i_i) \
119 V(GrowMemory, 0x39, i_i) 122 V(MemorySize, 0x3b, i_v)
120 123
121 // Expressions with signatures. 124 // Expressions with signatures.
122 #define FOREACH_SIMPLE_OPCODE(V) \ 125 #define FOREACH_SIMPLE_OPCODE(V) \
123 V(I32Add, 0x40, i_ii) \ 126 V(I32Add, 0x40, i_ii) \
124 V(I32Sub, 0x41, i_ii) \ 127 V(I32Sub, 0x41, i_ii) \
125 V(I32Mul, 0x42, i_ii) \ 128 V(I32Mul, 0x42, i_ii) \
126 V(I32DivS, 0x43, i_ii) \ 129 V(I32DivS, 0x43, i_ii) \
127 V(I32DivU, 0x44, i_ii) \ 130 V(I32DivU, 0x44, i_ii) \
128 V(I32RemS, 0x45, i_ii) \ 131 V(I32RemS, 0x45, i_ii) \
129 V(I32RemU, 0x46, i_ii) \ 132 V(I32RemU, 0x46, i_ii) \
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 V(I32AsmjsStoreMem8, 0xdb, i_ii) \ 274 V(I32AsmjsStoreMem8, 0xdb, i_ii) \
272 V(I32AsmjsStoreMem16, 0xdc, i_ii) \ 275 V(I32AsmjsStoreMem16, 0xdc, i_ii) \
273 V(I32AsmjsStoreMem, 0xdd, i_ii) \ 276 V(I32AsmjsStoreMem, 0xdd, i_ii) \
274 V(F32AsmjsStoreMem, 0xde, f_if) \ 277 V(F32AsmjsStoreMem, 0xde, f_if) \
275 V(F64AsmjsStoreMem, 0xdf, d_id) \ 278 V(F64AsmjsStoreMem, 0xdf, d_id) \
276 V(I32AsmjsSConvertF32, 0xe0, i_f) \ 279 V(I32AsmjsSConvertF32, 0xe0, i_f) \
277 V(I32AsmjsUConvertF32, 0xe1, i_f) \ 280 V(I32AsmjsUConvertF32, 0xe1, i_f) \
278 V(I32AsmjsSConvertF64, 0xe2, i_d) \ 281 V(I32AsmjsSConvertF64, 0xe2, i_d) \
279 V(I32AsmjsUConvertF64, 0xe3, i_d) 282 V(I32AsmjsUConvertF64, 0xe3, i_d)
280 283
284 #define FOREACH_SIMD_OPCODE(V) \
285 V(F32x4Splat, 0xe500, s_f) \
286 V(F32x4ExtractLane, 0xe501, f_si) \
aseemgarg 2016/05/27 23:59:37 probably better to take this and similar opcodes o
287 V(F32x4ReplaceLane, 0xe502, s_sif) \
288 V(F32x4Abs, 0xe503, s_s) \
289 V(F32x4Neg, 0xe504, s_s) \
290 V(F32x4Sqrt, 0xe505, s_s) \
291 V(F32x4RecipApprox, 0xe506, s_s) \
292 V(F32x4SqrtApprox, 0xe507, s_s) \
293 V(F32x4Add, 0xe508, s_ss) \
294 V(F32x4Sub, 0xe509, s_ss) \
295 V(F32x4Mul, 0xe50a, s_ss) \
296 V(F32x4Div, 0xe50b, s_ss) \
297 V(F32x4Min, 0xe50c, s_ss) \
298 V(F32x4Max, 0xe50d, s_ss) \
299 V(F32x4MinNum, 0xe50e, s_ss) \
300 V(F32x4MaxNum, 0xe50f, s_ss) \
301 V(F32x4Eq, 0xe510, s_ss) \
302 V(F32x4Ne, 0xe511, s_ss) \
303 V(F32x4Lt, 0xe512, s_ss) \
304 V(F32x4Le, 0xe513, s_ss) \
305 V(F32x4Gt, 0xe514, s_ss) \
306 V(F32x4Ge, 0xe515, s_ss) \
307 V(F32x4Select, 0xe516, s_sss) \
308 V(F32x4Swizzle, 0xe517, s_s) \
309 V(F32x4Shuffle, 0xe518, s_ss) \
310 V(F32x4FromInt32x4, 0xe519, s_s) \
311 V(F32x4FromUint32x4, 0xe51a, s_s) \
312 V(I32x4Splat, 0xe51b, s_i) \
313 V(I32x4ExtractLane, 0xe51c, i_si) \
314 V(I32x4ReplaceLane, 0xe51d, s_sii) \
315 V(I32x4Neg, 0xe51e, s_s) \
316 V(I32x4Add, 0xe51f, s_ss) \
317 V(I32x4Sub, 0xe520, s_ss) \
318 V(I32x4Mul, 0xe521, s_ss) \
319 V(I32x4Min_s, 0xe522, s_ss) \
320 V(I32x4Max_s, 0xe523, s_ss) \
321 V(I32x4Shl, 0xe524, s_si) \
322 V(I32x4Shr_s, 0xe525, s_si) \
323 V(I32x4Eq, 0xe526, s_ss) \
324 V(I32x4Ne, 0xe527, s_ss) \
325 V(I32x4Lt_s, 0xe528, s_ss) \
326 V(I32x4Le_s, 0xe529, s_ss) \
327 V(I32x4Gt_s, 0xe52a, s_ss) \
328 V(I32x4Ge_s, 0xe52b, s_ss) \
329 V(I32x4Select, 0xe52c, s_sss) \
aseemgarg 2016/05/27 23:59:37 These won't work. There is no implementation for o
330 V(I32x4Swizzle, 0xe52d, s_s) \
331 V(I32x4Shuffle, 0xe52e, s_ss) \
332 V(I32x4FromFloat32x4, 0xe52f, s_s) \
333 V(I32x4Min_u, 0xe530, s_ss) \
334 V(I32x4Max_u, 0xe531, s_ss) \
335 V(I32x4Shr_u, 0xe532, s_ss) \
336 V(I32x4Lt_u, 0xe533, s_ss) \
337 V(I32x4Le_u, 0xe534, s_ss) \
338 V(I32x4Gt_u, 0xe535, s_ss) \
339 V(I32x4Ge_u, 0xe536, s_ss) \
340 V(Ui32x4FromFloat32x4, 0xe537, s_s) \
341 V(I16x8Splat, 0xe538, s_i) \
342 V(I16x8ExtractLane, 0xe539, i_si) \
343 V(I16x8ReplaceLane, 0xe53a, s_sii) \
344 V(I16x8Neg, 0xe53b, s_s) \
345 V(I16x8Add, 0xe53c, s_ss) \
346 V(I16x8AddSaturate_s, 0xe53d, s_ss) \
347 V(I16x8Sub, 0xe53e, s_ss) \
348 V(I16x8SubSaturate_s, 0xe53f, s_ss) \
349 V(I16x8Mul, 0xe540, s_ss) \
350 V(I16x8Min_s, 0xe541, s_ss) \
351 V(I16x8Max_s, 0xe542, s_ss) \
352 V(I16x8Shl, 0xe543, s_si) \
353 V(I16x8Shr_s, 0xe544, s_si) \
354 V(I16x8Eq, 0xe545, s_ss) \
355 V(I16x8Ne, 0xe546, s_ss) \
356 V(I16x8Lt_s, 0xe547, s_ss) \
357 V(I16x8Le_s, 0xe548, s_ss) \
358 V(I16x8Gt_s, 0xe549, s_ss) \
359 V(I16x8Ge_s, 0xe54a, s_ss) \
360 V(I16x8Select, 0xe54b, s_sss) \
361 V(I16x8Swizzle, 0xe54c, s_s) \
362 V(I16x8Shuffle, 0xe54d, s_ss) \
363 V(I16x8AddSaturate_u, 0xe54e, s_ss) \
364 V(I16x8SubSaturate_u, 0xe54f, s_ss) \
365 V(I16x8Min_u, 0xe550, s_ss) \
366 V(I16x8Max_u, 0xe551, s_ss) \
367 V(I16x8Shr_u, 0xe552, s_si) \
368 V(I16x8Lt_u, 0xe553, s_ss) \
369 V(I16x8Le_u, 0xe554, s_ss) \
370 V(I16x8Gt_u, 0xe555, s_ss) \
371 V(I16x8Ge_u, 0xe556, s_ss) \
372 V(I8x16Splat, 0xe557, s_i) \
373 V(I8x16ExtractLane, 0xe558, i_si) \
374 V(I8x16ReplaceLane, 0xe559, s_sii) \
375 V(I8x16Neg, 0xe55a, s_s) \
376 V(I8x16Add, 0xe55b, s_ss) \
377 V(I8x16AddSaturate_s, 0xe55c, s_ss) \
378 V(I8x16Sub, 0xe55d, s_ss) \
379 V(I8x16SubSaturate_s, 0xe55e, s_ss) \
380 V(I8x16Mul, 0xe55f, s_ss) \
381 V(I8x16Min_s, 0xe560, s_ss) \
382 V(I8x16Max_s, 0xe561, s_ss) \
383 V(I8x16Shl, 0xe562, s_si) \
384 V(I8x16Shr_s, 0xe563, s_si) \
385 V(I8x16Eq, 0xe564, s_ss) \
386 V(I8x16Neq, 0xe565, s_ss) \
387 V(I8x16Lt_s, 0xe566, s_ss) \
388 V(I8x16Le_s, 0xe567, s_ss) \
389 V(I8x16Gt_s, 0xe568, s_ss) \
390 V(I8x16Ge_s, 0xe569, s_ss) \
391 V(I8x16Select, 0xe56a, s_sss) \
392 V(I8x16Swizzle, 0xe56b, s_s) \
393 V(I8x16Shuffle, 0xe56c, s_ss) \
394 V(I8x16AddSaturate_u, 0xe56d, s_ss) \
395 V(I8x16Sub_saturate_u, 0xe56e, s_ss) \
396 V(I8x16Min_u, 0xe56f, s_ss) \
397 V(I8x16Max_u, 0xe570, s_ss) \
398 V(I8x16Shr_u, 0xe571, s_ss) \
399 V(I8x16Lt_u, 0xe572, s_ss) \
400 V(I8x16Le_u, 0xe573, s_ss) \
401 V(I8x16Gt_u, 0xe574, s_ss) \
402 V(I8x16Ge_u, 0xe575, s_ss) \
403 V(S128And, 0xe576, s_ss) \
404 V(S128Ior, 0xe577, s_ss) \
405 V(S128Xor, 0xe578, s_ss) \
406 V(S128Not, 0xe579, s_s)
407
281 // All opcodes. 408 // All opcodes.
282 #define FOREACH_OPCODE(V) \ 409 #define FOREACH_OPCODE(V) \
283 FOREACH_CONTROL_OPCODE(V) \ 410 FOREACH_CONTROL_OPCODE(V) \
284 FOREACH_MISC_OPCODE(V) \ 411 FOREACH_MISC_OPCODE(V) \
285 FOREACH_SIMPLE_OPCODE(V) \ 412 FOREACH_SIMPLE_OPCODE(V) \
286 FOREACH_STORE_MEM_OPCODE(V) \ 413 FOREACH_STORE_MEM_OPCODE(V) \
287 FOREACH_LOAD_MEM_OPCODE(V) \ 414 FOREACH_LOAD_MEM_OPCODE(V) \
288 FOREACH_MISC_MEM_OPCODE(V) \ 415 FOREACH_MISC_MEM_OPCODE(V) \
289 FOREACH_ASMJS_COMPAT_OPCODE(V) 416 FOREACH_ASMJS_COMPAT_OPCODE(V) \
417 FOREACH_SIMD_OPCODE(V)
290 418
291 // All signatures. 419 // All signatures.
292 #define FOREACH_SIGNATURE(V) \ 420 #define FOREACH_SIGNATURE(V) \
421 FOREACH_SIMD_SIGNATURE(V) \
293 V(i_ii, kAstI32, kAstI32, kAstI32) \ 422 V(i_ii, kAstI32, kAstI32, kAstI32) \
294 V(i_i, kAstI32, kAstI32) \ 423 V(i_i, kAstI32, kAstI32) \
295 V(i_v, kAstI32) \ 424 V(i_v, kAstI32) \
296 V(i_ff, kAstI32, kAstF32, kAstF32) \ 425 V(i_ff, kAstI32, kAstF32, kAstF32) \
297 V(i_f, kAstI32, kAstF32) \ 426 V(i_f, kAstI32, kAstF32) \
298 V(i_dd, kAstI32, kAstF64, kAstF64) \ 427 V(i_dd, kAstI32, kAstF64, kAstF64) \
299 V(i_d, kAstI32, kAstF64) \ 428 V(i_d, kAstI32, kAstF64) \
300 V(i_l, kAstI32, kAstI64) \ 429 V(i_l, kAstI32, kAstI64) \
301 V(l_ll, kAstI64, kAstI64, kAstI64) \ 430 V(l_ll, kAstI64, kAstI64, kAstI64) \
302 V(i_ll, kAstI32, kAstI64, kAstI64) \ 431 V(i_ll, kAstI32, kAstI64, kAstI64) \
303 V(l_l, kAstI64, kAstI64) \ 432 V(l_l, kAstI64, kAstI64) \
304 V(l_i, kAstI64, kAstI32) \ 433 V(l_i, kAstI64, kAstI32) \
305 V(l_f, kAstI64, kAstF32) \ 434 V(l_f, kAstI64, kAstF32) \
306 V(l_d, kAstI64, kAstF64) \ 435 V(l_d, kAstI64, kAstF64) \
307 V(f_ff, kAstF32, kAstF32, kAstF32) \ 436 V(f_ff, kAstF32, kAstF32, kAstF32) \
308 V(f_f, kAstF32, kAstF32) \ 437 V(f_f, kAstF32, kAstF32) \
309 V(f_d, kAstF32, kAstF64) \ 438 V(f_d, kAstF32, kAstF64) \
310 V(f_i, kAstF32, kAstI32) \ 439 V(f_i, kAstF32, kAstI32) \
311 V(f_l, kAstF32, kAstI64) \ 440 V(f_l, kAstF32, kAstI64) \
312 V(d_dd, kAstF64, kAstF64, kAstF64) \ 441 V(d_dd, kAstF64, kAstF64, kAstF64) \
313 V(d_d, kAstF64, kAstF64) \ 442 V(d_d, kAstF64, kAstF64) \
314 V(d_f, kAstF64, kAstF32) \ 443 V(d_f, kAstF64, kAstF32) \
315 V(d_i, kAstF64, kAstI32) \ 444 V(d_i, kAstF64, kAstI32) \
316 V(d_l, kAstF64, kAstI64) \ 445 V(d_l, kAstF64, kAstI64) \
317 V(d_id, kAstF64, kAstI32, kAstF64) \ 446 V(d_id, kAstF64, kAstI32, kAstF64) \
318 V(f_if, kAstF32, kAstI32, kAstF32) \ 447 V(f_if, kAstF32, kAstI32, kAstF32) \
319 V(l_il, kAstI64, kAstI32, kAstI64) 448 V(l_il, kAstI64, kAstI32, kAstI64)
320 449
450 #define FOREACH_SIMD_SIGNATURE(V) \
451 V(s_s, kAstS128, kAstS128) \
452 V(s_f, kAstS128, kAstF32) \
453 V(f_si, kAstF32, kAstS128, kAstI32) \
454 V(s_sif, kAstS128, kAstS128, kAstI32, kAstF32) \
455 V(s_ss, kAstS128, kAstS128, kAstS128) \
456 V(s_sss, kAstS128, kAstS128, kAstS128, kAstS128) \
457 V(s_i, kAstS128, kAstI32) \
458 V(i_si, kAstI32, kAstS128, kAstI32) \
459 V(s_sii, kAstS128, kAstS128, kAstI32, kAstI32) \
460 V(s_si, kAstS128, kAstS128, kAstI32)
461
321 enum WasmOpcode { 462 enum WasmOpcode {
322 // Declare expression opcodes. 463 // Declare expression opcodes.
323 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, 464 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode,
324 FOREACH_OPCODE(DECLARE_NAMED_ENUM) 465 FOREACH_OPCODE(DECLARE_NAMED_ENUM)
325 #undef DECLARE_NAMED_ENUM 466 #undef DECLARE_NAMED_ENUM
326 }; 467 };
327 468
328 // The reason for a trap. 469 // The reason for a trap.
329 #define FOREACH_WASM_TRAPREASON(V) \ 470 #define FOREACH_WASM_TRAPREASON(V) \
330 V(TrapUnreachable) \ 471 V(TrapUnreachable) \
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 case kAstI32: 503 case kAstI32:
363 return kLocalI32; 504 return kLocalI32;
364 case kAstI64: 505 case kAstI64:
365 return kLocalI64; 506 return kLocalI64;
366 case kAstF32: 507 case kAstF32:
367 return kLocalF32; 508 return kLocalF32;
368 case kAstF64: 509 case kAstF64:
369 return kLocalF64; 510 return kLocalF64;
370 case kAstStmt: 511 case kAstStmt:
371 return kLocalVoid; 512 return kLocalVoid;
513 case kAstS128:
514 return kLocalS128;
372 default: 515 default:
373 UNREACHABLE(); 516 UNREACHABLE();
374 return kLocalVoid; 517 return kLocalVoid;
375 } 518 }
376 } 519 }
377 520
378 static MemTypeCode MemTypeCodeFor(MachineType type) { 521 static MemTypeCode MemTypeCodeFor(MachineType type) {
379 if (type == MachineType::Int8()) { 522 if (type == MachineType::Int8()) {
380 return kMemI8; 523 return kMemI8;
381 } else if (type == MachineType::Uint8()) { 524 } else if (type == MachineType::Uint8()) {
382 return kMemU8; 525 return kMemU8;
383 } else if (type == MachineType::Int16()) { 526 } else if (type == MachineType::Int16()) {
384 return kMemI16; 527 return kMemI16;
385 } else if (type == MachineType::Uint16()) { 528 } else if (type == MachineType::Uint16()) {
386 return kMemU16; 529 return kMemU16;
387 } else if (type == MachineType::Int32()) { 530 } else if (type == MachineType::Int32()) {
388 return kMemI32; 531 return kMemI32;
389 } else if (type == MachineType::Uint32()) { 532 } else if (type == MachineType::Uint32()) {
390 return kMemU32; 533 return kMemU32;
391 } else if (type == MachineType::Int64()) { 534 } else if (type == MachineType::Int64()) {
392 return kMemI64; 535 return kMemI64;
393 } else if (type == MachineType::Uint64()) { 536 } else if (type == MachineType::Uint64()) {
394 return kMemU64; 537 return kMemU64;
395 } else if (type == MachineType::Float32()) { 538 } else if (type == MachineType::Float32()) {
396 return kMemF32; 539 return kMemF32;
397 } else if (type == MachineType::Float64()) { 540 } else if (type == MachineType::Float64()) {
398 return kMemF64; 541 return kMemF64;
542 } else if (type == MachineType::Simd128()) {
543 return kMemS128;
399 } else { 544 } else {
400 UNREACHABLE(); 545 UNREACHABLE();
401 return kMemI32; 546 return kMemI32;
402 } 547 }
403 } 548 }
404 549
405 static MachineType MachineTypeFor(LocalType type) { 550 static MachineType MachineTypeFor(LocalType type) {
406 switch (type) { 551 switch (type) {
407 case kAstI32: 552 case kAstI32:
408 return MachineType::Int32(); 553 return MachineType::Int32();
409 case kAstI64: 554 case kAstI64:
410 return MachineType::Int64(); 555 return MachineType::Int64();
411 case kAstF32: 556 case kAstF32:
412 return MachineType::Float32(); 557 return MachineType::Float32();
413 case kAstF64: 558 case kAstF64:
414 return MachineType::Float64(); 559 return MachineType::Float64();
560 case kAstS128:
561 return MachineType::Simd128();
415 case kAstStmt: 562 case kAstStmt:
416 return MachineType::None(); 563 return MachineType::None();
417 default: 564 default:
418 UNREACHABLE(); 565 UNREACHABLE();
419 return MachineType::None(); 566 return MachineType::None();
420 } 567 }
421 } 568 }
422 569
423 static LocalType LocalTypeFor(MachineType type) { 570 static LocalType LocalTypeFor(MachineType type) {
424 if (type == MachineType::Int8()) { 571 if (type == MachineType::Int8()) {
425 return kAstI32; 572 return kAstI32;
426 } else if (type == MachineType::Uint8()) { 573 } else if (type == MachineType::Uint8()) {
427 return kAstI32; 574 return kAstI32;
428 } else if (type == MachineType::Int16()) { 575 } else if (type == MachineType::Int16()) {
429 return kAstI32; 576 return kAstI32;
430 } else if (type == MachineType::Uint16()) { 577 } else if (type == MachineType::Uint16()) {
431 return kAstI32; 578 return kAstI32;
432 } else if (type == MachineType::Int32()) { 579 } else if (type == MachineType::Int32()) {
433 return kAstI32; 580 return kAstI32;
434 } else if (type == MachineType::Uint32()) { 581 } else if (type == MachineType::Uint32()) {
435 return kAstI32; 582 return kAstI32;
436 } else if (type == MachineType::Int64()) { 583 } else if (type == MachineType::Int64()) {
437 return kAstI64; 584 return kAstI64;
438 } else if (type == MachineType::Uint64()) { 585 } else if (type == MachineType::Uint64()) {
439 return kAstI64; 586 return kAstI64;
440 } else if (type == MachineType::Float32()) { 587 } else if (type == MachineType::Float32()) {
441 return kAstF32; 588 return kAstF32;
442 } else if (type == MachineType::Float64()) { 589 } else if (type == MachineType::Float64()) {
443 return kAstF64; 590 return kAstF64;
591 } else if (type == MachineType::Simd128()) {
592 return kAstS128;
444 } else { 593 } else {
445 UNREACHABLE(); 594 UNREACHABLE();
446 return kAstI32; 595 return kAstI32;
447 } 596 }
448 } 597 }
449 598
450 static WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { 599 static WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
451 if (type == MachineType::Int8()) { 600 if (type == MachineType::Int8()) {
452 return store ? kExprI32StoreMem8 : kExprI32LoadMem8S; 601 return store ? kExprI32StoreMem8 : kExprI32LoadMem8S;
453 } else if (type == MachineType::Uint8()) { 602 } else if (type == MachineType::Uint8()) {
(...skipping 23 matching lines...) Expand all
477 static char ShortNameOf(LocalType type) { 626 static char ShortNameOf(LocalType type) {
478 switch (type) { 627 switch (type) {
479 case kAstI32: 628 case kAstI32:
480 return 'i'; 629 return 'i';
481 case kAstI64: 630 case kAstI64:
482 return 'l'; 631 return 'l';
483 case kAstF32: 632 case kAstF32:
484 return 'f'; 633 return 'f';
485 case kAstF64: 634 case kAstF64:
486 return 'd'; 635 return 'd';
636 case kAstS128:
637 return 's';
487 case kAstStmt: 638 case kAstStmt:
488 return 'v'; 639 return 'v';
489 case kAstEnd: 640 case kAstEnd:
490 return 'x'; 641 return 'x';
491 default: 642 default:
492 UNREACHABLE(); 643 UNREACHABLE();
493 return '?'; 644 return '?';
494 } 645 }
495 } 646 }
496 647
497 static const char* TypeName(LocalType type) { 648 static const char* TypeName(LocalType type) {
498 switch (type) { 649 switch (type) {
499 case kAstI32: 650 case kAstI32:
500 return "i32"; 651 return "i32";
501 case kAstI64: 652 case kAstI64:
502 return "i64"; 653 return "i64";
503 case kAstF32: 654 case kAstF32:
504 return "f32"; 655 return "f32";
505 case kAstF64: 656 case kAstF64:
506 return "f64"; 657 return "f64";
658 case kAstS128:
659 return "s128";
507 case kAstStmt: 660 case kAstStmt:
508 return "<stmt>"; 661 return "<stmt>";
509 case kAstEnd: 662 case kAstEnd:
510 return "<end>"; 663 return "<end>";
511 default: 664 default:
512 return "<unknown>"; 665 return "<unknown>";
513 } 666 }
514 } 667 }
515 }; 668 };
516 } // namespace wasm 669 } // namespace wasm
517 } // namespace internal 670 } // namespace internal
518 } // namespace v8 671 } // namespace v8
519 672
520 #endif // V8_WASM_OPCODES_H_ 673 #endif // V8_WASM_OPCODES_H_
OLDNEW
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698