| 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_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/globals.h" | 8 #include "src/globals.h" |
| 9 #include "src/machine-type.h" | 9 #include "src/machine-type.h" |
| 10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
| 11 #include "src/signature.h" | 11 #include "src/signature.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 namespace wasm { | 15 namespace wasm { |
| 16 | 16 |
| 17 // Binary encoding of local types. | 17 // Binary encoding of local types. |
| 18 enum ValueTypeCode { | 18 enum ValueTypeCode { |
| 19 kLocalVoid = 0x40, | 19 kLocalVoid = 0x40, |
| 20 kLocalI32 = 0x7f, | 20 kLocalI32 = 0x7f, |
| 21 kLocalI64 = 0x7e, | 21 kLocalI64 = 0x7e, |
| 22 kLocalF32 = 0x7d, | 22 kLocalF32 = 0x7d, |
| 23 kLocalF64 = 0x7c, | 23 kLocalF64 = 0x7c, |
| 24 kLocalS128 = 0x7b | 24 kLocalS128 = 0x7b, |
| 25 kLocalS1x4 = 0x7a, |
| 26 kLocalS1x8 = 0x79, |
| 27 kLocalS1x16 = 0x78 |
| 25 }; | 28 }; |
| 26 | 29 |
| 27 // Type code for multi-value block types. | 30 // Type code for multi-value block types. |
| 28 static const uint8_t kMultivalBlock = 0x41; | 31 static const uint8_t kMultivalBlock = 0x41; |
| 29 | 32 |
| 30 // We reuse the internal machine type to represent WebAssembly types. | 33 // We reuse the internal machine type to represent WebAssembly types. |
| 31 // A typedef improves readability without adding a whole new type system. | 34 // A typedef improves readability without adding a whole new type system. |
| 32 typedef MachineRepresentation ValueType; | 35 typedef MachineRepresentation ValueType; |
| 33 const ValueType kWasmStmt = MachineRepresentation::kNone; | 36 const ValueType kWasmStmt = MachineRepresentation::kNone; |
| 34 const ValueType kWasmI32 = MachineRepresentation::kWord32; | 37 const ValueType kWasmI32 = MachineRepresentation::kWord32; |
| 35 const ValueType kWasmI64 = MachineRepresentation::kWord64; | 38 const ValueType kWasmI64 = MachineRepresentation::kWord64; |
| 36 const ValueType kWasmF32 = MachineRepresentation::kFloat32; | 39 const ValueType kWasmF32 = MachineRepresentation::kFloat32; |
| 37 const ValueType kWasmF64 = MachineRepresentation::kFloat64; | 40 const ValueType kWasmF64 = MachineRepresentation::kFloat64; |
| 38 const ValueType kWasmS128 = MachineRepresentation::kSimd128; | 41 const ValueType kWasmS128 = MachineRepresentation::kSimd128; |
| 42 const ValueType kWasmS1x4 = MachineRepresentation::kSimd1x4; |
| 43 const ValueType kWasmS1x8 = MachineRepresentation::kSimd1x8; |
| 44 const ValueType kWasmS1x16 = MachineRepresentation::kSimd1x16; |
| 39 const ValueType kWasmVar = MachineRepresentation::kTagged; | 45 const ValueType kWasmVar = MachineRepresentation::kTagged; |
| 40 | 46 |
| 41 typedef Signature<ValueType> FunctionSig; | 47 typedef Signature<ValueType> FunctionSig; |
| 42 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); | 48 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); |
| 43 | 49 |
| 44 typedef Vector<const char> WasmName; | 50 typedef Vector<const char> WasmName; |
| 45 | 51 |
| 46 typedef int WasmCodePosition; | 52 typedef int WasmCodePosition; |
| 47 const WasmCodePosition kNoCodePosition = -1; | 53 const WasmCodePosition kNoCodePosition = -1; |
| 48 | 54 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 V(F32x4RecipApprox, 0xe506, s_s) \ | 287 V(F32x4RecipApprox, 0xe506, s_s) \ |
| 282 V(F32x4SqrtApprox, 0xe507, s_s) \ | 288 V(F32x4SqrtApprox, 0xe507, s_s) \ |
| 283 V(F32x4Add, 0xe508, s_ss) \ | 289 V(F32x4Add, 0xe508, s_ss) \ |
| 284 V(F32x4Sub, 0xe509, s_ss) \ | 290 V(F32x4Sub, 0xe509, s_ss) \ |
| 285 V(F32x4Mul, 0xe50a, s_ss) \ | 291 V(F32x4Mul, 0xe50a, s_ss) \ |
| 286 V(F32x4Div, 0xe50b, s_ss) \ | 292 V(F32x4Div, 0xe50b, s_ss) \ |
| 287 V(F32x4Min, 0xe50c, s_ss) \ | 293 V(F32x4Min, 0xe50c, s_ss) \ |
| 288 V(F32x4Max, 0xe50d, s_ss) \ | 294 V(F32x4Max, 0xe50d, s_ss) \ |
| 289 V(F32x4MinNum, 0xe50e, s_ss) \ | 295 V(F32x4MinNum, 0xe50e, s_ss) \ |
| 290 V(F32x4MaxNum, 0xe50f, s_ss) \ | 296 V(F32x4MaxNum, 0xe50f, s_ss) \ |
| 291 V(F32x4Eq, 0xe510, s_ss) \ | 297 V(F32x4Eq, 0xe510, s1x4_ss) \ |
| 292 V(F32x4Ne, 0xe511, s_ss) \ | 298 V(F32x4Ne, 0xe511, s1x4_ss) \ |
| 293 V(F32x4Lt, 0xe512, s_ss) \ | 299 V(F32x4Lt, 0xe512, s1x4_ss) \ |
| 294 V(F32x4Le, 0xe513, s_ss) \ | 300 V(F32x4Le, 0xe513, s1x4_ss) \ |
| 295 V(F32x4Gt, 0xe514, s_ss) \ | 301 V(F32x4Gt, 0xe514, s1x4_ss) \ |
| 296 V(F32x4Ge, 0xe515, s_ss) \ | 302 V(F32x4Ge, 0xe515, s1x4_ss) \ |
| 297 V(F32x4SConvertI32x4, 0xe519, s_s) \ | 303 V(F32x4SConvertI32x4, 0xe519, s_s) \ |
| 298 V(F32x4UConvertI32x4, 0xe51a, s_s) \ | 304 V(F32x4UConvertI32x4, 0xe51a, s_s) \ |
| 299 V(I32x4Splat, 0xe51b, s_i) \ | 305 V(I32x4Splat, 0xe51b, s_i) \ |
| 300 V(I32x4Neg, 0xe51e, s_s) \ | 306 V(I32x4Neg, 0xe51e, s_s) \ |
| 301 V(I32x4Add, 0xe51f, s_ss) \ | 307 V(I32x4Add, 0xe51f, s_ss) \ |
| 302 V(I32x4Sub, 0xe520, s_ss) \ | 308 V(I32x4Sub, 0xe520, s_ss) \ |
| 303 V(I32x4Mul, 0xe521, s_ss) \ | 309 V(I32x4Mul, 0xe521, s_ss) \ |
| 304 V(I32x4MinS, 0xe522, s_ss) \ | 310 V(I32x4MinS, 0xe522, s_ss) \ |
| 305 V(I32x4MaxS, 0xe523, s_ss) \ | 311 V(I32x4MaxS, 0xe523, s_ss) \ |
| 306 V(I32x4Eq, 0xe526, s_ss) \ | 312 V(I32x4Eq, 0xe526, s1x4_ss) \ |
| 307 V(I32x4Ne, 0xe527, s_ss) \ | 313 V(I32x4Ne, 0xe527, s1x4_ss) \ |
| 308 V(I32x4LtS, 0xe528, s_ss) \ | 314 V(I32x4LtS, 0xe528, s1x4_ss) \ |
| 309 V(I32x4LeS, 0xe529, s_ss) \ | 315 V(I32x4LeS, 0xe529, s1x4_ss) \ |
| 310 V(I32x4GtS, 0xe52a, s_ss) \ | 316 V(I32x4GtS, 0xe52a, s1x4_ss) \ |
| 311 V(I32x4GeS, 0xe52b, s_ss) \ | 317 V(I32x4GeS, 0xe52b, s1x4_ss) \ |
| 312 V(I32x4SConvertF32x4, 0xe52f, s_s) \ | 318 V(I32x4SConvertF32x4, 0xe52f, s_s) \ |
| 313 V(I32x4MinU, 0xe530, s_ss) \ | 319 V(I32x4MinU, 0xe530, s_ss) \ |
| 314 V(I32x4MaxU, 0xe531, s_ss) \ | 320 V(I32x4MaxU, 0xe531, s_ss) \ |
| 315 V(I32x4LtU, 0xe533, s_ss) \ | 321 V(I32x4LtU, 0xe533, s1x4_ss) \ |
| 316 V(I32x4LeU, 0xe534, s_ss) \ | 322 V(I32x4LeU, 0xe534, s1x4_ss) \ |
| 317 V(I32x4GtU, 0xe535, s_ss) \ | 323 V(I32x4GtU, 0xe535, s1x4_ss) \ |
| 318 V(I32x4GeU, 0xe536, s_ss) \ | 324 V(I32x4GeU, 0xe536, s1x4_ss) \ |
| 319 V(I32x4UConvertF32x4, 0xe537, s_s) \ | 325 V(I32x4UConvertF32x4, 0xe537, s_s) \ |
| 320 V(I16x8Splat, 0xe538, s_i) \ | 326 V(I16x8Splat, 0xe538, s_i) \ |
| 321 V(I16x8Neg, 0xe53b, s_s) \ | 327 V(I16x8Neg, 0xe53b, s_s) \ |
| 322 V(I16x8Add, 0xe53c, s_ss) \ | 328 V(I16x8Add, 0xe53c, s_ss) \ |
| 323 V(I16x8AddSaturateS, 0xe53d, s_ss) \ | 329 V(I16x8AddSaturateS, 0xe53d, s_ss) \ |
| 324 V(I16x8Sub, 0xe53e, s_ss) \ | 330 V(I16x8Sub, 0xe53e, s_ss) \ |
| 325 V(I16x8SubSaturateS, 0xe53f, s_ss) \ | 331 V(I16x8SubSaturateS, 0xe53f, s_ss) \ |
| 326 V(I16x8Mul, 0xe540, s_ss) \ | 332 V(I16x8Mul, 0xe540, s_ss) \ |
| 327 V(I16x8MinS, 0xe541, s_ss) \ | 333 V(I16x8MinS, 0xe541, s_ss) \ |
| 328 V(I16x8MaxS, 0xe542, s_ss) \ | 334 V(I16x8MaxS, 0xe542, s_ss) \ |
| 329 V(I16x8Eq, 0xe545, s_ss) \ | 335 V(I16x8Eq, 0xe545, s1x8_ss) \ |
| 330 V(I16x8Ne, 0xe546, s_ss) \ | 336 V(I16x8Ne, 0xe546, s1x8_ss) \ |
| 331 V(I16x8LtS, 0xe547, s_ss) \ | 337 V(I16x8LtS, 0xe547, s1x8_ss) \ |
| 332 V(I16x8LeS, 0xe548, s_ss) \ | 338 V(I16x8LeS, 0xe548, s1x8_ss) \ |
| 333 V(I16x8GtS, 0xe549, s_ss) \ | 339 V(I16x8GtS, 0xe549, s1x8_ss) \ |
| 334 V(I16x8GeS, 0xe54a, s_ss) \ | 340 V(I16x8GeS, 0xe54a, s1x8_ss) \ |
| 335 V(I16x8AddSaturateU, 0xe54e, s_ss) \ | 341 V(I16x8AddSaturateU, 0xe54e, s_ss) \ |
| 336 V(I16x8SubSaturateU, 0xe54f, s_ss) \ | 342 V(I16x8SubSaturateU, 0xe54f, s_ss) \ |
| 337 V(I16x8MinU, 0xe550, s_ss) \ | 343 V(I16x8MinU, 0xe550, s_ss) \ |
| 338 V(I16x8MaxU, 0xe551, s_ss) \ | 344 V(I16x8MaxU, 0xe551, s_ss) \ |
| 339 V(I16x8LtU, 0xe553, s_ss) \ | 345 V(I16x8LtU, 0xe553, s1x8_ss) \ |
| 340 V(I16x8LeU, 0xe554, s_ss) \ | 346 V(I16x8LeU, 0xe554, s1x8_ss) \ |
| 341 V(I16x8GtU, 0xe555, s_ss) \ | 347 V(I16x8GtU, 0xe555, s1x8_ss) \ |
| 342 V(I16x8GeU, 0xe556, s_ss) \ | 348 V(I16x8GeU, 0xe556, s1x8_ss) \ |
| 343 V(I8x16Splat, 0xe557, s_i) \ | 349 V(I8x16Splat, 0xe557, s_i) \ |
| 344 V(I8x16Neg, 0xe55a, s_s) \ | 350 V(I8x16Neg, 0xe55a, s_s) \ |
| 345 V(I8x16Add, 0xe55b, s_ss) \ | 351 V(I8x16Add, 0xe55b, s_ss) \ |
| 346 V(I8x16AddSaturateS, 0xe55c, s_ss) \ | 352 V(I8x16AddSaturateS, 0xe55c, s_ss) \ |
| 347 V(I8x16Sub, 0xe55d, s_ss) \ | 353 V(I8x16Sub, 0xe55d, s_ss) \ |
| 348 V(I8x16SubSaturateS, 0xe55e, s_ss) \ | 354 V(I8x16SubSaturateS, 0xe55e, s_ss) \ |
| 349 V(I8x16Mul, 0xe55f, s_ss) \ | 355 V(I8x16Mul, 0xe55f, s_ss) \ |
| 350 V(I8x16MinS, 0xe560, s_ss) \ | 356 V(I8x16MinS, 0xe560, s_ss) \ |
| 351 V(I8x16MaxS, 0xe561, s_ss) \ | 357 V(I8x16MaxS, 0xe561, s_ss) \ |
| 352 V(I8x16Eq, 0xe564, s_ss) \ | 358 V(I8x16Eq, 0xe564, s1x16_ss) \ |
| 353 V(I8x16Ne, 0xe565, s_ss) \ | 359 V(I8x16Ne, 0xe565, s1x16_ss) \ |
| 354 V(I8x16LtS, 0xe566, s_ss) \ | 360 V(I8x16LtS, 0xe566, s1x16_ss) \ |
| 355 V(I8x16LeS, 0xe567, s_ss) \ | 361 V(I8x16LeS, 0xe567, s1x16_ss) \ |
| 356 V(I8x16GtS, 0xe568, s_ss) \ | 362 V(I8x16GtS, 0xe568, s1x16_ss) \ |
| 357 V(I8x16GeS, 0xe569, s_ss) \ | 363 V(I8x16GeS, 0xe569, s1x16_ss) \ |
| 358 V(I8x16AddSaturateU, 0xe56d, s_ss) \ | 364 V(I8x16AddSaturateU, 0xe56d, s_ss) \ |
| 359 V(I8x16SubSaturateU, 0xe56e, s_ss) \ | 365 V(I8x16SubSaturateU, 0xe56e, s_ss) \ |
| 360 V(I8x16MinU, 0xe56f, s_ss) \ | 366 V(I8x16MinU, 0xe56f, s_ss) \ |
| 361 V(I8x16MaxU, 0xe570, s_ss) \ | 367 V(I8x16MaxU, 0xe570, s_ss) \ |
| 362 V(I8x16LtU, 0xe572, s_ss) \ | 368 V(I8x16LtU, 0xe572, s1x16_ss) \ |
| 363 V(I8x16LeU, 0xe573, s_ss) \ | 369 V(I8x16LeU, 0xe573, s1x16_ss) \ |
| 364 V(I8x16GtU, 0xe574, s_ss) \ | 370 V(I8x16GtU, 0xe574, s1x16_ss) \ |
| 365 V(I8x16GeU, 0xe575, s_ss) \ | 371 V(I8x16GeU, 0xe575, s1x16_ss) \ |
| 366 V(S128And, 0xe576, s_ss) \ | 372 V(S128And, 0xe576, s_ss) \ |
| 367 V(S128Or, 0xe577, s_ss) \ | 373 V(S128Or, 0xe577, s_ss) \ |
| 368 V(S128Xor, 0xe578, s_ss) \ | 374 V(S128Xor, 0xe578, s_ss) \ |
| 369 V(S128Not, 0xe579, s_s) \ | 375 V(S128Not, 0xe579, s_s) \ |
| 370 V(S32x4Select, 0xe52c, s_sss) \ | 376 V(S32x4Select, 0xe52c, s_s1x4ss) \ |
| 371 V(S32x4Swizzle, 0xe52d, s_s) \ | 377 V(S32x4Swizzle, 0xe52d, s_s) \ |
| 372 V(S32x4Shuffle, 0xe52e, s_ss) \ | 378 V(S32x4Shuffle, 0xe52e, s_ss) \ |
| 373 V(S16x8Select, 0xe54b, s_sss) \ | 379 V(S16x8Select, 0xe54b, s_s1x8ss) \ |
| 374 V(S16x8Swizzle, 0xe54c, s_s) \ | 380 V(S16x8Swizzle, 0xe54c, s_s) \ |
| 375 V(S16x8Shuffle, 0xe54d, s_ss) \ | 381 V(S16x8Shuffle, 0xe54d, s_ss) \ |
| 376 V(S8x16Select, 0xe56a, s_sss) \ | 382 V(S8x16Select, 0xe56a, s_s1x16ss) \ |
| 377 V(S8x16Swizzle, 0xe56b, s_s) \ | 383 V(S8x16Swizzle, 0xe56b, s_s) \ |
| 378 V(S8x16Shuffle, 0xe56c, s_ss) | 384 V(S8x16Shuffle, 0xe56c, s_ss) |
| 379 | 385 |
| 380 #define FOREACH_SIMD_1_OPERAND_OPCODE(V) \ | 386 #define FOREACH_SIMD_1_OPERAND_OPCODE(V) \ |
| 381 V(F32x4ExtractLane, 0xe501, _) \ | 387 V(F32x4ExtractLane, 0xe501, _) \ |
| 382 V(F32x4ReplaceLane, 0xe502, _) \ | 388 V(F32x4ReplaceLane, 0xe502, _) \ |
| 383 V(I32x4ExtractLane, 0xe51c, _) \ | 389 V(I32x4ExtractLane, 0xe51c, _) \ |
| 384 V(I32x4ReplaceLane, 0xe51d, _) \ | 390 V(I32x4ReplaceLane, 0xe51d, _) \ |
| 385 V(I32x4Shl, 0xe524, _) \ | 391 V(I32x4Shl, 0xe524, _) \ |
| 386 V(I32x4ShrS, 0xe525, _) \ | 392 V(I32x4ShrS, 0xe525, _) \ |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 V(f_l, kWasmF32, kWasmI64) \ | 476 V(f_l, kWasmF32, kWasmI64) \ |
| 471 V(d_dd, kWasmF64, kWasmF64, kWasmF64) \ | 477 V(d_dd, kWasmF64, kWasmF64, kWasmF64) \ |
| 472 V(d_d, kWasmF64, kWasmF64) \ | 478 V(d_d, kWasmF64, kWasmF64) \ |
| 473 V(d_f, kWasmF64, kWasmF32) \ | 479 V(d_f, kWasmF64, kWasmF32) \ |
| 474 V(d_i, kWasmF64, kWasmI32) \ | 480 V(d_i, kWasmF64, kWasmI32) \ |
| 475 V(d_l, kWasmF64, kWasmI64) \ | 481 V(d_l, kWasmF64, kWasmI64) \ |
| 476 V(d_id, kWasmF64, kWasmI32, kWasmF64) \ | 482 V(d_id, kWasmF64, kWasmI32, kWasmF64) \ |
| 477 V(f_if, kWasmF32, kWasmI32, kWasmF32) \ | 483 V(f_if, kWasmF32, kWasmI32, kWasmF32) \ |
| 478 V(l_il, kWasmI64, kWasmI32, kWasmI64) | 484 V(l_il, kWasmI64, kWasmI32, kWasmI64) |
| 479 | 485 |
| 480 #define FOREACH_SIMD_SIGNATURE(V) \ | 486 #define FOREACH_SIMD_SIGNATURE(V) \ |
| 481 V(s_s, kWasmS128, kWasmS128) \ | 487 V(s_s, kWasmS128, kWasmS128) \ |
| 482 V(s_f, kWasmS128, kWasmF32) \ | 488 V(s_f, kWasmS128, kWasmF32) \ |
| 483 V(s_ss, kWasmS128, kWasmS128, kWasmS128) \ | 489 V(s_ss, kWasmS128, kWasmS128, kWasmS128) \ |
| 484 V(s_sss, kWasmS128, kWasmS128, kWasmS128, kWasmS128) \ | 490 V(s1x4_ss, kWasmS1x4, kWasmS128, kWasmS128) \ |
| 485 V(s_i, kWasmS128, kWasmI32) \ | 491 V(s1x8_ss, kWasmS1x8, kWasmS128, kWasmS128) \ |
| 486 V(s_si, kWasmS128, kWasmS128, kWasmI32) | 492 V(s1x16_ss, kWasmS1x16, kWasmS128, kWasmS128) \ |
| 493 V(s_i, kWasmS128, kWasmI32) \ |
| 494 V(s_si, kWasmS128, kWasmS128, kWasmI32) \ |
| 495 V(i_s, kWasmI32, kWasmS128) \ |
| 496 V(s_s1x4ss, kWasmS128, kWasmS1x4, kWasmS128, kWasmS128) \ |
| 497 V(s_s1x8ss, kWasmS128, kWasmS1x8, kWasmS128, kWasmS128) \ |
| 498 V(s_s1x16ss, kWasmS128, kWasmS1x16, kWasmS128, kWasmS128) |
| 487 | 499 |
| 488 #define FOREACH_PREFIX(V) \ | 500 #define FOREACH_PREFIX(V) \ |
| 489 V(Simd, 0xe5) \ | 501 V(Simd, 0xe5) \ |
| 490 V(Atomic, 0xe6) | 502 V(Atomic, 0xe6) |
| 491 | 503 |
| 492 enum WasmOpcode { | 504 enum WasmOpcode { |
| 493 // Declare expression opcodes. | 505 // Declare expression opcodes. |
| 494 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, | 506 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, |
| 495 FOREACH_OPCODE(DECLARE_NAMED_ENUM) | 507 FOREACH_OPCODE(DECLARE_NAMED_ENUM) |
| 496 #undef DECLARE_NAMED_ENUM | 508 #undef DECLARE_NAMED_ENUM |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 case kWasmI32: | 552 case kWasmI32: |
| 541 return kLocalI32; | 553 return kLocalI32; |
| 542 case kWasmI64: | 554 case kWasmI64: |
| 543 return kLocalI64; | 555 return kLocalI64; |
| 544 case kWasmF32: | 556 case kWasmF32: |
| 545 return kLocalF32; | 557 return kLocalF32; |
| 546 case kWasmF64: | 558 case kWasmF64: |
| 547 return kLocalF64; | 559 return kLocalF64; |
| 548 case kWasmS128: | 560 case kWasmS128: |
| 549 return kLocalS128; | 561 return kLocalS128; |
| 562 case kWasmS1x4: |
| 563 return kLocalS1x4; |
| 564 case kWasmS1x8: |
| 565 return kLocalS1x8; |
| 566 case kWasmS1x16: |
| 567 return kLocalS1x16; |
| 550 case kWasmStmt: | 568 case kWasmStmt: |
| 551 return kLocalVoid; | 569 return kLocalVoid; |
| 552 default: | 570 default: |
| 553 UNREACHABLE(); | 571 UNREACHABLE(); |
| 554 return kLocalVoid; | 572 return kLocalVoid; |
| 555 } | 573 } |
| 556 } | 574 } |
| 557 | 575 |
| 558 static MachineType MachineTypeFor(ValueType type) { | 576 static MachineType MachineTypeFor(ValueType type) { |
| 559 switch (type) { | 577 switch (type) { |
| 560 case kWasmI32: | 578 case kWasmI32: |
| 561 return MachineType::Int32(); | 579 return MachineType::Int32(); |
| 562 case kWasmI64: | 580 case kWasmI64: |
| 563 return MachineType::Int64(); | 581 return MachineType::Int64(); |
| 564 case kWasmF32: | 582 case kWasmF32: |
| 565 return MachineType::Float32(); | 583 return MachineType::Float32(); |
| 566 case kWasmF64: | 584 case kWasmF64: |
| 567 return MachineType::Float64(); | 585 return MachineType::Float64(); |
| 568 case kWasmS128: | 586 case kWasmS128: |
| 569 return MachineType::Simd128(); | 587 return MachineType::Simd128(); |
| 588 case kWasmS1x4: |
| 589 return MachineType::Simd1x4(); |
| 590 case kWasmS1x8: |
| 591 return MachineType::Simd1x8(); |
| 592 case kWasmS1x16: |
| 593 return MachineType::Simd1x16(); |
| 570 case kWasmStmt: | 594 case kWasmStmt: |
| 571 return MachineType::None(); | 595 return MachineType::None(); |
| 572 default: | 596 default: |
| 573 UNREACHABLE(); | 597 UNREACHABLE(); |
| 574 return MachineType::None(); | 598 return MachineType::None(); |
| 575 } | 599 } |
| 576 } | 600 } |
| 577 | 601 |
| 578 static ValueType ValueTypeFor(MachineType type) { | 602 static ValueType ValueTypeFor(MachineType type) { |
| 579 if (type == MachineType::Int8()) { | 603 if (type == MachineType::Int8()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 591 } else if (type == MachineType::Int64()) { | 615 } else if (type == MachineType::Int64()) { |
| 592 return kWasmI64; | 616 return kWasmI64; |
| 593 } else if (type == MachineType::Uint64()) { | 617 } else if (type == MachineType::Uint64()) { |
| 594 return kWasmI64; | 618 return kWasmI64; |
| 595 } else if (type == MachineType::Float32()) { | 619 } else if (type == MachineType::Float32()) { |
| 596 return kWasmF32; | 620 return kWasmF32; |
| 597 } else if (type == MachineType::Float64()) { | 621 } else if (type == MachineType::Float64()) { |
| 598 return kWasmF64; | 622 return kWasmF64; |
| 599 } else if (type == MachineType::Simd128()) { | 623 } else if (type == MachineType::Simd128()) { |
| 600 return kWasmS128; | 624 return kWasmS128; |
| 625 } else if (type == MachineType::Simd1x4()) { |
| 626 return kWasmS1x4; |
| 627 } else if (type == MachineType::Simd1x8()) { |
| 628 return kWasmS1x8; |
| 629 } else if (type == MachineType::Simd1x16()) { |
| 630 return kWasmS1x16; |
| 601 } else { | 631 } else { |
| 602 UNREACHABLE(); | 632 UNREACHABLE(); |
| 603 return kWasmI32; | 633 return kWasmI32; |
| 604 } | 634 } |
| 605 } | 635 } |
| 606 | 636 |
| 607 static WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { | 637 static WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { |
| 608 if (type == MachineType::Int8()) { | 638 if (type == MachineType::Int8()) { |
| 609 return store ? kExprI32StoreMem8 : kExprI32LoadMem8S; | 639 return store ? kExprI32StoreMem8 : kExprI32LoadMem8S; |
| 610 } else if (type == MachineType::Uint8()) { | 640 } else if (type == MachineType::Uint8()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 635 switch (type) { | 665 switch (type) { |
| 636 case kWasmI32: | 666 case kWasmI32: |
| 637 return 'i'; | 667 return 'i'; |
| 638 case kWasmI64: | 668 case kWasmI64: |
| 639 return 'l'; | 669 return 'l'; |
| 640 case kWasmF32: | 670 case kWasmF32: |
| 641 return 'f'; | 671 return 'f'; |
| 642 case kWasmF64: | 672 case kWasmF64: |
| 643 return 'd'; | 673 return 'd'; |
| 644 case kWasmS128: | 674 case kWasmS128: |
| 675 case kWasmS1x4: |
| 676 case kWasmS1x8: |
| 677 case kWasmS1x16: |
| 645 return 's'; | 678 return 's'; |
| 646 case kWasmStmt: | 679 case kWasmStmt: |
| 647 return 'v'; | 680 return 'v'; |
| 648 case kWasmVar: | 681 case kWasmVar: |
| 649 return '*'; | 682 return '*'; |
| 650 default: | 683 default: |
| 651 return '?'; | 684 return '?'; |
| 652 } | 685 } |
| 653 } | 686 } |
| 654 | 687 |
| 655 static const char* TypeName(ValueType type) { | 688 static const char* TypeName(ValueType type) { |
| 656 switch (type) { | 689 switch (type) { |
| 657 case kWasmI32: | 690 case kWasmI32: |
| 658 return "i32"; | 691 return "i32"; |
| 659 case kWasmI64: | 692 case kWasmI64: |
| 660 return "i64"; | 693 return "i64"; |
| 661 case kWasmF32: | 694 case kWasmF32: |
| 662 return "f32"; | 695 return "f32"; |
| 663 case kWasmF64: | 696 case kWasmF64: |
| 664 return "f64"; | 697 return "f64"; |
| 665 case kWasmS128: | 698 case kWasmS128: |
| 666 return "s128"; | 699 return "s128"; |
| 700 case kWasmS1x4: |
| 701 return "s1x4"; |
| 702 case kWasmS1x8: |
| 703 return "s1x8"; |
| 704 case kWasmS1x16: |
| 705 return "s1x16"; |
| 667 case kWasmStmt: | 706 case kWasmStmt: |
| 668 return "<stmt>"; | 707 return "<stmt>"; |
| 669 case kWasmVar: | 708 case kWasmVar: |
| 670 return "<var>"; | 709 return "<var>"; |
| 671 default: | 710 default: |
| 672 return "<unknown>"; | 711 return "<unknown>"; |
| 673 } | 712 } |
| 674 } | 713 } |
| 675 }; | 714 }; |
| 676 } // namespace wasm | 715 } // namespace wasm |
| 677 } // namespace internal | 716 } // namespace internal |
| 678 } // namespace v8 | 717 } // namespace v8 |
| 679 | 718 |
| 680 #endif // V8_WASM_OPCODES_H_ | 719 #endif // V8_WASM_OPCODES_H_ |
| OLD | NEW |