js-operator.h 27 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_JS_OPERATOR_H_
#define V8_COMPILER_JS_OPERATOR_H_

8 9
#include "src/base/compiler-specific.h"
#include "src/globals.h"
10
#include "src/handles.h"
11
#include "src/runtime/runtime.h"
12
#include "src/type-hints.h"
13 14 15

namespace v8 {
namespace internal {
16

17
class AllocationSite;
18 19
class BoilerplateDescription;
class ConstantElementsPair;
20
class SharedFunctionInfo;
21
class FeedbackVector;
22

23 24
namespace compiler {

25 26
// Forward declarations.
class Operator;
27
struct JSOperatorGlobalCache;
28

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
// Defines the frequency a given Call/Construct site was executed. For some
// call sites the frequency is not known.
class CallFrequency final {
 public:
  CallFrequency() : value_(std::numeric_limits<float>::quiet_NaN()) {}
  explicit CallFrequency(float value) : value_(value) {
    DCHECK(!std::isnan(value));
  }

  bool IsKnown() const { return !IsUnknown(); }
  bool IsUnknown() const { return std::isnan(value_); }
  float value() const {
    DCHECK(IsKnown());
    return value_;
  }

  bool operator==(CallFrequency const& that) const {
    return bit_cast<uint32_t>(this->value_) == bit_cast<uint32_t>(that.value_);
  }
  bool operator!=(CallFrequency const& that) const { return !(*this == that); }

  friend size_t hash_value(CallFrequency f) {
    return bit_cast<uint32_t>(f.value_);
  }

 private:
  float value_;
};

std::ostream& operator<<(std::ostream&, CallFrequency);

60 61
CallFrequency CallFrequencyOf(Operator const* op) WARN_UNUSED_RESULT;

62
// Defines a pair of {FeedbackVector} and {FeedbackSlot}, which
63
// is used to access the type feedback for a certain {Node}.
64
class V8_EXPORT_PRIVATE VectorSlotPair {
65
 public:
66
  VectorSlotPair();
67
  VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot)
68 69
      : vector_(vector), slot_(slot) {}

70
  bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
71

72
  Handle<FeedbackVector> vector() const { return vector_; }
73
  FeedbackSlot slot() const { return slot_; }
74

75
  int index() const;
76 77

 private:
78
  const Handle<FeedbackVector> vector_;
79
  const FeedbackSlot slot_;
80 81 82 83 84 85 86
};

bool operator==(VectorSlotPair const&, VectorSlotPair const&);
bool operator!=(VectorSlotPair const&, VectorSlotPair const&);

size_t hash_value(VectorSlotPair const&);

87

88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
// Defines the flags for a JavaScript call forwarding parameters. This
// is used as parameter by JSConstructForwardVarargs operators.
class ConstructForwardVarargsParameters final {
 public:
  ConstructForwardVarargsParameters(size_t arity, uint32_t start_index)
      : bit_field_(ArityField::encode(arity) |
                   StartIndexField::encode(start_index)) {}

  size_t arity() const { return ArityField::decode(bit_field_); }
  uint32_t start_index() const { return StartIndexField::decode(bit_field_); }

  bool operator==(ConstructForwardVarargsParameters const& that) const {
    return this->bit_field_ == that.bit_field_;
  }
  bool operator!=(ConstructForwardVarargsParameters const& that) const {
    return !(*this == that);
  }

 private:
  friend size_t hash_value(ConstructForwardVarargsParameters const& p) {
    return p.bit_field_;
  }

  typedef BitField<size_t, 0, 16> ArityField;
  typedef BitField<uint32_t, 16, 16> StartIndexField;

