5 #ifndef V8_BUILTINS_BUILTINS_ARRAY_GEN_H_ 6 #define V8_BUILTINS_BUILTINS_ARRAY_GEN_H_ 8 #include "src/code-stub-assembler.h" 17 typedef std::function<void(ArrayBuiltinsAssembler* masm)>
18 BuiltinResultGenerator;
24 typedef std::function<void(ArrayBuiltinsAssembler* masm)> PostLoopAction;
26 enum class MissingPropertyMode { kSkip, kUseUndefined };
28 void FindResultGenerator();
32 void FindIndexResultGenerator();
36 void ForEachResultGenerator();
40 void SomeResultGenerator();
44 void EveryResultGenerator();
48 void ReduceResultGenerator();
52 void ReducePostLoopAction();
54 void FilterResultGenerator();
58 void MapResultGenerator();
60 void TypedArrayMapResultGenerator();
69 void NullPostLoopAction();
79 ExternalReference::jsarray_array_join_concat_to_sequential_string());
81 ExternalConstant(ExternalReference::isolate_address(isolate()));
82 return UncheckedCast<String>(
83 CallCFunction5(MachineType::AnyTagged(),
84 MachineType::Pointer(),
85 MachineType::AnyTagged(),
86 MachineType::IntPtr(),
87 MachineType::AnyTagged(),
88 MachineType::AnyTagged(),
89 func, isolate_ptr, fixed_array, length, sep, dest));
98 Node* callbackfn() {
return callbackfn_; }
99 Node* this_arg() {
return this_arg_; }
101 Node* a() {
return a_.value(); }
103 void ReturnFromBuiltin(
Node* value);
109 void GenerateIteratingArrayBuiltinBody(
110 const char* name,
const BuiltinResultGenerator& generator,
111 const CallResultProcessor& processor,
const PostLoopAction& action,
112 const Callable& slow_case_continuation,
113 MissingPropertyMode missing_property_mode,
114 ForEachDirection direction = ForEachDirection::kForward);
115 void InitIteratingArrayBuiltinLoopContinuation(
120 void GenerateIteratingTypedArrayBuiltinBody(
121 const char* name,
const BuiltinResultGenerator& generator,
122 const CallResultProcessor& processor,
const PostLoopAction& action,
123 ForEachDirection direction = ForEachDirection::kForward);
125 void GenerateIteratingArrayBuiltinLoopContinuation(
126 const CallResultProcessor& processor,
const PostLoopAction& action,
127 MissingPropertyMode missing_property_mode,
128 ForEachDirection direction = ForEachDirection::kForward);
130 void TailCallArrayConstructorStub(
135 void GenerateDispatchToArrayStub(
137 AllocationSiteOverrideMode mode,
140 void CreateArrayDispatchNoArgument(
142 AllocationSiteOverrideMode mode,
145 void CreateArrayDispatchSingleArgument(
147 AllocationSiteOverrideMode mode,
150 void GenerateConstructor(
Node* context,
Node* array_function,
Node* array_map,
151 Node* array_size,
Node* allocation_site,
152 ElementsKind elements_kind, AllocationSiteMode mode);
153 void GenerateArrayNoArgumentConstructor(ElementsKind kind,
154 AllocationSiteOverrideMode mode);
155 void GenerateArraySingleArgumentConstructor(ElementsKind kind,
156 AllocationSiteOverrideMode mode);
157 void GenerateArrayNArgumentsConstructor(
162 void GenerateInternalArrayNoArgumentConstructor(ElementsKind kind);
163 void GenerateInternalArraySingleArgumentConstructor(ElementsKind kind);
166 static ElementsKind ElementsKindForInstanceType(InstanceType
type);
168 void VisitAllTypedArrayElements(
Node* array_buffer,
169 const CallResultProcessor& processor,
170 Label* detached, ForEachDirection direction,
173 void VisitAllFastElementsOneKind(ElementsKind kind,
174 const CallResultProcessor& processor,
175 Label* array_changed, ParameterMode mode,
176 ForEachDirection direction,
177 MissingPropertyMode missing_property_mode,
180 void HandleFastElements(
const CallResultProcessor& processor,
181 const PostLoopAction& action,
Label* slow,
182 ForEachDirection direction,
183 MissingPropertyMode missing_property_mode);
188 void GenerateArraySpeciesCreate();
193 Node* callbackfn_ =
nullptr;
195 Node* this_arg_ =
nullptr;
200 Node* fast_typed_array_target_ =
nullptr;
201 const char* name_ =
nullptr;
205 Label fully_spec_compliant_;
206 ElementsKind source_elements_kind_ = ElementsKind::NO_ELEMENTS;
212 #endif // V8_BUILTINS_BUILTINS_ARRAY_GEN_H_