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_MACRO_GEN_H_ | 5 #ifndef V8_WASM_MACRO_GEN_H_ |
6 #define V8_WASM_MACRO_GEN_H_ | 6 #define V8_WASM_MACRO_GEN_H_ |
7 | 7 |
8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 | 9 |
10 #include "src/zone/zone-containers.h" | 10 #include "src/zone/zone-containers.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 static_cast<byte>( \ | 415 static_cast<byte>( \ |
416 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 416 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
417 alignment, ZERO_OFFSET | 417 alignment, ZERO_OFFSET |
418 | 418 |
419 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) | 419 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) |
420 #define WASM_CALL_FUNCTION(index, ...) \ | 420 #define WASM_CALL_FUNCTION(index, ...) \ |
421 __VA_ARGS__, kExprCallFunction, static_cast<byte>(index) | 421 __VA_ARGS__, kExprCallFunction, static_cast<byte>(index) |
422 | 422 |
423 // TODO(titzer): change usages of these macros to put func last. | 423 // TODO(titzer): change usages of these macros to put func last. |
424 #define WASM_CALL_INDIRECT0(index, func) \ | 424 #define WASM_CALL_INDIRECT0(index, func) \ |
425 func, kExprCallIndirect, static_cast<byte>(index) | 425 func, kExprCallIndirect, 0, static_cast<byte>(index) |
426 #define WASM_CALL_INDIRECT1(index, func, a) \ | 426 #define WASM_CALL_INDIRECT1(index, func, a) \ |
427 a, func, kExprCallIndirect, static_cast<byte>(index) | 427 a, func, kExprCallIndirect, 0, static_cast<byte>(index) |
428 #define WASM_CALL_INDIRECT2(index, func, a, b) \ | 428 #define WASM_CALL_INDIRECT2(index, func, a, b) \ |
429 a, b, func, kExprCallIndirect, static_cast<byte>(index) | 429 a, b, func, kExprCallIndirect, 0, static_cast<byte>(index) |
430 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ | 430 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ |
431 a, b, c, func, kExprCallIndirect, static_cast<byte>(index) | 431 a, b, c, func, kExprCallIndirect, 0, static_cast<byte>(index) |
432 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ | 432 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ |
433 a, b, c, d, func, kExprCallIndirect, static_cast<byte>(index) | 433 a, b, c, d, func, kExprCallIndirect, 0, static_cast<byte>(index) |
434 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ | 434 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ |
435 a, b, c, d, e, func, kExprCallIndirect, static_cast<byte>(index) | 435 a, b, c, d, e, func, kExprCallIndirect, 0, static_cast<byte>(index) |
436 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ | 436 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ |
437 __VA_ARGS__, func, kExprCallIndirect, static_cast<byte>(index) | 437 __VA_ARGS__, func, kExprCallIndirect, 0, static_cast<byte>(index) |
438 | 438 |
439 #define WASM_NOT(x) x, kExprI32Eqz | 439 #define WASM_NOT(x) x, kExprI32Eqz |
440 #define WASM_SEQ(...) __VA_ARGS__ | 440 #define WASM_SEQ(...) __VA_ARGS__ |
441 | 441 |
442 //------------------------------------------------------------------------------ | 442 //------------------------------------------------------------------------------ |
443 // Constructs that are composed of multiple bytecodes. | 443 // Constructs that are composed of multiple bytecodes. |
444 //------------------------------------------------------------------------------ | 444 //------------------------------------------------------------------------------ |
445 #define WASM_WHILE(x, y) \ | 445 #define WASM_WHILE(x, y) \ |
446 kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \ | 446 kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \ |
447 kExprEnd, kExprEnd | 447 kExprEnd, kExprEnd |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 #define WASM_F64_SCONVERT_I64(x) x, kExprF64SConvertI64 | 598 #define WASM_F64_SCONVERT_I64(x) x, kExprF64SConvertI64 |
599 #define WASM_F64_UCONVERT_I64(x) x, kExprF64UConvertI64 | 599 #define WASM_F64_UCONVERT_I64(x) x, kExprF64UConvertI64 |
600 #define WASM_F64_CONVERT_F32(x) x, kExprF64ConvertF32 | 600 #define WASM_F64_CONVERT_F32(x) x, kExprF64ConvertF32 |
601 #define WASM_F64_REINTERPRET_I64(x) x, kExprF64ReinterpretI64 | 601 #define WASM_F64_REINTERPRET_I64(x) x, kExprF64ReinterpretI64 |
602 #define WASM_I32_REINTERPRET_F32(x) x, kExprI32ReinterpretF32 | 602 #define WASM_I32_REINTERPRET_F32(x) x, kExprI32ReinterpretF32 |
603 #define WASM_I64_REINTERPRET_F64(x) x, kExprI64ReinterpretF64 | 603 #define WASM_I64_REINTERPRET_F64(x) x, kExprI64ReinterpretF64 |
604 | 604 |
605 //------------------------------------------------------------------------------ | 605 //------------------------------------------------------------------------------ |
606 // Memory Operations. | 606 // Memory Operations. |
607 //------------------------------------------------------------------------------ | 607 //------------------------------------------------------------------------------ |
608 #define WASM_GROW_MEMORY(x) x, kExprGrowMemory | 608 #define WASM_GROW_MEMORY(x) x, kExprGrowMemory, 0 |
609 #define WASM_MEMORY_SIZE kExprMemorySize | 609 #define WASM_MEMORY_SIZE kExprMemorySize, 0 |
610 | 610 |
611 //------------------------------------------------------------------------------ | 611 //------------------------------------------------------------------------------ |
612 // Simd Operations. | 612 // Simd Operations. |
613 //------------------------------------------------------------------------------ | 613 //------------------------------------------------------------------------------ |
614 #define WASM_SIMD_I32x4_SPLAT(x) x, kSimdPrefix, kExprI32x4Splat & 0xff | 614 #define WASM_SIMD_I32x4_SPLAT(x) x, kSimdPrefix, kExprI32x4Splat & 0xff |
615 #define WASM_SIMD_I32x4_EXTRACT_LANE(lane, x) \ | 615 #define WASM_SIMD_I32x4_EXTRACT_LANE(lane, x) \ |
616 x, kSimdPrefix, kExprI32x4ExtractLane & 0xff, static_cast<byte>(lane) | 616 x, kSimdPrefix, kExprI32x4ExtractLane & 0xff, static_cast<byte>(lane) |
617 #define WASM_SIMD_I32x4_ADD(x, y) x, y, kSimdPrefix, kExprI32x4Add & 0xff | 617 #define WASM_SIMD_I32x4_ADD(x, y) x, y, kSimdPrefix, kExprI32x4Add & 0xff |
618 #define WASM_SIMD_F32x4_SPLAT(x) x, kSimdPrefix, kExprF32x4Splat & 0xff | 618 #define WASM_SIMD_F32x4_SPLAT(x) x, kSimdPrefix, kExprF32x4Splat & 0xff |
619 #define WASM_SIMD_F32x4_EXTRACT_LANE(lane, x) \ | 619 #define WASM_SIMD_F32x4_EXTRACT_LANE(lane, x) \ |
(...skipping 22 matching lines...) Expand all Loading... |
642 #define WASM_BRV(depth, val) val, kExprBr, static_cast<byte>(depth) | 642 #define WASM_BRV(depth, val) val, kExprBr, static_cast<byte>(depth) |
643 #define WASM_BRV_IF(depth, val, cond) \ | 643 #define WASM_BRV_IF(depth, val, cond) \ |
644 val, cond, kExprBrIf, static_cast<byte>(depth) | 644 val, cond, kExprBrIf, static_cast<byte>(depth) |
645 #define WASM_BRV_IFD(depth, val, cond) \ | 645 #define WASM_BRV_IFD(depth, val, cond) \ |
646 val, cond, kExprBrIf, static_cast<byte>(depth), kExprDrop | 646 val, cond, kExprBrIf, static_cast<byte>(depth), kExprDrop |
647 #define WASM_IFB(cond, ...) cond, kExprIf, kLocalVoid, __VA_ARGS__, kExprEnd | 647 #define WASM_IFB(cond, ...) cond, kExprIf, kLocalVoid, __VA_ARGS__, kExprEnd |
648 #define WASM_BR_TABLEV(val, key, count, ...) \ | 648 #define WASM_BR_TABLEV(val, key, count, ...) \ |
649 val, key, kExprBrTable, U32V_1(count), __VA_ARGS__ | 649 val, key, kExprBrTable, U32V_1(count), __VA_ARGS__ |
650 | 650 |
651 #endif // V8_WASM_MACRO_GEN_H_ | 651 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |