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

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

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-opcodes.h ('k') | test/cctest/wasm/test-run-wasm.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 #include "src/wasm/wasm-opcodes.h" 5 #include "src/wasm/wasm-opcodes.h"
6 #include "src/messages.h" 6 #include "src/messages.h"
7 #include "src/runtime/runtime.h"
7 #include "src/signature.h" 8 #include "src/signature.h"
8 9
9 namespace v8 { 10 namespace v8 {
10 namespace internal { 11 namespace internal {
11 namespace wasm { 12 namespace wasm {
12 13
13 typedef Signature<LocalType> FunctionSig; 14 typedef Signature<LocalType> FunctionSig;
14 15
15 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { 16 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
16 switch (opcode) { 17 switch (opcode) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 #define TRAPREASON_TO_MESSAGE(name) \ 169 #define TRAPREASON_TO_MESSAGE(name) \
169 case k##name: \ 170 case k##name: \
170 return MessageTemplate::kWasm##name; 171 return MessageTemplate::kWasm##name;
171 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) 172 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE)
172 #undef TRAPREASON_TO_MESSAGE 173 #undef TRAPREASON_TO_MESSAGE
173 default: 174 default:
174 return MessageTemplate::kNone; 175 return MessageTemplate::kNone;
175 } 176 }
176 } 177 }
177 178
179 int32_t WasmOpcodes::TrapReasonToFunctionId(TrapReason reason) {
180 switch (reason) {
181 #define TRAPREASON_TO_MESSAGE(name) \
182 case k##name: \
183 return static_cast<int32_t>(Runtime::kThrowWasm##name);
184 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE)
185 #undef TRAPREASON_TO_MESSAGE
186 default:
187 UNREACHABLE();
188 return -1;
189 }
190 }
191
178 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { 192 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) {
179 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); 193 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason));
180 } 194 }
181 } // namespace wasm 195 } // namespace wasm
182 } // namespace internal 196 } // namespace internal
183 } // namespace v8 197 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698