  uint32_t const bit_field_;
};

std::ostream& operator<<(std::ostream&,
                         ConstructForwardVarargsParameters const&);

ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
    Operator const*) WARN_UNUSED_RESULT;
122

123
// Defines the arity and the feedback for a JavaScript constructor call. This is
124
// used as a parameter by JSConstruct and JSConstructWithSpread operators.
125
class ConstructParameters final {
126
 public:
127
  ConstructParameters(uint32_t arity, CallFrequency frequency,
128
                      VectorSlotPair const& feedback)
129
      : arity_(arity), frequency_(frequency), feedback_(feedback) {}
130

131
  uint32_t arity() const { return arity_; }
132
  CallFrequency frequency() const { return frequency_; }
133 134 135
  VectorSlotPair const& feedback() const { return feedback_; }

 private:
136
  uint32_t const arity_;
137
  CallFrequency const frequency_;
138 139 140
  VectorSlotPair const feedback_;
};

141 142
bool operator==(ConstructParameters const&, ConstructParameters const&);
bool operator!=(ConstructParameters const&, ConstructParameters const&);
143

144
size_t hash_value(ConstructParameters const&);
145

146
std::ostream& operator<<(std::ostream&, ConstructParameters const&);
147

148
ConstructParameters const& ConstructParametersOf(Operator const*);
149

150 151 152 153
// Defines the flags for a JavaScript call forwarding parameters. This
// is used as parameter by JSCallForwardVarargs operators.
class CallForwardVarargsParameters final {
 public:
154
  CallForwardVarargsParameters(size_t arity, uint32_t start_index)
155
      : bit_field_(ArityField::encode(arity) |
156
                   StartIndexField::encode(start_index)) {}
157

158
  size_t arity() const { return ArityField::decode(bit_field_); }
159 160 161 162 163 164 165 166 167 168 169 170 171 172
  uint32_t start_index() const { return StartIndexField::decode(bit_field_); }

  bool operator==(CallForwardVarargsParameters const& that) const {
    return this->bit_field_ == that.bit_field_;
  }
  bool operator!=(CallForwardVarargsParameters const& that) const {
    return !(*this == that);
  }

 private:
  friend size_t hash_value(CallForwardVarargsParameters const& p) {
    return p.bit_field_;
  }

173 174
  typedef BitField<size_t, 0, 15> ArityField;
  typedef BitField<uint32_t, 15, 15> StartIndexField;
175 176 177 178 179 180 181 182 183

  uint32_t const bit_field_;
};

std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&);

CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
    Operator const*) WARN_UNUSED_RESULT;

184
// Defines the arity and the call flags for a JavaScript function call. This is
185
// used as a parameter by JSCall and JSCallWithSpread operators.
186
class CallParameters final {
187
 public:
188
  CallParameters(size_t arity, CallFrequency frequency,
189
                 VectorSlotPair const& feedback,
190
                 ConvertReceiverMode convert_mode)
191
      : bit_field_(ArityField::encode(arity) |
192
                   ConvertReceiverModeField::encode(convert_mode)),
193
        frequency_(frequency),
194
        feedback_(feedback) {}
195 196

  size_t arity() const { return ArityField::decode(bit_field_); }
197
  CallFrequency frequency() const { return frequency_; }
198 199 200
  ConvertReceiverMode convert_mode() const {
    return ConvertReceiverModeField::decode(bit_field_);
  }
201
  VectorSlotPair const& feedback() const { return feedback_; }
202

203
  bool operator==(CallParameters const& that) const {
204
    return this->bit_field_ == that.bit_field_ &&
205
           this->frequency_ == that.frequency_ &&
206
           this->feedback_ == that.feedback_;
207
  }
208
  bool operator!=(CallParameters const& that) const { return !(*this == that); }
209 210

 private:
211
  friend size_t hash_value(CallParameters const& p) {
212
    return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_);
213 214
  }

215 216
  typedef BitField<size_t, 0, 29> ArityField;
  typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField;
217

218
  uint32_t const bit_field_;
219
  CallFrequency const frequency_;
220
  VectorSlotPair const feedback_;
221
};
222

223
size_t hash_value(CallParameters const&);
224

225
std::ostream& operator<<(std::ostream&, CallParameters const&);
226

227
const CallParameters& CallParametersOf(const Operator* op);
228 229 230 231


