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

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

Issue 2562393002: [wasm] Introduce the TrapIf and TrapUnless operators to generate trap code. (Closed)
Patch Set: Rename UseSourcePosition to IsSourcePositionUsed Created 4 years 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/wasm-external-refs.cc ('k') | src/wasm/wasm-opcodes.cc » ('j') | 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/globals.h" 8 #include "src/globals.h"
9 #include "src/machine-type.h" 9 #include "src/machine-type.h"
10 #include "src/signature.h" 10 #include "src/signature.h"
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 505
506 // The reason for a trap. 506 // The reason for a trap.
507 #define FOREACH_WASM_TRAPREASON(V) \ 507 #define FOREACH_WASM_TRAPREASON(V) \
508 V(TrapUnreachable) \ 508 V(TrapUnreachable) \
509 V(TrapMemOutOfBounds) \ 509 V(TrapMemOutOfBounds) \
510 V(TrapDivByZero) \ 510 V(TrapDivByZero) \
511 V(TrapDivUnrepresentable) \ 511 V(TrapDivUnrepresentable) \
512 V(TrapRemByZero) \ 512 V(TrapRemByZero) \
513 V(TrapFloatUnrepresentable) \ 513 V(TrapFloatUnrepresentable) \
514 V(TrapFuncInvalid) \ 514 V(TrapFuncInvalid) \
515 V(TrapFuncSigMismatch) \ 515 V(TrapFuncSigMismatch)
516 V(TrapInvalidIndex)
517 516
518 enum TrapReason { 517 enum TrapReason {
519 #define DECLARE_ENUM(name) k##name, 518 #define DECLARE_ENUM(name) k##name,
520 FOREACH_WASM_TRAPREASON(DECLARE_ENUM) 519 FOREACH_WASM_TRAPREASON(DECLARE_ENUM)
521 kTrapCount 520 kTrapCount
522 #undef DECLARE_ENUM 521 #undef DECLARE_ENUM
523 }; 522 };
524 523
525 // A collection of opcode-related static methods. 524 // A collection of opcode-related static methods.
526 class V8_EXPORT_PRIVATE WasmOpcodes { 525 class V8_EXPORT_PRIVATE WasmOpcodes {
527 public: 526 public:
528 static const char* OpcodeName(WasmOpcode opcode); 527 static const char* OpcodeName(WasmOpcode opcode);
529 static const char* ShortOpcodeName(WasmOpcode opcode); 528 static const char* ShortOpcodeName(WasmOpcode opcode);
530 static FunctionSig* Signature(WasmOpcode opcode); 529 static FunctionSig* Signature(WasmOpcode opcode);
531 static FunctionSig* AsmjsSignature(WasmOpcode opcode); 530 static FunctionSig* AsmjsSignature(WasmOpcode opcode);
532 static FunctionSig* AtomicSignature(WasmOpcode opcode); 531 static FunctionSig* AtomicSignature(WasmOpcode opcode);
533 static bool IsPrefixOpcode(WasmOpcode opcode); 532 static bool IsPrefixOpcode(WasmOpcode opcode);
534 533
535 static int TrapReasonToMessageId(TrapReason reason); 534 static int TrapReasonToMessageId(TrapReason reason);
536 static const char* TrapReasonMessage(TrapReason reason); 535 static const char* TrapReasonMessage(TrapReason reason);
536 static int32_t TrapReasonToFunctionId(TrapReason reason);
537 537
538 static byte MemSize(MachineType type) { 538 static byte MemSize(MachineType type) {
539 return 1 << ElementSizeLog2Of(type.representation()); 539 return 1 << ElementSizeLog2Of(type.representation());
540 } 540 }
541 541
542 static byte MemSize(LocalType type) { return 1 << ElementSizeLog2Of(type); } 542 static byte MemSize(LocalType type) { return 1 << ElementSizeLog2Of(type); }
543 543
544 static LocalTypeCode LocalTypeCodeFor(LocalType type) { 544 static LocalTypeCode LocalTypeCodeFor(LocalType type) {
545 switch (type) { 545 switch (type) {
546 case kAstI32: 546 case kAstI32:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 default: 678 default:
679 return "<unknown>"; 679 return "<unknown>";
680 } 680 }
681 } 681 }
682 }; 682 };
683 } // namespace wasm 683 } // namespace wasm
684 } // namespace internal 684 } // namespace internal
685 } // namespace v8 685 } // namespace v8
686 686
687 #endif // V8_WASM_OPCODES_H_ 687 #endif // V8_WASM_OPCODES_H_
OLDNEW
« no previous file with comments | « src/wasm/wasm-external-refs.cc ('k') | src/wasm/wasm-opcodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698