1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "src/builtins/builtins-utils-gen.h"
6 #include "src/code-stub-assembler.h"
7 #include "src/objects-inl.h"
8 #include "src/wasm/wasm-opcodes.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 typedef compiler::Node Node;
14 
TF_BUILTIN(WasmStackGuard,CodeStubAssembler)15 TF_BUILTIN(WasmStackGuard, CodeStubAssembler) {
16   TailCallRuntime(Runtime::kWasmStackGuard, NoContextConstant());
17 }
18 
19 #define DECLARE_ENUM(name)                                                    \
20   TF_BUILTIN(ThrowWasm##name, CodeStubAssembler) {                            \
21     int message_id = wasm::WasmOpcodes::TrapReasonToMessageId(wasm::k##name); \
22     TailCallRuntime(Runtime::kThrowWasmError, NoContextConstant(),            \
23                     SmiConstant(message_id));                                 \
24   }
25 FOREACH_WASM_TRAPREASON(DECLARE_ENUM)
26 #undef DECLARE_ENUM
27 
28 }  // namespace internal
29 }  // namespace v8
30