// Defines the arity and the ID for a runtime function call. This is used as a
// parameter by JSCallRuntime operators.
232
class CallRuntimeParameters final {
233 234 235 236 237 238 239 240 241 242 243 244
 public:
  CallRuntimeParameters(Runtime::FunctionId id, size_t arity)
      : id_(id), arity_(arity) {}

  Runtime::FunctionId id() const { return id_; }
  size_t arity() const { return arity_; }

 private:
  const Runtime::FunctionId id_;
  const size_t arity_;
};

245 246 247 248 249 250 251
bool operator==(CallRuntimeParameters const&, CallRuntimeParameters const&);
bool operator!=(CallRuntimeParameters const&, CallRuntimeParameters const&);

size_t hash_value(CallRuntimeParameters const&);

std::ostream& operator<<(std::ostream&, CallRuntimeParameters const&);

252 253 254
const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op);


255 256 257
// Defines the location of a context slot relative to a specific scope. This is
// used as a parameter by JSLoadContext and JSStoreContext operators and allows
// accessing a context-allocated variable without keeping track of the scope.
258
class ContextAccess final {
259
 public:
260 261 262 263
  ContextAccess(size_t depth, size_t index, bool immutable);

  size_t depth() const { return depth_; }
  size_t index() const { return index_; }
264 265 266 267 268 269 270 271 272 273
  bool immutable() const { return immutable_; }

 private:
  // For space reasons, we keep this tightly packed, otherwise we could just use
  // a simple int/int/bool POD.
  const bool immutable_;
  const uint16_t depth_;
  const uint32_t index_;
};

274 275 276 277
bool operator==(ContextAccess const&, ContextAccess const&);
bool operator!=(ContextAccess const&, ContextAccess const&);

size_t hash_value(ContextAccess const&);
278

279
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ContextAccess const&);
280 281

ContextAccess const& ContextAccessOf(Operator const*);
282

283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
// Defines the name and ScopeInfo for a new catch context. This is used as a
// parameter by the JSCreateCatchContext operator.
class CreateCatchContextParameters final {
 public:
  CreateCatchContextParameters(Handle<String> catch_name,
                               Handle<ScopeInfo> scope_info);

  Handle<String> catch_name() const { return catch_name_; }
  Handle<ScopeInfo> scope_info() const { return scope_info_; }

 private:
  Handle<String> const catch_name_;
  Handle<ScopeInfo> const scope_info_;
};

bool operator==(CreateCatchContextParameters const& lhs,
                CreateCatchContextParameters const& rhs);
bool operator!=(CreateCatchContextParameters const& lhs,
                CreateCatchContextParameters const& rhs);

size_t hash_value(CreateCatchContextParameters const& parameters);

std::ostream& operator<<(std::ostream& os,
                         CreateCatchContextParameters const& parameters);

CreateCatchContextParameters const& CreateCatchContextParametersOf(
    Operator const*);
310

311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
// Defines the slot count and ScopeType for a new function or eval context. This
// is used as a parameter by the JSCreateFunctionContext operator.
class CreateFunctionContextParameters final {
 public:
  CreateFunctionContextParameters(int slot_count, ScopeType scope_type);

  int slot_count() const { return slot_count_; }
  ScopeType scope_type() const { return scope_type_; }

 private:
  int const slot_count_;
  ScopeType const scope_type_;
};

bool operator==(CreateFunctionContextParameters const& lhs,
                CreateFunctionContextParameters const& rhs);
bool operator!=(CreateFunctionContextParameters const& lhs,
                CreateFunctionContextParameters const& rhs);

size_t hash_value(CreateFunctionContextParameters const& parameters);

std::ostream& operator<<(std::ostream& os,
                         CreateFunctionContextParameters const& parameters);

CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
    Operator const*);

338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
// Defines parameters for JSStoreNamedOwn operator.
class StoreNamedOwnParameters final {
 public:
  StoreNamedOwnParameters(Handle<Name> name, VectorSlotPair const& feedback)
      : name_(name), feedback_(feedback) {}

  Handle<Name> name() const { return name_; }
  VectorSlotPair const& feedback() const { return feedback_; }

