blob: 177ca7b78f110c3cc5b9bd4a00528f9352424482 [file] [log] [blame]
Rubin Xu7bc1b612021-02-16 09:38:50 +00001// Copyright 2018 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#ifndef V8_WASM_BASELINE_LIFTOFF_COMPILER_H_
6#define V8_WASM_BASELINE_LIFTOFF_COMPILER_H_
7
8#include "src/wasm/function-compiler.h"
9
10namespace v8 {
11namespace internal {
12
13class AccountingAllocator;
14class Counters;
15
16namespace wasm {
17
18struct CompilationEnv;
19class DebugSideTable;
20struct FunctionBody;
21class WasmFeatures;
22
23// Note: If this list changes, also the histogram "V8.LiftoffBailoutReasons"
24// on the chromium side needs to be updated.
25// Deprecating entries is always fine. Repurposing works if you don't care about
26// temporary mix-ups. Increasing the number of reasons {kNumBailoutReasons} is
27// more tricky, and might require introducing a new (updated) histogram.
28enum LiftoffBailoutReason : int8_t {
29 // Nothing actually failed.
30 kSuccess = 0,
31 // Compilation failed, but not because of Liftoff.
32 kDecodeError = 1,
33 // Liftoff is not implemented on that architecture.
34 kUnsupportedArchitecture = 2,
35 // More complex code would be needed because a CPU feature is not present.
36 kMissingCPUFeature = 3,
37 // Liftoff does not implement a complex (and rare) instruction.
38 kComplexOperation = 4,
39 // Unimplemented proposals:
40 kSimd = 5,
41 kRefTypes = 6,
42 kExceptionHandling = 7,
43 kMultiValue = 8,
44 kTailCall = 9,
45 kAtomics = 10,
46 kBulkMemory = 11,
47 kNonTrappingFloatToInt = 12,
48 kGC = 13,
49 // A little gap, for forward compatibility.
50 // Any other reason (use rarely; introduce new reasons if this spikes).
51 kOtherReason = 20,
52 // Marker:
53 kNumBailoutReasons
54};
55
56V8_EXPORT_PRIVATE WasmCompilationResult ExecuteLiftoffCompilation(
57 AccountingAllocator*, CompilationEnv*, const FunctionBody&, int func_index,
58 ForDebugging, Counters*, WasmFeatures* detected_features,
59 Vector<int> breakpoints = {}, std::unique_ptr<DebugSideTable>* = nullptr,
60 int dead_breakpoint = 0);
61
62V8_EXPORT_PRIVATE std::unique_ptr<DebugSideTable> GenerateLiftoffDebugSideTable(
63 AccountingAllocator*, CompilationEnv*, const FunctionBody&, int func_index);
64
65} // namespace wasm
66} // namespace internal
67} // namespace v8
68
69#endif // V8_WASM_BASELINE_LIFTOFF_COMPILER_H_