• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
8 #include "src/base/compiler-specific.h"
9 #include "src/globals.h"
10 #include "src/handles.h"
11 #include "src/runtime/runtime.h"
12 #include "src/type-hints.h"
13 
14 namespace v8 {
15 namespace internal {
16 
17 class AllocationSite;
18 class BoilerplateDescription;
19 class ConstantElementsPair;
20 class SharedFunctionInfo;
21 class FeedbackVector;
22 
23 namespace compiler {
24 
25 // Forward declarations.
26 class Operator;
27 struct JSOperatorGlobalCache;
28 
29 // Defines a pair of {FeedbackVector} and {FeedbackSlot}, which
30 // is used to access the type feedback for a certain {Node}.
31 class V8_EXPORT_PRIVATE VectorSlotPair {
32  public:
33   VectorSlotPair();
VectorSlotPair(Handle<FeedbackVector> vector,FeedbackSlot slot)34   VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot)
35       : vector_(vector), slot_(slot) {}
36 
IsValid()37   bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
38 
vector()39   Handle<FeedbackVector> vector() const { return vector_; }
slot()40   FeedbackSlot slot() const { return slot_; }
41 
42   int index() const;
43 
44  private:
45   const Handle<FeedbackVector> vector_;
46   const FeedbackSlot slot_;
47 };
48 
49 bool operator==(VectorSlotPair const&, VectorSlotPair const&);
50 bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
51 
52 size_t hash_value(VectorSlotPair const&);
53 
54 
55 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators.
56 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op);
57 
58 
59 // The ToBooleanHints are used as parameter by JSToBoolean operators.
60 ToBooleanHints ToBooleanHintsOf(Operator const* op);
61 
62 
63 // Defines the arity and the feedback for a JavaScript constructor call. This is
64 // used as a parameter by JSConstruct operators.
65 class ConstructParameters final {
66  public:
ConstructParameters(uint32_t arity,float frequency,VectorSlotPair const & feedback)67   ConstructParameters(uint32_t arity, float frequency,
68                       VectorSlotPair const& feedback)
69       : arity_(arity), frequency_(frequency), feedback_(feedback) {}
70 
arity()71   uint32_t arity() const { return arity_; }
frequency()72   float frequency() const { return frequency_; }
feedback()73   VectorSlotPair const& feedback() const { return feedback_; }
74 
75  private:
76   uint32_t const arity_;
77   float const frequency_;
78   VectorSlotPair const feedback_;
79 };
80 
81 bool operator==(ConstructParameters const&, ConstructParameters const&);
82 bool operator!=(ConstructParameters const&, ConstructParameters const&);
83 
84 size_t hash_value(ConstructParameters const&);
85 
86 std::ostream& operator<<(std::ostream&, ConstructParameters const&);
87 
88 ConstructParameters const& ConstructParametersOf(Operator const*);
89 
90 // Defines the arity for a JavaScript constructor call with a spread as the last
91 // parameters. This is used as a parameter by JSConstructWithSpread
92 // operators.
93 class ConstructWithSpreadParameters final {
94  public:
ConstructWithSpreadParameters(uint32_t arity)95   explicit ConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {}
96 
arity()97   uint32_t arity() const { return arity_; }
98 
99  private:
100   uint32_t const arity_;
101 };
102 
103 bool operator==(ConstructWithSpreadParameters const&,
104                 ConstructWithSpreadParameters const&);
105 bool operator!=(ConstructWithSpreadParameters const&,
106                 ConstructWithSpreadParameters const&);
107 
108 size_t hash_value(ConstructWithSpreadParameters const&);
109 
110 std::ostream& operator<<(std::ostream&, ConstructWithSpreadParameters const&);
111 
112 ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf(
113     Operator const*);
114 
115 // Defines the flags for a JavaScript call forwarding parameters. This
116 // is used as parameter by JSCallForwardVarargs operators.
117 class CallForwardVarargsParameters final {
118  public:
CallForwardVarargsParameters(uint32_t start_index,TailCallMode tail_call_mode)119   CallForwardVarargsParameters(uint32_t start_index,
120                                TailCallMode tail_call_mode)
121       : bit_field_(StartIndexField::encode(start_index) |
122                    TailCallModeField::encode(tail_call_mode)) {}
123 
start_index()124   uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
tail_call_mode()125   TailCallMode tail_call_mode() const {
126     return TailCallModeField::decode(bit_field_);
127   }
128 
129   bool operator==(CallForwardVarargsParameters const& that) const {
130     return this->bit_field_ == that.bit_field_;
131   }
132   bool operator!=(CallForwardVarargsParameters const& that) const {
133     return !(*this == that);
134   }
135 
136  private:
hash_value(CallForwardVarargsParameters const & p)137   friend size_t hash_value(CallForwardVarargsParameters const& p) {
138     return p.bit_field_;
139   }
140 
141   typedef BitField<uint32_t, 0, 30> StartIndexField;
142   typedef BitField<TailCallMode, 31, 1> TailCallModeField;
143 
144   uint32_t const bit_field_;
145 };
146 
147 std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&);
148 
149 CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
150     Operator const*) WARN_UNUSED_RESULT;
151 
152 // Defines the arity and the call flags for a JavaScript function call. This is
153 // used as a parameter by JSCall operators.
154 class CallParameters final {
155  public:
CallParameters(size_t arity,float frequency,VectorSlotPair const & feedback,TailCallMode tail_call_mode,ConvertReceiverMode convert_mode)156   CallParameters(size_t arity, float frequency, VectorSlotPair const& feedback,
157                  TailCallMode tail_call_mode, ConvertReceiverMode convert_mode)
158       : bit_field_(ArityField::encode(arity) |
159                    ConvertReceiverModeField::encode(convert_mode) |
160                    TailCallModeField::encode(tail_call_mode)),
161         frequency_(frequency),
162         feedback_(feedback) {}
163 
arity()164   size_t arity() const { return ArityField::decode(bit_field_); }
frequency()165   float frequency() const { return frequency_; }
convert_mode()166   ConvertReceiverMode convert_mode() const {
167     return ConvertReceiverModeField::decode(bit_field_);
168   }
tail_call_mode()169   TailCallMode tail_call_mode() const {
170     return TailCallModeField::decode(bit_field_);
171   }
feedback()172   VectorSlotPair const& feedback() const { return feedback_; }
173 
174   bool operator==(CallParameters const& that) const {
175     return this->bit_field_ == that.bit_field_ &&
176            this->frequency_ == that.frequency_ &&
177            this->feedback_ == that.feedback_;
178   }
179   bool operator!=(CallParameters const& that) const { return !(*this == that); }
180 
181  private:
hash_value(CallParameters const & p)182   friend size_t hash_value(CallParameters const& p) {
183     return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_);
184   }
185 
186   typedef BitField<size_t, 0, 29> ArityField;
187   typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField;
188   typedef BitField<TailCallMode, 31, 1> TailCallModeField;
189 
190   uint32_t const bit_field_;
191   float const frequency_;
192   VectorSlotPair const feedback_;
193 };
194 
195 size_t hash_value(CallParameters const&);
196 
197 std::ostream& operator<<(std::ostream&, CallParameters const&);
198 
199 const CallParameters& CallParametersOf(const Operator* op);
200 
201 // Defines the arity for a JavaScript constructor call with a spread as the last
202 // parameters. This is used as a parameter by JSConstructWithSpread
203 // operators.
204 class CallWithSpreadParameters final {
205  public:
CallWithSpreadParameters(uint32_t arity)206   explicit CallWithSpreadParameters(uint32_t arity) : arity_(arity) {}
207 
arity()208   uint32_t arity() const { return arity_; }
209 
210  private:
211   uint32_t const arity_;
212 };
213 
214 bool operator==(CallWithSpreadParameters const&,
215                 CallWithSpreadParameters const&);
216 bool operator!=(CallWithSpreadParameters const&,
217                 CallWithSpreadParameters const&);
218 
219 size_t hash_value(CallWithSpreadParameters const&);
220 
221 std::ostream& operator<<(std::ostream&, CallWithSpreadParameters const&);
222 
223 CallWithSpreadParameters const& CallWithSpreadParametersOf(Operator const*);
224 
225 // Defines the arity and the ID for a runtime function call. This is used as a
226 // parameter by JSCallRuntime operators.
227 class CallRuntimeParameters final {
228  public:
CallRuntimeParameters(Runtime::FunctionId id,size_t arity)229   CallRuntimeParameters(Runtime::FunctionId id, size_t arity)
230       : id_(id), arity_(arity) {}
231 
id()232   Runtime::FunctionId id() const { return id_; }
arity()233   size_t arity() const { return arity_; }
234 
235  private:
236   const Runtime::FunctionId id_;
237   const size_t arity_;
238 };
239 
240 bool operator==(CallRuntimeParameters const&, CallRuntimeParameters const&);
241 bool operator!=(CallRuntimeParameters const&, CallRuntimeParameters const&);
242 
243 size_t hash_value(CallRuntimeParameters const&);
244 
245 std::ostream& operator<<(std::ostream&, CallRuntimeParameters const&);
246 
247 const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op);
248 
249 
250 // Defines the location of a context slot relative to a specific scope. This is
251 // used as a parameter by JSLoadContext and JSStoreContext operators and allows
252 // accessing a context-allocated variable without keeping track of the scope.
253 class ContextAccess final {
254  public:
255   ContextAccess(size_t depth, size_t index, bool immutable);
256 
depth()257   size_t depth() const { return depth_; }
index()258   size_t index() const { return index_; }
immutable()259   bool immutable() const { return immutable_; }
260 
261  private:
262   // For space reasons, we keep this tightly packed, otherwise we could just use
263   // a simple int/int/bool POD.
264   const bool immutable_;
265   const uint16_t depth_;
266   const uint32_t index_;
267 };
268 
269 bool operator==(ContextAccess const&, ContextAccess const&);
270 bool operator!=(ContextAccess const&, ContextAccess const&);
271 
272 size_t hash_value(ContextAccess const&);
273 
274 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ContextAccess const&);
275 
276 ContextAccess const& ContextAccessOf(Operator const*);
277 
278 // Defines the name and ScopeInfo for a new catch context. This is used as a
279 // parameter by the JSCreateCatchContext operator.
280 class CreateCatchContextParameters final {
281  public:
282   CreateCatchContextParameters(Handle<String> catch_name,
283                                Handle<ScopeInfo> scope_info);
284 
catch_name()285   Handle<String> catch_name() const { return catch_name_; }
scope_info()286   Handle<ScopeInfo> scope_info() const { return scope_info_; }
287 
288  private:
289   Handle<String> const catch_name_;
290   Handle<ScopeInfo> const scope_info_;
291 };
292 
293 bool operator==(CreateCatchContextParameters const& lhs,
294                 CreateCatchContextParameters const& rhs);
295 bool operator!=(CreateCatchContextParameters const& lhs,
296                 CreateCatchContextParameters const& rhs);
297 
298 size_t hash_value(CreateCatchContextParameters const& parameters);
299 
300 std::ostream& operator<<(std::ostream& os,
301                          CreateCatchContextParameters const& parameters);
302 
303 CreateCatchContextParameters const& CreateCatchContextParametersOf(
304     Operator const*);
305 
306 // Defines the slot count and ScopeType for a new function or eval context. This
307 // is used as a parameter by the JSCreateFunctionContext operator.
308 class CreateFunctionContextParameters final {
309  public:
310   CreateFunctionContextParameters(int slot_count, ScopeType scope_type);
311 
slot_count()312   int slot_count() const { return slot_count_; }
scope_type()313   ScopeType scope_type() const { return scope_type_; }
314 
315  private:
316   int const slot_count_;
317   ScopeType const scope_type_;
318 };
319 
320 bool operator==(CreateFunctionContextParameters const& lhs,
321                 CreateFunctionContextParameters const& rhs);
322 bool operator!=(CreateFunctionContextParameters const& lhs,
323                 CreateFunctionContextParameters const& rhs);
324 
325 size_t hash_value(CreateFunctionContextParameters const& parameters);
326 
327 std::ostream& operator<<(std::ostream& os,
328                          CreateFunctionContextParameters const& parameters);
329 
330 CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
331     Operator const*);
332 
333 // Defines parameters for JSStoreNamedOwn operator.
334 class StoreNamedOwnParameters final {
335  public:
StoreNamedOwnParameters(Handle<Name> name,VectorSlotPair const & feedback)336   StoreNamedOwnParameters(Handle<Name> name, VectorSlotPair const& feedback)
337       : name_(name), feedback_(feedback) {}
338 
name()339   Handle<Name> name() const { return name_; }
feedback()340   VectorSlotPair const& feedback() const { return feedback_; }
341 
342  private:
343   Handle<Name> const name_;
344   VectorSlotPair const feedback_;
345 };
346 
347 bool operator==(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
348 bool operator!=(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
349 
350 size_t hash_value(StoreNamedOwnParameters const&);
351 
352 std::ostream& operator<<(std::ostream&, StoreNamedOwnParameters const&);
353 
354 const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op);
355 
356 // Defines the feedback, i.e., vector and index, for storing a data property in
357 // an object literal. This is
358 // used as a parameter by the JSStoreDataPropertyInLiteral operator.
359 class DataPropertyParameters final {
360  public:
DataPropertyParameters(VectorSlotPair const & feedback)361   explicit DataPropertyParameters(VectorSlotPair const& feedback)
362       : feedback_(feedback) {}
363 
feedback()364   VectorSlotPair const& feedback() const { return feedback_; }
365 
366  private:
367   VectorSlotPair const feedback_;
368 };
369 
370 bool operator==(DataPropertyParameters const&, DataPropertyParameters const&);
371 bool operator!=(DataPropertyParameters const&, DataPropertyParameters const&);
372 
373 size_t hash_value(DataPropertyParameters const&);
374 
375 std::ostream& operator<<(std::ostream&, DataPropertyParameters const&);
376 
377 const DataPropertyParameters& DataPropertyParametersOf(const Operator* op);
378 
379 // Defines the property of an object for a named access. This is
380 // used as a parameter by the JSLoadNamed and JSStoreNamed operators.
381 class NamedAccess final {
382  public:
NamedAccess(LanguageMode language_mode,Handle<Name> name,VectorSlotPair const & feedback)383   NamedAccess(LanguageMode language_mode, Handle<Name> name,
384               VectorSlotPair const& feedback)
385       : name_(name), feedback_(feedback), language_mode_(language_mode) {}
386 
name()387   Handle<Name> name() const { return name_; }
language_mode()388   LanguageMode language_mode() const { return language_mode_; }
feedback()389   VectorSlotPair const& feedback() const { return feedback_; }
390 
391  private:
392   Handle<Name> const name_;
393   VectorSlotPair const feedback_;
394   LanguageMode const language_mode_;
395 };
396 
397 bool operator==(NamedAccess const&, NamedAccess const&);
398 bool operator!=(NamedAccess const&, NamedAccess const&);
399 
400 size_t hash_value(NamedAccess const&);
401 
402 std::ostream& operator<<(std::ostream&, NamedAccess const&);
403 
404 const NamedAccess& NamedAccessOf(const Operator* op);
405 
406 
407 // Defines the property being loaded from an object by a named load. This is
408 // used as a parameter by JSLoadGlobal operator.
409 class LoadGlobalParameters final {
410  public:
LoadGlobalParameters(const Handle<Name> & name,const VectorSlotPair & feedback,TypeofMode typeof_mode)411   LoadGlobalParameters(const Handle<Name>& name, const VectorSlotPair& feedback,
412                        TypeofMode typeof_mode)
413       : name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {}
414 
name()415   const Handle<Name>& name() const { return name_; }
typeof_mode()416   TypeofMode typeof_mode() const { return typeof_mode_; }
417 
feedback()418   const VectorSlotPair& feedback() const { return feedback_; }
419 
420  private:
421   const Handle<Name> name_;
422   const VectorSlotPair feedback_;
423   const TypeofMode typeof_mode_;
424 };
425 
426 bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&);
427 bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&);
428 
429 size_t hash_value(LoadGlobalParameters const&);
430 
431 std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
432 
433 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);
434 
435 
436 // Defines the property being stored to an object by a named store. This is
437 // used as a parameter by JSStoreGlobal operator.
438 class StoreGlobalParameters final {
439  public:
StoreGlobalParameters(LanguageMode language_mode,const VectorSlotPair & feedback,const Handle<Name> & name)440   StoreGlobalParameters(LanguageMode language_mode,
441                         const VectorSlotPair& feedback,
442                         const Handle<Name>& name)
443       : language_mode_(language_mode), name_(name), feedback_(feedback) {}
444 
language_mode()445   LanguageMode language_mode() const { return language_mode_; }
feedback()446   const VectorSlotPair& feedback() const { return feedback_; }
name()447   const Handle<Name>& name() const { return name_; }
448 
449  private:
450   const LanguageMode language_mode_;
451   const Handle<Name> name_;
452   const VectorSlotPair feedback_;
453 };
454 
455 bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&);
456 bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&);
457 
458 size_t hash_value(StoreGlobalParameters const&);
459 
460 std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
461 
462 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op);
463 
464 
465 // Defines the property of an object for a keyed access. This is used
466 // as a parameter by the JSLoadProperty and JSStoreProperty operators.
467 class PropertyAccess final {
468  public:
PropertyAccess(LanguageMode language_mode,VectorSlotPair const & feedback)469   PropertyAccess(LanguageMode language_mode, VectorSlotPair const& feedback)
470       : feedback_(feedback), language_mode_(language_mode) {}
471 
language_mode()472   LanguageMode language_mode() const { return language_mode_; }
feedback()473   VectorSlotPair const& feedback() const { return feedback_; }
474 
475  private:
476   VectorSlotPair const feedback_;
477   LanguageMode const language_mode_;
478 };
479 
480 bool operator==(PropertyAccess const&, PropertyAccess const&);
481 bool operator!=(PropertyAccess const&, PropertyAccess const&);
482 
483 size_t hash_value(PropertyAccess const&);
484 
485 std::ostream& operator<<(std::ostream&, PropertyAccess const&);
486 
487 PropertyAccess const& PropertyAccessOf(const Operator* op);
488 
489 
490 // CreateArgumentsType is used as parameter to JSCreateArguments nodes.
491 CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op);
492 
493 
494 // Defines shared information for the array that should be created. This is
495 // used as parameter by JSCreateArray operators.
496 class CreateArrayParameters final {
497  public:
CreateArrayParameters(size_t arity,Handle<AllocationSite> site)498   explicit CreateArrayParameters(size_t arity, Handle<AllocationSite> site)
499       : arity_(arity), site_(site) {}
500 
arity()501   size_t arity() const { return arity_; }
site()502   Handle<AllocationSite> site() const { return site_; }
503 
504  private:
505   size_t const arity_;
506   Handle<AllocationSite> const site_;
507 };
508 
509 bool operator==(CreateArrayParameters const&, CreateArrayParameters const&);
510 bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&);
511 
512 size_t hash_value(CreateArrayParameters const&);
513 
514 std::ostream& operator<<(std::ostream&, CreateArrayParameters const&);
515 
516 const CreateArrayParameters& CreateArrayParametersOf(const Operator* op);
517 
518 
519 // Defines shared information for the closure that should be created. This is
520 // used as a parameter by JSCreateClosure operators.
521 class CreateClosureParameters final {
522  public:
CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,VectorSlotPair const & feedback,PretenureFlag pretenure)523   CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,
524                           VectorSlotPair const& feedback,
525                           PretenureFlag pretenure)
526       : shared_info_(shared_info), feedback_(feedback), pretenure_(pretenure) {}
527 
shared_info()528   Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
feedback()529   VectorSlotPair const& feedback() const { return feedback_; }
pretenure()530   PretenureFlag pretenure() const { return pretenure_; }
531 
532  private:
533   const Handle<SharedFunctionInfo> shared_info_;
534   VectorSlotPair const feedback_;
535   const PretenureFlag pretenure_;
536 };
537 
538 bool operator==(CreateClosureParameters const&, CreateClosureParameters const&);
539 bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&);
540 
541 size_t hash_value(CreateClosureParameters const&);
542 
543 std::ostream& operator<<(std::ostream&, CreateClosureParameters const&);
544 
545 const CreateClosureParameters& CreateClosureParametersOf(const Operator* op);
546 
547 // Defines shared information for the literal that should be created. This is
548 // used as parameter by JSCreateLiteralArray, JSCreateLiteralObject and
549 // JSCreateLiteralRegExp operators.
550 class CreateLiteralParameters final {
551  public:
CreateLiteralParameters(Handle<HeapObject> constant,int length,int flags,int index)552   CreateLiteralParameters(Handle<HeapObject> constant, int length, int flags,
553                           int index)
554       : constant_(constant), length_(length), flags_(flags), index_(index) {}
555 
constant()556   Handle<HeapObject> constant() const { return constant_; }
length()557   int length() const { return length_; }
flags()558   int flags() const { return flags_; }
index()559   int index() const { return index_; }
560 
561  private:
562   Handle<HeapObject> const constant_;
563   int const length_;
564   int const flags_;
565   int const index_;
566 };
567 
568 bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&);
569 bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&);
570 
571 size_t hash_value(CreateLiteralParameters const&);
572 
573 std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&);
574 
575 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op);
576 
577 BinaryOperationHint BinaryOperationHintOf(const Operator* op);
578 
579 CompareOperationHint CompareOperationHintOf(const Operator* op);
580 
581 // Interface for building JavaScript-level operators, e.g. directly from the
582 // AST. Most operators have no parameters, thus can be globally shared for all
583 // graphs.
584 class V8_EXPORT_PRIVATE JSOperatorBuilder final
NON_EXPORTED_BASE(ZoneObject)585     : public NON_EXPORTED_BASE(ZoneObject) {
586  public:
587   explicit JSOperatorBuilder(Zone* zone);
588 
589   const Operator* Equal(CompareOperationHint hint);
590   const Operator* NotEqual(CompareOperationHint hint);
591   const Operator* StrictEqual(CompareOperationHint hint);
592   const Operator* StrictNotEqual(CompareOperationHint hint);
593   const Operator* LessThan(CompareOperationHint hint);
594   const Operator* GreaterThan(CompareOperationHint hint);
595   const Operator* LessThanOrEqual(CompareOperationHint hint);
596   const Operator* GreaterThanOrEqual(CompareOperationHint hint);
597 
598   const Operator* BitwiseOr();
599   const Operator* BitwiseXor();
600   const Operator* BitwiseAnd();
601   const Operator* ShiftLeft();
602   const Operator* ShiftRight();
603   const Operator* ShiftRightLogical();
604   const Operator* Add(BinaryOperationHint hint);
605   const Operator* Subtract();
606   const Operator* Multiply();
607   const Operator* Divide();
608   const Operator* Modulus();
609 
610   const Operator* ToBoolean(ToBooleanHints hints);
611   const Operator* ToInteger();
612   const Operator* ToLength();
613   const Operator* ToName();
614   const Operator* ToNumber();
615   const Operator* ToObject();
616   const Operator* ToString();
617 
618   const Operator* Create();
619   const Operator* CreateArguments(CreateArgumentsType type);
620   const Operator* CreateArray(size_t arity, Handle<AllocationSite> site);
621   const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info,
622                                 VectorSlotPair const& feedback,
623                                 PretenureFlag pretenure);
624   const Operator* CreateIterResultObject();
625   const Operator* CreateKeyValueArray();
626   const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant,
627                                      int literal_flags, int literal_index,
628                                      int number_of_elements);
629   const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant,
630                                       int literal_flags, int literal_index,
631                                       int number_of_properties);
632   const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
633                                       int literal_flags, int literal_index);
634 
635   const Operator* CallForwardVarargs(uint32_t start_index,
636                                      TailCallMode tail_call_mode);
637   const Operator* Call(
638       size_t arity, float frequency = 0.0f,
639       VectorSlotPair const& feedback = VectorSlotPair(),
640       ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
641       TailCallMode tail_call_mode = TailCallMode::kDisallow);
642   const Operator* CallWithSpread(uint32_t arity);
643   const Operator* CallRuntime(Runtime::FunctionId id);
644   const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
645   const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
646   const Operator* Construct(uint32_t arity, float frequency,
647                             VectorSlotPair const& feedback);
648   const Operator* ConstructWithSpread(uint32_t arity);
649 
650   const Operator* ConvertReceiver(ConvertReceiverMode convert_mode);
651 
652   const Operator* LoadProperty(VectorSlotPair const& feedback);
653   const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
654 
655   const Operator* StoreProperty(LanguageMode language_mode,
656                                 VectorSlotPair const& feedback);
657   const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
658                              VectorSlotPair const& feedback);
659 
660   const Operator* StoreNamedOwn(Handle<Name> name,
661                                 VectorSlotPair const& feedback);
662   const Operator* StoreDataPropertyInLiteral(const VectorSlotPair& feedback);
663 
664   const Operator* DeleteProperty(LanguageMode language_mode);
665 
666   const Operator* HasProperty();
667 
668   const Operator* GetSuperConstructor();
669 
670   const Operator* LoadGlobal(const Handle<Name>& name,
671                              const VectorSlotPair& feedback,
672                              TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
673   const Operator* StoreGlobal(LanguageMode language_mode,
674                               const Handle<Name>& name,
675                               const VectorSlotPair& feedback);
676 
677   const Operator* LoadContext(size_t depth, size_t index, bool immutable);
678   const Operator* StoreContext(size_t depth, size_t index);
679 
680   const Operator* LoadModule(int32_t cell_index);
681   const Operator* StoreModule(int32_t cell_index);
682 
683   const Operator* ClassOf();
684   const Operator* TypeOf();
685   const Operator* InstanceOf();
686   const Operator* OrdinaryHasInstance();
687 
688   const Operator* ForInNext();
689   const Operator* ForInPrepare();
690 
691   const Operator* LoadMessage();
692   const Operator* StoreMessage();
693 
694   // Used to implement Ignition's SuspendGenerator bytecode.
695   const Operator* GeneratorStore(int register_count);
696 
697   // Used to implement Ignition's ResumeGenerator bytecode.
698   const Operator* GeneratorRestoreContinuation();
699   const Operator* GeneratorRestoreRegister(int index);
700 
701   const Operator* StackCheck();
702   const Operator* Debugger();
703 
704   const Operator* CreateFunctionContext(int slot_count, ScopeType scope_type);
705   const Operator* CreateCatchContext(const Handle<String>& name,
706                                      const Handle<ScopeInfo>& scope_info);
707   const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info);
708   const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
709   const Operator* CreateModuleContext();
710   const Operator* CreateScriptContext(const Handle<ScopeInfo>& scpope_info);
711 
712  private:
713   Zone* zone() const { return zone_; }
714 
715   const JSOperatorGlobalCache& cache_;
716   Zone* const zone_;
717 
718   DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
719 };
720 
721 }  // namespace compiler
722 }  // namespace internal
723 }  // namespace v8
724 
725 #endif  // V8_COMPILER_JS_OPERATOR_H_
726