v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
debug-feature-lowering-reducer.h
Go to the documentation of this file.
1// Copyright 2023 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_COMPILER_TURBOSHAFT_DEBUG_FEATURE_LOWERING_REDUCER_H_
6#define V8_COMPILER_TURBOSHAFT_DEBUG_FEATURE_LOWERING_REDUCER_H_
7
15
17
19
20template <typename Next>
21class DebugFeatureLoweringReducer : public Next {
22 public:
23 TURBOSHAFT_REDUCER_BOILERPLATE(DebugFeatureLowering)
24
26 if (isolate_ != nullptr) {
27 switch (rep.value()) {
29 __ CallBuiltin_DebugPrintWordPtr(isolate_, __ NoContextConstant(),
30 input);
31 break;
33 __ CallBuiltin_DebugPrintFloat64(isolate_, __ NoContextConstant(),
34 input);
35 break;
37 __ CallRuntime_DebugPrint(isolate_, input);
38 break;
39 default:
40 // TODO(nicohartmann@): Support other representations.
42 }
43 } else {
44#if V8_ENABLE_WEBASSEMBLY
45 DCHECK(__ data()->is_wasm());
46 switch (rep.value()) {
48 __ template WasmCallBuiltinThroughJumptable<
50 {input});
51 break;
53 __ template WasmCallBuiltinThroughJumptable<
55 {input});
56 break;
57 default:
58 // TODO(mliedtke): Support other representations.
60 }
61#else
63#endif
64 }
65 return {};
66 }
67
69 // Static asserts should be (statically asserted and) removed by turboshaft.
71 AllowHandleDereference allow_handle_dereference;
72 std::cout << __ output_graph().Get(condition);
73 FATAL(
74 "Expected Turbofan static assert to hold, but got non-true input:\n "
75 "%s",
76 source);
77 }
78
81 bool successful) {
82 if (successful) return input;
83
85 AllowHandleDereference allow_handle_dereference;
86 FATAL("Checking type %s of operation %d:%s failed!",
87 type.ToString().c_str(), input.id(),
88 __ output_graph().Get(input).ToString().c_str());
89 }
90
91 private:
94};
95
97
98} // namespace v8::internal::compiler::turboshaft
99
100#endif // V8_COMPILER_TURBOSHAFT_DEBUG_FEATURE_LOWERING_REDUCER_H_
#define REDUCE(operation)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
OpIndex REDUCE DebugPrint(OpIndex input, RegisterRepresentation rep)
OpIndex REDUCE CheckTurboshaftTypeOf(OpIndex input, RegisterRepresentation rep, Type type, bool successful)
V< None > REDUCE StaticAssert(V< Word32 > condition, const char *source)
static constexpr RegisterRepresentation Float64()
static constexpr RegisterRepresentation WordPtr()
static constexpr RegisterRepresentation Tagged()
#define TURBOSHAFT_REDUCER_BOILERPLATE(Name)
Definition assembler.h:823
Isolate * isolate
JSHeapBroker * broker
InstructionOperand source
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
Definition graph.h:1231
std::string ToString(const BytecodeLivenessState &liveness)
#define FATAL(...)
Definition logging.h:47
#define DCHECK(condition)
Definition logging.h:482
wasm::ValueType type