v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-operator.h
Go to the documentation of this file.
1// Copyright 2013 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_JS_OPERATOR_H_
6#define V8_COMPILER_JS_OPERATOR_H_
7
9#include "src/codegen/tnode.h"
14#include "src/compiler/node.h"
18#include "src/objects/oddball.h"
19#include "src/runtime/runtime.h"
20
21#if DEBUG && V8_ENABLE_WEBASSEMBLY
23#endif
24
25namespace v8 {
26namespace internal {
27
28class AllocationSite;
29class ObjectBoilerplateDescription;
30class ArrayBoilerplateDescription;
31class FeedbackCell;
32class SharedFunctionInfo;
33
34namespace wasm {
35class ValueType;
36}
37
38namespace compiler {
39
40// Forward declarations.
41class JSGraph;
42class Operator;
43struct JSOperatorGlobalCache;
44
45// Macro lists.
46#define JS_UNOP_WITH_FEEDBACK(V) \
47 JS_BITWISE_UNOP_LIST(V) \
48 JS_ARITH_UNOP_LIST(V)
49
50#define JS_BINOP_WITH_FEEDBACK(V) \
51 JS_ARITH_BINOP_LIST(V) \
52 JS_BITWISE_BINOP_LIST(V) \
53 JS_COMPARE_BINOP_LIST(V) \
54 V(JSInstanceOf, InstanceOf)
55
56// Predicates.
57class JSOperator final : public AllStatic {
58 public:
59 static constexpr bool IsUnaryWithFeedback(Operator::Opcode opcode) {
60#define CASE(Name, ...) \
61 case IrOpcode::k##Name: \
62 return true;
63 switch (opcode) {
65 default:
66 return false;
67 }
68#undef CASE
69 }
70
71 static constexpr bool IsBinaryWithFeedback(Operator::Opcode opcode) {
72#define CASE(Name, ...) \
73 case IrOpcode::k##Name: \
74 return true;
75 switch (opcode) {
77 default:
78 return false;
79 }
80#undef CASE
81 }
82};
83
84// Defines the frequency a given Call/Construct site was executed. For some
85// call sites the frequency is not known.
86class CallFrequency final {
87 public:
88 CallFrequency() : value_(std::numeric_limits<float>::quiet_NaN()) {}
89 explicit CallFrequency(float value) : value_(value) {
90 DCHECK(!std::isnan(value));
91 }
92
93 bool IsKnown() const { return !IsUnknown(); }
94 bool IsUnknown() const { return std::isnan(value_); }
95 float value() const {
96 DCHECK(IsKnown());
97 return value_;
98 }
99
100 bool operator==(CallFrequency const& that) const {
101 return base::bit_cast<uint32_t>(this->value_) ==
103 }
104 bool operator!=(CallFrequency const& that) const { return !(*this == that); }
105
106 friend size_t hash_value(CallFrequency const& f) {
108 }
109
110 static constexpr float kNoFeedbackCallFrequency = -1;
111
112 private:
113 float value_;
114};
115
116std::ostream& operator<<(std::ostream&, CallFrequency const&);
117
118// Defines the flags for a JavaScript call forwarding parameters. This
119// is used as parameter by JSConstructForwardVarargs operators.
121 public:
125
126 size_t arity() const { return ArityField::decode(bit_field_); }
127 uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
128
130 return this->bit_field_ == that.bit_field_;
131 }
133 return !(*this == that);
134 }
135
136 private:
138 return p.bit_field_;
139 }
140
143
144 uint32_t const bit_field_;
145};
146
147std::ostream& operator<<(std::ostream&,
149
152
153// Defines the arity (parameters plus the target and new target) and the
154// feedback for a JavaScript constructor call. This is used as a parameter by
155// JSConstruct, JSConstructWithArrayLike, and JSConstructWithSpread operators.
157 public:
158 // A separate declaration to get around circular declaration dependencies.
159 // Checked to equal JSConstructNode::kExtraInputCount below.
160 static constexpr int kExtraConstructInputCount = 3;
161
163 FeedbackSource const& feedback)
164 : arity_(arity), frequency_(frequency), feedback_(feedback) {
166 DCHECK(is_int32(arity));
167 }
168
169 // TODO(jgruber): Consider removing `arity()` and just storing the arity
170 // without extra args in ConstructParameters. Every spot that creates
171 // ConstructParameters artifically adds the extra args. Every spot that uses
172 // ConstructParameters artificially subtracts the extra args.
173 // We keep them for now for consistency with other spots
174 // that expect `arity()` to include extra args.
175 uint32_t arity() const { return arity_; }
177 return static_cast<int>(arity_ - kExtraConstructInputCount);
178 }
179
180 CallFrequency const& frequency() const { return frequency_; }
181 FeedbackSource const& feedback() const { return feedback_; }
182
183 private:
184 uint32_t const arity_;
187};
188
191
192size_t hash_value(ConstructParameters const&);
193
194std::ostream& operator<<(std::ostream&, ConstructParameters const&);
195
197
198// Defines the flags for a JavaScript call forwarding parameters. This
199// is used as parameter by JSCallForwardVarargs operators.
201 public:
205
206 size_t arity() const { return ArityField::decode(bit_field_); }
207 uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
208
209 bool operator==(CallForwardVarargsParameters const& that) const {
210 return this->bit_field_ == that.bit_field_;
211 }
212 bool operator!=(CallForwardVarargsParameters const& that) const {
213 return !(*this == that);
214 }
215
216 private:
217 friend size_t hash_value(CallForwardVarargsParameters const& p) {
218 return p.bit_field_;
219 }
220
223
224 uint32_t const bit_field_;
225};
226
227std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&);
228
231
232// Defines the arity (parameters plus the target and receiver) and the call
233// flags for a JavaScript function call. This is used as a parameter by JSCall,
234// JSCallWithArrayLike and JSCallWithSpread operators.
235class CallParameters final {
236 public:
237 // A separate declaration to get around circular declaration dependencies.
238 // Checked to equal JSCallNode::kExtraInputCount below.
239 static constexpr int kExtraCallInputCount = 3;
240
242 FeedbackSource const& feedback,
246 : bit_field_(ArityField::encode(arity) |
251 feedback_(feedback) {
252 // CallFeedbackRelation is ignored if the feedback slot is invalid.
254 feedback.IsValid());
255 DCHECK_IMPLIES(!feedback.IsValid(),
258 DCHECK(is_int32(arity));
259 }
260
261 // TODO(jgruber): Consider removing `arity()` and just storing the arity
262 // without extra args in CallParameters.
263 size_t arity() const { return ArityField::decode(bit_field_); }
265 return static_cast<int>(arity() - kExtraCallInputCount);
266 }
267
268 CallFrequency const& frequency() const { return frequency_; }
272 FeedbackSource const& feedback() const { return feedback_; }
273
277
281
282 bool operator==(CallParameters const& that) const {
283 return this->bit_field_ == that.bit_field_ &&
284 this->frequency_ == that.frequency_ &&
285 this->feedback_ == that.feedback_;
286 }
287 bool operator!=(CallParameters const& that) const { return !(*this == that); }
288
289 private:
290 friend size_t hash_value(CallParameters const& p) {
291 FeedbackSource::Hash feedback_hash;
293 feedback_hash(p.feedback_));
294 }
295
300
301 uint32_t const bit_field_;
304};
305
306size_t hash_value(CallParameters const&);
307
308std::ostream& operator<<(std::ostream&, CallParameters const&);
309
311
312
313// Defines the arity and the ID for a runtime function call. This is used as a
314// parameter by JSCallRuntime operators.
316 public:
318 : id_(id), arity_(arity) {}
319
320 Runtime::FunctionId id() const { return id_; }
321 size_t arity() const { return arity_; }
322
323 private:
325 const size_t arity_;
326};
327
330
331size_t hash_value(CallRuntimeParameters const&);
332
333std::ostream& operator<<(std::ostream&, CallRuntimeParameters const&);
334
336 const Operator* op);
337
338// Defines the location of a context slot relative to a specific scope. This is
339// used as a parameter by JSLoadContext and JSStoreContext operators and allows
340// accessing a context-allocated variable without keeping track of the scope.
341class ContextAccess final {
342 public:
343 ContextAccess(size_t depth, size_t index, bool immutable);
344
345 size_t depth() const { return depth_; }
346 size_t index() const { return index_; }
347 bool immutable() const { return immutable_; }
348
349 private:
350 // For space reasons, we keep this tightly packed, otherwise we could just use
351 // a simple int/int/bool POD.
352 const bool immutable_;
353 const uint16_t depth_;
354 const uint32_t index_;
355};
356
357bool operator==(ContextAccess const&, ContextAccess const&);
358bool operator!=(ContextAccess const&, ContextAccess const&);
359
360size_t hash_value(ContextAccess const&);
361
362V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ContextAccess const&);
363
365
366// Defines the slot count and ScopeType for a new function or eval context. This
367// is used as a parameter by the JSCreateFunctionContext operator.
369 public:
375
377 int slot_count() const { return slot_count_; }
378 ScopeType scope_type() const { return scope_type_; }
379
380 private:
382 int const slot_count_;
384
385 friend bool operator==(CreateFunctionContextParameters const& lhs,
387 friend bool operator!=(CreateFunctionContextParameters const& lhs,
389
390 friend size_t hash_value(CreateFunctionContextParameters const& parameters);
391
392 friend std::ostream& operator<<(
393 std::ostream& os, CreateFunctionContextParameters const& parameters);
394};
395
397 Operator const*);
398
399// Defines parameters for JSDefineNamedOwnProperty operator.
401 public:
403 : name_(name), feedback_(feedback) {}
404
405 NameRef name() const { return name_; }
406 FeedbackSource const& feedback() const { return feedback_; }
407
408 private:
411
416 friend size_t hash_value(DefineNamedOwnPropertyParameters const&);
417 friend std::ostream& operator<<(std::ostream&,
419};
420
422 const Operator* op);
423
424// Defines the feedback, i.e., vector and index, for storing a data property in
425// an object literal. This is used as a parameter by JSCreateEmptyLiteralArray
426// and JSDefineKeyedOwnPropertyInLiteral operators.
427class FeedbackParameter final {
428 public:
429 explicit FeedbackParameter(FeedbackSource const& feedback)
430 : feedback_(feedback) {}
431
432 FeedbackSource const& feedback() const { return feedback_; }
433
434 private:
436};
437
440
441size_t hash_value(FeedbackParameter const&);
442
443std::ostream& operator<<(std::ostream&, FeedbackParameter const&);
444
446
447// Defines the property of an object for a named access. This is
448// used as a parameter by the JSLoadNamed and JSSetNamedProperty operators.
449class NamedAccess final {
450 public:
454
455 NameRef name() const { return name_; }
457 FeedbackSource const& feedback() const { return feedback_; }
458
459 private:
463
464 friend bool operator==(NamedAccess const&, NamedAccess const&);
465 friend bool operator!=(NamedAccess const&, NamedAccess const&);
466
467 friend size_t hash_value(NamedAccess const&);
468
469 friend std::ostream& operator<<(std::ostream&, NamedAccess const&);
470};
471
472const NamedAccess& NamedAccessOf(const Operator* op);
473
474
475// Defines the property being loaded from an object by a named load. This is
476// used as a parameter by JSLoadGlobal operator.
478 public:
482
483 NameRef name() const { return name_; }
485
486 const FeedbackSource& feedback() const { return feedback_; }
487
488 private:
492
493 friend bool operator==(LoadGlobalParameters const&,
494 LoadGlobalParameters const&);
495 friend bool operator!=(LoadGlobalParameters const&,
496 LoadGlobalParameters const&);
497
498 friend size_t hash_value(LoadGlobalParameters const&);
499
500 friend std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
501};
502
504
505
506// Defines the property being stored to an object by a named store. This is
507// used as a parameter by JSStoreGlobal operator.
509 public:
513
515 FeedbackSource const& feedback() const { return feedback_; }
516 NameRef name() const { return name_; }
517
518 private:
522
523 friend bool operator==(StoreGlobalParameters const&,
524 StoreGlobalParameters const&);
525 friend bool operator!=(StoreGlobalParameters const&,
526 StoreGlobalParameters const&);
527
528 friend size_t hash_value(StoreGlobalParameters const&);
529
530 friend std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
531};
532
534
535// Defines the property of an object for a keyed access. This is used
536// as a parameter by the JSLoadProperty and JSSetKeyedProperty
537// operators.
538class PropertyAccess final {
539 public:
542
544 FeedbackSource const& feedback() const { return feedback_; }
545
546 private:
549};
550
551bool operator==(PropertyAccess const&, PropertyAccess const&);
552bool operator!=(PropertyAccess const&, PropertyAccess const&);
553
554size_t hash_value(PropertyAccess const&);
555
556V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
557 PropertyAccess const&);
558
560
561
562// CreateArgumentsType is used as parameter to JSCreateArguments nodes.
564
565
566// Defines shared information for the array that should be created. This is
567// used as parameter by JSCreateArray operators.
569 public:
570 CreateArrayParameters(size_t arity, OptionalAllocationSiteRef site)
571 : arity_(arity), site_(site) {}
572
573 size_t arity() const { return arity_; }
574 OptionalAllocationSiteRef site() const { return site_; }
575
576 private:
577 size_t const arity_;
578 OptionalAllocationSiteRef const site_;
579
580 friend bool operator==(CreateArrayParameters const&,
581 CreateArrayParameters const&);
582 friend bool operator!=(CreateArrayParameters const&,
583 CreateArrayParameters const&);
584 friend size_t hash_value(CreateArrayParameters const&);
585 friend std::ostream& operator<<(std::ostream&, CreateArrayParameters const&);
586};
587
589
590// Defines shared information for the array iterator that should be created.
591// This is used as parameter by JSCreateArrayIterator operators.
593 public:
595
596 IterationKind kind() const { return kind_; }
597
598 private:
600};
601
606
608
609std::ostream& operator<<(std::ostream&, CreateArrayIteratorParameters const&);
610
612 const Operator* op);
613
614// Defines shared information for the array iterator that should be created.
615// This is used as parameter by JSCreateCollectionIterator operators.
632
637
639
640std::ostream& operator<<(std::ostream&,
642
644 const Operator* op);
645
646// Defines shared information for the bound function that should be created.
647// This is used as parameter by JSCreateBoundFunction operators.
649 public:
652
653 size_t arity() const { return arity_; }
654 MapRef map() const { return map_; }
655
656 private:
657 size_t const arity_;
659
660 friend bool operator==(CreateBoundFunctionParameters const&,
662 friend bool operator!=(CreateBoundFunctionParameters const&,
664
665 friend size_t hash_value(CreateBoundFunctionParameters const&);
666
667 friend std::ostream& operator<<(std::ostream&,
669};
670
672 const Operator* op);
673
674// Defines shared information for the closure that should be created. This is
675// used as a parameter by JSCreateClosure operators.
677 public:
681
683 CodeRef code() const { return code_; }
685
686 private:
690
691 friend bool operator==(CreateClosureParameters const&,
693 friend bool operator!=(CreateClosureParameters const&,
695
696 friend size_t hash_value(CreateClosureParameters const&);
697
698 friend std::ostream& operator<<(std::ostream&,
700};
701
703
705 public:
710
713 FeedbackSource const& feedback() const { return feedback_; }
714
715 private:
719
720 friend bool operator==(GetTemplateObjectParameters const&,
722 friend bool operator!=(GetTemplateObjectParameters const&,
724
725 friend size_t hash_value(GetTemplateObjectParameters const&);
726
727 friend std::ostream& operator<<(std::ostream&,
729};
730
732 const Operator* op);
733
734// Defines shared information for the literal that should be created. This is
735// used as parameter by JSCreateLiteralArray, JSCreateLiteralObject and
736// JSCreateLiteralRegExp operators.
738 public:
740 FeedbackSource const& feedback, int length, int flags)
741 : constant_(constant),
742 feedback_(feedback),
743 length_(length),
744 flags_(flags) {}
745
746 HeapObjectRef constant() const { return constant_; }
747 FeedbackSource const& feedback() const { return feedback_; }
748 int length() const { return length_; }
749 int flags() const { return flags_; }
750
751 private:
754 int const length_;
755 int const flags_;
756
757 friend bool operator==(CreateLiteralParameters const&,
759 friend bool operator!=(CreateLiteralParameters const&,
761
762 friend size_t hash_value(CreateLiteralParameters const&);
763
764 friend std::ostream& operator<<(std::ostream&,
766};
767
769
771 public:
772 CloneObjectParameters(FeedbackSource const& feedback, int flags)
773 : feedback_(feedback), flags_(flags) {}
774
775 FeedbackSource const& feedback() const { return feedback_; }
776 int flags() const { return flags_; }
777
778 private:
780 int const flags_;
781};
782
785
786size_t hash_value(CloneObjectParameters const&);
787
788std::ostream& operator<<(std::ostream&, CloneObjectParameters const&);
789
791
792// Defines the shared information for the iterator symbol thats loaded and
793// called. This is used as a parameter by JSGetIterator operator.
795 public:
797 const FeedbackSource& call_feedback)
798 : load_feedback_(load_feedback), call_feedback_(call_feedback) {}
799
800 FeedbackSource const& loadFeedback() const { return load_feedback_; }
801 FeedbackSource const& callFeedback() const { return call_feedback_; }
802
803 private:
806};
807
810
811size_t hash_value(GetIteratorParameters const&);
812
813std::ostream& operator<<(std::ostream&, GetIteratorParameters const&);
814
816
817enum class ForInMode : uint8_t {
821};
822size_t hash_value(ForInMode const&);
823std::ostream& operator<<(std::ostream&, ForInMode const&);
824
825class ForInParameters final {
826 public:
828 : feedback_(feedback), mode_(mode) {}
829
830 const FeedbackSource& feedback() const { return feedback_; }
831 ForInMode mode() const { return mode_; }
832
833 private:
836};
837
838bool operator==(ForInParameters const&, ForInParameters const&);
839bool operator!=(ForInParameters const&, ForInParameters const&);
840size_t hash_value(ForInParameters const&);
841std::ostream& operator<<(std::ostream&, ForInParameters const&);
843
844#if V8_ENABLE_WEBASSEMBLY
845class JSWasmCallParameters {
846 public:
847 explicit JSWasmCallParameters(const wasm::WasmModule* module,
848 const wasm::CanonicalSig* signature,
849 int function_index,
850 SharedFunctionInfoRef shared_fct_info,
851 wasm::NativeModule* native_module,
852 FeedbackSource const& feedback)
853 : module_(module),
854 signature_(signature),
855 function_index_(function_index),
856 shared_fct_info_(shared_fct_info),
857 native_module_(native_module),
858 feedback_(feedback) {
859 DCHECK_NOT_NULL(module);
860 DCHECK(wasm::GetTypeCanonicalizer()->Contains(signature));
861 }
862
863 const wasm::WasmModule* module() const { return module_; }
864 const wasm::CanonicalSig* signature() const { return signature_; }
865 int function_index() const { return function_index_; }
866 SharedFunctionInfoRef shared_fct_info() const { return shared_fct_info_; }
867 wasm::NativeModule* native_module() const { return native_module_; }
868 FeedbackSource const& feedback() const { return feedback_; }
869 int input_count() const;
870 int arity_without_implicit_args() const;
871
872 private:
873 const wasm::WasmModule* const module_;
874 const wasm::CanonicalSig* const signature_;
875 int function_index_;
876 SharedFunctionInfoRef shared_fct_info_;
877 wasm::NativeModule* native_module_;
878 const FeedbackSource feedback_;
879};
880
881JSWasmCallParameters const& JSWasmCallParametersOf(const Operator* op)
883V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
884 JSWasmCallParameters const&);
885size_t hash_value(JSWasmCallParameters const&);
886bool operator==(JSWasmCallParameters const&, JSWasmCallParameters const&);
887#endif // V8_ENABLE_WEBASSEMBLY
888
889int RegisterCountOf(Operator const* op) V8_WARN_UNUSED_RESULT;
890
892int RestoreRegisterIndexOf(const Operator* op) V8_WARN_UNUSED_RESULT;
893
894ScopeInfoRef ScopeInfoOf(const Operator* op) V8_WARN_UNUSED_RESULT;
895
896bool operator==(ScopeInfoRef, ScopeInfoRef);
897bool operator!=(ScopeInfoRef, ScopeInfoRef);
898
899size_t hash_value(ScopeInfoRef);
900
901V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ScopeInfoRef);
902
903// Interface for building JavaScript-level operators, e.g. directly from the
904// AST. Most operators have no parameters, thus can be globally shared for all
905// graphs.
907 : public NON_EXPORTED_BASE(ZoneObject) {
908 public:
909 explicit JSOperatorBuilder(Zone* zone);
912
913 const Operator* Equal(FeedbackSource const& feedback);
914 const Operator* StrictEqual(FeedbackSource const& feedback);
915 const Operator* LessThan(FeedbackSource const& feedback);
916 const Operator* GreaterThan(FeedbackSource const& feedback);
917 const Operator* LessThanOrEqual(FeedbackSource const& feedback);
919
920 const Operator* BitwiseOr(FeedbackSource const& feedback);
921 const Operator* BitwiseXor(FeedbackSource const& feedback);
922 const Operator* BitwiseAnd(FeedbackSource const& feedback);
923 const Operator* ShiftLeft(FeedbackSource const& feedback);
924 const Operator* ShiftRight(FeedbackSource const& feedback);
926 const Operator* Add(FeedbackSource const& feedback);
927 const Operator* Subtract(FeedbackSource const& feedback);
928 const Operator* Multiply(FeedbackSource const& feedback);
929 const Operator* Divide(FeedbackSource const& feedback);
930 const Operator* Modulus(FeedbackSource const& feedback);
931 const Operator* Exponentiate(FeedbackSource const& feedback);
932
933 const Operator* BitwiseNot(FeedbackSource const& feedback);
934 const Operator* Decrement(FeedbackSource const& feedback);
935 const Operator* Increment(FeedbackSource const& feedback);
936 const Operator* Negate(FeedbackSource const& feedback);
937
939 const Operator* ToName();
947
948 const Operator* Create();
949 const Operator* CreateArguments(CreateArgumentsType type);
950 const Operator* CreateArray(size_t arity, OptionalAllocationSiteRef site);
951 const Operator* CreateArrayIterator(IterationKind);
952 const Operator* CreateAsyncFunctionObject(int register_count);
953 const Operator* CreateCollectionIterator(CollectionKind, IterationKind);
954 const Operator* CreateBoundFunction(size_t arity, MapRef map);
955 const Operator* CreateClosure(
956 SharedFunctionInfoRef shared_info, CodeRef code,
957 AllocationType allocation = AllocationType::kYoung);
965 const Operator* CreateLiteralArray(ArrayBoilerplateDescriptionRef constant,
966 FeedbackSource const& feedback,
967 int literal_flags, int number_of_elements);
968 const Operator* CreateEmptyLiteralArray(FeedbackSource const& feedback);
969 const Operator* CreateArrayFromIterable();
970 const Operator* CreateEmptyLiteralObject();
971 const Operator* CreateLiteralObject(ObjectBoilerplateDescriptionRef constant,
972 FeedbackSource const& feedback,
973 int literal_flags,
974 int number_of_properties);
975 const Operator* CloneObject(FeedbackSource const& feedback,
976 int literal_flags);
977 const Operator* CreateLiteralRegExp(StringRef constant_pattern,
978 FeedbackSource const& feedback,
979 int literal_flags);
980
983 FeedbackSource const& feedback);
984
985 const Operator* CallForwardVarargs(size_t arity, uint32_t start_index);
986 const Operator* Call(
987 size_t arity, CallFrequency const& frequency = CallFrequency(),
988 FeedbackSource const& feedback = FeedbackSource(),
989 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
990 SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation,
991 CallFeedbackRelation feedback_relation =
992 CallFeedbackRelation::kUnrelated);
993 const Operator* CallWithArrayLike(
994 CallFrequency const& frequency,
995 const FeedbackSource& feedback = FeedbackSource{},
996 SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation,
997 CallFeedbackRelation feedback_relation = CallFeedbackRelation::kTarget);
998 const Operator* CallWithSpread(
999 uint32_t arity, CallFrequency const& frequency = CallFrequency(),
1000 FeedbackSource const& feedback = FeedbackSource(),
1001 SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation,
1002 CallFeedbackRelation feedback_relation = CallFeedbackRelation::kTarget);
1004 const Operator* CallRuntime(
1005 Runtime::FunctionId id, size_t arity,
1006 Operator::Properties properties = Operator::kNoProperties);
1007 const Operator* CallRuntime(
1008 const Runtime::Function* function, size_t arity,
1009 Operator::Properties properties = Operator::kNoProperties);
1010
1011#if V8_ENABLE_WEBASSEMBLY
1012 const Operator* CallWasm(const wasm::WasmModule* wasm_module,
1013 const wasm::CanonicalSig* wasm_signature,
1014 int wasm_function_index,
1015 SharedFunctionInfoRef shared_fct_info,
1016 wasm::NativeModule* native_module,
1017 FeedbackSource const& feedback);
1018#endif // V8_ENABLE_WEBASSEMBLY
1019
1020 const Operator* ConstructForwardVarargs(size_t arity, uint32_t start_index);
1021 const Operator* Construct(uint32_t arity,
1022 CallFrequency const& frequency = CallFrequency(),
1023 FeedbackSource const& feedback = FeedbackSource());
1024 const Operator* ConstructWithArrayLike(CallFrequency const& frequency,
1025 FeedbackSource const& feedback);
1026 const Operator* ConstructWithSpread(
1027 uint32_t arity, CallFrequency const& frequency = CallFrequency(),
1028 FeedbackSource const& feedback = FeedbackSource());
1029 const Operator* ConstructForwardAllArgs(
1030 CallFrequency const& frequency = CallFrequency(),
1031 FeedbackSource const& feedback = FeedbackSource());
1032
1033 const Operator* LoadProperty(FeedbackSource const& feedback);
1034 const Operator* LoadNamed(NameRef name, FeedbackSource const& feedback);
1035 const Operator* LoadNamedFromSuper(NameRef name,
1036 FeedbackSource const& feedback);
1037
1038 const Operator* SetKeyedProperty(LanguageMode language_mode,
1039 FeedbackSource const& feedback);
1040 const Operator* DefineKeyedOwnProperty(LanguageMode language_mode,
1041 FeedbackSource const& feedback);
1042 const Operator* SetNamedProperty(LanguageMode language_mode, NameRef name,
1043 FeedbackSource const& feedback);
1044
1045 const Operator* DefineNamedOwnProperty(NameRef name,
1046 FeedbackSource const& feedback);
1047 const Operator* DefineKeyedOwnPropertyInLiteral(
1048 const FeedbackSource& feedback);
1049 const Operator* StoreInArrayLiteral(const FeedbackSource& feedback);
1050
1051 const Operator* DeleteProperty();
1052
1053 const Operator* HasProperty(FeedbackSource const& feedback);
1054
1056
1058
1059 const Operator* CreateGeneratorObject();
1060
1061 const Operator* LoadGlobal(NameRef name, const FeedbackSource& feedback,
1062 TypeofMode typeof_mode = TypeofMode::kNotInside);
1063 const Operator* StoreGlobal(LanguageMode language_mode, NameRef name,
1064 const FeedbackSource& feedback);
1065
1066 const Operator* HasContextExtension(size_t depth);
1067 const Operator* LoadContext(size_t depth, size_t index, bool immutable);
1068 const Operator* LoadScriptContext(size_t depth, size_t index);
1069 const Operator* StoreContext(size_t depth, size_t index);
1070 const Operator* StoreScriptContext(size_t depth, size_t index);
1071
1072 const Operator* LoadModule(int32_t cell_index);
1073 const Operator* StoreModule(int32_t cell_index);
1074
1075 const Operator* GetImportMeta();
1076
1078 const Operator* InstanceOf(const FeedbackSource& feedback);
1080
1084
1086 const Operator* ForInNext(ForInMode mode, const FeedbackSource& feedback);
1087 const Operator* ForInPrepare(ForInMode mode, const FeedbackSource& feedback);
1088
1091
1092 // Used to implement Ignition's SuspendGenerator bytecode.
1093 const Operator* GeneratorStore(int value_count);
1094
1095 // Used to implement Ignition's SwitchOnGeneratorState bytecode.
1098
1099 // Used to implement Ignition's ResumeGenerator bytecode.
1100 const Operator* GeneratorRestoreRegister(int index);
1102
1103 const Operator* StackCheck(StackCheckKind kind);
1105
1111
1112 const Operator* CreateFunctionContext(ScopeInfoRef scope_info, int slot_count,
1113 ScopeType scope_type);
1114 const Operator* CreateCatchContext(ScopeInfoRef scope_info);
1115 const Operator* CreateWithContext(ScopeInfoRef scope_info);
1116 const Operator* CreateBlockContext(ScopeInfoRef scpope_info);
1117
1121
1122 const Operator* GetIterator(FeedbackSource const& load_feedback,
1123 FeedbackSource const& call_feedback);
1124
1125 private:
1126 Zone* zone() const { return zone_; }
1127
1129 Zone* const zone_;
1130};
1131
1132// Node wrappers.
1133
1135 public:
1136 explicit constexpr JSNodeWrapperBase(Node* node) : NodeWrapper(node) {}
1137
1138 // Valid iff this node has a context input.
1140 // Could be a Context or NoContextConstant.
1143 }
1144
1145 // Valid iff this node has exactly one effect input.
1146 Effect effect() const {
1147 DCHECK_EQ(node()->op()->EffectInputCount(), 1);
1149 }
1150
1151 // Valid iff this node has exactly one control input.
1153 DCHECK_EQ(node()->op()->ControlInputCount(), 1);
1155 }
1156
1157 // Valid iff this node has a frame state input.
1161};
1162
1163#define DEFINE_INPUT_ACCESSORS(Name, name, TheIndex, Type) \
1164 static constexpr int Name##Index() { return TheIndex; } \
1165 TNode<Type> name() const { \
1166 return TNode<Type>::UncheckedCast( \
1167 NodeProperties::GetValueInput(node(), TheIndex)); \
1168 }
1169
1170class JSUnaryOpNode final : public JSNodeWrapperBase {
1171 public:
1172 explicit constexpr JSUnaryOpNode(Node* node) : JSNodeWrapperBase(node) {
1173 DCHECK(JSOperator::IsUnaryWithFeedback(node->opcode()));
1174 }
1175
1176#define INPUTS(V) \
1177 V(Value, value, 0, Object) \
1178 V(FeedbackVector, feedback_vector, 1, HeapObject)
1180#undef INPUTS
1181};
1182
1183#define V(JSName, ...) using JSName##Node = JSUnaryOpNode;
1185#undef V
1186
1187class JSBinaryOpNode final : public JSNodeWrapperBase {
1188 public:
1189 explicit constexpr JSBinaryOpNode(Node* node) : JSNodeWrapperBase(node) {
1191 }
1192
1194 return FeedbackParameterOf(node()->op());
1195 }
1196
1197#define INPUTS(V) \
1198 V(Left, left, 0, Object) \
1199 V(Right, right, 1, Object) \
1200 V(FeedbackVector, feedback_vector, 2, HeapObject)
1202#undef INPUTS
1203};
1204
1205#define V(JSName, ...) using JSName##Node = JSBinaryOpNode;
1207#undef V
1208
1210 public:
1211 explicit constexpr JSGetIteratorNode(Node* node) : JSNodeWrapperBase(node) {
1212 DCHECK_EQ(IrOpcode::kJSGetIterator, node->opcode());
1213 }
1214
1216 return GetIteratorParametersOf(node()->op());
1217 }
1218
1219#define INPUTS(V) \
1220 V(Receiver, receiver, 0, Object) \
1221 V(FeedbackVector, feedback_vector, 1, HeapObject)
1223#undef INPUTS
1224};
1225
1227 public:
1228 explicit constexpr JSCloneObjectNode(Node* node) : JSNodeWrapperBase(node) {
1229 DCHECK_EQ(IrOpcode::kJSCloneObject, node->opcode());
1230 }
1231
1233 return CloneObjectParametersOf(node()->op());
1234 }
1235
1236#define INPUTS(V) \
1237 V(Source, source, 0, Object) \
1238 V(FeedbackVector, feedback_vector, 1, HeapObject)
1240#undef INPUTS
1241};
1242
1244 public:
1245 explicit constexpr JSGetTemplateObjectNode(Node* node)
1246 : JSNodeWrapperBase(node) {
1247 DCHECK_EQ(IrOpcode::kJSGetTemplateObject, node->opcode());
1248 }
1249
1251 return GetTemplateObjectParametersOf(node()->op());
1252 }
1253
1254#define INPUTS(V) V(FeedbackVector, feedback_vector, 0, HeapObject)
1256#undef INPUTS
1257};
1258
1260 public:
1261 explicit constexpr JSCreateLiteralOpNode(Node* node)
1262 : JSNodeWrapperBase(node) {
1263 DCHECK(node->opcode() == IrOpcode::kJSCreateLiteralArray ||
1264 node->opcode() == IrOpcode::kJSCreateLiteralObject ||
1265 node->opcode() == IrOpcode::kJSCreateLiteralRegExp);
1266 }
1267
1269 return CreateLiteralParametersOf(node()->op());
1270 }
1271
1272#define INPUTS(V) V(FeedbackVector, feedback_vector, 0, HeapObject)
1274#undef INPUTS
1275};
1276
1280
1282 public:
1283 explicit constexpr JSHasPropertyNode(Node* node) : JSNodeWrapperBase(node) {
1284 DCHECK_EQ(IrOpcode::kJSHasProperty, node->opcode());
1285 }
1286
1288 return PropertyAccessOf(node()->op());
1289 }
1290
1291#define INPUTS(V) \
1292 V(Object, object, 0, Object) \
1293 V(Key, key, 1, Object) \
1294 V(FeedbackVector, feedback_vector, 2, HeapObject)
1296#undef INPUTS
1297};
1298
1300 public:
1301 explicit constexpr JSLoadPropertyNode(Node* node) : JSNodeWrapperBase(node) {
1302 DCHECK_EQ(IrOpcode::kJSLoadProperty, node->opcode());
1303 }
1304
1306 return PropertyAccessOf(node()->op());
1307 }
1308
1309#define INPUTS(V) \
1310 V(Object, object, 0, Object) \
1311 V(Key, key, 1, Object) \
1312 V(FeedbackVector, feedback_vector, 2, HeapObject)
1314#undef INPUTS
1315};
1316
1318 public:
1319 explicit constexpr JSSetKeyedPropertyNode(Node* node)
1320 : JSNodeWrapperBase(node) {
1321 DCHECK_EQ(IrOpcode::kJSSetKeyedProperty, node->opcode());
1322 }
1323
1325 return PropertyAccessOf(node()->op());
1326 }
1327
1328#define INPUTS(V) \
1329 V(Object, object, 0, Object) \
1330 V(Key, key, 1, Object) \
1331 V(Value, value, 2, Object) \
1332 V(FeedbackVector, feedback_vector, 3, HeapObject)
1334#undef INPUTS
1335};
1336
1338 public:
1339 explicit constexpr JSDefineKeyedOwnPropertyNode(Node* node)
1340 : JSNodeWrapperBase(node) {
1341 DCHECK_EQ(IrOpcode::kJSDefineKeyedOwnProperty, node->opcode());
1342 }
1343
1345 return PropertyAccessOf(node()->op());
1346 }
1347
1348#define INPUTS(V) \
1349 V(Object, object, 0, Object) \
1350 V(Key, key, 1, Object) \
1351 V(Value, value, 2, Object) \
1352 V(Flags, flags, 3, Object) \
1353 V(FeedbackVector, feedback_vector, 4, HeapObject)
1355#undef INPUTS
1356};
1357
1358namespace js_node_wrapper_utils {
1359// Avoids template definitions in the .cc file.
1361} // namespace js_node_wrapper_utils
1362
1364 public:
1365 explicit constexpr JSCallOrConstructNode(Node* node)
1366 : JSNodeWrapperBase(node) {
1367 DCHECK(IsValidNode(node));
1368 }
1369
1370#define INPUTS(V) \
1371 V(Target, target, 0, Object) \
1372 V(ReceiverOrNewTarget, receiver_or_new_target, 1, Object)
1374#undef INPUTS
1375
1376 // Besides actual arguments, JSCall nodes (and variants) also take the
1377 // following. Note that we rely on the fact that all variants (JSCall,
1378 // JSCallWithArrayLike, JSCallWithSpread, JSConstruct,
1379 // JSConstructWithArrayLike, JSConstructWithSpread, JSWasmCall) have the same
1380 // underlying node layout.
1381 static constexpr int kTargetInputCount = 1;
1382 static constexpr int kReceiverOrNewTargetInputCount = 1;
1383 static constexpr int kFeedbackVectorInputCount = 1;
1384 static constexpr int kExtraInputCount = kTargetInputCount +
1388 static_assert(kExtraInputCount ==
1390
1391 // Just for static asserts for spots that rely on node layout.
1392 static constexpr bool kFeedbackVectorIsLastInput = true;
1393
1394 // Some spots rely on the fact that call and construct variants have the same
1395 // layout.
1396 static constexpr bool kHaveIdenticalLayouts = true;
1397
1398 // This is the arity fed into Call/ConstructArguments.
1399 static constexpr int ArityForArgc(int parameters) {
1400 return parameters + kExtraInputCount;
1401 }
1402
1403 static constexpr int FirstArgumentIndex() {
1404 return ReceiverOrNewTargetIndex() + 1;
1405 }
1406 static constexpr int ArgumentIndex(int i) { return FirstArgumentIndex() + i; }
1407
1413 int LastArgumentIndex() const {
1415 return ArgumentIndex(ArgumentCount() - 1);
1416 }
1419 return Argument(ArgumentCount() - 1);
1420 }
1421 TNode<Object> ArgumentOr(int i, TNode<Object> default_value) const {
1422 return i < ArgumentCount() ? Argument(i) : default_value;
1423 }
1427 virtual int ArgumentCount() const = 0;
1428
1429 static constexpr int FeedbackVectorIndexForArgc(int argc) {
1430 static_assert(kFeedbackVectorIsLastInput);
1431 return ArgumentIndex(argc - 1) + 1;
1432 }
1440
1441 private:
1442 static constexpr bool IsValidNode(Node* node) {
1443 return node->opcode() == IrOpcode::kJSCall ||
1444 node->opcode() == IrOpcode::kJSCallWithArrayLike ||
1445 node->opcode() == IrOpcode::kJSCallWithSpread ||
1446 node->opcode() == IrOpcode::kJSConstruct ||
1447 node->opcode() == IrOpcode::kJSConstructWithArrayLike ||
1448 node->opcode() == IrOpcode::kJSConstructWithSpread ||
1449 node->opcode() == IrOpcode::kJSConstructForwardAllArgs
1450#if V8_ENABLE_WEBASSEMBLY
1451 || node->opcode() == IrOpcode::kJSWasmCall
1452#endif // V8_ENABLE_WEBASSEMBLY
1453 ; // NOLINT(whitespace/semicolon)
1454 }
1455};
1456
1457template <int kOpcode>
1458bool IsExpectedOpcode(int opcode) {
1459 return opcode == kOpcode;
1460}
1461
1462template <int kOpcode1, int kOpcode2, int... kOpcodes>
1463bool IsExpectedOpcode(int opcode) {
1464 return opcode == kOpcode1 || IsExpectedOpcode<kOpcode2, kOpcodes...>(opcode);
1465}
1466
1467template <int... kOpcodes>
1469 public:
1470 explicit constexpr JSCallNodeBase(Node* node) : JSCallOrConstructNode(node) {
1471 DCHECK(IsExpectedOpcode<kOpcodes...>(node->opcode()));
1472 }
1473
1475 return CallParametersOf(node()->op());
1476 }
1477
1478#define INPUTS(V) \
1479 V(Target, target, 0, Object) \
1480 V(Receiver, receiver, 1, Object)
1482#undef INPUTS
1483
1484 static constexpr int kReceiverInputCount = 1;
1485 static_assert(kReceiverInputCount ==
1487
1488 int ArgumentCount() const override {
1489 // Note: The count reported by this function depends only on the parameter,
1490 // thus adding/removing inputs will not affect it.
1491 return Parameters().arity_without_implicit_args();
1492 }
1493};
1494
1500
1501#if V8_ENABLE_WEBASSEMBLY
1502class JSWasmCallNode final : public JSCallOrConstructNode {
1503 public:
1504 explicit constexpr JSWasmCallNode(Node* node) : JSCallOrConstructNode(node) {
1505 DCHECK_EQ(IrOpcode::kJSWasmCall, node->opcode());
1506 }
1507
1508 const JSWasmCallParameters& Parameters() const {
1509 return OpParameter<JSWasmCallParameters>(node()->op());
1510 }
1511
1512#define INPUTS(V) \
1513 V(Target, target, 0, Object) \
1514 V(Receiver, receiver, 1, Object)
1516#undef INPUTS
1517
1518 static constexpr int kReceiverInputCount = 1;
1519 static_assert(kReceiverInputCount ==
1520 JSCallOrConstructNode::kReceiverOrNewTargetInputCount);
1521
1522 int ArgumentCount() const override {
1523 // Note: The count reported by this function depends only on the parameter
1524 // count, thus adding/removing inputs will not affect it.
1525 return Parameters().arity_without_implicit_args();
1526 }
1527
1528 static Type TypeForWasmReturnType(wasm::CanonicalValueType type);
1529};
1530#endif // V8_ENABLE_WEBASSEMBLY
1531
1532template <int kOpcode>
1534 public:
1535 explicit constexpr JSConstructNodeBase(Node* node)
1536 : JSCallOrConstructNode(node) {
1537 DCHECK_EQ(kOpcode, node->opcode());
1538 }
1539
1541 return ConstructParametersOf(node()->op());
1542 }
1543
1544#define INPUTS(V) \
1545 V(Target, target, 0, Object) \
1546 V(NewTarget, new_target, 1, Object)
1548#undef INPUTS
1549
1550 static constexpr int kNewTargetInputCount = 1;
1551 static_assert(kNewTargetInputCount ==
1553
1554 int ArgumentCount() const {
1555 // Note: The count reported by this function depends only on the parameter,
1556 // thus adding/removing inputs will not affect it.
1557 return Parameters().arity_without_implicit_args();
1558 }
1559};
1560
1568
1570 public:
1571 explicit constexpr JSLoadNamedNode(Node* node) : JSNodeWrapperBase(node) {
1572 DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
1573 }
1574
1575 const NamedAccess& Parameters() const { return NamedAccessOf(node()->op()); }
1576
1577#define INPUTS(V) \
1578 V(Object, object, 0, Object) \
1579 V(FeedbackVector, feedback_vector, 1, HeapObject)
1581#undef INPUTS
1582};
1583
1585 public:
1586 explicit constexpr JSLoadNamedFromSuperNode(Node* node)
1587 : JSNodeWrapperBase(node) {
1588 DCHECK_EQ(IrOpcode::kJSLoadNamedFromSuper, node->opcode());
1589 }
1590
1591 const NamedAccess& Parameters() const { return NamedAccessOf(node()->op()); }
1592
1593#define INPUTS(V) \
1594 V(Receiver, receiver, 0, Object) \
1595 V(HomeObject, home_object, 1, Object) \
1596 V(FeedbackVector, feedback_vector, 2, HeapObject)
1598#undef INPUTS
1599};
1600
1602 public:
1603 explicit constexpr JSSetNamedPropertyNode(Node* node)
1604 : JSNodeWrapperBase(node) {
1605 DCHECK_EQ(IrOpcode::kJSSetNamedProperty, node->opcode());
1606 }
1607
1608 const NamedAccess& Parameters() const { return NamedAccessOf(node()->op()); }
1609
1610#define INPUTS(V) \
1611 V(Object, object, 0, Object) \
1612 V(Value, value, 1, Object) \
1613 V(FeedbackVector, feedback_vector, 2, HeapObject)
1615#undef INPUTS
1616};
1617
1619 public:
1620 explicit constexpr JSDefineNamedOwnPropertyNode(Node* node)
1621 : JSNodeWrapperBase(node) {
1622 DCHECK_EQ(IrOpcode::kJSDefineNamedOwnProperty, node->opcode());
1623 }
1624
1628
1629#define INPUTS(V) \
1630 V(Object, object, 0, Object) \
1631 V(Value, value, 1, Object) \
1632 V(FeedbackVector, feedback_vector, 2, HeapObject)
1634#undef INPUTS
1635};
1636
1638 public:
1639 explicit constexpr JSStoreGlobalNode(Node* node) : JSNodeWrapperBase(node) {
1640 DCHECK_EQ(IrOpcode::kJSStoreGlobal, node->opcode());
1641 }
1642
1644 return StoreGlobalParametersOf(node()->op());
1645 }
1646
1647#define INPUTS(V) \
1648 V(Value, value, 0, Object) \
1649 V(FeedbackVector, feedback_vector, 1, HeapObject)
1651#undef INPUTS
1652};
1653
1655 public:
1656 explicit constexpr JSLoadGlobalNode(Node* node) : JSNodeWrapperBase(node) {
1657 DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode());
1658 }
1659
1661 return LoadGlobalParametersOf(node()->op());
1662 }
1663
1664#define INPUTS(V) V(FeedbackVector, feedback_vector, 0, HeapObject)
1666#undef INPUTS
1667};
1668
1670 public:
1671 explicit constexpr JSCreateEmptyLiteralArrayNode(Node* node)
1672 : JSNodeWrapperBase(node) {
1673 DCHECK_EQ(IrOpcode::kJSCreateEmptyLiteralArray, node->opcode());
1674 }
1675
1677 return FeedbackParameterOf(node()->op());
1678 }
1679
1680#define INPUTS(V) V(FeedbackVector, feedback_vector, 0, HeapObject)
1682#undef INPUTS
1683};
1684
1686 public:
1688 : JSNodeWrapperBase(node) {
1689 DCHECK_EQ(IrOpcode::kJSDefineKeyedOwnPropertyInLiteral, node->opcode());
1690 }
1691
1693 return FeedbackParameterOf(node()->op());
1694 }
1695
1696#define INPUTS(V) \
1697 V(Object, object, 0, Object) \
1698 V(Name, name, 1, Object) \
1699 V(Value, value, 2, Object) \
1700 V(Flags, flags, 3, Object) \
1701 V(FeedbackVector, feedback_vector, 4, HeapObject)
1703#undef INPUTS
1704};
1705
1707 public:
1708 explicit constexpr JSStoreInArrayLiteralNode(Node* node)
1709 : JSNodeWrapperBase(node) {
1710 DCHECK_EQ(IrOpcode::kJSStoreInArrayLiteral, node->opcode());
1711 }
1712
1714 return FeedbackParameterOf(node()->op());
1715 }
1716
1717#define INPUTS(V) \
1718 V(Array, array, 0, Object) \
1719 V(Index, index, 1, Object) \
1720 V(Value, value, 2, Object) \
1721 V(FeedbackVector, feedback_vector, 3, HeapObject)
1723#undef INPUTS
1724};
1725
1727 public:
1728 explicit constexpr JSCreateClosureNode(Node* node) : JSNodeWrapperBase(node) {
1729 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode());
1730 }
1731
1733 return CreateClosureParametersOf(node()->op());
1734 }
1735
1736#define INPUTS(V) V(FeedbackCell, feedback_cell, 0, FeedbackCell)
1738#undef INPUTS
1739
1741};
1742
1744 public:
1745 explicit constexpr JSForInPrepareNode(Node* node) : JSNodeWrapperBase(node) {
1746 DCHECK_EQ(IrOpcode::kJSForInPrepare, node->opcode());
1747 }
1748
1750 return ForInParametersOf(node()->op());
1751 }
1752
1753#define INPUTS(V) \
1754 V(Enumerator, enumerator, 0, Object) \
1755 V(FeedbackVector, feedback_vector, 1, HeapObject)
1757#undef INPUTS
1758};
1759
1761 public:
1762 explicit constexpr JSForInNextNode(Node* node) : JSNodeWrapperBase(node) {
1763 DCHECK_EQ(IrOpcode::kJSForInNext, node->opcode());
1764 }
1765
1767 return ForInParametersOf(node()->op());
1768 }
1769
1770#define INPUTS(V) \
1771 V(Receiver, receiver, 0, Object) \
1772 V(CacheArray, cache_array, 1, Object) \
1773 V(CacheType, cache_type, 2, Object) \
1774 V(Index, index, 3, Smi) \
1775 V(FeedbackVector, feedback_vector, 4, HeapObject)
1777#undef INPUTS
1778};
1779
1781 : public JSNodeWrapperBase {
1782 public:
1784 : JSNodeWrapperBase(node) {
1785 DCHECK_EQ(IrOpcode::kJSFindNonDefaultConstructorOrConstruct,
1786 node->opcode());
1787 }
1788
1789#define INPUTS(V) \
1790 V(ThisFunction, this_function, 0, Object) \
1791 V(NewTarget, new_target, 1, Object)
1793#undef INPUTS
1794};
1795
1796#undef DEFINE_INPUT_ACCESSORS
1797
1798} // namespace compiler
1799} // namespace internal
1800} // namespace v8
1801
1802#endif // V8_COMPILER_JS_OPERATOR_H_
JSGraph * jsgraph
Builtins::Kind kind
Definition builtins.cc:40
static constexpr T decode(U value)
Definition bit-field.h:66
static TNode UncheckedCast(compiler::Node *node)
Definition tnode.h:413
bool operator!=(CallForwardVarargsParameters const &that) const
bool operator==(CallForwardVarargsParameters const &that) const
friend size_t hash_value(CallForwardVarargsParameters const &p)
CallForwardVarargsParameters(size_t arity, uint32_t start_index)
bool operator!=(CallFrequency const &that) const
friend size_t hash_value(CallFrequency const &f)
bool operator==(CallFrequency const &that) const
static constexpr float kNoFeedbackCallFrequency
static constexpr int kExtraCallInputCount
CallParameters(size_t arity, CallFrequency const &frequency, FeedbackSource const &feedback, ConvertReceiverMode convert_mode, SpeculationMode speculation_mode, CallFeedbackRelation feedback_relation)
ConvertReceiverMode convert_mode() const
bool operator!=(CallParameters const &that) const
bool operator==(CallParameters const &that) const
CallFeedbackRelation feedback_relation() const
CallFrequency const & frequency() const
friend size_t hash_value(CallParameters const &p)
FeedbackSource const & feedback() const
SpeculationMode speculation_mode() const
CallRuntimeParameters(Runtime::FunctionId id, size_t arity)
FeedbackSource const & feedback() const
CloneObjectParameters(FeedbackSource const &feedback, int flags)
ConstructForwardVarargsParameters(size_t arity, uint32_t start_index)
bool operator==(ConstructForwardVarargsParameters const &that) const
bool operator!=(ConstructForwardVarargsParameters const &that) const
friend size_t hash_value(ConstructForwardVarargsParameters const &p)
ConstructParameters(uint32_t arity, CallFrequency const &frequency, FeedbackSource const &feedback)
FeedbackSource const & feedback() const
CallFrequency const & frequency() const
ContextAccess(size_t depth, size_t index, bool immutable)
CreateArrayParameters(size_t arity, OptionalAllocationSiteRef site)
OptionalAllocationSiteRef const site_
friend bool operator==(CreateArrayParameters const &, CreateArrayParameters const &)
friend size_t hash_value(CreateArrayParameters const &)
OptionalAllocationSiteRef site() const
friend bool operator!=(CreateArrayParameters const &, CreateArrayParameters const &)
friend std::ostream & operator<<(std::ostream &, CreateArrayParameters const &)
friend bool operator!=(CreateBoundFunctionParameters const &, CreateBoundFunctionParameters const &)
friend std::ostream & operator<<(std::ostream &, CreateBoundFunctionParameters const &)
friend size_t hash_value(CreateBoundFunctionParameters const &)
friend bool operator==(CreateBoundFunctionParameters const &, CreateBoundFunctionParameters const &)
friend bool operator!=(CreateClosureParameters const &, CreateClosureParameters const &)
friend size_t hash_value(CreateClosureParameters const &)
friend std::ostream & operator<<(std::ostream &, CreateClosureParameters const &)
SharedFunctionInfoRef shared_info() const
friend bool operator==(CreateClosureParameters const &, CreateClosureParameters const &)
CreateClosureParameters(SharedFunctionInfoRef shared_info, CodeRef code, AllocationType allocation)
CreateCollectionIteratorParameters(CollectionKind collection_kind, IterationKind iteration_kind)
friend bool operator!=(CreateFunctionContextParameters const &lhs, CreateFunctionContextParameters const &rhs)
friend bool operator==(CreateFunctionContextParameters const &lhs, CreateFunctionContextParameters const &rhs)
CreateFunctionContextParameters(ScopeInfoRef scope_info, int slot_count, ScopeType scope_type)
friend std::ostream & operator<<(std::ostream &os, CreateFunctionContextParameters const &parameters)
friend size_t hash_value(CreateFunctionContextParameters const &parameters)
friend size_t hash_value(CreateLiteralParameters const &)
friend std::ostream & operator<<(std::ostream &, CreateLiteralParameters const &)
FeedbackSource const & feedback() const
friend bool operator==(CreateLiteralParameters const &, CreateLiteralParameters const &)
friend bool operator!=(CreateLiteralParameters const &, CreateLiteralParameters const &)
CreateLiteralParameters(HeapObjectRef constant, FeedbackSource const &feedback, int length, int flags)
friend bool operator!=(DefineNamedOwnPropertyParameters const &, DefineNamedOwnPropertyParameters const &)
friend size_t hash_value(DefineNamedOwnPropertyParameters const &)
friend std::ostream & operator<<(std::ostream &, DefineNamedOwnPropertyParameters const &)
friend bool operator==(DefineNamedOwnPropertyParameters const &, DefineNamedOwnPropertyParameters const &)
DefineNamedOwnPropertyParameters(NameRef name, FeedbackSource const &feedback)
FeedbackSource const & feedback() const
FeedbackParameter(FeedbackSource const &feedback)
ForInParameters(const FeedbackSource &feedback, ForInMode mode)
const FeedbackSource & feedback() const
FeedbackSource const & callFeedback() const
GetIteratorParameters(const FeedbackSource &load_feedback, const FeedbackSource &call_feedback)
FeedbackSource const & loadFeedback() const
GetTemplateObjectParameters(TemplateObjectDescriptionRef description, SharedFunctionInfoRef shared, FeedbackSource const &feedback)
friend std::ostream & operator<<(std::ostream &, GetTemplateObjectParameters const &)
friend bool operator!=(GetTemplateObjectParameters const &, GetTemplateObjectParameters const &)
friend size_t hash_value(GetTemplateObjectParameters const &)
friend bool operator==(GetTemplateObjectParameters const &, GetTemplateObjectParameters const &)
const TemplateObjectDescriptionRef description_
TemplateObjectDescriptionRef description() const
const FeedbackParameter & Parameters() const
const CallParameters & Parameters() const
static constexpr int ArityForArgc(int parameters)
static constexpr int FeedbackVectorIndexForArgc(int argc)
TNode< HeapObject > feedback_vector() const
static constexpr int ArgumentIndex(int i)
TNode< Object > ArgumentOr(int i, TNode< Object > default_value) const
TNode< Object > ArgumentOrUndefined(int i, JSGraph *jsgraph) const
static constexpr bool IsValidNode(Node *node)
const CloneObjectParameters & Parameters() const
const ConstructParameters & Parameters() const
FeedbackCellRef GetFeedbackCellRefChecked(JSHeapBroker *broker) const
const CreateClosureParameters & Parameters() const
const CreateLiteralParameters & Parameters() const
const DefineNamedOwnPropertyParameters & Parameters() const
const ForInParameters & Parameters() const
const ForInParameters & Parameters() const
const GetIteratorParameters & Parameters() const
const GetTemplateObjectParameters & Parameters() const
const PropertyAccess & Parameters() const
const LoadGlobalParameters & Parameters() const
const NamedAccess & Parameters() const
const PropertyAccess & Parameters() const
const Operator * StrictEqual(FeedbackSource const &feedback)
const Operator * GreaterThanOrEqual(FeedbackSource const &feedback)
const Operator * ShiftRightLogical(FeedbackSource const &feedback)
const Operator * Equal(FeedbackSource const &feedback)
const Operator * Increment(FeedbackSource const &feedback)
const Operator * GeneratorRestoreInputOrDebugPos()
const Operator * ShiftRight(FeedbackSource const &feedback)
const JSOperatorGlobalCache & cache_
const Operator * BitwiseAnd(FeedbackSource const &feedback)
const Operator * ShiftLeft(FeedbackSource const &feedback)
const Operator * FindNonDefaultConstructorOrConstruct()
const Operator * Negate(FeedbackSource const &feedback)
const Operator * GreaterThan(FeedbackSource const &feedback)
const Operator * Multiply(FeedbackSource const &feedback)
const Operator * LessThan(FeedbackSource const &feedback)
const Operator * Decrement(FeedbackSource const &feedback)
const Operator * Modulus(FeedbackSource const &feedback)
const Operator * LessThanOrEqual(FeedbackSource const &feedback)
const Operator * Divide(FeedbackSource const &feedback)
const Operator * BitwiseOr(FeedbackSource const &feedback)
const Operator * InstanceOf(const FeedbackSource &feedback)
const Operator * Exponentiate(FeedbackSource const &feedback)
const Operator * BitwiseXor(FeedbackSource const &feedback)
const Operator * BitwiseNot(FeedbackSource const &feedback)
const Operator * Add(FeedbackSource const &feedback)
JSOperatorBuilder(const JSOperatorBuilder &)=delete
const Operator * Subtract(FeedbackSource const &feedback)
JSOperatorBuilder & operator=(const JSOperatorBuilder &)=delete
static constexpr bool IsUnaryWithFeedback(Operator::Opcode opcode)
Definition js-operator.h:59
static constexpr bool IsBinaryWithFeedback(Operator::Opcode opcode)
Definition js-operator.h:71
const PropertyAccess & Parameters() const
const StoreGlobalParameters & Parameters() const
const FeedbackParameter & Parameters() const
friend size_t hash_value(LoadGlobalParameters const &)
friend std::ostream & operator<<(std::ostream &, LoadGlobalParameters const &)
friend bool operator==(LoadGlobalParameters const &, LoadGlobalParameters const &)
const FeedbackSource & feedback() const
friend bool operator!=(LoadGlobalParameters const &, LoadGlobalParameters const &)
LoadGlobalParameters(NameRef name, const FeedbackSource &feedback, TypeofMode typeof_mode)
friend size_t hash_value(NamedAccess const &)
NamedAccess(LanguageMode language_mode, NameRef name, FeedbackSource const &feedback)
friend std::ostream & operator<<(std::ostream &, NamedAccess const &)
LanguageMode language_mode() const
FeedbackSource const & feedback() const
friend bool operator==(NamedAccess const &, NamedAccess const &)
friend bool operator!=(NamedAccess const &, NamedAccess const &)
static Node * GetEffectInput(Node *node, int index=0)
static Node * GetContextInput(Node *node)
static Node * GetFrameStateInput(Node *node)
static Node * GetValueInput(Node *node, int index)
static Node * GetControlInput(Node *node, int index=0)
PropertyAccess(LanguageMode language_mode, FeedbackSource const &feedback)
FeedbackSource const & feedback() const
FeedbackSource const & feedback() const
friend size_t hash_value(StoreGlobalParameters const &)
friend bool operator==(StoreGlobalParameters const &, StoreGlobalParameters const &)
StoreGlobalParameters(LanguageMode language_mode, const FeedbackSource &feedback, NameRef name)
friend std::ostream & operator<<(std::ostream &, StoreGlobalParameters const &)
friend bool operator!=(StoreGlobalParameters const &, StoreGlobalParameters const &)
Zone * zone_
#define DEFINE_INPUT_ACCESSORS(Name, name, TheIndex, Type)
JSHeapBroker * broker
Node * node
#define INPUTS(V)
#define JS_BINOP_WITH_FEEDBACK(V)
Definition js-operator.h:50
#define JS_UNOP_WITH_FEEDBACK(V)
Definition js-operator.h:46
std::shared_ptr< NativeModule > native_module_
STL namespace.
V8_INLINE size_t hash_combine(size_t seed, size_t hash)
Definition hashing.h:77
V8_INLINE Dest bit_cast(Source const &source)
Definition macros.h:95
TNode< Oddball > UndefinedConstant(JSGraph *jsgraph)
const CreateArrayIteratorParameters & CreateArrayIteratorParametersOf(const Operator *op)
bool IsExpectedOpcode(int opcode)
const CallRuntimeParameters & CallRuntimeParametersOf(const Operator *op)
NamedAccess const & NamedAccessOf(const Operator *op)
const StoreGlobalParameters & StoreGlobalParametersOf(const Operator *op)
DefineNamedOwnPropertyParameters const & DefineNamedOwnPropertyParametersOf(const Operator *op)
ForInParameters const & ForInParametersOf(const Operator *op)
CallForwardVarargsParameters const & CallForwardVarargsParametersOf(Operator const *op)
const GetTemplateObjectParameters & GetTemplateObjectParametersOf(const Operator *op)
const CreateBoundFunctionParameters & CreateBoundFunctionParametersOf(const Operator *op)
const CreateClosureParameters & CreateClosureParametersOf(const Operator *op)
const CreateLiteralParameters & CreateLiteralParametersOf(const Operator *op)
int RestoreRegisterIndexOf(const Operator *op)
const CallParameters & CallParametersOf(const Operator *op)
ConstructParameters const & ConstructParametersOf(Operator const *op)
ScopeInfoRef ScopeInfoOf(const Operator *op)
ConstructForwardVarargsParameters const & ConstructForwardVarargsParametersOf(Operator const *op)
size_t hash_value(const BranchParameters &p)
const CreateCollectionIteratorParameters & CreateCollectionIteratorParametersOf(const Operator *op)
const LoadGlobalParameters & LoadGlobalParametersOf(const Operator *op)
CreateFunctionContextParameters const & CreateFunctionContextParametersOf(Operator const *op)
bool operator!=(DeoptimizeParameters lhs, DeoptimizeParameters rhs)
bool operator==(const BranchParameters &lhs, const BranchParameters &rhs)
const CreateArrayParameters & CreateArrayParametersOf(const Operator *op)
FeedbackParameter const & FeedbackParameterOf(const Operator *op)
CreateArgumentsType const & CreateArgumentsTypeOf(const Operator *op)
std::ostream & operator<<(std::ostream &os, AccessMode access_mode)
int RegisterCountOf(Operator const *op)
ContextAccess const & ContextAccessOf(Operator const *op)
PropertyAccess const & PropertyAccessOf(const Operator *op)
GetIteratorParameters const & GetIteratorParametersOf(const Operator *op)
int GeneratorStoreValueCountOf(const Operator *op)
const CloneObjectParameters & CloneObjectParametersOf(const Operator *op)
Definition c-api.cc:87
#define NON_EXPORTED_BASE(code)
#define CHECK(condition)
Definition logging.h:124
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_LT(v1, v2)
Definition logging.h:489
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define DCHECK_GT(v1, v2)
Definition logging.h:487
#define V8_EXPORT_PRIVATE
Definition macros.h:460
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671
const wasm::WasmModule * module_