| 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 | |
| 28 }; | 25 }; |
| 29 | 26 |
| 30 // Type code for multi-value block types. | 27 // Type code for multi-value block types. |
| 31 static const uint8_t kMultivalBlock = 0x41; | 28 static const uint8_t kMultivalBlock = 0x41; |
| 32 | 29 |
| 33 // We reuse the internal machine type to represent WebAssembly types. | 30 // We reuse the internal machine type to represent WebAssembly types. |
| 34 // A typedef improves readability without adding a whole new type system. | 31 // A typedef improves readability without adding a whole new type system. |
| 35 using ValueType = MachineRepresentation; | 32 using ValueType = MachineRepresentation; |
| 36 constexpr ValueType kWasmStmt = MachineRepresentation::kNone; | 33 constexpr ValueType kWasmStmt = MachineRepresentation::kNone; |
| 37 constexpr ValueType kWasmI32 = MachineRepresentation::kWord32; | 34 constexpr ValueType kWasmI32 = MachineRepresentation::kWord32; |
| 38 constexpr ValueType kWasmI64 = MachineRepresentation::kWord64; | 35 constexpr ValueType kWasmI64 = MachineRepresentation::kWord64; |
| 39 constexpr ValueType kWasmF32 = MachineRepresentation::kFloat32; | 36 constexpr ValueType kWasmF32 = MachineRepresentation::kFloat32; |
| 40 constexpr ValueType kWasmF64 = MachineRepresentation::kFloat64; | 37 constexpr ValueType kWasmF64 = MachineRepresentation::kFloat64; |
| 41 constexpr ValueType kWasmS128 = MachineRepresentation::kSimd128; | 38 constexpr ValueType kWasmS128 = MachineRepresentation::kSimd128; |
| 42 constexpr ValueType kWasmS1x4 = MachineRepresentation::kSimd1x4; | |
| 43 constexpr ValueType kWasmS1x8 = MachineRepresentation::kSimd1x8; | |
| 44 constexpr ValueType kWasmS1x16 = MachineRepresentation::kSimd1x16; | |
| 45 constexpr ValueType kWasmVar = MachineRepresentation::kTagged; | 39 constexpr ValueType kWasmVar = MachineRepresentation::kTagged; |
| 46 | 40 |
| 47 using FunctionSig = Signature<ValueType>; | 41 using FunctionSig = Signature<ValueType>; |
| 48 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); | 42 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); |
| 49 bool IsJSCompatibleSignature(const FunctionSig* sig); | 43 bool IsJSCompatibleSignature(const FunctionSig* sig); |
| 50 | 44 |
| 51 using WasmName = Vector<const char>; | 45 using WasmName = Vector<const char>; |
| 52 | 46 |
| 53 using WasmCodePosition = int; | 47 using WasmCodePosition = int; |
| 54 constexpr WasmCodePosition kNoCodePosition = -1; | 48 constexpr WasmCodePosition kNoCodePosition = -1; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 V(F32x4Abs, 0xe503, s_s) \ | 281 V(F32x4Abs, 0xe503, s_s) \ |
| 288 V(F32x4Neg, 0xe504, s_s) \ | 282 V(F32x4Neg, 0xe504, s_s) \ |
| 289 V(F32x4RecipApprox, 0xe506, s_s) \ | 283 V(F32x4RecipApprox, 0xe506, s_s) \ |
| 290 V(F32x4RecipSqrtApprox, 0xe507, s_s) \ | 284 V(F32x4RecipSqrtApprox, 0xe507, s_s) \ |
| 291 V(F32x4Add, 0xe508, s_ss) \ | 285 V(F32x4Add, 0xe508, s_ss) \ |
| 292 V(F32x4AddHoriz, 0xe5b9, s_ss) \ | 286 V(F32x4AddHoriz, 0xe5b9, s_ss) \ |
| 293 V(F32x4Sub, 0xe509, s_ss) \ | 287 V(F32x4Sub, 0xe509, s_ss) \ |
| 294 V(F32x4Mul, 0xe50a, s_ss) \ | 288 V(F32x4Mul, 0xe50a, s_ss) \ |
| 295 V(F32x4Min, 0xe50c, s_ss) \ | 289 V(F32x4Min, 0xe50c, s_ss) \ |
| 296 V(F32x4Max, 0xe50d, s_ss) \ | 290 V(F32x4Max, 0xe50d, s_ss) \ |
| 297 V(F32x4Eq, 0xe510, s1x4_ss) \ | 291 V(F32x4Eq, 0xe510, s_ss) \ |
| 298 V(F32x4Ne, 0xe511, s1x4_ss) \ | 292 V(F32x4Ne, 0xe511, s_ss) \ |
| 299 V(F32x4Lt, 0xe512, s1x4_ss) \ | 293 V(F32x4Lt, 0xe512, s_ss) \ |
| 300 V(F32x4Le, 0xe513, s1x4_ss) \ | 294 V(F32x4Le, 0xe513, s_ss) \ |
| 301 V(F32x4Gt, 0xe514, s1x4_ss) \ | 295 V(F32x4Gt, 0xe514, s_ss) \ |
| 302 V(F32x4Ge, 0xe515, s1x4_ss) \ | 296 V(F32x4Ge, 0xe515, s_ss) \ |
| 303 V(F32x4SConvertI32x4, 0xe519, s_s) \ | 297 V(F32x4SConvertI32x4, 0xe519, s_s) \ |
| 304 V(F32x4UConvertI32x4, 0xe51a, s_s) \ | 298 V(F32x4UConvertI32x4, 0xe51a, s_s) \ |
| 305 V(I32x4Splat, 0xe51b, s_i) \ | 299 V(I32x4Splat, 0xe51b, s_i) \ |
| 306 V(I32x4Neg, 0xe51e, s_s) \ | 300 V(I32x4Neg, 0xe51e, s_s) \ |
| 307 V(I32x4Add, 0xe51f, s_ss) \ | 301 V(I32x4Add, 0xe51f, s_ss) \ |
| 308 V(I32x4AddHoriz, 0xe5ba, s_ss) \ | 302 V(I32x4AddHoriz, 0xe5ba, s_ss) \ |
| 309 V(I32x4Sub, 0xe520, s_ss) \ | 303 V(I32x4Sub, 0xe520, s_ss) \ |
| 310 V(I32x4Mul, 0xe521, s_ss) \ | 304 V(I32x4Mul, 0xe521, s_ss) \ |
| 311 V(I32x4MinS, 0xe522, s_ss) \ | 305 V(I32x4MinS, 0xe522, s_ss) \ |
| 312 V(I32x4MaxS, 0xe523, s_ss) \ | 306 V(I32x4MaxS, 0xe523, s_ss) \ |
| 313 V(I32x4Eq, 0xe526, s1x4_ss) \ | 307 V(I32x4Eq, 0xe526, s_ss) \ |
| 314 V(I32x4Ne, 0xe527, s1x4_ss) \ | 308 V(I32x4Ne, 0xe527, s_ss) \ |
| 315 V(I32x4LtS, 0xe528, s1x4_ss) \ | 309 V(I32x4LtS, 0xe528, s_ss) \ |
| 316 V(I32x4LeS, 0xe529, s1x4_ss) \ | 310 V(I32x4LeS, 0xe529, s_ss) \ |
| 317 V(I32x4GtS, 0xe52a, s1x4_ss) \ | 311 V(I32x4GtS, 0xe52a, s_ss) \ |
| 318 V(I32x4GeS, 0xe52b, s1x4_ss) \ | 312 V(I32x4GeS, 0xe52b, s_ss) \ |
| 319 V(I32x4SConvertF32x4, 0xe52f, s_s) \ | 313 V(I32x4SConvertF32x4, 0xe52f, s_s) \ |
| 320 V(I32x4UConvertF32x4, 0xe537, s_s) \ | 314 V(I32x4UConvertF32x4, 0xe537, s_s) \ |
| 321 V(I32x4SConvertI16x8Low, 0xe594, s_s) \ | 315 V(I32x4SConvertI16x8Low, 0xe594, s_s) \ |
| 322 V(I32x4SConvertI16x8High, 0xe595, s_s) \ | 316 V(I32x4SConvertI16x8High, 0xe595, s_s) \ |
| 323 V(I32x4UConvertI16x8Low, 0xe596, s_s) \ | 317 V(I32x4UConvertI16x8Low, 0xe596, s_s) \ |
| 324 V(I32x4UConvertI16x8High, 0xe597, s_s) \ | 318 V(I32x4UConvertI16x8High, 0xe597, s_s) \ |
| 325 V(I32x4MinU, 0xe530, s_ss) \ | 319 V(I32x4MinU, 0xe530, s_ss) \ |
| 326 V(I32x4MaxU, 0xe531, s_ss) \ | 320 V(I32x4MaxU, 0xe531, s_ss) \ |
| 327 V(I32x4LtU, 0xe533, s1x4_ss) \ | 321 V(I32x4LtU, 0xe533, s_ss) \ |
| 328 V(I32x4LeU, 0xe534, s1x4_ss) \ | 322 V(I32x4LeU, 0xe534, s_ss) \ |
| 329 V(I32x4GtU, 0xe535, s1x4_ss) \ | 323 V(I32x4GtU, 0xe535, s_ss) \ |
| 330 V(I32x4GeU, 0xe536, s1x4_ss) \ | 324 V(I32x4GeU, 0xe536, s_ss) \ |
| 331 V(I16x8Splat, 0xe538, s_i) \ | 325 V(I16x8Splat, 0xe538, s_i) \ |
| 332 V(I16x8Neg, 0xe53b, s_s) \ | 326 V(I16x8Neg, 0xe53b, s_s) \ |
| 333 V(I16x8Add, 0xe53c, s_ss) \ | 327 V(I16x8Add, 0xe53c, s_ss) \ |
| 334 V(I16x8AddSaturateS, 0xe53d, s_ss) \ | 328 V(I16x8AddSaturateS, 0xe53d, s_ss) \ |
| 335 V(I16x8AddHoriz, 0xe5bb, s_ss) \ | 329 V(I16x8AddHoriz, 0xe5bb, s_ss) \ |
| 336 V(I16x8Sub, 0xe53e, s_ss) \ | 330 V(I16x8Sub, 0xe53e, s_ss) \ |
| 337 V(I16x8SubSaturateS, 0xe53f, s_ss) \ | 331 V(I16x8SubSaturateS, 0xe53f, s_ss) \ |
| 338 V(I16x8Mul, 0xe540, s_ss) \ | 332 V(I16x8Mul, 0xe540, s_ss) \ |
| 339 V(I16x8MinS, 0xe541, s_ss) \ | 333 V(I16x8MinS, 0xe541, s_ss) \ |
| 340 V(I16x8MaxS, 0xe542, s_ss) \ | 334 V(I16x8MaxS, 0xe542, s_ss) \ |
| 341 V(I16x8Eq, 0xe545, s1x8_ss) \ | 335 V(I16x8Eq, 0xe545, s_ss) \ |
| 342 V(I16x8Ne, 0xe546, s1x8_ss) \ | 336 V(I16x8Ne, 0xe546, s_ss) \ |
| 343 V(I16x8LtS, 0xe547, s1x8_ss) \ | 337 V(I16x8LtS, 0xe547, s_ss) \ |
| 344 V(I16x8LeS, 0xe548, s1x8_ss) \ | 338 V(I16x8LeS, 0xe548, s_ss) \ |
| 345 V(I16x8GtS, 0xe549, s1x8_ss) \ | 339 V(I16x8GtS, 0xe549, s_ss) \ |
| 346 V(I16x8GeS, 0xe54a, s1x8_ss) \ | 340 V(I16x8GeS, 0xe54a, s_ss) \ |
| 347 V(I16x8AddSaturateU, 0xe54e, s_ss) \ | 341 V(I16x8AddSaturateU, 0xe54e, s_ss) \ |
| 348 V(I16x8SubSaturateU, 0xe54f, s_ss) \ | 342 V(I16x8SubSaturateU, 0xe54f, s_ss) \ |
| 349 V(I16x8MinU, 0xe550, s_ss) \ | 343 V(I16x8MinU, 0xe550, s_ss) \ |
| 350 V(I16x8MaxU, 0xe551, s_ss) \ | 344 V(I16x8MaxU, 0xe551, s_ss) \ |
| 351 V(I16x8LtU, 0xe553, s1x8_ss) \ | 345 V(I16x8LtU, 0xe553, s_ss) \ |
| 352 V(I16x8LeU, 0xe554, s1x8_ss) \ | 346 V(I16x8LeU, 0xe554, s_ss) \ |
| 353 V(I16x8GtU, 0xe555, s1x8_ss) \ | 347 V(I16x8GtU, 0xe555, s_ss) \ |
| 354 V(I16x8GeU, 0xe556, s1x8_ss) \ | 348 V(I16x8GeU, 0xe556, s_ss) \ |
| 355 V(I16x8SConvertI32x4, 0xe598, s_ss) \ | 349 V(I16x8SConvertI32x4, 0xe598, s_ss) \ |
| 356 V(I16x8UConvertI32x4, 0xe599, s_ss) \ | 350 V(I16x8UConvertI32x4, 0xe599, s_ss) \ |
| 357 V(I16x8SConvertI8x16Low, 0xe59a, s_s) \ | 351 V(I16x8SConvertI8x16Low, 0xe59a, s_s) \ |
| 358 V(I16x8SConvertI8x16High, 0xe59b, s_s) \ | 352 V(I16x8SConvertI8x16High, 0xe59b, s_s) \ |
| 359 V(I16x8UConvertI8x16Low, 0xe59c, s_s) \ | 353 V(I16x8UConvertI8x16Low, 0xe59c, s_s) \ |
| 360 V(I16x8UConvertI8x16High, 0xe59d, s_s) \ | 354 V(I16x8UConvertI8x16High, 0xe59d, s_s) \ |
| 361 V(I8x16Splat, 0xe557, s_i) \ | 355 V(I8x16Splat, 0xe557, s_i) \ |
| 362 V(I8x16Neg, 0xe55a, s_s) \ | 356 V(I8x16Neg, 0xe55a, s_s) \ |
| 363 V(I8x16Add, 0xe55b, s_ss) \ | 357 V(I8x16Add, 0xe55b, s_ss) \ |
| 364 V(I8x16AddSaturateS, 0xe55c, s_ss) \ | 358 V(I8x16AddSaturateS, 0xe55c, s_ss) \ |
| 365 V(I8x16Sub, 0xe55d, s_ss) \ | 359 V(I8x16Sub, 0xe55d, s_ss) \ |
| 366 V(I8x16SubSaturateS, 0xe55e, s_ss) \ | 360 V(I8x16SubSaturateS, 0xe55e, s_ss) \ |
| 367 V(I8x16Mul, 0xe55f, s_ss) \ | 361 V(I8x16Mul, 0xe55f, s_ss) \ |
| 368 V(I8x16MinS, 0xe560, s_ss) \ | 362 V(I8x16MinS, 0xe560, s_ss) \ |
| 369 V(I8x16MaxS, 0xe561, s_ss) \ | 363 V(I8x16MaxS, 0xe561, s_ss) \ |
| 370 V(I8x16Eq, 0xe564, s1x16_ss) \ | 364 V(I8x16Eq, 0xe564, s_ss) \ |
| 371 V(I8x16Ne, 0xe565, s1x16_ss) \ | 365 V(I8x16Ne, 0xe565, s_ss) \ |
| 372 V(I8x16LtS, 0xe566, s1x16_ss) \ | 366 V(I8x16LtS, 0xe566, s_ss) \ |
| 373 V(I8x16LeS, 0xe567, s1x16_ss) \ | 367 V(I8x16LeS, 0xe567, s_ss) \ |
| 374 V(I8x16GtS, 0xe568, s1x16_ss) \ | 368 V(I8x16GtS, 0xe568, s_ss) \ |
| 375 V(I8x16GeS, 0xe569, s1x16_ss) \ | 369 V(I8x16GeS, 0xe569, s_ss) \ |
| 376 V(I8x16AddSaturateU, 0xe56d, s_ss) \ | 370 V(I8x16AddSaturateU, 0xe56d, s_ss) \ |
| 377 V(I8x16SubSaturateU, 0xe56e, s_ss) \ | 371 V(I8x16SubSaturateU, 0xe56e, s_ss) \ |
| 378 V(I8x16MinU, 0xe56f, s_ss) \ | 372 V(I8x16MinU, 0xe56f, s_ss) \ |
| 379 V(I8x16MaxU, 0xe570, s_ss) \ | 373 V(I8x16MaxU, 0xe570, s_ss) \ |
| 380 V(I8x16LtU, 0xe572, s1x16_ss) \ | 374 V(I8x16LtU, 0xe572, s_ss) \ |
| 381 V(I8x16LeU, 0xe573, s1x16_ss) \ | 375 V(I8x16LeU, 0xe573, s_ss) \ |
| 382 V(I8x16GtU, 0xe574, s1x16_ss) \ | 376 V(I8x16GtU, 0xe574, s_ss) \ |
| 383 V(I8x16GeU, 0xe575, s1x16_ss) \ | 377 V(I8x16GeU, 0xe575, s_ss) \ |
| 384 V(I8x16SConvertI16x8, 0xe59e, s_ss) \ | 378 V(I8x16SConvertI16x8, 0xe59e, s_ss) \ |
| 385 V(I8x16UConvertI16x8, 0xe59f, s_ss) \ | 379 V(I8x16UConvertI16x8, 0xe59f, s_ss) \ |
| 386 V(S128And, 0xe576, s_ss) \ | 380 V(S128And, 0xe576, s_ss) \ |
| 387 V(S128Or, 0xe577, s_ss) \ | 381 V(S128Or, 0xe577, s_ss) \ |
| 388 V(S128Xor, 0xe578, s_ss) \ | 382 V(S128Xor, 0xe578, s_ss) \ |
| 389 V(S128Not, 0xe579, s_s) \ | 383 V(S128Not, 0xe579, s_s) \ |
| 390 V(S32x4Select, 0xe52c, s_s1x4ss) \ | 384 V(S128Select, 0xe52c, s_sss) \ |
| 391 V(S16x8Select, 0xe54b, s_s1x8ss) \ | 385 V(S1x4AnyTrue, 0xe584, i_s) \ |
| 392 V(S8x16Select, 0xe56a, s_s1x16ss) \ | 386 V(S1x4AllTrue, 0xe585, i_s) \ |
| 393 V(S1x4And, 0xe580, s1x4_s1x4s1x4) \ | 387 V(S1x8AnyTrue, 0xe58a, i_s) \ |
| 394 V(S1x4Or, 0xe581, s1x4_s1x4s1x4) \ | 388 V(S1x8AllTrue, 0xe58b, i_s) \ |
| 395 V(S1x4Xor, 0xe582, s1x4_s1x4s1x4) \ | 389 V(S1x16AnyTrue, 0xe590, i_s) \ |
| 396 V(S1x4Not, 0xe583, s1x4_s1x4) \ | 390 V(S1x16AllTrue, 0xe591, i_s) |
| 397 V(S1x4AnyTrue, 0xe584, i_s1x4) \ | |
| 398 V(S1x4AllTrue, 0xe585, i_s1x4) \ | |
| 399 V(S1x8And, 0xe586, s1x8_s1x8s1x8) \ | |
| 400 V(S1x8Or, 0xe587, s1x8_s1x8s1x8) \ | |
| 401 V(S1x8Xor, 0xe588, s1x8_s1x8s1x8) \ | |
| 402 V(S1x8Not, 0xe589, s1x8_s1x8) \ | |
| 403 V(S1x8AnyTrue, 0xe58a, i_s1x8) \ | |
| 404 V(S1x8AllTrue, 0xe58b, i_s1x8) \ | |
| 405 V(S1x16And, 0xe58c, s1x16_s1x16s1x16) \ | |
| 406 V(S1x16Or, 0xe58d, s1x16_s1x16s1x16) \ | |
| 407 V(S1x16Xor, 0xe58e, s1x16_s1x16s1x16) \ | |
| 408 V(S1x16Not, 0xe58f, s1x16_s1x16) \ | |
| 409 V(S1x16AnyTrue, 0xe590, i_s1x16) \ | |
| 410 V(S1x16AllTrue, 0xe591, i_s1x16) | |
| 411 | 391 |
| 412 #define FOREACH_SIMD_1_OPERAND_OPCODE(V) \ | 392 #define FOREACH_SIMD_1_OPERAND_OPCODE(V) \ |
| 413 V(F32x4ExtractLane, 0xe501, _) \ | 393 V(F32x4ExtractLane, 0xe501, _) \ |
| 414 V(F32x4ReplaceLane, 0xe502, _) \ | 394 V(F32x4ReplaceLane, 0xe502, _) \ |
| 415 V(I32x4ExtractLane, 0xe51c, _) \ | 395 V(I32x4ExtractLane, 0xe51c, _) \ |
| 416 V(I32x4ReplaceLane, 0xe51d, _) \ | 396 V(I32x4ReplaceLane, 0xe51d, _) \ |
| 417 V(I32x4Shl, 0xe524, _) \ | 397 V(I32x4Shl, 0xe524, _) \ |
| 418 V(I32x4ShrS, 0xe525, _) \ | 398 V(I32x4ShrS, 0xe525, _) \ |
| 419 V(I32x4ShrU, 0xe532, _) \ | 399 V(I32x4ShrU, 0xe532, _) \ |
| 420 V(I16x8ExtractLane, 0xe539, _) \ | 400 V(I16x8ExtractLane, 0xe539, _) \ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 V(f_l, kWasmF32, kWasmI64) \ | 488 V(f_l, kWasmF32, kWasmI64) \ |
| 509 V(d_dd, kWasmF64, kWasmF64, kWasmF64) \ | 489 V(d_dd, kWasmF64, kWasmF64, kWasmF64) \ |
| 510 V(d_d, kWasmF64, kWasmF64) \ | 490 V(d_d, kWasmF64, kWasmF64) \ |
| 511 V(d_f, kWasmF64, kWasmF32) \ | 491 V(d_f, kWasmF64, kWasmF32) \ |
| 512 V(d_i, kWasmF64, kWasmI32) \ | 492 V(d_i, kWasmF64, kWasmI32) \ |
| 513 V(d_l, kWasmF64, kWasmI64) \ | 493 V(d_l, kWasmF64, kWasmI64) \ |
| 514 V(d_id, kWasmF64, kWasmI32, kWasmF64) \ | 494 V(d_id, kWasmF64, kWasmI32, kWasmF64) \ |
| 515 V(f_if, kWasmF32, kWasmI32, kWasmF32) \ | 495 V(f_if, kWasmF32, kWasmI32, kWasmF32) \ |
| 516 V(l_il, kWasmI64, kWasmI32, kWasmI64) | 496 V(l_il, kWasmI64, kWasmI32, kWasmI64) |
| 517 | 497 |
| 518 #define FOREACH_SIMD_SIGNATURE(V) \ | 498 #define FOREACH_SIMD_SIGNATURE(V) \ |
| 519 V(s_s, kWasmS128, kWasmS128) \ | 499 V(s_s, kWasmS128, kWasmS128) \ |
| 520 V(s_f, kWasmS128, kWasmF32) \ | 500 V(s_f, kWasmS128, kWasmF32) \ |
| 521 V(s_ss, kWasmS128, kWasmS128, kWasmS128) \ | 501 V(s_ss, kWasmS128, kWasmS128, kWasmS128) \ |
| 522 V(s1x4_ss, kWasmS1x4, kWasmS128, kWasmS128) \ | 502 V(s_i, kWasmS128, kWasmI32) \ |
| 523 V(s1x8_ss, kWasmS1x8, kWasmS128, kWasmS128) \ | 503 V(s_si, kWasmS128, kWasmS128, kWasmI32) \ |
| 524 V(s1x16_ss, kWasmS1x16, kWasmS128, kWasmS128) \ | 504 V(i_s, kWasmI32, kWasmS128) \ |
| 525 V(s_i, kWasmS128, kWasmI32) \ | 505 V(s_sss, kWasmS128, kWasmS128, kWasmS128, kWasmS128) |
| 526 V(s_si, kWasmS128, kWasmS128, kWasmI32) \ | |
| 527 V(i_s, kWasmI32, kWasmS128) \ | |
| 528 V(i_s1x4, kWasmI32, kWasmS1x4) \ | |
| 529 V(i_s1x8, kWasmI32, kWasmS1x8) \ | |
| 530 V(i_s1x16, kWasmI32, kWasmS1x16) \ | |
| 531 V(s_s1x4ss, kWasmS128, kWasmS1x4, kWasmS128, kWasmS128) \ | |
| 532 V(s_s1x8ss, kWasmS128, kWasmS1x8, kWasmS128, kWasmS128) \ | |
| 533 V(s_s1x16ss, kWasmS128, kWasmS1x16, kWasmS128, kWasmS128) \ | |
| 534 V(s1x4_s1x4, kWasmS1x4, kWasmS1x4) \ | |
| 535 V(s1x4_s1x4s1x4, kWasmS1x4, kWasmS1x4, kWasmS1x4) \ | |
| 536 V(s1x8_s1x8, kWasmS1x8, kWasmS1x8) \ | |
| 537 V(s1x8_s1x8s1x8, kWasmS1x8, kWasmS1x8, kWasmS1x8) \ | |
| 538 V(s1x16_s1x16, kWasmS1x16, kWasmS1x16) \ | |
| 539 V(s1x16_s1x16s1x16, kWasmS1x16, kWasmS1x16, kWasmS1x16) | |
| 540 | 506 |
| 541 #define FOREACH_PREFIX(V) \ | 507 #define FOREACH_PREFIX(V) \ |
| 542 V(Simd, 0xe5) \ | 508 V(Simd, 0xe5) \ |
| 543 V(Atomic, 0xe6) | 509 V(Atomic, 0xe6) |
| 544 | 510 |
| 545 enum WasmOpcode { | 511 enum WasmOpcode { |
| 546 // Declare expression opcodes. | 512 // Declare expression opcodes. |
| 547 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, | 513 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, |
| 548 FOREACH_OPCODE(DECLARE_NAMED_ENUM) | 514 FOREACH_OPCODE(DECLARE_NAMED_ENUM) |
| 549 #undef DECLARE_NAMED_ENUM | 515 #undef DECLARE_NAMED_ENUM |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 case kWasmI32: | 563 case kWasmI32: |
| 598 return kLocalI32; | 564 return kLocalI32; |
| 599 case kWasmI64: | 565 case kWasmI64: |
| 600 return kLocalI64; | 566 return kLocalI64; |
| 601 case kWasmF32: | 567 case kWasmF32: |
| 602 return kLocalF32; | 568 return kLocalF32; |
| 603 case kWasmF64: | 569 case kWasmF64: |
| 604 return kLocalF64; | 570 return kLocalF64; |
| 605 case kWasmS128: | 571 case kWasmS128: |
| 606 return kLocalS128; | 572 return kLocalS128; |
| 607 case kWasmS1x4: | |
| 608 return kLocalS1x4; | |
| 609 case kWasmS1x8: | |
| 610 return kLocalS1x8; | |
| 611 case kWasmS1x16: | |
| 612 return kLocalS1x16; | |
| 613 case kWasmStmt: | 573 case kWasmStmt: |
| 614 return kLocalVoid; | 574 return kLocalVoid; |
| 615 default: | 575 default: |
| 616 UNREACHABLE(); | 576 UNREACHABLE(); |
| 617 } | 577 } |
| 618 } | 578 } |
| 619 | 579 |
| 620 static MachineType MachineTypeFor(ValueType type) { | 580 static MachineType MachineTypeFor(ValueType type) { |
| 621 switch (type) { | 581 switch (type) { |
| 622 case kWasmI32: | 582 case kWasmI32: |
| 623 return MachineType::Int32(); | 583 return MachineType::Int32(); |
| 624 case kWasmI64: | 584 case kWasmI64: |
| 625 return MachineType::Int64(); | 585 return MachineType::Int64(); |
| 626 case kWasmF32: | 586 case kWasmF32: |
| 627 return MachineType::Float32(); | 587 return MachineType::Float32(); |
| 628 case kWasmF64: | 588 case kWasmF64: |
| 629 return MachineType::Float64(); | 589 return MachineType::Float64(); |
| 630 case kWasmS128: | 590 case kWasmS128: |
| 631 return MachineType::Simd128(); | 591 return MachineType::Simd128(); |
| 632 case kWasmS1x4: | |
| 633 return MachineType::Simd1x4(); | |
| 634 case kWasmS1x8: | |
| 635 return MachineType::Simd1x8(); | |
| 636 case kWasmS1x16: | |
| 637 return MachineType::Simd1x16(); | |
| 638 case kWasmStmt: | 592 case kWasmStmt: |
| 639 return MachineType::None(); | 593 return MachineType::None(); |
| 640 default: | 594 default: |
| 641 UNREACHABLE(); | 595 UNREACHABLE(); |
| 642 } | 596 } |
| 643 } | 597 } |
| 644 | 598 |
| 645 static ValueType ValueTypeFor(MachineType type) { | 599 static ValueType ValueTypeFor(MachineType type) { |
| 646 switch (type.representation()) { | 600 switch (type.representation()) { |
| 647 case MachineRepresentation::kWord8: | 601 case MachineRepresentation::kWord8: |
| 648 case MachineRepresentation::kWord16: | 602 case MachineRepresentation::kWord16: |
| 649 case MachineRepresentation::kWord32: | 603 case MachineRepresentation::kWord32: |
| 650 return kWasmI32; | 604 return kWasmI32; |
| 651 case MachineRepresentation::kWord64: | 605 case MachineRepresentation::kWord64: |
| 652 return kWasmI64; | 606 return kWasmI64; |
| 653 case MachineRepresentation::kFloat32: | 607 case MachineRepresentation::kFloat32: |
| 654 return kWasmF32; | 608 return kWasmF32; |
| 655 case MachineRepresentation::kFloat64: | 609 case MachineRepresentation::kFloat64: |
| 656 return kWasmF64; | 610 return kWasmF64; |
| 657 case MachineRepresentation::kSimd128: | 611 case MachineRepresentation::kSimd128: |
| 658 return kWasmS128; | 612 return kWasmS128; |
| 659 case MachineRepresentation::kSimd1x4: | |
| 660 return kWasmS1x4; | |
| 661 case MachineRepresentation::kSimd1x8: | |
| 662 return kWasmS1x8; | |
| 663 case MachineRepresentation::kSimd1x16: | |
| 664 return kWasmS1x16; | |
| 665 default: | 613 default: |
| 666 UNREACHABLE(); | 614 UNREACHABLE(); |
| 667 } | 615 } |
| 668 } | 616 } |
| 669 | 617 |
| 670 static char ShortNameOf(ValueType type) { | 618 static char ShortNameOf(ValueType type) { |
| 671 switch (type) { | 619 switch (type) { |
| 672 case kWasmI32: | 620 case kWasmI32: |
| 673 return 'i'; | 621 return 'i'; |
| 674 case kWasmI64: | 622 case kWasmI64: |
| 675 return 'l'; | 623 return 'l'; |
| 676 case kWasmF32: | 624 case kWasmF32: |
| 677 return 'f'; | 625 return 'f'; |
| 678 case kWasmF64: | 626 case kWasmF64: |
| 679 return 'd'; | 627 return 'd'; |
| 680 case kWasmS128: | 628 case kWasmS128: |
| 681 case kWasmS1x4: | |
| 682 case kWasmS1x8: | |
| 683 case kWasmS1x16: | |
| 684 return 's'; | 629 return 's'; |
| 685 case kWasmStmt: | 630 case kWasmStmt: |
| 686 return 'v'; | 631 return 'v'; |
| 687 case kWasmVar: | 632 case kWasmVar: |
| 688 return '*'; | 633 return '*'; |
| 689 default: | 634 default: |
| 690 return '?'; | 635 return '?'; |
| 691 } | 636 } |
| 692 } | 637 } |
| 693 | 638 |
| 694 static const char* TypeName(ValueType type) { | 639 static const char* TypeName(ValueType type) { |
| 695 switch (type) { | 640 switch (type) { |
| 696 case kWasmI32: | 641 case kWasmI32: |
| 697 return "i32"; | 642 return "i32"; |
| 698 case kWasmI64: | 643 case kWasmI64: |
| 699 return "i64"; | 644 return "i64"; |
| 700 case kWasmF32: | 645 case kWasmF32: |
| 701 return "f32"; | 646 return "f32"; |
| 702 case kWasmF64: | 647 case kWasmF64: |
| 703 return "f64"; | 648 return "f64"; |
| 704 case kWasmS128: | 649 case kWasmS128: |
| 705 return "s128"; | 650 return "s128"; |
| 706 case kWasmS1x4: | |
| 707 return "s1x4"; | |
| 708 case kWasmS1x8: | |
| 709 return "s1x8"; | |
| 710 case kWasmS1x16: | |
| 711 return "s1x16"; | |
| 712 case kWasmStmt: | 651 case kWasmStmt: |
| 713 return "<stmt>"; | 652 return "<stmt>"; |
| 714 case kWasmVar: | 653 case kWasmVar: |
| 715 return "<var>"; | 654 return "<var>"; |
| 716 default: | 655 default: |
| 717 return "<unknown>"; | 656 return "<unknown>"; |
| 718 } | 657 } |
| 719 } | 658 } |
| 720 }; | 659 }; |
| 721 } // namespace wasm | 660 } // namespace wasm |
| 722 } // namespace internal | 661 } // namespace internal |
| 723 } // namespace v8 | 662 } // namespace v8 |
| 724 | 663 |
| 725 #endif // V8_WASM_OPCODES_H_ | 664 #endif // V8_WASM_OPCODES_H_ |
| OLD | NEW |