 private:
  Handle<Name> const name_;
  VectorSlotPair const feedback_;
};

bool operator==(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
bool operator!=(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);

size_t hash_value(StoreNamedOwnParameters const&);

std::ostream& operator<<(std::ostream&, StoreNamedOwnParameters const&);

const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op);

361
// Defines the feedback, i.e., vector and index, for storing a data property in
362 363
// an object literal. This is used as a parameter by JSCreateEmptyLiteralArray
// and JSStoreDataPropertyInLiteral operators.
364
class FeedbackParameter final {
365
 public:
366
  explicit FeedbackParameter(VectorSlotPair const& feedback)
367 368 369 370 371 372 373 374
      : feedback_(feedback) {}

  VectorSlotPair const& feedback() const { return feedback_; }

 private:
  VectorSlotPair const feedback_;
};

375 376
bool operator==(FeedbackParameter const&, FeedbackParameter const&);
bool operator!=(FeedbackParameter const&, FeedbackParameter const&);
377

378
size_t hash_value(FeedbackParameter const&);
379

380
std::ostream& operator<<(std::ostream&, FeedbackParameter const&);
381

382
const FeedbackParameter& FeedbackParameterOf(const Operator* op);
383

384 385 386
// Defines the property of an object for a named access. This is
// used as a parameter by the JSLoadNamed and JSStoreNamed operators.
class NamedAccess final {
387
 public:
388 389
  NamedAccess(LanguageMode language_mode, Handle<Name> name,
              VectorSlotPair const& feedback)
390
      : name_(name), feedback_(feedback), language_mode_(language_mode) {}
391

392
  Handle<Name> name() const { return name_; }
393
  LanguageMode language_mode() const { return language_mode_; }
394
  VectorSlotPair const& feedback() const { return feedback_; }
395

396
 private:
397 398 399
  Handle<Name> const name_;
  VectorSlotPair const feedback_;
  LanguageMode const language_mode_;
400 401
};

402 403
bool operator==(NamedAccess const&, NamedAccess const&);
bool operator!=(NamedAccess const&, NamedAccess const&);
404

405
size_t hash_value(NamedAccess const&);
406

407
std::ostream& operator<<(std::ostream&, NamedAccess const&);
408

409
const NamedAccess& NamedAccessOf(const Operator* op);
410

411 412 413 414 415

// Defines the property being loaded from an object by a named load. This is
// used as a parameter by JSLoadGlobal operator.
class LoadGlobalParameters final {
 public:
416
  LoadGlobalParameters(const Handle<Name>& name, const VectorSlotPair& feedback,
417 418
                       TypeofMode typeof_mode)
      : name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {}
419

420
  const Handle<Name>& name() const { return name_; }
421
  TypeofMode typeof_mode() const { return typeof_mode_; }
422 423 424 425

  const VectorSlotPair& feedback() const { return feedback_; }

 private:
426
  const Handle<Name> name_;
427
  const VectorSlotPair feedback_;
428
  const TypeofMode typeof_mode_;
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
};

bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&);
bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&);

size_t hash_value(LoadGlobalParameters const&);

std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);

const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);


// Defines the property being stored to an object by a named store. This is
// used as a parameter by JSStoreGlobal operator.
class StoreGlobalParameters final {
 public:
  StoreGlobalParameters(LanguageMode language_mode,
                        const VectorSlotPair& feedback,
447 448
                        const Handle<Name>& name)
      : language_mode_(language_mode), name_(name), feedback_(feedback) {}
449 450 451

  LanguageMode language_mode() const { return language_mode_; }
  const VectorSlotPair& feedback() const { return feedback_; }
452
  const Handle<Name>& name() const { return name_; }
453 454 455

 private:
  const LanguageMode language_mode_;
456
  const Handle<Name> name_;
457 458 459 460 461 462 463 464 465 466 467
  const VectorSlotPair feedback_;
};

bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&);
bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&);

size_t hash_value(StoreGlobalParameters const&);

std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);

const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op);
468

469

470 471 472
// Defines the property of an object for a keyed access. This is used
// as a parameter by the JSLoadProperty and JSStoreProperty operators.
class PropertyAccess final {
473
 public:
474
  PropertyAccess(LanguageMode language_mode, VectorSlotPair const& feedback)
475
      : feedback_(feedback), language_mode_(language_mode) {}
476

477
  LanguageMode language_mode() const { return language_mode_; }
478
  VectorSlotPair const& feedback() const { return feedback_; }
479 480

 private:
481 482
  VectorSlotPair const feedback_;
  LanguageMode const language_mode_;
483 484
};

485 486
bool operator==(PropertyAccess const&, PropertyAccess const&);
bool operator!=(PropertyAccess const&, PropertyAccess const&);
487

488
size_t hash_value(PropertyAccess const&);
489

490
std::ostream& operator<<(std::ostream&, PropertyAccess const&);
491

492
PropertyAccess const& PropertyAccessOf(const Operator* op);
493 494


495 496
// CreateArgumentsType is used as parameter to JSCreateArguments nodes.
CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op);
497

498

499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
// Defines shared information for the array that should be created. This is
// used as parameter by JSCreateArray operators.
class CreateArrayParameters final {
 public:
  explicit CreateArrayParameters(size_t arity, Handle<AllocationSite> site)
      : arity_(arity), site_(site) {}

  size_t arity() const { return arity_; }
  Handle<AllocationSite> site() const { return site_; }

 private:
  size_t const arity_;
  Handle<AllocationSite> const site_;
};

bool operator==(CreateArrayParameters const&, CreateArrayParameters const&);
bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&);

size_t hash_value(CreateArrayParameters const&);

std::ostream& operator<<(std::ostream&, CreateArrayParameters const&);

const CreateArrayParameters& CreateArrayParametersOf(const Operator* op);

523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
// Defines shared information for the bound function that should be created.
// This is used as parameter by JSCreateBoundFunction operators.
class CreateBoundFunctionParameters final {
 public:
  CreateBoundFunctionParameters(size_t arity, Handle<Map> map)
      : arity_(arity), map_(map) {}

  size_t arity() const { return arity_; }
  Handle<Map> map() const { return map_; }

 private:
  size_t const arity_;
  Handle<Map> const map_;
};

bool operator==(CreateBoundFunctionParameters const&,
                CreateBoundFunctionParameters const&);
bool operator!=(CreateBoundFunctionParameters const&,
                CreateBoundFunctionParameters const&);

size_t hash_value(CreateBoundFunctionParameters const&);

std::ostream& operator<<(std::ostream&, CreateBoundFunctionParameters const&);

const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf(
    const Operator* op);
549

550 551 552 553 554
// Defines shared information for the closure that should be created. This is
// used as a parameter by JSCreateClosure operators.
class CreateClosureParameters final {
 public:
  CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,
555
                          VectorSlotPair const& feedback,
556
                          PretenureFlag pretenure)
557
      : shared_info_(shared_info), feedback_(feedback), pretenure_(pretenure) {}
558 559

  Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
560
  VectorSlotPair const& feedback() const { return feedback_; }
561 562 563 564
  PretenureFlag pretenure() const { return pretenure_; }

 private:
  const Handle<SharedFunctionInfo> shared_info_;
565
  VectorSlotPair const feedback_;
566 567 568 569 570 571 572 573 574 575 576 577
  const PretenureFlag pretenure_;
};

bool operator==(CreateClosureParameters const&, CreateClosureParameters const&);
bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&);

size_t hash_value(CreateClosureParameters const&);

std::ostream& operator<<(std::ostream&, CreateClosureParameters const&);

const CreateClosureParameters& CreateClosureParametersOf(const Operator* op);

