v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-operator.cc
Go to the documentation of this file.
1// Copyright 2014 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
6
7#include <limits>
8
18
19namespace v8 {
20namespace internal {
21namespace compiler {
22
23namespace {
24
25// Returns properties for the given binary op.
26constexpr Operator::Properties BinopProperties(Operator::Opcode opcode) {
28 return opcode == IrOpcode::kJSStrictEqual ? Operator::kPure
30}
31
32template <class T>
33Address AddressOrNull(OptionalRef<T> ref) {
34 if (!ref.has_value()) return kNullAddress;
35 return ref->object().address();
36}
37
38} // namespace
39
40namespace js_node_wrapper_utils {
41
45
46} // namespace js_node_wrapper_utils
47
49 JSHeapBroker* broker) const {
50 HeapObjectMatcher m(feedback_cell());
51 CHECK(m.HasResolvedValue());
52 return MakeRef(broker, Cast<FeedbackCell>(m.ResolvedValue()));
53}
54
55std::ostream& operator<<(std::ostream& os, CallFrequency const& f) {
56 if (f.IsUnknown()) return os << "unknown";
57 return os << f.value();
58}
59
60std::ostream& operator<<(std::ostream& os,
62 return os << p.arity() << ", " << p.start_index();
63}
64
66 Operator const* op) {
67 DCHECK_EQ(IrOpcode::kJSConstructForwardVarargs, op->opcode());
69}
70
72 ConstructParameters const& rhs) {
73 return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() &&
74 lhs.feedback() == rhs.feedback();
75}
76
78 ConstructParameters const& rhs) {
79 return !(lhs == rhs);
80}
81
83 return base::hash_combine(p.arity(), p.frequency(),
85}
86
87std::ostream& operator<<(std::ostream& os, ConstructParameters const& p) {
88 return os << p.arity() << ", " << p.frequency();
89}
90
92 DCHECK(op->opcode() == IrOpcode::kJSConstruct ||
93 op->opcode() == IrOpcode::kJSConstructWithArrayLike ||
94 op->opcode() == IrOpcode::kJSConstructWithSpread ||
95 op->opcode() == IrOpcode::kJSConstructForwardAllArgs);
97}
98
99std::ostream& operator<<(std::ostream& os, CallParameters const& p) {
100 return os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode()
101 << ", " << p.speculation_mode() << ", " << p.feedback_relation();
102}
103
105 DCHECK(op->opcode() == IrOpcode::kJSCall ||
106 op->opcode() == IrOpcode::kJSCallWithArrayLike ||
107 op->opcode() == IrOpcode::kJSCallWithSpread);
109}
110
111std::ostream& operator<<(std::ostream& os,
113 return os << p.arity() << ", " << p.start_index();
114}
115
117 Operator const* op) {
118 DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode());
120}
121
122
124 CallRuntimeParameters const& rhs) {
125 return lhs.id() == rhs.id() && lhs.arity() == rhs.arity();
126}
127
128
130 CallRuntimeParameters const& rhs) {
131 return !(lhs == rhs);
132}
133
134
136 return base::hash_combine(p.id(), p.arity());
137}
138
139
140std::ostream& operator<<(std::ostream& os, CallRuntimeParameters const& p) {
141 return os << p.id() << ", " << p.arity();
142}
143
144
146 DCHECK_EQ(IrOpcode::kJSCallRuntime, op->opcode());
148}
149
150
151ContextAccess::ContextAccess(size_t depth, size_t index, bool immutable)
152 : immutable_(immutable),
153 depth_(static_cast<uint16_t>(depth)),
154 index_(static_cast<uint32_t>(index)) {
155 DCHECK(depth <= std::numeric_limits<uint16_t>::max());
156 DCHECK(index <= std::numeric_limits<uint32_t>::max());
157}
158
159
160bool operator==(ContextAccess const& lhs, ContextAccess const& rhs) {
161 return lhs.depth() == rhs.depth() && lhs.index() == rhs.index() &&
162 lhs.immutable() == rhs.immutable();
163}
164
165
166bool operator!=(ContextAccess const& lhs, ContextAccess const& rhs) {
167 return !(lhs == rhs);
168}
169
170
171size_t hash_value(ContextAccess const& access) {
172 return base::hash_combine(access.depth(), access.index(), access.immutable());
173}
174
175
176std::ostream& operator<<(std::ostream& os, ContextAccess const& access) {
177 return os << access.depth() << ", " << access.index() << ", "
178 << access.immutable();
179}
180
181
183 DCHECK(op->opcode() == IrOpcode::kJSLoadContext ||
184 op->opcode() == IrOpcode::kJSLoadScriptContext ||
185 op->opcode() == IrOpcode::kJSStoreContext ||
186 op->opcode() == IrOpcode::kJSStoreScriptContext);
188}
189
192 return lhs.scope_info_.object().location() ==
193 rhs.scope_info_.object().location() &&
194 lhs.slot_count() == rhs.slot_count() &&
195 lhs.scope_type() == rhs.scope_type();
196}
197
200 return !(lhs == rhs);
201}
202
204 return base::hash_combine(parameters.scope_info_.object().location(),
205 parameters.slot_count(),
206 static_cast<int>(parameters.scope_type()));
207}
208
209std::ostream& operator<<(std::ostream& os,
210 CreateFunctionContextParameters const& parameters) {
211 return os << parameters.slot_count() << ", " << parameters.scope_type();
212}
213
215 Operator const* op) {
216 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, op->opcode());
218}
219
222 return lhs.name_.object().location() == rhs.name_.object().location() &&
223 lhs.feedback() == rhs.feedback();
224}
225
228 return !(lhs == rhs);
229}
230
232 return base::hash_combine(p.name_.object().location(),
234}
235
236std::ostream& operator<<(std::ostream& os,
238 return os << Brief(*p.name_.object());
239}
240
242 const Operator* op) {
243 DCHECK_EQ(IrOpcode::kJSDefineNamedOwnProperty, op->opcode());
245}
246
247bool operator==(FeedbackParameter const& lhs, FeedbackParameter const& rhs) {
248 return lhs.feedback() == rhs.feedback();
249}
250
251bool operator!=(FeedbackParameter const& lhs, FeedbackParameter const& rhs) {
252 return !(lhs == rhs);
253}
254
256 return FeedbackSource::Hash()(p.feedback());
257}
258
259std::ostream& operator<<(std::ostream& os, FeedbackParameter const& p) {
260 return os << p.feedback();
261}
262
266 op->opcode() == IrOpcode::kJSCreateEmptyLiteralArray ||
267 op->opcode() == IrOpcode::kJSInstanceOf ||
268 op->opcode() == IrOpcode::kJSDefineKeyedOwnPropertyInLiteral ||
269 op->opcode() == IrOpcode::kJSStoreInArrayLiteral);
271}
272
273bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
274 return lhs.name_.object().location() == rhs.name_.object().location() &&
275 lhs.language_mode() == rhs.language_mode() &&
276 lhs.feedback() == rhs.feedback();
277}
278
279
280bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) {
281 return !(lhs == rhs);
282}
283
284
285size_t hash_value(NamedAccess const& p) {
286 return base::hash_combine(p.name_.object().location(), p.language_mode(),
288}
289
290
291std::ostream& operator<<(std::ostream& os, NamedAccess const& p) {
292 return os << Brief(*p.name_.object()) << ", " << p.language_mode();
293}
294
295
297 DCHECK(op->opcode() == IrOpcode::kJSLoadNamed ||
298 op->opcode() == IrOpcode::kJSLoadNamedFromSuper ||
299 op->opcode() == IrOpcode::kJSSetNamedProperty);
300 return OpParameter<NamedAccess>(op);
301}
302
303
304std::ostream& operator<<(std::ostream& os, PropertyAccess const& p) {
305 return os << p.language_mode() << ", " << p.feedback();
306}
307
308
309bool operator==(PropertyAccess const& lhs, PropertyAccess const& rhs) {
310 return lhs.language_mode() == rhs.language_mode() &&
311 lhs.feedback() == rhs.feedback();
312}
313
314
315bool operator!=(PropertyAccess const& lhs, PropertyAccess const& rhs) {
316 return !(lhs == rhs);
317}
318
319
321 DCHECK(op->opcode() == IrOpcode::kJSHasProperty ||
322 op->opcode() == IrOpcode::kJSLoadProperty ||
323 op->opcode() == IrOpcode::kJSSetKeyedProperty ||
324 op->opcode() == IrOpcode::kJSDefineKeyedOwnProperty);
326}
327
328
329size_t hash_value(PropertyAccess const& p) {
332}
333
334
336 LoadGlobalParameters const& rhs) {
337 return lhs.name_.object().location() == rhs.name_.object().location() &&
338 lhs.feedback() == rhs.feedback() &&
339 lhs.typeof_mode() == rhs.typeof_mode();
340}
341
342
344 LoadGlobalParameters const& rhs) {
345 return !(lhs == rhs);
346}
347
348
350 return base::hash_combine(p.name_.object().location(),
351 static_cast<int>(p.typeof_mode()));
352}
353
354
355std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) {
356 return os << Brief(*p.name_.object()) << ", "
357 << static_cast<int>(p.typeof_mode());
358}
359
360
362 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode());
364}
365
366
368 StoreGlobalParameters const& rhs) {
369 return lhs.language_mode() == rhs.language_mode() &&
370 lhs.name_.object().location() == rhs.name_.object().location() &&
371 lhs.feedback() == rhs.feedback();
372}
373
374
376 StoreGlobalParameters const& rhs) {
377 return !(lhs == rhs);
378}
379
380
382 return base::hash_combine(p.language_mode(), p.name_.object().location(),
384}
385
386
387std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) {
388 return os << p.language_mode() << ", " << Brief(*p.name_.object());
389}
390
391
393 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
395}
396
397
399 DCHECK_EQ(IrOpcode::kJSCreateArguments, op->opcode());
401}
402
404 CreateArrayParameters const& rhs) {
405 return lhs.arity() == rhs.arity() &&
406 AddressOrNull(lhs.site_) == AddressOrNull(rhs.site_);
407}
408
409
411 CreateArrayParameters const& rhs) {
412 return !(lhs == rhs);
413}
414
415
417 return base::hash_combine(p.arity(), AddressOrNull(p.site_));
418}
419
420
421std::ostream& operator<<(std::ostream& os, CreateArrayParameters const& p) {
422 os << p.arity();
423 if (p.site_.has_value()) {
424 os << ", " << Brief(*p.site_->object());
425 }
426 return os;
427}
428
430 DCHECK_EQ(IrOpcode::kJSCreateArray, op->opcode());
432}
433
436 return lhs.kind() == rhs.kind();
437}
438
441 return !(lhs == rhs);
442}
443
445 return static_cast<size_t>(p.kind());
446}
447
448std::ostream& operator<<(std::ostream& os,
450 return os << p.kind();
451}
452
454 const Operator* op) {
455 DCHECK_EQ(IrOpcode::kJSCreateArrayIterator, op->opcode());
457}
458
461 return lhs.collection_kind() == rhs.collection_kind() &&
462 lhs.iteration_kind() == rhs.iteration_kind();
463}
464
467 return !(lhs == rhs);
468}
469
471 return base::hash_combine(static_cast<size_t>(p.collection_kind()),
472 static_cast<size_t>(p.iteration_kind()));
473}
474
475std::ostream& operator<<(std::ostream& os,
477 return os << p.collection_kind() << ", " << p.iteration_kind();
478}
479
481 const Operator* op) {
482 DCHECK_EQ(IrOpcode::kJSCreateCollectionIterator, op->opcode());
484}
485
488 return lhs.arity() == rhs.arity() &&
489 lhs.map_.object().location() == rhs.map_.object().location();
490}
491
494 return !(lhs == rhs);
495}
496
498 return base::hash_combine(p.arity(), p.map_.object().location());
499}
500
501std::ostream& operator<<(std::ostream& os,
503 os << p.arity();
504 if (!p.map_.object().is_null()) os << ", " << Brief(*p.map_.object());
505 return os;
506}
507
509 const Operator* op) {
510 DCHECK_EQ(IrOpcode::kJSCreateBoundFunction, op->opcode());
512}
513
515 GetTemplateObjectParameters const& rhs) {
516 return lhs.description_.object().location() ==
517 rhs.description_.object().location() &&
518 lhs.shared_.object().location() == rhs.shared_.object().location() &&
519 lhs.feedback() == rhs.feedback();
520}
521
523 GetTemplateObjectParameters const& rhs) {
524 return !(lhs == rhs);
525}
526
528 return base::hash_combine(p.description_.object().location(),
529 p.shared_.object().location(),
531}
532
533std::ostream& operator<<(std::ostream& os,
535 return os << Brief(*p.description_.object()) << ", "
536 << Brief(*p.shared_.object());
537}
538
540 const Operator* op) {
541 DCHECK(op->opcode() == IrOpcode::kJSGetTemplateObject);
543}
544
546 CreateClosureParameters const& rhs) {
547 return lhs.allocation() == rhs.allocation() &&
548 lhs.code_.object().location() == rhs.code_.object().location() &&
549 lhs.shared_info_.object().location() ==
550 rhs.shared_info_.object().location();
551}
552
553
555 CreateClosureParameters const& rhs) {
556 return !(lhs == rhs);
557}
558
559
561 return base::hash_combine(p.allocation(), p.code_.object().location(),
562 p.shared_info_.object().location());
563}
564
565
566std::ostream& operator<<(std::ostream& os, CreateClosureParameters const& p) {
567 return os << p.allocation() << ", " << Brief(*p.shared_info_.object()) << ", "
568 << Brief(*p.code_.object());
569}
570
571
573 DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode());
575}
576
577
579 CreateLiteralParameters const& rhs) {
580 return lhs.constant_.object().location() ==
581 rhs.constant_.object().location() &&
582 lhs.feedback() == rhs.feedback() && lhs.length() == rhs.length() &&
583 lhs.flags() == rhs.flags();
584}
585
586
588 CreateLiteralParameters const& rhs) {
589 return !(lhs == rhs);
590}
591
592
594 return base::hash_combine(p.constant_.object().location(),
596 p.flags());
597}
598
599
600std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) {
601 return os << Brief(*p.constant_.object()) << ", " << p.length() << ", "
602 << p.flags();
603}
604
605
607 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray ||
608 op->opcode() == IrOpcode::kJSCreateLiteralObject ||
609 op->opcode() == IrOpcode::kJSCreateLiteralRegExp);
611}
612
614 CloneObjectParameters const& rhs) {
615 return lhs.feedback() == rhs.feedback() && lhs.flags() == rhs.flags();
616}
617
619 CloneObjectParameters const& rhs) {
620 return !(lhs == rhs);
621}
622
626
627std::ostream& operator<<(std::ostream& os, CloneObjectParameters const& p) {
628 return os << p.flags();
629}
630
632 DCHECK(op->opcode() == IrOpcode::kJSCloneObject);
634}
635
636std::ostream& operator<<(std::ostream& os, GetIteratorParameters const& p) {
637 return os << p.loadFeedback() << ", " << p.callFeedback();
638}
639
641 GetIteratorParameters const& rhs) {
642 return lhs.loadFeedback() == rhs.loadFeedback() &&
643 lhs.callFeedback() == rhs.callFeedback();
644}
645
647 GetIteratorParameters const& rhs) {
648 return !(lhs == rhs);
649}
650
652 DCHECK(op->opcode() == IrOpcode::kJSGetIterator);
654}
655
660
661size_t hash_value(ForInMode const& mode) { return static_cast<uint8_t>(mode); }
662
663std::ostream& operator<<(std::ostream& os, ForInMode const& mode) {
664 switch (mode) {
666 return os << "UseEnumCacheKeysAndIndices";
668 return os << "UseEnumCacheKeys";
670 return os << "Generic";
671 }
672 UNREACHABLE();
673}
674
675bool operator==(ForInParameters const& lhs, ForInParameters const& rhs) {
676 return lhs.feedback() == rhs.feedback() && lhs.mode() == rhs.mode();
677}
678
679bool operator!=(ForInParameters const& lhs, ForInParameters const& rhs) {
680 return !(lhs == rhs);
681}
682
683size_t hash_value(ForInParameters const& p) {
685}
686
687std::ostream& operator<<(std::ostream& os, ForInParameters const& p) {
688 return os << p.feedback() << ", " << p.mode();
689}
690
692 DCHECK(op->opcode() == IrOpcode::kJSForInNext ||
693 op->opcode() == IrOpcode::kJSForInPrepare);
695}
696
697#if V8_ENABLE_WEBASSEMBLY
698JSWasmCallParameters const& JSWasmCallParametersOf(const Operator* op) {
699 DCHECK_EQ(IrOpcode::kJSWasmCall, op->opcode());
701}
702
703std::ostream& operator<<(std::ostream& os, JSWasmCallParameters const& p) {
704 return os << p.module() << ", " << p.signature() << ", " << p.feedback();
705}
706
707size_t hash_value(JSWasmCallParameters const& p) {
708 return base::hash_combine(p.module(), p.signature(),
709 FeedbackSource::Hash()(p.feedback()));
710}
711
712bool operator==(JSWasmCallParameters const& lhs,
713 JSWasmCallParameters const& rhs) {
714 return lhs.module() == rhs.module() && lhs.signature() == rhs.signature() &&
715 lhs.feedback() == rhs.feedback();
716}
717
718int JSWasmCallParameters::arity_without_implicit_args() const {
719 return static_cast<int>(signature_->parameter_count());
720}
721
722int JSWasmCallParameters::input_count() const {
723 return static_cast<int>(signature_->parameter_count()) +
724 JSWasmCallNode::kExtraInputCount;
725}
726
727// static
728Type JSWasmCallNode::TypeForWasmReturnType(wasm::CanonicalValueType type) {
729 switch (type.kind()) {
730 case wasm::kI32:
731 return Type::Signed32();
732 case wasm::kI64:
733 return Type::SignedBigInt64();
734 case wasm::kF32:
735 case wasm::kF64:
736 return Type::Number();
737 case wasm::kRef:
738 case wasm::kRefNull:
739 CHECK(type.is_reference_to(wasm::HeapType::kExtern));
740 return Type::Any();
741 default:
742 UNREACHABLE();
743 }
744}
745#endif // V8_ENABLE_WEBASSEMBLY
746
747#define CACHED_OP_LIST(V) \
748 V(ToLength, Operator::kNoProperties, 1, 1) \
749 V(ToName, Operator::kNoProperties, 1, 1) \
750 V(ToNumber, Operator::kNoProperties, 1, 1) \
751 V(ToNumberConvertBigInt, Operator::kNoProperties, 1, 1) \
752 V(ToBigInt, Operator::kNoProperties, 1, 1) \
753 V(ToBigIntConvertNumber, Operator::kNoProperties, 1, 1) \
754 V(ToNumeric, Operator::kNoProperties, 1, 1) \
755 V(ToObject, Operator::kFoldable, 1, 1) \
756 V(ToString, Operator::kNoProperties, 1, 1) \
757 V(Create, Operator::kNoProperties, 2, 1) \
758 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \
759 V(CreateStringIterator, Operator::kEliminatable, 1, 1) \
760 V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \
761 V(CreatePromise, Operator::kEliminatable, 0, 1) \
762 V(CreateTypedArray, Operator::kNoProperties, 5, 1) \
763 V(CreateObject, Operator::kNoProperties, 1, 1) \
764 V(CreateStringWrapper, Operator::kEliminatable, 1, 1) \
765 V(ObjectIsArray, Operator::kNoProperties, 1, 1) \
766 V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \
767 V(OrdinaryHasInstance, Operator::kNoProperties, 2, 1) \
768 V(ForInEnumerate, Operator::kNoProperties, 1, 1) \
769 V(AsyncFunctionEnter, Operator::kNoProperties, 2, 1) \
770 V(AsyncFunctionReject, Operator::kNoDeopt | Operator::kNoThrow, 2, 1) \
771 V(AsyncFunctionResolve, Operator::kNoDeopt | Operator::kNoThrow, 2, 1) \
772 V(LoadMessage, Operator::kNoThrow | Operator::kNoWrite, 0, 1) \
773 V(StoreMessage, Operator::kNoRead | Operator::kNoThrow, 1, 0) \
774 V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \
775 V(GeneratorRestoreContext, Operator::kNoThrow, 1, 1) \
776 V(GeneratorRestoreInputOrDebugPos, Operator::kNoThrow, 1, 1) \
777 V(Debugger, Operator::kNoProperties, 0, 0) \
778 V(FulfillPromise, Operator::kNoDeopt | Operator::kNoThrow, 2, 1) \
779 V(PerformPromiseThen, Operator::kNoDeopt | Operator::kNoThrow, 4, 1) \
780 V(PromiseResolve, Operator::kNoProperties, 2, 1) \
781 V(RejectPromise, Operator::kNoDeopt | Operator::kNoThrow, 3, 1) \
782 V(ResolvePromise, Operator::kNoDeopt | Operator::kNoThrow, 2, 1) \
783 V(GetSuperConstructor, Operator::kNoWrite | Operator::kNoThrow, 1, 1) \
784 V(FindNonDefaultConstructorOrConstruct, Operator::kNoProperties, 2, 2) \
785 V(ParseInt, Operator::kNoProperties, 2, 1) \
786 V(RegExpTest, Operator::kNoProperties, 2, 1)
787
789#define CACHED_OP(Name, properties, value_input_count, value_output_count) \
790 struct Name##Operator final : public Operator { \
791 Name##Operator() \
792 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \
793 value_input_count, Operator::ZeroIfPure(properties), \
794 Operator::ZeroIfEliminatable(properties), \
795 value_output_count, Operator::ZeroIfPure(properties), \
796 Operator::ZeroIfNoThrow(properties)) {} \
797 }; \
798 Name##Operator k##Name##Operator;
800#undef CACHED_OP
801};
802
803namespace {
804DEFINE_LAZY_LEAKY_OBJECT_GETTER(JSOperatorGlobalCache, GetJSOperatorGlobalCache)
805} // namespace
806
808 : cache_(*GetJSOperatorGlobalCache()), zone_(zone) {}
809
810#define CACHED_OP(Name, properties, value_input_count, value_output_count) \
811 const Operator* JSOperatorBuilder::Name() { \
812 return &cache_.k##Name##Operator; \
813 }
815#undef CACHED_OP
816
817#define UNARY_OP(JSName, Name) \
818 const Operator* JSOperatorBuilder::Name(FeedbackSource const& feedback) { \
819 FeedbackParameter parameters(feedback); \
820 return zone()->New<Operator1<FeedbackParameter>>( \
821 IrOpcode::k##JSName, Operator::kNoProperties, #JSName, 2, 1, 1, 1, 1, \
822 2, parameters); \
823 }
825#undef UNARY_OP
826
827#define BINARY_OP(JSName, Name) \
828 const Operator* JSOperatorBuilder::Name(FeedbackSource const& feedback) { \
829 static constexpr auto kProperties = BinopProperties(IrOpcode::k##JSName); \
830 FeedbackParameter parameters(feedback); \
831 return zone()->New<Operator1<FeedbackParameter>>( \
832 IrOpcode::k##JSName, kProperties, #JSName, 3, 1, 1, 1, 1, \
833 Operator::ZeroIfNoThrow(kProperties), parameters); \
834 }
836#undef BINARY_OP
837
839 const FeedbackSource& feedback) {
840 static constexpr int kObject = 1;
841 static constexpr int kName = 1;
842 static constexpr int kValue = 1;
843 static constexpr int kFlags = 1;
844 static constexpr int kFeedbackVector = 1;
845 static constexpr int kArity =
846 kObject + kName + kValue + kFlags + kFeedbackVector;
847 FeedbackParameter parameters(feedback);
848 return zone()->New<Operator1<FeedbackParameter>>( // --
849 IrOpcode::kJSDefineKeyedOwnPropertyInLiteral,
850 Operator::kNoThrow, // opcode
851 "JSDefineKeyedOwnPropertyInLiteral", // name
852 kArity, 1, 1, 0, 1, 1, // counts
853 parameters); // parameter
854}
855
857 const FeedbackSource& feedback) {
858 static constexpr int kArray = 1;
859 static constexpr int kIndex = 1;
860 static constexpr int kValue = 1;
861 static constexpr int kFeedbackVector = 1;
862 static constexpr int kArity = kArray + kIndex + kValue + kFeedbackVector;
863 FeedbackParameter parameters(feedback);
864 return zone()->New<Operator1<FeedbackParameter>>( // --
865 IrOpcode::kJSStoreInArrayLiteral,
866 Operator::kNoThrow, // opcode
867 "JSStoreInArrayLiteral", // name
868 kArity, 1, 1, 0, 1, 1, // counts
869 parameters); // parameter
870}
871
873 uint32_t start_index) {
874 CallForwardVarargsParameters parameters(arity, start_index);
876 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode
877 "JSCallForwardVarargs", // name
878 parameters.arity(), 1, 1, 1, 1, 2, // counts
879 parameters); // parameter
880}
881
883 size_t arity, CallFrequency const& frequency,
884 FeedbackSource const& feedback, ConvertReceiverMode convert_mode,
885 SpeculationMode speculation_mode, CallFeedbackRelation feedback_relation) {
886 CallParameters parameters(arity, frequency, feedback, convert_mode,
887 speculation_mode, feedback_relation);
888 return zone()->New<Operator1<CallParameters>>( // --
889 IrOpcode::kJSCall, Operator::kNoProperties, // opcode
890 "JSCall", // name
891 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs
892 parameters); // parameter
893}
894
896 const CallFrequency& frequency, const FeedbackSource& feedback,
897 SpeculationMode speculation_mode, CallFeedbackRelation feedback_relation) {
898 static constexpr int kTheArrayLikeObject = 1;
899 CallParameters parameters(
900 JSCallWithArrayLikeNode::ArityForArgc(kTheArrayLikeObject), frequency,
901 feedback, ConvertReceiverMode::kAny, speculation_mode, feedback_relation);
902 return zone()->New<Operator1<CallParameters>>( // --
903 IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode
904 "JSCallWithArrayLike", // name
905 parameters.arity(), 1, 1, 1, 1, 2, // counts
906 parameters); // parameter
907}
908
910 uint32_t arity, CallFrequency const& frequency,
911 FeedbackSource const& feedback, SpeculationMode speculation_mode,
912 CallFeedbackRelation feedback_relation) {
914 feedback.IsValid());
915 CallParameters parameters(arity, frequency, feedback,
916 ConvertReceiverMode::kAny, speculation_mode,
917 feedback_relation);
918 return zone()->New<Operator1<CallParameters>>( // --
919 IrOpcode::kJSCallWithSpread, Operator::kNoProperties, // opcode
920 "JSCallWithSpread", // name
921 parameters.arity(), 1, 1, 1, 1, 2, // counts
922 parameters); // parameter
923}
924
929
931 Runtime::FunctionId id, size_t arity, Operator::Properties properties) {
933 return CallRuntime(f, arity, properties);
934}
935
937 const Runtime::Function* f, size_t arity, Operator::Properties properties) {
938 CallRuntimeParameters parameters(f->function_id, arity);
939 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity()));
941 IrOpcode::kJSCallRuntime, properties, // opcode
942 "JSCallRuntime", // name
943 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs
944 parameters); // parameter
945}
946
947#if V8_ENABLE_WEBASSEMBLY
948const Operator* JSOperatorBuilder::CallWasm(
949 const wasm::WasmModule* wasm_module,
950 const wasm::CanonicalSig* wasm_signature, int wasm_function_index,
951 SharedFunctionInfoRef shared_fct_info, wasm::NativeModule* native_module,
952 FeedbackSource const& feedback) {
953 // TODO(clemensb): Drop wasm_module.
954 DCHECK_EQ(wasm_module, native_module->module());
955 JSWasmCallParameters parameters(wasm_module, wasm_signature,
956 wasm_function_index, shared_fct_info,
957 native_module, feedback);
959 IrOpcode::kJSWasmCall, Operator::kNoProperties, // opcode
960 "JSWasmCall", // name
961 parameters.input_count(), 1, 1, 1, 1, 2, // inputs/outputs
962 parameters); // parameter
963}
964#endif // V8_ENABLE_WEBASSEMBLY
965
967 size_t arity, uint32_t start_index) {
968 ConstructForwardVarargsParameters parameters(arity, start_index);
970 IrOpcode::kJSConstructForwardVarargs, Operator::kNoProperties, // opcode
971 "JSConstructForwardVarargs", // name
972 parameters.arity(), 1, 1, 1, 1, 2, // counts
973 parameters); // parameter
974}
975
976// Note: frequency is taken by reference to work around a GCC bug
977// on AIX (v8:8193).
979 CallFrequency const& frequency,
980 FeedbackSource const& feedback) {
981 ConstructParameters parameters(arity, frequency, feedback);
982 return zone()->New<Operator1<ConstructParameters>>( // --
983 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode
984 "JSConstruct", // name
985 parameters.arity(), 1, 1, 1, 1, 2, // counts
986 parameters); // parameter
987}
988
990 CallFrequency const& frequency, FeedbackSource const& feedback) {
991 static constexpr int kTheArrayLikeObject = 1;
992 ConstructParameters parameters(
994 frequency, feedback);
995 return zone()->New<Operator1<ConstructParameters>>( // --
996 IrOpcode::kJSConstructWithArrayLike, // opcode
997 Operator::kNoProperties, // properties
998 "JSConstructWithArrayLike", // name
999 parameters.arity(), 1, 1, 1, 1, 2, // counts
1000 parameters); // parameter
1001}
1002
1004 uint32_t arity, CallFrequency const& frequency,
1005 FeedbackSource const& feedback) {
1006 ConstructParameters parameters(arity, frequency, feedback);
1007 return zone()->New<Operator1<ConstructParameters>>( // --
1008 IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode
1009 "JSConstructWithSpread", // name
1010 parameters.arity(), 1, 1, 1, 1, 2, // counts
1011 parameters); // parameter
1012}
1013
1015 CallFrequency const& frequency, FeedbackSource const& feedback) {
1016 // Use 0 as a fake arity. This operator will be reduced away to either a call
1017 // to Builtin::kConstructForwardAllArgs or an ordinary
1018 // JSConstruct.
1020 frequency, feedback);
1021 return zone()->New<Operator1<ConstructParameters>>( // --
1022 IrOpcode::kJSConstructForwardAllArgs, Operator::kNoProperties, // opcode
1023 "JSConstructForwardAllArgs", // name
1024 parameters.arity(), 1, 1, 1, 1, 2, // counts
1025 parameters); // parameter
1026}
1027
1029 const FeedbackSource& feedback) {
1030 static constexpr int kObject = 1;
1031 static constexpr int kFeedbackVector = 1;
1032 static constexpr int kArity = kObject + kFeedbackVector;
1033 NamedAccess access(LanguageMode::kSloppy, name, feedback);
1034 return zone()->New<Operator1<NamedAccess>>( // --
1035 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
1036 "JSLoadNamed", // name
1037 kArity, 1, 1, 1, 1, 2, // counts
1038 access); // parameter
1039}
1040
1042 NameRef name, const FeedbackSource& feedback) {
1043 static constexpr int kReceiver = 1;
1044 static constexpr int kHomeObject = 1;
1045 static constexpr int kFeedbackVector = 1;
1046 static constexpr int kArity = kReceiver + kHomeObject + kFeedbackVector;
1047 NamedAccess access(LanguageMode::kSloppy, name, feedback);
1048 return zone()->New<Operator1<NamedAccess>>( // --
1049 IrOpcode::kJSLoadNamedFromSuper, Operator::kNoProperties, // opcode
1050 "JSLoadNamedFromSuper", // name
1051 kArity, 1, 1, 1, 1, 2, // counts
1052 access); // parameter
1053}
1054
1056 FeedbackSource const& feedback) {
1057 PropertyAccess access(LanguageMode::kSloppy, feedback);
1058 return zone()->New<Operator1<PropertyAccess>>( // --
1059 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
1060 "JSLoadProperty", // name
1061 3, 1, 1, 1, 1, 2, // counts
1062 access); // parameter
1063}
1064
1066 FeedbackSource const& load_feedback, FeedbackSource const& call_feedback) {
1067 GetIteratorParameters access(load_feedback, call_feedback);
1068 return zone()->New<Operator1<GetIteratorParameters>>( // --
1069 IrOpcode::kJSGetIterator, Operator::kNoProperties, // opcode
1070 "JSGetIterator", // name
1071 2, 1, 1, 1, 1, 2, // counts
1072 access); // parameter
1073}
1074
1076 PropertyAccess access(LanguageMode::kSloppy, feedback);
1077 return zone()->New<Operator1<PropertyAccess>>( // --
1078 IrOpcode::kJSHasProperty, Operator::kNoProperties, // opcode
1079 "JSHasProperty", // name
1080 3, 1, 1, 1, 1, 2, // counts
1081 access); // parameter
1082}
1083
1085 const FeedbackSource& feedback) {
1086 return zone()->New<Operator1<ForInParameters>>( // --
1087 IrOpcode::kJSForInNext, Operator::kNoProperties, // opcode
1088 "JSForInNext", // name
1089 5, 1, 1, 1, 1, 2, // counts
1090 ForInParameters{feedback, mode}); // parameter
1091}
1092
1094 ForInMode mode, const FeedbackSource& feedback) {
1095 return zone()->New<Operator1<ForInParameters>>( // --
1096 IrOpcode::kJSForInPrepare, // opcode
1098 "JSForInPrepare", // name
1099 2, 1, 1, 3, 1, 1, // counts
1100 ForInParameters{feedback, mode}); // parameter
1101}
1102
1104 return zone()->New<Operator1<int>>( // --
1105 IrOpcode::kJSGeneratorStore, Operator::kNoThrow, // opcode
1106 "JSGeneratorStore", // name
1107 3 + register_count, 1, 1, 0, 1, 0, // counts
1108 register_count); // parameter
1109}
1110
1112 DCHECK_EQ(IrOpcode::kJSCreateAsyncFunctionObject, op->opcode());
1113 return OpParameter<int>(op);
1114}
1115
1117 DCHECK_EQ(IrOpcode::kJSGeneratorStore, op->opcode());
1118 return OpParameter<int>(op);
1119}
1120
1122 return zone()->New<Operator1<int>>( // --
1123 IrOpcode::kJSGeneratorRestoreRegister, Operator::kNoThrow, // opcode
1124 "JSGeneratorRestoreRegister", // name
1125 1, 1, 1, 1, 1, 0, // counts
1126 index); // parameter
1127}
1128
1130 DCHECK_EQ(IrOpcode::kJSGeneratorRestoreRegister, op->opcode());
1131 return OpParameter<int>(op);
1132}
1133
1135 LanguageMode language_mode, NameRef name, FeedbackSource const& feedback) {
1136 static constexpr int kObject = 1;
1137 static constexpr int kValue = 1;
1138 static constexpr int kFeedbackVector = 1;
1139 static constexpr int kArity = kObject + kValue + kFeedbackVector;
1140 NamedAccess access(language_mode, name, feedback);
1141 return zone()->New<Operator1<NamedAccess>>( // --
1142 IrOpcode::kJSSetNamedProperty, Operator::kNoProperties, // opcode
1143 "JSSetNamedProperty", // name
1144 kArity, 1, 1, 0, 1, 2, // counts
1145 access); // parameter
1146}
1147
1149 LanguageMode language_mode, FeedbackSource const& feedback) {
1150 PropertyAccess access(language_mode, feedback);
1151 return zone()->New<Operator1<PropertyAccess>>( // --
1152 IrOpcode::kJSSetKeyedProperty, Operator::kNoProperties, // opcode
1153 "JSSetKeyedProperty", // name
1154 4, 1, 1, 0, 1, 2, // counts
1155 access); // parameter
1156}
1157
1159 LanguageMode language_mode, FeedbackSource const& feedback) {
1160 PropertyAccess access(language_mode, feedback);
1161 return zone()->New<Operator1<PropertyAccess>>( // --
1162 IrOpcode::kJSDefineKeyedOwnProperty, Operator::kNoProperties, // opcode
1163 "JSDefineKeyedOwnProperty", // name
1164 5, 1, 1, 0, 1, 2, // counts
1165 access); // parameter
1166}
1167
1169 NameRef name, FeedbackSource const& feedback) {
1170 static constexpr int kObject = 1;
1171 static constexpr int kValue = 1;
1172 static constexpr int kFeedbackVector = 1;
1173 static constexpr int kArity = kObject + kValue + kFeedbackVector;
1174 DefineNamedOwnPropertyParameters parameters(name, feedback);
1176 IrOpcode::kJSDefineNamedOwnProperty, Operator::kNoProperties, // opcode
1177 "JSDefineNamedOwnProperty", // name
1178 kArity, 1, 1, 0, 1, 2, // counts
1179 parameters); // parameter
1180}
1181
1183 return zone()->New<Operator>( // --
1184 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode
1185 "JSDeleteProperty", // name
1186 3, 1, 1, 1, 1, 2); // counts
1187}
1188
1190 return zone()->New<Operator>( // --
1191 IrOpcode::kJSCreateGeneratorObject, Operator::kEliminatable, // opcode
1192 "JSCreateGeneratorObject", // name
1193 2, 1, 1, 1, 1, 0); // counts
1194}
1195
1197 const FeedbackSource& feedback,
1198 TypeofMode typeof_mode) {
1199 static constexpr int kFeedbackVector = 1;
1200 static constexpr int kArity = kFeedbackVector;
1201 LoadGlobalParameters parameters(name, feedback, typeof_mode);
1202 return zone()->New<Operator1<LoadGlobalParameters>>( // --
1203 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
1204 "JSLoadGlobal", // name
1205 kArity, 1, 1, 1, 1, 2, // counts
1206 parameters); // parameter
1207}
1208
1210 NameRef name,
1211 const FeedbackSource& feedback) {
1212 static constexpr int kValue = 1;
1213 static constexpr int kFeedbackVector = 1;
1214 static constexpr int kArity = kValue + kFeedbackVector;
1215 StoreGlobalParameters parameters(language_mode, feedback, name);
1216 return zone()->New<Operator1<StoreGlobalParameters>>( // --
1217 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode
1218 "JSStoreGlobal", // name
1219 kArity, 1, 1, 0, 1, 2, // counts
1220 parameters); // parameter
1221}
1222
1224 return zone()->New<Operator1<size_t>>( // --
1225 IrOpcode::kJSHasContextExtension, // opcode
1227 "JSHasContextExtension", // name
1228 0, 1, 0, 1, 1, 0, // counts
1229 depth); // parameter
1230}
1231
1232const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index,
1233 bool immutable) {
1234 ContextAccess access(depth, index, immutable);
1235 return zone()->New<Operator1<ContextAccess>>( // --
1236 IrOpcode::kJSLoadContext, // opcode
1238 "JSLoadContext", // name
1239 0, 1, 0, 1, 1, 0, // counts
1240 access); // parameter
1241}
1242
1244 size_t index) {
1245 ContextAccess access(depth, index, false);
1246 return zone()->New<Operator1<ContextAccess>>( // --
1247 IrOpcode::kJSLoadScriptContext, // opcode
1249 "JSLoadScriptContext", // name
1250 0, 1, 1, 1, 1, 1, // counts
1251 access); // parameter
1252}
1253
1254const Operator* JSOperatorBuilder::StoreContext(size_t depth, size_t index) {
1255 ContextAccess access(depth, index, false);
1256 return zone()->New<Operator1<ContextAccess>>( // --
1257 IrOpcode::kJSStoreContext, // opcode
1259 "JSStoreContext", // name
1260 1, 1, 1, 0, 1, 0, // counts
1261 access); // parameter
1262}
1263
1265 size_t index) {
1266 ContextAccess access(depth, index, false);
1267 return zone()->New<Operator1<ContextAccess>>( // --
1268 IrOpcode::kJSStoreScriptContext, // opcode
1270 "JSStoreScriptContext", // name
1271 1, 1, 1, 0, 1, 1, // counts
1272 access); // parameter
1273}
1274
1275const Operator* JSOperatorBuilder::LoadModule(int32_t cell_index) {
1276 return zone()->New<Operator1<int32_t>>( // --
1277 IrOpcode::kJSLoadModule, // opcode
1279 "JSLoadModule", // name
1280 1, 1, 1, 1, 1, 0, // counts
1281 cell_index); // parameter
1282}
1283
1285 return zone()->New<Operator>( // --
1286 IrOpcode::kJSGetImportMeta, // opcode
1287 Operator::kNoProperties, // flags
1288 "JSGetImportMeta", // name
1289 0, 1, 1, 1, 1, 2); // counts
1290}
1291
1292const Operator* JSOperatorBuilder::StoreModule(int32_t cell_index) {
1293 return zone()->New<Operator1<int32_t>>( // --
1294 IrOpcode::kJSStoreModule, // opcode
1296 "JSStoreModule", // name
1297 2, 1, 1, 0, 1, 0, // counts
1298 cell_index); // parameter
1299}
1300
1302 return zone()->New<Operator1<CreateArgumentsType>>( // --
1303 IrOpcode::kJSCreateArguments, Operator::kEliminatable, // opcode
1304 "JSCreateArguments", // name
1305 1, 1, 0, 1, 1, 0, // counts
1306 type); // parameter
1307}
1308
1310 OptionalAllocationSiteRef site) {
1311 // constructor, new_target, arg1, ..., argN
1312 int const value_input_count = static_cast<int>(arity) + 2;
1313 CreateArrayParameters parameters(arity, site);
1314 return zone()->New<Operator1<CreateArrayParameters>>( // --
1315 IrOpcode::kJSCreateArray, Operator::kNoProperties, // opcode
1316 "JSCreateArray", // name
1317 value_input_count, 1, 1, 1, 1, 2, // counts
1318 parameters); // parameter
1319}
1320
1324 IrOpcode::kJSCreateArrayIterator, Operator::kEliminatable, // opcode
1325 "JSCreateArrayIterator", // name
1326 1, 1, 1, 1, 1, 0, // counts
1327 parameters); // parameter
1328}
1329
1331 int register_count) {
1332 return zone()->New<Operator1<int>>( // --
1333 IrOpcode::kJSCreateAsyncFunctionObject, // opcode
1334 Operator::kEliminatable, // flags
1335 "JSCreateAsyncFunctionObject", // name
1336 3, 1, 1, 1, 1, 0, // counts
1337 register_count); // parameter
1338}
1339
1341 CollectionKind collection_kind, IterationKind iteration_kind) {
1342 CreateCollectionIteratorParameters parameters(collection_kind,
1343 iteration_kind);
1345 IrOpcode::kJSCreateCollectionIterator, Operator::kEliminatable,
1346 "JSCreateCollectionIterator", 1, 1, 1, 1, 1, 0, parameters);
1347}
1348
1350 MapRef map) {
1351 // bound_target_function, bound_this, arg1, ..., argN
1352 int const value_input_count = static_cast<int>(arity) + 2;
1353 CreateBoundFunctionParameters parameters(arity, map);
1355 IrOpcode::kJSCreateBoundFunction, Operator::kEliminatable, // opcode
1356 "JSCreateBoundFunction", // name
1357 value_input_count, 1, 1, 1, 1, 0, // counts
1358 parameters); // parameter
1359}
1360
1362 SharedFunctionInfoRef shared_info, CodeRef code,
1363 AllocationType allocation) {
1364 static constexpr int kFeedbackCell = 1;
1365 static constexpr int kArity = kFeedbackCell;
1366 CreateClosureParameters parameters(shared_info, code, allocation);
1368 IrOpcode::kJSCreateClosure, Operator::kEliminatable, // opcode
1369 "JSCreateClosure", // name
1370 kArity, 1, 1, 1, 1, 0, // counts
1371 parameters); // parameter
1372}
1373
1375 ArrayBoilerplateDescriptionRef description, FeedbackSource const& feedback,
1376 int literal_flags, int number_of_elements) {
1377 CreateLiteralParameters parameters(description, feedback, number_of_elements,
1378 literal_flags);
1380 IrOpcode::kJSCreateLiteralArray, // opcode
1381 Operator::kNoProperties, // properties
1382 "JSCreateLiteralArray", // name
1383 1, 1, 1, 1, 1, 2, // counts
1384 parameters); // parameter
1385}
1386
1388 FeedbackSource const& feedback) {
1389 static constexpr int kFeedbackVector = 1;
1390 static constexpr int kArity = kFeedbackVector;
1391 FeedbackParameter parameters(feedback);
1392 return zone()->New<Operator1<FeedbackParameter>>( // --
1393 IrOpcode::kJSCreateEmptyLiteralArray, // opcode
1394 Operator::kEliminatable, // properties
1395 "JSCreateEmptyLiteralArray", // name
1396 kArity, 1, 1, 1, 1, 0, // counts
1397 parameters); // parameter
1398}
1399
1401 return zone()->New<Operator>( // --
1402 IrOpcode::kJSCreateArrayFromIterable, // opcode
1403 Operator::kNoProperties, // properties
1404 "JSCreateArrayFromIterable", // name
1405 1, 1, 1, 1, 1, 2); // counts
1406}
1407
1409 ObjectBoilerplateDescriptionRef constant_properties,
1410 FeedbackSource const& feedback, int literal_flags,
1411 int number_of_properties) {
1412 CreateLiteralParameters parameters(constant_properties, feedback,
1413 number_of_properties, literal_flags);
1415 IrOpcode::kJSCreateLiteralObject, // opcode
1416 Operator::kNoProperties, // properties
1417 "JSCreateLiteralObject", // name
1418 1, 1, 1, 1, 1, 2, // counts
1419 parameters); // parameter
1420}
1421
1424 FeedbackSource const& feedback) {
1425 GetTemplateObjectParameters parameters(description, shared, feedback);
1427 IrOpcode::kJSGetTemplateObject, // opcode
1428 Operator::kEliminatable, // properties
1429 "JSGetTemplateObject", // name
1430 1, 1, 1, 1, 1, 0, // counts
1431 parameters); // parameter
1432}
1433
1435 int literal_flags) {
1436 CloneObjectParameters parameters(feedback, literal_flags);
1437 return zone()->New<Operator1<CloneObjectParameters>>( // --
1438 IrOpcode::kJSCloneObject, // opcode
1439 Operator::kNoProperties, // properties
1440 "JSCloneObject", // name
1441 2, 1, 1, 1, 1, 2, // counts
1442 parameters); // parameter
1443}
1444
1446 Operator::Properties properties;
1447 switch (kind) {
1451 properties = Operator::kNoProperties;
1452 break;
1454 properties = Operator::kNoWrite;
1455 break;
1456 }
1457 return zone()->New<Operator1<StackCheckKind>>( // --
1458 IrOpcode::kJSStackCheck, // opcode
1459 properties, // properties
1460 "JSStackCheck", // name
1461 0, 1, 1, 0, 1, 2, // counts
1462 kind); // parameter
1463}
1464
1466 return zone()->New<Operator>( // --
1467 IrOpcode::kJSCreateEmptyLiteralObject, // opcode
1468 Operator::kNoProperties, // properties
1469 "JSCreateEmptyLiteralObject", // name
1470 0, 1, 1, 1, 1, 2); // counts
1471}
1472
1474 StringRef constant_pattern, FeedbackSource const& feedback,
1475 int literal_flags) {
1476 CreateLiteralParameters parameters(constant_pattern, feedback, -1,
1477 literal_flags);
1479 IrOpcode::kJSCreateLiteralRegExp, // opcode
1480 Operator::kNoProperties, // properties
1481 "JSCreateLiteralRegExp", // name
1482 1, 1, 1, 1, 1, 2, // counts
1483 parameters); // parameter
1484}
1485
1487 ScopeInfoRef scope_info, int slot_count, ScopeType scope_type) {
1488 CreateFunctionContextParameters parameters(scope_info, slot_count,
1489 scope_type);
1491 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode
1492 "JSCreateFunctionContext", // name
1493 0, 1, 1, 1, 1, 2, // counts
1494 parameters); // parameter
1495}
1496
1498 return zone()->New<Operator1<ScopeInfoRef>>(
1499 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
1500 "JSCreateCatchContext", // name
1501 1, 1, 1, 1, 1, 2, // counts
1502 ScopeInfoRef{scope_info}); // parameter
1503}
1504
1506 return zone()->New<Operator1<ScopeInfoRef>>(
1507 IrOpcode::kJSCreateWithContext, Operator::kNoProperties, // opcode
1508 "JSCreateWithContext", // name
1509 1, 1, 1, 1, 1, 2, // counts
1510 ScopeInfoRef{scope_info}); // parameter
1511}
1512
1514 return zone()->New<Operator1<ScopeInfoRef>>( // --
1515 IrOpcode::kJSCreateBlockContext, Operator::kNoProperties, // opcode
1516 "JSCreateBlockContext", // name
1517 0, 1, 1, 1, 1, 2, // counts
1518 ScopeInfoRef{scope_info}); // parameter
1519}
1520
1522 DCHECK(IrOpcode::kJSCreateBlockContext == op->opcode() ||
1523 IrOpcode::kJSCreateWithContext == op->opcode() ||
1524 IrOpcode::kJSCreateCatchContext == op->opcode());
1525 return OpParameter<ScopeInfoRef>(op);
1526}
1527
1529 return lhs.object().location() == rhs.object().location();
1530}
1531
1532bool operator!=(ScopeInfoRef lhs, ScopeInfoRef rhs) { return !(lhs == rhs); }
1533
1535 return reinterpret_cast<size_t>(ref.object().location());
1536}
1537
1538std::ostream& operator<<(std::ostream& os, ScopeInfoRef ref) {
1539 return os << Brief(*ref.object());
1540}
1541
1542#undef CACHED_OP_LIST
1543
1544} // namespace compiler
1545} // namespace internal
1546} // namespace v8
JSGraph * jsgraph
Builtins::Kind kind
Definition builtins.cc:40
static V8_EXPORT_PRIVATE const Function * FunctionForId(FunctionId id)
Definition runtime.cc:350
static TNode UncheckedCast(compiler::Node *node)
Definition tnode.h:413
T * New(Args &&... args)
Definition zone.h:114
ConvertReceiverMode convert_mode() const
CallFeedbackRelation feedback_relation() const
CallFrequency const & frequency() const
SpeculationMode speculation_mode() const
FeedbackSource const & feedback() const
FeedbackSource const & feedback() const
CallFrequency const & frequency() const
ContextAccess(size_t depth, size_t index, bool immutable)
OptionalAllocationSiteRef const site_
FeedbackSource const & feedback() const
FeedbackSource const & feedback() const
const FeedbackSource & feedback() const
FeedbackSource const & callFeedback() const
FeedbackSource const & loadFeedback() const
const TemplateObjectDescriptionRef description_
static constexpr int ArityForArgc(int parameters)
FeedbackCellRef GetFeedbackCellRefChecked(JSHeapBroker *broker) const
const Operator * CreateBoundFunction(size_t arity, MapRef map)
const Operator * DefineKeyedOwnProperty(LanguageMode language_mode, FeedbackSource const &feedback)
const Operator * LoadScriptContext(size_t depth, size_t index)
const Operator * StackCheck(StackCheckKind kind)
const Operator * CallForwardVarargs(size_t arity, uint32_t start_index)
const Operator * DefineKeyedOwnPropertyInLiteral(const FeedbackSource &feedback)
const Operator * SetNamedProperty(LanguageMode language_mode, NameRef name, FeedbackSource const &feedback)
const Operator * Construct(uint32_t arity, CallFrequency const &frequency=CallFrequency(), FeedbackSource const &feedback=FeedbackSource())
const Operator * CallRuntime(Runtime::FunctionId id)
const Operator * CreateLiteralObject(ObjectBoilerplateDescriptionRef constant, FeedbackSource const &feedback, int literal_flags, int number_of_properties)
const Operator * DefineNamedOwnProperty(NameRef name, FeedbackSource const &feedback)
const Operator * CreateBlockContext(ScopeInfoRef scpope_info)
const Operator * Call(size_t arity, CallFrequency const &frequency=CallFrequency(), FeedbackSource const &feedback=FeedbackSource(), ConvertReceiverMode convert_mode=ConvertReceiverMode::kAny, SpeculationMode speculation_mode=SpeculationMode::kDisallowSpeculation, CallFeedbackRelation feedback_relation=CallFeedbackRelation::kUnrelated)
const Operator * StoreGlobal(LanguageMode language_mode, NameRef name, const FeedbackSource &feedback)
const Operator * StoreInArrayLiteral(const FeedbackSource &feedback)
const Operator * StoreContext(size_t depth, size_t index)
const Operator * HasProperty(FeedbackSource const &feedback)
const Operator * LoadNamed(NameRef name, FeedbackSource const &feedback)
const Operator * GetTemplateObject(TemplateObjectDescriptionRef description, SharedFunctionInfoRef shared, FeedbackSource const &feedback)
const Operator * ConstructWithArrayLike(CallFrequency const &frequency, FeedbackSource const &feedback)
const Operator * CreateWithContext(ScopeInfoRef scope_info)
const Operator * CreateAsyncFunctionObject(int register_count)
const Operator * CallWithSpread(uint32_t arity, CallFrequency const &frequency=CallFrequency(), FeedbackSource const &feedback=FeedbackSource(), SpeculationMode speculation_mode=SpeculationMode::kDisallowSpeculation, CallFeedbackRelation feedback_relation=CallFeedbackRelation::kTarget)
const Operator * CreateEmptyLiteralArray(FeedbackSource const &feedback)
const Operator * CreateArray(size_t arity, OptionalAllocationSiteRef site)
const Operator * ForInNext(ForInMode mode, const FeedbackSource &feedback)
const Operator * CreateCatchContext(ScopeInfoRef scope_info)
const Operator * CreateArrayIterator(IterationKind)
const Operator * CreateFunctionContext(ScopeInfoRef scope_info, int slot_count, ScopeType scope_type)
const Operator * CreateLiteralArray(ArrayBoilerplateDescriptionRef constant, FeedbackSource const &feedback, int literal_flags, int number_of_elements)
const Operator * StoreModule(int32_t cell_index)
const Operator * LoadModule(int32_t cell_index)
const Operator * ConstructForwardAllArgs(CallFrequency const &frequency=CallFrequency(), FeedbackSource const &feedback=FeedbackSource())
const Operator * SetKeyedProperty(LanguageMode language_mode, FeedbackSource const &feedback)
const Operator * GetIterator(FeedbackSource const &load_feedback, FeedbackSource const &call_feedback)
const Operator * CreateCollectionIterator(CollectionKind, IterationKind)
const Operator * HasContextExtension(size_t depth)
const Operator * ConstructWithSpread(uint32_t arity, CallFrequency const &frequency=CallFrequency(), FeedbackSource const &feedback=FeedbackSource())
const Operator * CreateArguments(CreateArgumentsType type)
const Operator * ConstructForwardVarargs(size_t arity, uint32_t start_index)
const Operator * StoreScriptContext(size_t depth, size_t index)
const Operator * ForInPrepare(ForInMode mode, const FeedbackSource &feedback)
const Operator * LoadContext(size_t depth, size_t index, bool immutable)
const Operator * LoadProperty(FeedbackSource const &feedback)
const Operator * CloneObject(FeedbackSource const &feedback, int literal_flags)
const Operator * GeneratorStore(int value_count)
const Operator * LoadNamedFromSuper(NameRef name, FeedbackSource const &feedback)
const Operator * CreateClosure(SharedFunctionInfoRef shared_info, CodeRef code, AllocationType allocation=AllocationType::kYoung)
const Operator * CreateLiteralRegExp(StringRef constant_pattern, FeedbackSource const &feedback, int literal_flags)
const Operator * LoadGlobal(NameRef name, const FeedbackSource &feedback, TypeofMode typeof_mode=TypeofMode::kNotInside)
const Operator * CallWithArrayLike(CallFrequency const &frequency, const FeedbackSource &feedback=FeedbackSource{}, SpeculationMode speculation_mode=SpeculationMode::kDisallowSpeculation, CallFeedbackRelation feedback_relation=CallFeedbackRelation::kTarget)
const Operator * GeneratorRestoreRegister(int index)
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 FeedbackSource & feedback() const
LanguageMode language_mode() const
FeedbackSource const & feedback() const
base::Flags< Property, uint8_t > Properties
Definition operator.h:60
constexpr Opcode opcode() const
Definition operator.h:75
FeedbackSource const & feedback() const
IndirectHandle< ScopeInfo > object() const
FeedbackSource const & feedback() const
const WasmModule * module() const
Zone * zone_
Register const index_
JSHeapBroker * broker
#define CACHED_OP_LIST(V)
#define CACHED_OP(Name, properties, value_input_count, value_output_count)
#define UNARY_OP(JSName, Name)
#define BINARY_OP(JSName, Name)
#define JS_BINOP_WITH_FEEDBACK(V)
Definition js-operator.h:50
#define JS_UNOP_WITH_FEEDBACK(V)
Definition js-operator.h:46
#define DEFINE_LAZY_LEAKY_OBJECT_GETTER(T, FunctionName,...)
int m
Definition mul-fft.cc:294
V8_INLINE size_t hash_combine(size_t seed, size_t hash)
Definition hashing.h:77
TNode< Oddball > UndefinedConstant(JSGraph *jsgraph)
const CreateArrayIteratorParameters & CreateArrayIteratorParametersOf(const Operator *op)
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)
T const & OpParameter(const Operator *op)
Definition operator.h:214
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)
ref_traits< T >::ref_type MakeRef(JSHeapBroker *broker, Tagged< T > object)
const CloneObjectParameters & CloneObjectParametersOf(const Operator *op)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates use incremental marking for CppHeap cppheap_concurrent_marking c value for membalancer A special constant to balance between memory and space tradeoff The smaller the more memory it uses enable use of SSE4 instructions if available enable use of AVX VNNI instructions if available enable use of POPCNT instruction if available force all emitted branches to be in long mode(MIPS/PPC only)") DEFINE_BOOL(partial_constant_pool
static constexpr Address kNullAddress
Definition v8-internal.h:53
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define CHECK(condition)
Definition logging.h:124
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
wasm::ValueType type