Line data Source code
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 :
59 : FieldAccess()
60 : : base_is_tagged(kTaggedBase),
61 : offset(0),
62 : type(Type::None()),
63 : machine_type(MachineType::None()),
64 : write_barrier_kind(kFullWriteBarrier),
65 14240 : 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)
71 : : 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 4751054 : load_sensitivity(load_sensitivity) {}
79 :
80 14361923 : 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 :
108 : 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)
119 : : 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 50125 : load_sensitivity(load_sensitivity) {}
125 :
126 247799 : 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:
149 : explicit CheckParameters(const VectorSlotPair& feedback)
150 503341 : : feedback_(feedback) {}
151 :
152 201102 : 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 CheckBoundsParameters final {
167 : public:
168 : enum Mode { kAbortOnOutOfBounds, kDeoptOnOutOfBounds };
169 :
170 : CheckBoundsParameters(const VectorSlotPair& feedback, Mode mode)
171 : : check_parameters_(feedback), mode_(mode) {}
172 :
173 : Mode mode() const { return mode_; }
174 0 : const CheckParameters& check_parameters() const { return check_parameters_; }
175 :
176 : private:
177 : CheckParameters check_parameters_;
178 : Mode mode_;
179 : };
180 :
181 : bool operator==(CheckBoundsParameters const&, CheckBoundsParameters const&);
182 :
183 : size_t hash_value(CheckBoundsParameters const&);
184 :
185 : std::ostream& operator<<(std::ostream&, CheckBoundsParameters const&);
186 :
187 : CheckBoundsParameters const& CheckBoundsParametersOf(Operator const*)
188 : V8_WARN_UNUSED_RESULT;
189 :
190 : class CheckIfParameters final {
191 : public:
192 : explicit CheckIfParameters(DeoptimizeReason reason,
193 : const VectorSlotPair& feedback)
194 1162891 : : reason_(reason), feedback_(feedback) {}
195 :
196 16870 : VectorSlotPair const& feedback() const { return feedback_; }
197 : DeoptimizeReason reason() const { return reason_; }
198 :
199 : private:
200 : DeoptimizeReason reason_;
201 : VectorSlotPair feedback_;
202 : };
203 :
204 : bool operator==(CheckIfParameters const&, CheckIfParameters const&);
205 :
206 : size_t hash_value(CheckIfParameters const&);
207 :
208 : std::ostream& operator<<(std::ostream&, CheckIfParameters const&);
209 :
210 : CheckIfParameters const& CheckIfParametersOf(Operator const*)
211 : V8_WARN_UNUSED_RESULT;
212 :
213 : enum class CheckFloat64HoleMode : uint8_t {
214 : kNeverReturnHole, // Never return the hole (deoptimize instead).
215 : kAllowReturnHole // Allow to return the hole (signaling NaN).
216 : };
217 :
218 : size_t hash_value(CheckFloat64HoleMode);
219 :
220 : std::ostream& operator<<(std::ostream&, CheckFloat64HoleMode);
221 :
222 : class CheckFloat64HoleParameters {
223 : public:
224 : CheckFloat64HoleParameters(CheckFloat64HoleMode mode,
225 : VectorSlotPair const& feedback)
226 56713 : : mode_(mode), feedback_(feedback) {}
227 :
228 : CheckFloat64HoleMode mode() const { return mode_; }
229 619 : VectorSlotPair const& feedback() const { return feedback_; }
230 :
231 : private:
232 : CheckFloat64HoleMode mode_;
233 : VectorSlotPair feedback_;
234 : };
235 :
236 : CheckFloat64HoleParameters const& CheckFloat64HoleParametersOf(Operator const*)
237 : V8_WARN_UNUSED_RESULT;
238 :
239 : std::ostream& operator<<(std::ostream&, CheckFloat64HoleParameters const&);
240 :
241 : size_t hash_value(CheckFloat64HoleParameters const&);
242 :
243 : bool operator==(CheckFloat64HoleParameters const&,
244 : CheckFloat64HoleParameters const&);
245 : bool operator!=(CheckFloat64HoleParameters const&,
246 : CheckFloat64HoleParameters const&);
247 :
248 : enum class CheckTaggedInputMode : uint8_t {
249 : kNumber,
250 : kNumberOrOddball,
251 : };
252 :
253 : size_t hash_value(CheckTaggedInputMode);
254 :
255 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, CheckTaggedInputMode);
256 :
257 : class CheckTaggedInputParameters {
258 : public:
259 : CheckTaggedInputParameters(CheckTaggedInputMode mode,
260 : const VectorSlotPair& feedback)
261 145338 : : mode_(mode), feedback_(feedback) {}
262 :
263 : CheckTaggedInputMode mode() const { return mode_; }
264 53410 : const VectorSlotPair& feedback() const { return feedback_; }
265 :
266 : private:
267 : CheckTaggedInputMode mode_;
268 : VectorSlotPair feedback_;
269 : };
270 :
271 : const CheckTaggedInputParameters& CheckTaggedInputParametersOf(const Operator*)
272 : V8_WARN_UNUSED_RESULT;
273 :
274 : std::ostream& operator<<(std::ostream&,
275 : const CheckTaggedInputParameters& params);
276 :
277 : size_t hash_value(const CheckTaggedInputParameters& params);
278 :
279 : bool operator==(CheckTaggedInputParameters const&,
280 : CheckTaggedInputParameters const&);
281 :
282 : enum class CheckForMinusZeroMode : uint8_t {
283 : kCheckForMinusZero,
284 : kDontCheckForMinusZero,
285 : };
286 :
287 : size_t hash_value(CheckForMinusZeroMode);
288 :
289 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
290 : CheckForMinusZeroMode);
291 :
292 : CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator*)
293 : V8_WARN_UNUSED_RESULT;
294 :
295 : class CheckMinusZeroParameters {
296 : public:
297 : CheckMinusZeroParameters(CheckForMinusZeroMode mode,
298 : const VectorSlotPair& feedback)
299 227404 : : mode_(mode), feedback_(feedback) {}
300 :
301 : CheckForMinusZeroMode mode() const { return mode_; }
302 4384 : const VectorSlotPair& feedback() const { return feedback_; }
303 :
304 : private:
305 : CheckForMinusZeroMode mode_;
306 : VectorSlotPair feedback_;
307 : };
308 :
309 : const CheckMinusZeroParameters& CheckMinusZeroParametersOf(const Operator* op)
310 : V8_WARN_UNUSED_RESULT;
311 :
312 : std::ostream& operator<<(std::ostream&, const CheckMinusZeroParameters& params);
313 :
314 : size_t hash_value(const CheckMinusZeroParameters& params);
315 :
316 : bool operator==(CheckMinusZeroParameters const&,
317 : CheckMinusZeroParameters const&);
318 :
319 : // Flags for map checks.
320 : enum class CheckMapsFlag : uint8_t {
321 : kNone = 0u,
322 : kTryMigrateInstance = 1u << 0, // Try instance migration.
323 : };
324 : typedef base::Flags<CheckMapsFlag> CheckMapsFlags;
325 :
326 : DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags)
327 :
328 : std::ostream& operator<<(std::ostream&, CheckMapsFlags);
329 :
330 : // A descriptor for map checks. The {feedback} parameter is optional.
331 : // If {feedback} references a valid CallIC slot and this MapCheck fails,
332 : // then speculation on that CallIC slot will be disabled.
333 : class CheckMapsParameters final {
334 : public:
335 : CheckMapsParameters(CheckMapsFlags flags, ZoneHandleSet<Map> const& maps,
336 : const VectorSlotPair& feedback)
337 91084 : : flags_(flags), maps_(maps), feedback_(feedback) {}
338 :
339 : CheckMapsFlags flags() const { return flags_; }
340 303246 : ZoneHandleSet<Map> const& maps() const { return maps_; }
341 51248 : VectorSlotPair const& feedback() const { return feedback_; }
342 :
343 : private:
344 : CheckMapsFlags const flags_;
345 : ZoneHandleSet<Map> const maps_;
346 : VectorSlotPair const feedback_;
347 : };
348 :
349 : bool operator==(CheckMapsParameters const&, CheckMapsParameters const&);
350 :
351 : size_t hash_value(CheckMapsParameters const&);
352 :
353 : std::ostream& operator<<(std::ostream&, CheckMapsParameters const&);
354 :
355 : CheckMapsParameters const& CheckMapsParametersOf(Operator const*)
356 : V8_WARN_UNUSED_RESULT;
357 :
358 : ZoneHandleSet<Map> const& MapGuardMapsOf(Operator const*) V8_WARN_UNUSED_RESULT;
359 :
360 : // Parameters for CompareMaps operator.
361 : ZoneHandleSet<Map> const& CompareMapsParametersOf(Operator const*)
362 : V8_WARN_UNUSED_RESULT;
363 :
364 : // A descriptor for growing elements backing stores.
365 : enum class GrowFastElementsMode : uint8_t {
366 : kDoubleElements,
367 : kSmiOrObjectElements
368 : };
369 :
370 : inline size_t hash_value(GrowFastElementsMode mode) {
371 0 : return static_cast<uint8_t>(mode);
372 : }
373 :
374 : std::ostream& operator<<(std::ostream&, GrowFastElementsMode);
375 :
376 : class GrowFastElementsParameters {
377 : public:
378 : GrowFastElementsParameters(GrowFastElementsMode mode,
379 : const VectorSlotPair& feedback)
380 58522 : : mode_(mode), feedback_(feedback) {}
381 :
382 : GrowFastElementsMode mode() const { return mode_; }
383 0 : const VectorSlotPair& feedback() const { return feedback_; }
384 :
385 : private:
386 : GrowFastElementsMode mode_;
387 : VectorSlotPair feedback_;
388 : };
389 :
390 : bool operator==(const GrowFastElementsParameters&,
391 : const GrowFastElementsParameters&);
392 :
393 : inline size_t hash_value(const GrowFastElementsParameters&);
394 :
395 : std::ostream& operator<<(std::ostream&, const GrowFastElementsParameters&);
396 :
397 : const GrowFastElementsParameters& GrowFastElementsParametersOf(const Operator*)
398 : V8_WARN_UNUSED_RESULT;
399 :
400 : // A descriptor for elements kind transitions.
401 : class ElementsTransition final {
402 : public:
403 : enum Mode : uint8_t {
404 : kFastTransition, // simple transition, just updating the map.
405 : kSlowTransition // full transition, round-trip to the runtime.
406 : };
407 :
408 : ElementsTransition(Mode mode, Handle<Map> source, Handle<Map> target)
409 570 : : mode_(mode), source_(source), target_(target) {}
410 :
411 : Mode mode() const { return mode_; }
412 : Handle<Map> source() const { return source_; }
413 : Handle<Map> target() const { return target_; }
414 :
415 : private:
416 : Mode const mode_;
417 : Handle<Map> const source_;
418 : Handle<Map> const target_;
419 : };
420 :
421 : bool operator==(ElementsTransition const&, ElementsTransition const&);
422 :
423 : size_t hash_value(ElementsTransition);
424 :
425 : std::ostream& operator<<(std::ostream&, ElementsTransition);
426 :
427 : ElementsTransition const& ElementsTransitionOf(const Operator* op)
428 : V8_WARN_UNUSED_RESULT;
429 :
430 : // Parameters for TransitionAndStoreElement, or
431 : // TransitionAndStoreNonNumberElement, or
432 : // TransitionAndStoreNumberElement.
433 : Handle<Map> DoubleMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
434 : Handle<Map> FastMapParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
435 :
436 : // Parameters for TransitionAndStoreNonNumberElement.
437 : Type ValueTypeParameterOf(const Operator* op) V8_WARN_UNUSED_RESULT;
438 :
439 : // A hint for speculative number operations.
440 : enum class NumberOperationHint : uint8_t {
441 : kSignedSmall, // Inputs were Smi, output was in Smi.
442 : kSignedSmallInputs, // Inputs were Smi, output was Number.
443 : kSigned32, // Inputs were Signed32, output was Number.
444 : kNumber, // Inputs were Number, output was Number.
445 : kNumberOrOddball, // Inputs were Number or Oddball, output was Number.
446 : };
447 :
448 : size_t hash_value(NumberOperationHint);
449 :
450 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, NumberOperationHint);
451 :
452 : V8_EXPORT_PRIVATE NumberOperationHint NumberOperationHintOf(const Operator* op)
453 : V8_WARN_UNUSED_RESULT;
454 :
455 : class NumberOperationParameters {
456 : public:
457 : NumberOperationParameters(NumberOperationHint hint,
458 : const VectorSlotPair& feedback)
459 171174 : : hint_(hint), feedback_(feedback) {}
460 :
461 : NumberOperationHint hint() const { return hint_; }
462 133310 : const VectorSlotPair& feedback() const { return feedback_; }
463 :
464 : private:
465 : NumberOperationHint hint_;
466 : VectorSlotPair feedback_;
467 : };
468 :
469 : size_t hash_value(NumberOperationParameters const&);
470 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
471 : const NumberOperationParameters&);
472 : bool operator==(NumberOperationParameters const&,
473 : NumberOperationParameters const&);
474 : const NumberOperationParameters& NumberOperationParametersOf(const Operator* op)
475 : V8_WARN_UNUSED_RESULT;
476 :
477 : int FormalParameterCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
478 : bool IsRestLengthOf(const Operator* op) V8_WARN_UNUSED_RESULT;
479 :
480 : class AllocateParameters {
481 : public:
482 : AllocateParameters(Type type, AllocationType allocation_type)
483 : : type_(type), allocation_type_(allocation_type) {}
484 :
485 : Type type() const { return type_; }
486 : AllocationType allocation_type() const { return allocation_type_; }
487 :
488 : private:
489 : Type type_;
490 : AllocationType allocation_type_;
491 : };
492 :
493 : bool IsCheckedWithFeedback(const Operator* op);
494 :
495 : size_t hash_value(AllocateParameters);
496 :
497 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, AllocateParameters);
498 :
499 : bool operator==(AllocateParameters const&, AllocateParameters const&);
500 :
501 : AllocationType AllocationTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
502 :
503 : Type AllocateTypeOf(const Operator* op) V8_WARN_UNUSED_RESULT;
504 :
505 : UnicodeEncoding UnicodeEncodingOf(const Operator*) V8_WARN_UNUSED_RESULT;
506 :
507 : AbortReason AbortReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
508 :
509 : DeoptimizeReason DeoptimizeReasonOf(const Operator* op) V8_WARN_UNUSED_RESULT;
510 :
511 : int NewArgumentsElementsMappedCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
512 :
513 : // Interface for building simplified operators, which represent the
514 : // medium-level operations of V8, including adding numbers, allocating objects,
515 : // indexing into objects and arrays, etc.
516 : // All operators are typed but many are representation independent.
517 :
518 : // Number values from JS can be in one of these representations:
519 : // - Tagged: word-sized integer that is either
520 : // - a signed small integer (31 or 32 bits plus a tag)
521 : // - a tagged pointer to a HeapNumber object that has a float64 field
522 : // - Int32: an untagged signed 32-bit integer
523 : // - Uint32: an untagged unsigned 32-bit integer
524 : // - Float64: an untagged float64
525 :
526 : // Additional representations for intermediate code or non-JS code:
527 : // - Int64: an untagged signed 64-bit integer
528 : // - Uint64: an untagged unsigned 64-bit integer
529 : // - Float32: an untagged float32
530 :
531 : // Boolean values can be:
532 : // - Bool: a tagged pointer to either the canonical JS #false or
533 : // the canonical JS #true object
534 : // - Bit: an untagged integer 0 or 1, but word-sized
535 : class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
536 : : public NON_EXPORTED_BASE(ZoneObject) {
537 : public:
538 : explicit SimplifiedOperatorBuilder(Zone* zone);
539 :
540 : const Operator* BooleanNot();
541 :
542 : const Operator* NumberEqual();
543 : const Operator* NumberLessThan();
544 : const Operator* NumberLessThanOrEqual();
545 : const Operator* NumberAdd();
546 : const Operator* NumberSubtract();
547 : const Operator* NumberMultiply();
548 : const Operator* NumberDivide();
549 : const Operator* NumberModulus();
550 : const Operator* NumberBitwiseOr();
551 : const Operator* NumberBitwiseXor();
552 : const Operator* NumberBitwiseAnd();
553 : const Operator* NumberShiftLeft();
554 : const Operator* NumberShiftRight();
555 : const Operator* NumberShiftRightLogical();
556 : const Operator* NumberImul();
557 : const Operator* NumberAbs();
558 : const Operator* NumberClz32();
559 : const Operator* NumberCeil();
560 : const Operator* NumberFloor();
561 : const Operator* NumberFround();
562 : const Operator* NumberAcos();
563 : const Operator* NumberAcosh();
564 : const Operator* NumberAsin();
565 : const Operator* NumberAsinh();
566 : const Operator* NumberAtan();
567 : const Operator* NumberAtan2();
568 : const Operator* NumberAtanh();
569 : const Operator* NumberCbrt();
570 : const Operator* NumberCos();
571 : const Operator* NumberCosh();
572 : const Operator* NumberExp();
573 : const Operator* NumberExpm1();
574 : const Operator* NumberLog();
575 : const Operator* NumberLog1p();
576 : const Operator* NumberLog10();
577 : const Operator* NumberLog2();
578 : const Operator* NumberMax();
579 : const Operator* NumberMin();
580 : const Operator* NumberPow();
581 : const Operator* NumberRound();
582 : const Operator* NumberSign();
583 : const Operator* NumberSin();
584 : const Operator* NumberSinh();
585 : const Operator* NumberSqrt();
586 : const Operator* NumberTan();
587 : const Operator* NumberTanh();
588 : const Operator* NumberTrunc();
589 : const Operator* NumberToBoolean();
590 : const Operator* NumberToInt32();
591 : const Operator* NumberToString();
592 : const Operator* NumberToUint32();
593 : const Operator* NumberToUint8Clamped();
594 :
595 : const Operator* NumberSilenceNaN();
596 :
597 : const Operator* SpeculativeSafeIntegerAdd(NumberOperationHint hint);
598 : const Operator* SpeculativeSafeIntegerSubtract(NumberOperationHint hint);
599 :
600 : const Operator* SpeculativeNumberAdd(NumberOperationHint hint);
601 : const Operator* SpeculativeNumberSubtract(NumberOperationHint hint);
602 : const Operator* SpeculativeNumberMultiply(NumberOperationHint hint);
603 : const Operator* SpeculativeNumberDivide(NumberOperationHint hint);
604 : const Operator* SpeculativeNumberModulus(NumberOperationHint hint);
605 : const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint);
606 : const Operator* SpeculativeNumberShiftRight(NumberOperationHint hint);
607 : const Operator* SpeculativeNumberShiftRightLogical(NumberOperationHint hint);
608 : const Operator* SpeculativeNumberBitwiseAnd(NumberOperationHint hint);
609 : const Operator* SpeculativeNumberBitwiseOr(NumberOperationHint hint);
610 : const Operator* SpeculativeNumberBitwiseXor(NumberOperationHint hint);
611 :
612 : const Operator* SpeculativeNumberLessThan(NumberOperationHint hint);
613 : const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint);
614 : const Operator* SpeculativeNumberEqual(NumberOperationHint hint);
615 :
616 : const Operator* ReferenceEqual();
617 : const Operator* SameValue();
618 :
619 : const Operator* TypeOf();
620 :
621 : const Operator* ToBoolean();
622 :
623 : const Operator* StringConcat();
624 : const Operator* StringEqual();
625 : const Operator* StringLessThan();
626 : const Operator* StringLessThanOrEqual();
627 : const Operator* StringCharCodeAt();
628 : const Operator* StringCodePointAt(UnicodeEncoding encoding);
629 : const Operator* StringFromSingleCharCode();
630 : const Operator* StringFromSingleCodePoint(UnicodeEncoding encoding);
631 : const Operator* StringIndexOf();
632 : const Operator* StringLength();
633 : const Operator* StringToLowerCaseIntl();
634 : const Operator* StringToUpperCaseIntl();
635 : const Operator* StringSubstring();
636 :
637 : const Operator* FindOrderedHashMapEntry();
638 : const Operator* FindOrderedHashMapEntryForInt32Key();
639 :
640 : const Operator* SpeculativeToNumber(NumberOperationHint hint,
641 : const VectorSlotPair& feedback);
642 :
643 : const Operator* StringToNumber();
644 : const Operator* PlainPrimitiveToNumber();
645 : const Operator* PlainPrimitiveToWord32();
646 : const Operator* PlainPrimitiveToFloat64();
647 :
648 : const Operator* ChangeTaggedSignedToInt32();
649 : const Operator* ChangeTaggedSignedToInt64();
650 : const Operator* ChangeTaggedToInt32();
651 : const Operator* ChangeTaggedToInt64();
652 : const Operator* ChangeTaggedToUint32();
653 : const Operator* ChangeTaggedToFloat64();
654 : const Operator* ChangeTaggedToTaggedSigned();
655 : const Operator* ChangeInt31ToTaggedSigned();
656 : const Operator* ChangeInt32ToTagged();
657 : const Operator* ChangeInt64ToTagged();
658 : const Operator* ChangeUint32ToTagged();
659 : const Operator* ChangeUint64ToTagged();
660 : const Operator* ChangeFloat64ToTagged(CheckForMinusZeroMode);
661 : const Operator* ChangeFloat64ToTaggedPointer();
662 : const Operator* ChangeTaggedToBit();
663 : const Operator* ChangeBitToTagged();
664 : const Operator* TruncateTaggedToWord32();
665 : const Operator* TruncateTaggedToFloat64();
666 : const Operator* TruncateTaggedToBit();
667 : const Operator* TruncateTaggedPointerToBit();
668 :
669 : const Operator* PoisonIndex();
670 : const Operator* CompareMaps(ZoneHandleSet<Map>);
671 : const Operator* MapGuard(ZoneHandleSet<Map> maps);
672 :
673 : const Operator* CheckBounds(const VectorSlotPair& feedback);
674 : const Operator* CheckEqualsInternalizedString();
675 : const Operator* CheckEqualsSymbol();
676 : const Operator* CheckFloat64Hole(CheckFloat64HoleMode, VectorSlotPair const&);
677 : const Operator* CheckHeapObject();
678 : const Operator* CheckIf(DeoptimizeReason deoptimize_reason,
679 : const VectorSlotPair& feedback = VectorSlotPair());
680 : const Operator* CheckMaps(CheckMapsFlags, ZoneHandleSet<Map>,
681 : const VectorSlotPair& = VectorSlotPair());
682 : const Operator* CheckNotTaggedHole();
683 : const Operator* CheckNumber(const VectorSlotPair& feedback);
684 : const Operator* CheckReceiver();
685 : const Operator* CheckReceiverOrNullOrUndefined();
686 : const Operator* CheckSmi(const VectorSlotPair& feedback);
687 : const Operator* CheckInternalizedString();
688 : const Operator* CheckNonEmptyString();
689 : const Operator* CheckNonEmptyOneByteString();
690 : const Operator* CheckNonEmptyTwoByteString();
691 : const Operator* CheckString(const VectorSlotPair& feedback);
692 : const Operator* CheckSymbol();
693 :
694 : const Operator* CheckedFloat64ToInt32(CheckForMinusZeroMode,
695 : const VectorSlotPair& feedback);
696 : const Operator* CheckedFloat64ToInt64(CheckForMinusZeroMode,
697 : const VectorSlotPair& feedback);
698 : const Operator* CheckedInt32Add();
699 : const Operator* CheckedInt32Div();
700 : const Operator* CheckedInt32Mod();
701 : const Operator* CheckedInt32Mul(CheckForMinusZeroMode);
702 : const Operator* CheckedInt32Sub();
703 : const Operator* CheckedInt32ToTaggedSigned(const VectorSlotPair& feedback);
704 : const Operator* CheckedInt64ToInt32(const VectorSlotPair& feedback);
705 : const Operator* CheckedInt64ToTaggedSigned(const VectorSlotPair& feedback);
706 : const Operator* CheckedTaggedSignedToInt32(const VectorSlotPair& feedback);
707 : const Operator* CheckedTaggedToFloat64(CheckTaggedInputMode,
708 : const VectorSlotPair& feedback);
709 : const Operator* CheckedTaggedToInt32(CheckForMinusZeroMode,
710 : const VectorSlotPair& feedback);
711 : const Operator* CheckedTaggedToInt64(CheckForMinusZeroMode,
712 : const VectorSlotPair& feedback);
713 : const Operator* CheckedTaggedToTaggedPointer(const VectorSlotPair& feedback);
714 : const Operator* CheckedTaggedToTaggedSigned(const VectorSlotPair& feedback);
715 : const Operator* CheckedTruncateTaggedToWord32(CheckTaggedInputMode,
716 : const VectorSlotPair& feedback);
717 : const Operator* CheckedUint32Div();
718 : const Operator* CheckedUint32Mod();
719 : const Operator* CheckedUint32Bounds(const VectorSlotPair& feedback,
720 : CheckBoundsParameters::Mode mode);
721 : const Operator* CheckedUint32ToInt32(const VectorSlotPair& feedback);
722 : const Operator* CheckedUint32ToTaggedSigned(const VectorSlotPair& feedback);
723 : const Operator* CheckedUint64Bounds(const VectorSlotPair& feedback);
724 : const Operator* CheckedUint64ToInt32(const VectorSlotPair& feedback);
725 : const Operator* CheckedUint64ToTaggedSigned(const VectorSlotPair& feedback);
726 :
727 : const Operator* ConvertReceiver(ConvertReceiverMode);
728 :
729 : const Operator* ConvertTaggedHoleToUndefined();
730 :
731 : const Operator* ObjectIsArrayBufferView();
732 : const Operator* ObjectIsBigInt();
733 : const Operator* ObjectIsCallable();
734 : const Operator* ObjectIsConstructor();
735 : const Operator* ObjectIsDetectableCallable();
736 : const Operator* ObjectIsMinusZero();
737 : const Operator* NumberIsMinusZero();
738 : const Operator* ObjectIsNaN();
739 : const Operator* NumberIsNaN();
740 : const Operator* ObjectIsNonCallable();
741 : const Operator* ObjectIsNumber();
742 : const Operator* ObjectIsReceiver();
743 : const Operator* ObjectIsSmi();
744 : const Operator* ObjectIsString();
745 : const Operator* ObjectIsSymbol();
746 : const Operator* ObjectIsUndetectable();
747 :
748 : const Operator* NumberIsFloat64Hole();
749 : const Operator* NumberIsFinite();
750 : const Operator* ObjectIsFiniteNumber();
751 : const Operator* NumberIsInteger();
752 : const Operator* ObjectIsSafeInteger();
753 : const Operator* NumberIsSafeInteger();
754 : const Operator* ObjectIsInteger();
755 :
756 : const Operator* ArgumentsFrame();
757 : const Operator* ArgumentsLength(int formal_parameter_count,
758 : bool is_rest_length);
759 :
760 : const Operator* NewDoubleElements(AllocationType);
761 : const Operator* NewSmiOrObjectElements(AllocationType);
762 :
763 : // new-arguments-elements arguments-frame, arguments-length
764 : const Operator* NewArgumentsElements(int mapped_count);
765 :
766 : // new-cons-string length, first, second
767 : const Operator* NewConsOneByteString();
768 : const Operator* NewConsTwoByteString();
769 : const Operator* NewConsString();
770 :
771 : // ensure-writable-fast-elements object, elements
772 : const Operator* EnsureWritableFastElements();
773 :
774 : // maybe-grow-fast-elements object, elements, index, length
775 : const Operator* MaybeGrowFastElements(GrowFastElementsMode mode,
776 : const VectorSlotPair& feedback);
777 :
778 : // transition-elements-kind object, from-map, to-map
779 : const Operator* TransitionElementsKind(ElementsTransition transition);
780 :
781 : const Operator* Allocate(Type type,
782 : AllocationType allocation = AllocationType::kYoung);
783 : const Operator* AllocateRaw(
784 : Type type, AllocationType allocation = AllocationType::kYoung);
785 :
786 : const Operator* LoadFieldByIndex();
787 : const Operator* LoadField(FieldAccess const&);
788 : const Operator* StoreField(FieldAccess const&);
789 :
790 : const Operator* LoadMessage();
791 : const Operator* StoreMessage();
792 :
793 : // load-element [base + index]
794 : const Operator* LoadElement(ElementAccess const&);
795 :
796 : // load-stack-argument [base + index]
797 : const Operator* LoadStackArgument();
798 :
799 : // store-element [base + index], value
800 : const Operator* StoreElement(ElementAccess const&);
801 :
802 : // store-element [base + index], value, only with fast arrays.
803 : const Operator* TransitionAndStoreElement(Handle<Map> double_map,
804 : Handle<Map> fast_map);
805 : // store-element [base + index], smi value, only with fast arrays.
806 : const Operator* StoreSignedSmallElement();
807 :
808 : // store-element [base + index], double value, only with fast arrays.
809 : const Operator* TransitionAndStoreNumberElement(Handle<Map> double_map);
810 :
811 : // store-element [base + index], object value, only with fast arrays.
812 : const Operator* TransitionAndStoreNonNumberElement(Handle<Map> fast_map,
813 : Type value_type);
814 :
815 : // load-typed-element buffer, [base + external + index]
816 : const Operator* LoadTypedElement(ExternalArrayType const&);
817 :
818 : // load-data-view-element buffer, [base + byte_offset + index]
819 : const Operator* LoadDataViewElement(ExternalArrayType const&);
820 :
821 : // store-typed-element buffer, [base + external + index], value
822 : const Operator* StoreTypedElement(ExternalArrayType const&);
823 :
824 : // store-data-view-element buffer, [base + byte_offset + index], value
825 : const Operator* StoreDataViewElement(ExternalArrayType const&);
826 :
827 : // Abort (for terminating execution on internal error).
828 : const Operator* RuntimeAbort(AbortReason reason);
829 :
830 : const Operator* DateNow();
831 :
832 : private:
833 : Zone* zone() const { return zone_; }
834 :
835 : const SimplifiedOperatorGlobalCache& cache_;
836 : Zone* const zone_;
837 :
838 : DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder);
839 : };
840 :
841 : } // namespace compiler
842 : } // namespace internal
843 : } // namespace v8
844 :
845 : #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_
|