578
// Defines shared information for the literal that should be created. This is
579 580
// used as parameter by JSCreateLiteralArray, JSCreateLiteralObject and
// JSCreateLiteralRegExp operators.
581 582
class CreateLiteralParameters final {
 public:
583 584 585 586 587 588
  CreateLiteralParameters(Handle<HeapObject> constant,
                          VectorSlotPair const& feedback, int length, int flags)
      : constant_(constant),
        feedback_(feedback),
        length_(length),
        flags_(flags) {}
589

590
  Handle<HeapObject> constant() const { return constant_; }
591
  VectorSlotPair const& feedback() const { return feedback_; }
592
  int length() const { return length_; }
593 594 595
  int flags() const { return flags_; }

 private:
596
  Handle<HeapObject> const constant_;
597
  VectorSlotPair const feedback_;
598
  int const length_;
599 600 601 602 603 604 605 606 607 608 609 610
  int const flags_;
};

bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&);
bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&);

size_t hash_value(CreateLiteralParameters const&);

std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&);

const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op);

611 612 613 614 615 616 617 618 619 620 621 622 623
// Descriptor used by the JSForInPrepare and JSForInNext opcodes.
enum class ForInMode : uint8_t {
  kUseEnumCacheKeysAndIndices,
  kUseEnumCacheKeys,
  kGeneric
};

size_t hash_value(ForInMode);

std::ostream& operator<<(std::ostream&, ForInMode);

ForInMode ForInModeOf(Operator const* op) WARN_UNUSED_RESULT;

624
BinaryOperationHint BinaryOperationHintOf(const Operator* op);
625

626
CompareOperationHint CompareOperationHintOf(const Operator* op);
627

628 629 630
// Interface for building JavaScript-level operators, e.g. directly from the
// AST. Most operators have no parameters, thus can be globally shared for all
// graphs.
631 632
class V8_EXPORT_PRIVATE JSOperatorBuilder final
    : public NON_EXPORTED_BASE(ZoneObject) {
633
 public:
634 635
  explicit JSOperatorBuilder(Zone* zone);

636 637 638 639 640 641 642
  const Operator* Equal(CompareOperationHint hint);
  const Operator* StrictEqual(CompareOperationHint hint);
  const Operator* LessThan(CompareOperationHint hint);
  const Operator* GreaterThan(CompareOperationHint hint);
  const Operator* LessThanOrEqual(CompareOperationHint hint);
  const Operator* GreaterThanOrEqual(CompareOperationHint hint);

643 644 645 646 647 648
  const Operator* BitwiseOr();
  const Operator* BitwiseXor();
  const Operator* BitwiseAnd();
  const Operator* ShiftLeft();
  const Operator* ShiftRight();
  const Operator* ShiftRightLogical();
649
  const Operator* Add(BinaryOperationHint hint);
650 651 652 653
  const Operator* Subtract();
  const Operator* Multiply();
  const Operator* Divide();
  const Operator* Modulus();
654

655 656
  const Operator* ToInteger();
  const Operator* ToLength();
657
  const Operator* ToName();
658
  const Operator* ToNumber();
659
  const Operator* ToObject();
660
  const Operator* ToString();
661 662

  const Operator* Create();
663
  const Operator* CreateArguments(CreateArgumentsType type);
664
  const Operator* CreateArray(size_t arity, Handle<AllocationSite> site);
665
  const Operator* CreateBoundFunction(size_t arity, Handle<Map> map);
666
  const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info,
667
                                VectorSlotPair const& feedback,
668
                                PretenureFlag pretenure);
669
  const Operator* CreateIterResultObject();
670
  const Operator* CreateKeyValueArray();
671
  const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant,
672 673 674
                                     VectorSlotPair const& feedback,
                                     int literal_flags, int number_of_elements);
  const Operator* CreateEmptyLiteralArray(VectorSlotPair const& feedback);
675
  const Operator* CreateEmptyLiteralObject();
676

677
  const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant,
678 679
                                      VectorSlotPair const& feedback,
                                      int literal_flags,
680
                                      int number_of_properties);
681
  const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
682 683
                                      VectorSlotPair const& feedback,
                                      int literal_flags);
684

685
  const Operator* CallForwardVarargs(size_t arity, uint32_t start_index);
