v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
fast-api-calls.h
Go to the documentation of this file.
1// Copyright 2021 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_FAST_API_CALLS_H_
6#define V8_COMPILER_FAST_API_CALLS_H_
7
10
11namespace v8 {
12namespace internal {
13namespace compiler {
14namespace fast_api_call {
15
20
21 OverloadsResolutionResult(int distinguishable_arg_index_,
22 CTypeInfo::Type element_type_)
23 : distinguishable_arg_index(distinguishable_arg_index_),
24 element_type(element_type_) {
25 DCHECK(distinguishable_arg_index_ < 0 ||
26 element_type_ != CTypeInfo::Type::kVoid);
27 }
28
29 bool is_valid() const { return distinguishable_arg_index >= 0; }
30
31 // The index of the distinguishable overload argument. Only the case where the
32 // types of this argument is a JSArray vs a TypedArray is supported.
34
35 // The element type in the typed array argument.
37
38 Node* target_address = nullptr;
39};
40
42
43bool CanOptimizeFastSignature(const CFunctionInfo* c_signature);
44
45using GetParameter = std::function<Node*(int, GraphAssemblerLabel<0>*)>;
46using ConvertReturnValue = std::function<Node*(const CFunctionInfo*, Node*)>;
47using InitializeOptions = std::function<void(Node*)>;
48using GenerateSlowApiCall = std::function<Node*()>;
49
50Node* BuildFastApiCall(Isolate* isolate, TFGraph* graph,
51 GraphAssembler* graph_assembler,
52 FastApiCallFunction c_function, Node* data_argument,
53 const GetParameter& get_parameter,
54 const ConvertReturnValue& convert_return_value,
55 const InitializeOptions& initialize_options,
56 const GenerateSlowApiCall& generate_slow_api_call);
57
59 JSHeapBroker* broker, FunctionTemplateInfoRef function_template_info,
60 size_t arg_count);
61
62} // namespace fast_api_call
63} // namespace compiler
64} // namespace internal
65} // namespace v8
66
67#endif // V8_COMPILER_FAST_API_CALLS_H_
JSHeapBroker * broker
std::function< Node *(const CFunctionInfo *, Node *)> ConvertReturnValue
ElementsKind GetTypedArrayElementsKind(CTypeInfo::Type type)
std::function< Node *(int, GraphAssemblerLabel< 0 > *)> GetParameter
std::function< void(Node *)> InitializeOptions
std::function< Node *()> GenerateSlowApiCall
FastApiCallFunction GetFastApiCallTarget(JSHeapBroker *broker, FunctionTemplateInfoRef function_template_info, size_t arg_count)
Node * BuildFastApiCall(Isolate *isolate, TFGraph *graph, GraphAssembler *graph_assembler, FastApiCallFunction c_function, Node *data_argument, const GetParameter &get_parameter, const ConvertReturnValue &convert_return_value, const InitializeOptions &initialize_options, const GenerateSlowApiCall &generate_slow_api_call)
bool CanOptimizeFastSignature(const CFunctionInfo *c_signature)
#define DCHECK(condition)
Definition logging.h:482
OverloadsResolutionResult(int distinguishable_arg_index_, CTypeInfo::Type element_type_)