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
5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_
7
8 #include <iosfwd>
9
10 #include "src/base/compiler-specific.h"
11 #include "src/compiler/operator.h"
12 #include "src/compiler/types.h"
13 #include "src/deoptimize-reason.h"
14 #include "src/globals.h"
15 #include "src/handles.h"
16 #include "src/machine-type.h"
17 #include "src/maybe-handles.h"
18 #include "src/objects.h"
19 #include "src/type-hints.h"
20 #include "src/vector-slot-pair.h"
21 #include "src/zone/zone-handle-set.h"
22
23 namespace v8 {
24 namespace internal {
25
26 // Forward declarations.
27 enum class AbortReason : uint8_t;
28 class Zone;
29
30 namespace compiler {
31
32 // Forward declarations.
33 class Operator;
34 struct SimplifiedOperatorGlobalCache;
35
36 enum BaseTaggedness : uint8_t { kUntaggedBase, kTaggedBase };
37
38 size_t hash_value(BaseTaggedness);
39
40 std::ostream& operator<<(std::ostream&, BaseTaggedness);
41
42 size_t hash_value(LoadSensitivity);
43
44 std::ostream& operator<<(std::ostream&, LoadSensitivity);
45
46 // An access descriptor for loads/stores of fixed structures like field
47 // accesses of heap objects. Accesses from either tagged or untagged base
48 // pointers are supported; untagging is done automatically during lowering.
49 struct FieldAccess {
50 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
51 int offset; // offset of the field, without tag.
52 MaybeHandle<Name> name; // debugging only.
53 MaybeHandle<Map> map; // map of the field value (if known).
54 Type type; // type of the field.
55 MachineType machine_type; // machine type of the field.
56 WriteBarrierKind write_barrier_kind; // write barrier hint.
57 LoadSensitivity load_sensitivity; // load safety for poisoning.
58
FieldAccessFieldAccess59 FieldAccess()
60 : base_is_tagged(kTaggedBase),
61 offset(0),
62 type(Type::None()),
63 machine_type(MachineType::None()),
64 write_barrier_kind(kFullWriteBarrier),
65 load_sensitivity(LoadSensitivity::kUnsafe) {}
66
67 FieldAccess(BaseTaggedness base_is_tagged, int offset, MaybeHandle<Name> name,
68 MaybeHandle<Map> map, Type type, MachineType machine_type,
69 WriteBarrierKind write_barrier_kind,
70 LoadSensitivity load_sensitivity = LoadSensitivity::kUnsafe)
base_is_taggedFieldAccess71 : base_is_tagged(base_is_tagged),
72 offset(offset),
73 name(name),
74 map(map),
75 type(type),
76 machine_type(machine_type),
77 write_barrier_kind(write_barrier_kind),
78 load_sensitivity(load_sensitivity) {}
79
tagFieldAccess80 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
81 };
82
83 V8_EXPORT_PRIVATE bool operator==(FieldAccess const&, FieldAccess const&);
84
85 size_t hash_value(FieldAccess const&);
86
87 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, FieldAccess const&);
88
89 V8_EXPORT_PRIVATE FieldAccess const& FieldAccessOf(const Operator* op)
90 V8_WARN_UNUSED_RESULT;
91
92 template <>
93 void Operator1<FieldAccess>::PrintParameter(std::ostream& os,
94 PrintVerbosity verbose) const;
95
96 // An access descriptor for loads/stores of indexed structures like characters
97 // in strings or off-heap backing stores. Accesses from either tagged or
98 // untagged base pointers are supported; untagging is done automatically during
99 // lowering.
100 struct ElementAccess {
101 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
102 int header_size; // size of the header, without tag.
103 Type type; // type of the element.
104 MachineType machine_type; // machine type of the element.
105 WriteBarrierKind write_barrier_kind; // write barrier hint.
106 LoadSensitivity load_sensitivity; // load safety for poisoning.
107
ElementAccessElementAccess108 ElementAccess()
109 : base_is_tagged(kTaggedBase),
110 header_size(0),
111 type(Type::None()),
112 machine_type(MachineType::None()),
113 write_barrier_kind(kFullWriteBarrier),
114 load_sensitivity(LoadSensitivity::kUnsafe) {}
115
116 ElementAccess(BaseTaggedness base_is_tagged, int header_size, Type type,
117 MachineType machine_type, WriteBarrierKind write_barrier_kind,
118 LoadSensitivity load_sensitivity = LoadSensitivity::kUnsafe)
base_is_taggedElementAccess119 : base_is_tagged(base_is_tagged),
120 header_size(header_size),
121 type(type),
122 machine_type(machine_type),
123 write_barrier_kind(write_barrier_kind),
124 load_sensitivity(load_sensitivity) {}
125
tagElementAccess126 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
127 };
128
129 V8_EXPORT_PRIVATE bool operator==(ElementAccess const&, ElementAccess const&);
130
131 size_t hash_value(ElementAccess const&);
132
133 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ElementAccess const&);
134
135 V8_EXPORT_PRIVATE ElementAccess const& ElementAccessOf(const Operator* op)
136 V8_WARN_UNUSED_RESULT;
137
138 ExternalArrayType ExternalArrayTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
139
140 // The ConvertReceiverMode is used as parameter by ConvertReceiver operators.
141 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op)
142 V8_WARN_UNUSED_RESULT;
143
144 // A the parameters for several Check nodes. The {feedback} parameter is
145 // optional. If {feedback} references a valid CallIC slot and this MapCheck
146 // fails, then speculation on that CallIC slot will be disabled.
147 class CheckParameters final {
148 public:
CheckParameters(const VectorSlotPair & feedback)149 explicit CheckParameters(const VectorSlotPair& feedback)
150 : feedback_(feedback) {}
151
feedback()152 VectorSlotPair const& feedback() const { return feedback_; }
153
154 private:
155 VectorSlotPair feedback_;
156 };
157
158 bool operator==(CheckParameters const&, CheckParameters const&);
159
160 size_t hash_value(CheckParameters const&);
161
162 std::ostream& operator<<(std::ostream&, CheckParameters const&);
163
164 CheckParameters const& CheckParametersOf(Operator const*) V8_WARN_UNUSED_RESULT;
165
166 class CheckIfParameters final {
167 public:
CheckIfParameters(DeoptimizeReason reason,const VectorSlotPair & feedback)168 explicit CheckIfParameters(DeoptimizeReason reason,
169 const VectorSlotPair& feedback)
170 : reason_(reason), feedback_(feedback) {}
171
feedback()172 VectorSlotPair const& feedback() const { return feedback_; }
reason()173 DeoptimizeReason reason() const { return reason_; }
174
175 private:
176 DeoptimizeReason reason_;
177 VectorSlotPair feedback_;
178 };
179
180 bool operator==(CheckIfParameters const&, CheckIfParameters const&);
181
182 size_t hash_value(CheckIfParameters const&);
183
184 std::ostream& operator<<(std::ostream&, CheckIfParameters const&);
185
186 CheckIfParameters const& CheckIfParametersOf(Operator const*)
187 V8_WARN_UNUSED_RESULT;
188
189 enum class CheckFloat64HoleMode : uint8_t {
190 kNeverReturnHole, // Never return the hole (deoptimize instead).
191 kAllowReturnHole // Allow to return the hole (signaling NaN).
192 };
193
194 size_t hash_value(CheckFloat64HoleMode);
195
196 std::ostream& operator<<(std::ostream&, CheckFloat64HoleMode);
197
198 class CheckFloat64HoleParameters {
199 public:
CheckFloat64HoleParameters(CheckFloat64HoleMode mode,VectorSlotPair const & feedback)200 CheckFloat64HoleParameters(CheckFloat64HoleMode mode,
201 VectorSlotPair const& feedback)
202 : mode_(mode), feedback_(feedback) {}
203
mode()204 CheckFloat64HoleMode mode() const { return mode_; }
feedback()205 VectorSlotPair const& feedback() const { return feedback_; }
206
207 private:
208 CheckFloat64HoleMode mode_;
209 VectorSlotPair feedback_;
210 };
211
212 CheckFloat64HoleParameters const& CheckFloat64HoleParametersOf(Operator const*)
213 V8_WARN_UNUSED_RESULT;
214
215 std::ostream& operator<<(std::ostream&, CheckFloat64HoleParameters const&);
216
217 size_t hash_value(CheckFloat64HoleParameters const&);
218
219 bool operator==(CheckFloat64HoleParameters const&,
220 CheckFloat64HoleParameters const&);
221 bool operator!=(CheckFloat64HoleParameters const&,
222 CheckFloat64HoleParameters const&);
223
224 enum class CheckTaggedInputMode : uint8_t {
225 kNumber,
226 kNumberOrOddball,
227 };
228
229 size_t hash_value(CheckTaggedInputMode);
230
231 std::ostream& operator<<(std::ostream&, CheckTaggedInputMode);
232
233 class CheckTaggedInputParameters {
234 public:
CheckTaggedInputParameters(CheckTaggedInputMode mode,const VectorSlotPair & feedback)235 CheckTaggedInputParameters(CheckTaggedInputMode mode,
236 const VectorSlotPair& feedback)
237 : mode_(mode), feedback_(feedback) {}
238
mode()239 CheckTaggedInputMode mode() const { return mode_; }
feedback()240 const VectorSlotPair& feedback() const { return feedback_; }
241
242 private:
243 CheckTaggedInputMode mode_;
244 VectorSlotPair feedback_;
245 };
246
247 const CheckTaggedInputParameters& CheckTaggedInputParametersOf(const Operator*)
248 V8_WARN_UNUSED_RESULT;
249
250 std::ostream& operator<<(std::ostream&,
251 const CheckTaggedInputParameters& params);
252
253 size_t hash_value(const CheckTaggedInputParameters& params);
254
255 bool operator==(CheckTaggedInputParameters const&,
256 CheckTaggedInputParameters const&);
257
258 enum class CheckForMinusZeroMode : uint8_t {
259 kCheckForMinusZero,
260 kDontCheckForMinusZero,
261 };
262
263 size_t hash_value(CheckForMinusZeroMode);
264
265 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
266 CheckForMinusZeroMode);
267
268 CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator*)
269 V8_WARN_UNUSED_RESULT;
270
271 class CheckMinusZeroParameters {
272 public:
CheckMinusZeroParameters(CheckForMinusZeroMode mode,const VectorSlotPair & feedback)273 CheckMinusZeroParameters(CheckForMinusZeroMode mode,
274 const VectorSlotPair& feedback)
275 : mode_(mode), feedback_(feedback) {}
276
mode()277 CheckForMinusZeroMode mode() const { return mode_; }
feedback()278 const VectorSlotPair& feedback() const { return feedback_; }
279
280 private:
281 CheckForMinusZeroMode mode_;
282 VectorSlotPair feedback_;
283 };
284
285 const CheckMinusZeroParameters& CheckMinusZeroParametersOf(const Operator* op)
286 V8_WARN_UNUSED_RESULT;
287
288 std::ostream& operator<<(std::ostream&, const CheckMinusZeroParameters& params);
289
290 size_t hash_value(const CheckMinusZeroParameters& params);
291
292 bool operator==(CheckMinusZeroParameters const&,
293 CheckMinusZeroParameters const&);
294
295 // Flags for map checks.
296 enum class CheckMapsFlag : uint8_t {
297 kNone = 0u,
298 kTryMigrateInstance = 1u << 0, // Try instance migration.
299 };
300 typedef base::Flags<CheckMapsFlag> CheckMapsFlags;
301
302 DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags)
303
304 std::ostream& operator<<(std::ostream&, CheckMapsFlags);
305
306 class MapsParameterInfo {
307 public:
308 explicit MapsParameterInfo(ZoneHandleSet<Map> const& maps);
309
instance_type()310 Maybe<InstanceType> instance_type() const { return instance_type_; }
maps()311 ZoneHandleSet<Map> const& maps() const { return maps_; }
312
313 private:
314 ZoneHandleSet<Map> const maps_;
315 Maybe<InstanceType> instance_type_;
316 };
317
318 std::ostream& operator<<(std::ostream&, MapsParameterInfo const&);
319
320 bool operator==(MapsParameterInfo const&, MapsParameterInfo const&);
321 bool operator!=(MapsParameterInfo const&, MapsParameterInfo const&);
322
323 size_t hash_value(MapsParameterInfo const&);
324
325 // A descriptor for map checks. The {feedback} parameter is optional.
326 // If {feedback} references a valid CallIC slot and this MapCheck fails,
327 // then speculation on that CallIC slot will be disabled.
328 class CheckMapsParameters final {
329 public:
CheckMapsParameters(CheckMapsFlags flags,ZoneHandleSet<Map> const & maps,const VectorSlotPair & feedback)330 CheckMapsParameters(CheckMapsFlags flags, ZoneHandleSet<Map> const& maps,
331 const VectorSlotPair& feedback)
332 : flags_(flags), maps_info_(maps), feedback_(feedback) {}
333
flags()334 CheckMapsFlags flags() const { return flags_; }
maps()335 ZoneHandleSet<Map> const& maps() const { return maps_info_.maps(); }
maps_info()336 MapsParameterInfo const& maps_info() const { return maps_info_; }
feedback()337 VectorSlotPair const& feedback() const { return feedback_; }
338
339 private:
340 CheckMapsFlags const flags_;
341 MapsParameterInfo const maps_info_;
342 VectorSlotPair const feedback_;
343 };
344
345 bool operator==(CheckMapsParameters const&, CheckMapsParameters const&);
346
347 size_t hash_value(CheckMapsParameters const&);
348
349 std::ostream& operator<<(std::ostream&, CheckMapsParameters const&);
350
351 CheckMapsParameters const& CheckMapsParametersOf(Operator const*)
352 V8_WARN_UNUSED_RESULT;
353
354 MapsParameterInfo const& MapGuardMapsOf(Operator const*) V8_WARN_UNUSED_RESULT;
355
356 // Parameters for CompareMaps operator.
357 MapsParameterInfo const& CompareMapsParametersOf(Operator const*)
358 V8_WARN_UNUSED_RESULT;
359
360 // A descriptor for growing elements backing stores.
361 enum class GrowFastElementsMode : uint8_t {
362 kDoubleElements,
363 kSmiOrObjectElements
364 };
365
hash_value(GrowFastElementsMode mode)366 inline size_t hash_value(GrowFastElementsMode mode) {
367 return static_cast<uint8_t>(mode);
368 }
369
370 std::ostream& operator<<(std::ostream&, GrowFastElementsMode);
371
372 class GrowFastElementsParameters {
373 public:
GrowFastElementsParameters(GrowFastElementsMode mode,const VectorSlotPair & feedback)374 GrowFastElementsParameters(GrowFastElementsMode mode,
375 const VectorSlotPair& feedback)
376 : mode_(mode), feedback_(feedback) {}
377
mode()378 GrowFastElementsMode mode() const { return mode_; }
feedback()379 const VectorSlotPair& feedback() const { return feedback_; }
380
381 private:
382 GrowFastElementsMode mode_;
383 VectorSlotPair feedback_;
384 };
385
386 bool operator==(const GrowFastElementsParameters&,
387 const GrowFastElementsParameters&);
388
389 inline size_t hash_value(const GrowFastElementsParameters&);
390
391 std::ostream& operator<<(std::ostream&, const GrowFastElementsParameters&);
392
393 const GrowFastElementsParameters& GrowFastElementsParametersOf(const Operator*)
394 V8_WARN_UNUSED_RESULT;
395
396 // A descriptor for elements kind transitions.
397 class ElementsTransition final {
398 public:
399 enum Mode : uint8_t {
400 kFastTransition, // simple transition, just updating the map.
401 kSlowTransition // full transition, round-trip to the runtime.
402 };
403
ElementsTransition(Mode mode,Handle<Map> source,Handle<Map> target)404 ElementsTransition(Mode mode, Handle<Map> source, Handle<Map> target)
405 : mode_(mode), source_(source), target_(target) {}
406
mode()407 Mode mode() const { return mode_; }
source()408 Handle<Map> source() const { return source_; }
target()409 Handle<Map> target() const { return target_; }
410
411 private:
412 Mode const mode_;
413 Handle<Map> const source_;
414 Handle<Map> const target_;
415 };
416
417 bool operator==(ElementsTransition const&, ElementsTransition const&);
418
419 size_t hash_value(ElementsTransition);
420
421 std::ostream& operator<<(std::ostream&, ElementsTransition);
422
423 ElementsTransition const& ElementsTransitionOf(const Operator* op)
424 V8_WARN_UNUSED_RESULT;
425
426 // Parameters for TransitionAndStoreElement, or
427 // TransitionAndStoreNonNumberElement, or
428 // TransitionAndStoreNumberElement.
429 Handle<Map> DoubleMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
430 Handle<Map> FastMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
431
432 // Parameters for TransitionAndStoreNonNumberElement.
433 Type ValueTypeParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
434
435 // A hint for speculative number operations.
436 enum class NumberOperationHint : uint8_t {
437 kSignedSmall, // Inputs were Smi, output was in Smi.
438 kSignedSmallInputs, // Inputs were Smi, output was Number.
439 kSigned32, // Inputs were Signed32, output was Number.
440 kNumber, // Inputs were Number, output was Number.
441 kNumberOrOddball, // Inputs were Number or Oddball, output was Number.
442 };
443
444 size_t hash_value(NumberOperationHint);
445
446 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, NumberOperationHint);
447
448 V8_EXPORT_PRIVATE NumberOperationHint NumberOperationHintOf(const Operator* op)
449 V8_WARN_UNUSED_RESULT;
450
451 class NumberOperationParameters {
452 public:
NumberOperationParameters(NumberOperationHint hint,const VectorSlotPair & feedback)453 NumberOperationParameters(NumberOperationHint hint,
454 const VectorSlotPair& feedback)
455 : hint_(hint), feedback_(feedback) {}
456
hint()457 NumberOperationHint hint() const { return hint_; }
feedback()458 const VectorSlotPair& feedback() const { return feedback_; }
459
460 private:
461 NumberOperationHint hint_;
462 VectorSlotPair feedback_;
463 };
464
465 size_t hash_value(NumberOperationParameters const&);
466 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
467 const NumberOperationParameters&);
468 bool operator==(NumberOperationParameters const&,
469 NumberOperationParameters const&);
470 const NumberOperationParameters& NumberOperationParametersOf(const Operator* op)
471 V8_WARN_UNUSED_RESULT;
472
473 int FormalParameterCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
474 bool IsRestLengthOf(const Operator* op) V8_WARN_UNUSED_RESULT;
475
476 class AllocateParameters {
477 public:
AllocateParameters(Type type,PretenureFlag pretenure)478 AllocateParameters(Type type, PretenureFlag pretenure)
479 : type_(type), pretenure_(pretenure) {}
480
type()481 Type type() const { return type_; }
pretenure()482 PretenureFlag pretenure() const { return pretenure_; }
483
484 private:
485 Type type_;
486 PretenureFlag pretenure_;
487 };
488
489 bool IsCheckedWithFeedback(const Operator* op);
490
491 size_t hash_value(AllocateParameters);
492
493 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, AllocateParameters);
494
495 bool operator==(AllocateParameters const&, AllocateParameters const&);
496
497 PretenureFlag PretenureFlagOf(const Operator* op) V8_WARN_UNUSED_RESULT;
498
499 Type AllocateTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
500
501 UnicodeEncoding UnicodeEncodingOf(const Operator*) V8_WARN_UNUSED_RESULT;
502
503 AbortReason AbortReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
504
505 DeoptimizeReason DeoptimizeReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
506
507 int NewArgumentsElementsMappedCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
508
509 // Interface for building simplified operators, which represent the
510 // medium-level operations of V8, including adding numbers, allocating objects,
511 // indexing into objects and arrays, etc.
512 // All operators are typed but many are representation independent.
513
514 // Number values from JS can be in one of these representations:
515 // - Tagged: word-sized integer that is either
516 // - a signed small integer (31 or 32 bits plus a tag)
517 // - a tagged pointer to a HeapNumber object that has a float64 field
518 // - Int32: an untagged signed 32-bit integer
519 // - Uint32: an untagged unsigned 32-bit integer
520 // - Float64: an untagged float64
521
522 // Additional representations for intermediate code or non-JS code:
523 // - Int64: an untagged signed 64-bit integer
524 // - Uint64: an untagged unsigned 64-bit integer
525 // - Float32: an untagged float32
526
527 // Boolean values can be:
528 // - Bool: a tagged pointer to either the canonical JS #false or
529 // the canonical JS #true object
530 // - Bit: an untagged integer 0 or 1, but word-sized
531 class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
NON_EXPORTED_BASE(ZoneObject)532 : public NON_EXPORTED_BASE(ZoneObject) {
533 public:
534 explicit SimplifiedOperatorBuilder(Zone* zone);
535
536 const Operator* BooleanNot();
537
538 const Operator* NumberEqual();
539 const Operator* NumberLessThan();
540 const Operator* NumberLessThanOrEqual();
541 const Operator* NumberAdd();
542 const Operator* NumberSubtract();
543 const Operator* NumberMultiply();
544 const Operator* NumberDivide();
545 const Operator* NumberModulus();
546 const Operator* NumberBitwiseOr();
547 const Operator* NumberBitwiseXor();
548 const Operator* NumberBitwiseAnd();
549 const Operator* NumberShiftLeft();
550 const Operator* NumberShiftRight();
551 const Operator* NumberShiftRightLogical();
552 const Operator* NumberImul();
553 const Operator* NumberAbs();
554 const Operator* NumberClz32();
555 const Operator* NumberCeil();
556 const Operator* NumberFloor();
557 const Operator* NumberFround();
558 const Operator* NumberAcos();
559 const Operator* NumberAcosh();
560 const Operator* NumberAsin();
561 const Operator* NumberAsinh();
562 const Operator* NumberAtan();
563 const Operator* NumberAtan2();
564 const Operator* NumberAtanh();
565 const Operator* NumberCbrt();
566 const Operator* NumberCos();
567 const Operator* NumberCosh();
568 const Operator* NumberExp();
569 const Operator* NumberExpm1();
570 const Operator* NumberLog();
571 const Operator* NumberLog1p();
572 const Operator* NumberLog10();
573 const Operator* NumberLog2();
574 const Operator* NumberMax();
575 const Operator* NumberMin();
576 const Operator* NumberPow();
577 const Operator* NumberRound();
578 const Operator* NumberSign();
579 const Operator* NumberSin();
580 const Operator* NumberSinh();
581 const Operator* NumberSqrt();
582 const Operator* NumberTan();
583 const Operator* NumberTanh();
584 const Operator* NumberTrunc();
585 const Operator* NumberToBoolean();
586 const Operator* NumberToInt32();
587 const Operator* NumberToString();
588 const Operator* NumberToUint32();
589 const Operator* NumberToUint8Clamped();
590
591 const Operator* NumberSilenceNaN();
592
593 const Operator* SpeculativeSafeIntegerAdd(NumberOperationHint hint);
594 const Operator* SpeculativeSafeIntegerSubtract(NumberOperationHint hint);
595
596 const Operator* SpeculativeNumberAdd(NumberOperationHint hint);
597 const Operator* SpeculativeNumberSubtract(NumberOperationHint hint);
598 const Operator* SpeculativeNumberMultiply(NumberOperationHint hint);
599 const Operator* SpeculativeNumberDivide(NumberOperationHint hint);
600 const Operator* SpeculativeNumberModulus(NumberOperationHint hint);
601 const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint);
602 const Operator* SpeculativeNumberShiftRight(NumberOperationHint hint);
603 const Operator* SpeculativeNumberShiftRightLogical(NumberOperationHint hint);
604 const Operator* SpeculativeNumberBitwiseAnd(NumberOperationHint hint);
605 const Operator* SpeculativeNumberBitwiseOr(NumberOperationHint hint);
606 const Operator* SpeculativeNumberBitwiseXor(NumberOperationHint hint);
607
608 const Operator* SpeculativeNumberLessThan(NumberOperationHint hint);
609 const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint);
610 const Operator* SpeculativeNumberEqual(NumberOperationHint hint);
611
612 const Operator* ReferenceEqual();
613 const Operator* SameValue();
614
615 const Operator* TypeOf();
616
617 const Operator* ToBoolean();
618
619 const Operator* StringEqual();
620 const Operator* StringLessThan();
621 const Operator* StringLessThanOrEqual();
622 const Operator* StringCharCodeAt();
623 const Operator* StringCodePointAt(UnicodeEncoding encoding);
624 const Operator* StringFromSingleCharCode();
625 const Operator* StringFromSingleCodePoint(UnicodeEncoding encoding);
626 const Operator* StringIndexOf();
627 const Operator* StringLength();
628 const Operator* StringToLowerCaseIntl();
629 const Operator* StringToUpperCaseIntl();
630 const Operator* StringSubstring();
631
632 const Operator* FindOrderedHashMapEntry();
633 const Operator* FindOrderedHashMapEntryForInt32Key();
634
635 const Operator* SpeculativeToNumber(NumberOperationHint hint,
636 const VectorSlotPair& feedback);
637
638 const Operator* StringToNumber();
639 const Operator* PlainPrimitiveToNumber();
640 const Operator* PlainPrimitiveToWord32();
641 const Operator* PlainPrimitiveToFloat64();
642
643 const Operator* ChangeTaggedSignedToInt32();
644 const Operator* ChangeTaggedToInt32();
645 const Operator* ChangeTaggedToUint32();
646 const Operator* ChangeTaggedToFloat64();
647 const Operator* ChangeTaggedToTaggedSigned();
648 const Operator* ChangeInt31ToTaggedSigned();
649 const Operator* ChangeInt32ToTagged();
650 const Operator* ChangeUint32ToTagged();
651 const Operator* ChangeFloat64ToTagged(CheckForMinusZeroMode);
652 const Operator* ChangeFloat64ToTaggedPointer();
653 const Operator* ChangeTaggedToBit();
654 const Operator* ChangeBitToTagged();
655 const Operator* TruncateTaggedToWord32();
656 const Operator* TruncateTaggedToFloat64();
657 const Operator* TruncateTaggedToBit();
658 const Operator* TruncateTaggedPointerToBit();
659
660 const Operator* PoisonIndex();
661 const Operator* CompareMaps(ZoneHandleSet<Map>);
662 const Operator* MapGuard(ZoneHandleSet<Map> maps);
663
664 const Operator* CheckBounds(const VectorSlotPair& feedback);
665 const Operator* CheckEqualsInternalizedString();
666 const Operator* CheckEqualsSymbol();
667 const Operator* CheckFloat64Hole(CheckFloat64HoleMode, VectorSlotPair const&);
668 const Operator* CheckHeapObject();
669 const Operator* CheckIf(DeoptimizeReason deoptimize_reason,
670 const VectorSlotPair& feedback = VectorSlotPair());
671 const Operator* CheckInternalizedString();
672 const Operator* CheckMaps(CheckMapsFlags, ZoneHandleSet<Map>,
673 const VectorSlotPair& = VectorSlotPair());
674 const Operator* CheckNotTaggedHole();
675 const Operator* CheckNumber(const VectorSlotPair& feedback);
676 const Operator* CheckReceiver();
677 const Operator* CheckSmi(const VectorSlotPair& feedback);
678 const Operator* CheckString(const VectorSlotPair& feedback);
679 const Operator* CheckSymbol();
680
681 const Operator* CheckedFloat64ToInt32(CheckForMinusZeroMode,
682 const VectorSlotPair& feedback);
683 const Operator* CheckedInt32Add();
684 const Operator* CheckedInt32Div();
685 const Operator* CheckedInt32Mod();
686 const Operator* CheckedInt32Mul(CheckForMinusZeroMode);
687 const Operator* CheckedInt32Sub();
688 const Operator* CheckedInt32ToTaggedSigned(const VectorSlotPair& feedback);
689 const Operator* CheckedTaggedSignedToInt32(const VectorSlotPair& feedback);
690 const Operator* CheckedTaggedToFloat64(CheckTaggedInputMode,
691 const VectorSlotPair& feedback);
692 const Operator* CheckedTaggedToInt32(CheckForMinusZeroMode,
693 const VectorSlotPair& feedback);
694 const Operator* CheckedTaggedToTaggedPointer(const VectorSlotPair& feedback);
695 const Operator* CheckedTaggedToTaggedSigned(const VectorSlotPair& feedback);
696 const Operator* CheckedTruncateTaggedToWord32(CheckTaggedInputMode,
697 const VectorSlotPair& feedback);
698 const Operator* CheckedUint32Div();
699 const Operator* CheckedUint32Mod();
700 const Operator* CheckedUint32ToInt32(const VectorSlotPair& feedback);
701 const Operator* CheckedUint32ToTaggedSigned(const VectorSlotPair& feedback);
702
703 const Operator* ConvertReceiver(ConvertReceiverMode);
704
705 const Operator* ConvertTaggedHoleToUndefined();
706
707 const Operator* ObjectIsArrayBufferView();
708 const Operator* ObjectIsBigInt();
709 const Operator* ObjectIsCallable();
710 const Operator* ObjectIsConstructor();
711 const Operator* ObjectIsDetectableCallable();
712 const Operator* ObjectIsMinusZero();
713 const Operator* ObjectIsNaN();
714 const Operator* NumberIsNaN();
715 const Operator* ObjectIsNonCallable();
716 const Operator* ObjectIsNumber();
717 const Operator* ObjectIsReceiver();
718 const Operator* ObjectIsSmi();
719 const Operator* ObjectIsString();
720 const Operator* ObjectIsSymbol();
721 const Operator* ObjectIsUndetectable();
722
723 const Operator* NumberIsFloat64Hole();
724 const Operator* NumberIsFinite();
725 const Operator* ObjectIsFiniteNumber();
726 const Operator* NumberIsInteger();
727 const Operator* ObjectIsSafeInteger();
728 const Operator* NumberIsSafeInteger();
729 const Operator* ObjectIsInteger();
730
731 const Operator* ArgumentsFrame();
732 const Operator* ArgumentsLength(int formal_parameter_count,
733 bool is_rest_length);
734
735 const Operator* NewDoubleElements(PretenureFlag);
736 const Operator* NewSmiOrObjectElements(PretenureFlag);
737
738 // new-arguments-elements arguments-frame, arguments-length
739 const Operator* NewArgumentsElements(int mapped_count);
740
741 // new-cons-string length, first, second
742 const Operator* NewConsString();
743
744 // array-buffer-was-neutered buffer
745 const Operator* ArrayBufferWasNeutered();
746
747 // ensure-writable-fast-elements object, elements
748 const Operator* EnsureWritableFastElements();
749
750 // maybe-grow-fast-elements object, elements, index, length
751 const Operator* MaybeGrowFastElements(GrowFastElementsMode mode,
752 const VectorSlotPair& feedback);
753
754 // transition-elements-kind object, from-map, to-map
755 const Operator* TransitionElementsKind(ElementsTransition transition);
756
757 const Operator* Allocate(Type type, PretenureFlag pretenure = NOT_TENURED);
758 const Operator* AllocateRaw(Type type, PretenureFlag pretenure = NOT_TENURED);
759
760 const Operator* LoadFieldByIndex();
761 const Operator* LoadField(FieldAccess const&);
762 const Operator* StoreField(FieldAccess const&);
763
764 // load-element [base + index]
765 const Operator* LoadElement(ElementAccess const&);
766
767 // store-element [base + index], value
768 const Operator* StoreElement(ElementAccess const&);
769
770 // store-element [base + index], value, only with fast arrays.
771 const Operator* TransitionAndStoreElement(Handle<Map> double_map,
772 Handle<Map> fast_map);
773 // store-element [base + index], smi value, only with fast arrays.
774 const Operator* StoreSignedSmallElement();
775
776 // store-element [base + index], double value, only with fast arrays.
777 const Operator* TransitionAndStoreNumberElement(Handle<Map> double_map);
778
779 // store-element [base + index], object value, only with fast arrays.
780 const Operator* TransitionAndStoreNonNumberElement(Handle<Map> fast_map,
781 Type value_type);
782
783 // load-typed-element buffer, [base + external + index]
784 const Operator* LoadTypedElement(ExternalArrayType const&);
785
786 // load-data-view-element buffer, [base + index]
787 const Operator* LoadDataViewElement(ExternalArrayType const&);
788
789 // store-typed-element buffer, [base + external + index], value
790 const Operator* StoreTypedElement(ExternalArrayType const&);
791
792 // store-data-view-element buffer, [base + index], value
793 const Operator* StoreDataViewElement(ExternalArrayType const&);
794
795 // Abort (for terminating execution on internal error).
796 const Operator* RuntimeAbort(AbortReason reason);
797
798 const Operator* DateNow();
799
800 private:
801 Zone* zone() const { return zone_; }
802
803 const SimplifiedOperatorGlobalCache& cache_;
804 Zone* const zone_;
805
806 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder);
807 };
808
809 } // namespace compiler
810 } // namespace internal
811 } // namespace v8
812
813 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_
814