686
  const Operator* Call(
687
      size_t arity, CallFrequency frequency = CallFrequency(),
688
      VectorSlotPair const& feedback = VectorSlotPair(),
689
      ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny);
690
  const Operator* CallWithArrayLike(CallFrequency frequency);
691 692 693
  const Operator* CallWithSpread(
      uint32_t arity, CallFrequency frequency = CallFrequency(),
      VectorSlotPair const& feedback = VectorSlotPair());
694
  const Operator* CallRuntime(Runtime::FunctionId id);
695
  const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
696
  const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
697 698

  const Operator* ConstructForwardVarargs(size_t arity, uint32_t start_index);
699 700 701
  const Operator* Construct(uint32_t arity,
                            CallFrequency frequency = CallFrequency(),
                            VectorSlotPair const& feedback = VectorSlotPair());
702
  const Operator* ConstructWithArrayLike(CallFrequency frequency);
703 704 705
  const Operator* ConstructWithSpread(
      uint32_t arity, CallFrequency frequency = CallFrequency(),
      VectorSlotPair const& feedback = VectorSlotPair());
706

707 708
  const Operator* LoadProperty(VectorSlotPair const& feedback);
  const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
709

710
  const Operator* StoreProperty(LanguageMode language_mode,
711 712 713
                                VectorSlotPair const& feedback);
  const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
                             VectorSlotPair const& feedback);
714

715 716
  const Operator* StoreNamedOwn(Handle<Name> name,
                                VectorSlotPair const& feedback);
717
  const Operator* StoreDataPropertyInLiteral(const VectorSlotPair& feedback);
718

719
  const Operator* DeleteProperty();
720 721 722

  const Operator* HasProperty();

723 724
  const Operator* GetSuperConstructor();

725 726
  const Operator* CreateGeneratorObject();

727
  const Operator* LoadGlobal(const Handle<Name>& name,
728
                             const VectorSlotPair& feedback,
729
                             TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
730
  const Operator* StoreGlobal(LanguageMode language_mode,
731
                              const Handle<Name>& name,
732
                              const VectorSlotPair& feedback);
733

734 735 736
  const Operator* LoadContext(size_t depth, size_t index, bool immutable);
  const Operator* StoreContext(size_t depth, size_t index);

737 738 739
  const Operator* LoadModule(int32_t cell_index);
  const Operator* StoreModule(int32_t cell_index);

740
  const Operator* ClassOf();
741
  const Operator* HasInPrototypeChain();
742
  const Operator* InstanceOf(const VectorSlotPair& feedback);
743
  const Operator* OrdinaryHasInstance();
744

745 746 747
  const Operator* ForInEnumerate();
  const Operator* ForInNext(ForInMode);
  const Operator* ForInPrepare(ForInMode);
748

749 750 751
  const Operator* LoadMessage();
  const Operator* StoreMessage();

752
  // Used to implement Ignition's SuspendGenerator bytecode.
753
  const Operator* GeneratorStore(int register_count);
754

755
  // Used to implement Ignition's RestoreGeneratorState bytecode.
756
  const Operator* GeneratorRestoreContinuation();
757
  // Used to implement Ignition's RestoreGeneratorRegisters bytecode.
758 759
  const Operator* GeneratorRestoreRegister(int index);

760
  const Operator* StackCheck();
761
  const Operator* Debugger();
762

763
  const Operator* CreateFunctionContext(int slot_count, ScopeType scope_type);
764 765
  const Operator* CreateCatchContext(const Handle<String>& name,
                                     const Handle<ScopeInfo>& scope_info);
766
  const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info);
767 768
  const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
  const Operator* CreateScriptContext(const Handle<ScopeInfo>& scpope_info);
769 770

 private:
771
  Zone* zone() const { return zone_; }
772

773
  const JSOperatorGlobalCache& cache_;
774
  Zone* const zone_;
775 776

  DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
777
};
778 779 780 781

}  // namespace compiler
}  // namespace internal
}  // namespace v8
782 783

#endif  // V8_COMPILER_JS_OPERATOR_H_