Home | History | Annotate | Download | only in compiler

Lines Matching refs:Node

12 #include "src/compiler/node-matchers.h"
13 #include "src/compiler/node-origin-table.h"
14 #include "src/compiler/node-properties.h"
15 #include "src/compiler/node.h"
50 Node* current_effect = nullptr; // New effect.
51 Node* current_control = nullptr; // New control.
52 Node* current_frame_state = nullptr; // New frame state.
76 Node* effect_phi;
79 PendingEffectPhi(Node* effect_phi, BasicBlock* block)
83 void ConnectUnreachableToEnd(Node* effect, Node* control, JSGraph* jsgraph) {
90 Node* throw_node = graph->NewNode(common->Throw(), effect, control);
94 void UpdateEffectPhi(Node* node, BasicBlock* block,
98 DCHECK_EQ(IrOpcode::kEffectPhi, node->opcode());
99 DCHECK_EQ(static_cast<size_t>(node->op()->EffectInputCount()),
101 for (int i = 0; i < node->op()->EffectInputCount(); i++) {
102 Node* input = node->InputAt(i);
106 Node* effect = block_effect.current_effect;
108 node->ReplaceInput(i, effect);
115 Node* control = block->NodeAt(0);
118 // Do not rewire the end node.
121 // Update all inputs to the given control node with the correct control.
127 return; // We already re-wired the control inputs of this node.
130 Node* input = NodeProperties::GetControlInput(control, i);
150 void RemoveRenameNode(Node* node) {
151 DCHECK(IrOpcode::kFinishRegion == node->opcode() ||
152 IrOpcode::kBeginRegion == node->opcode() ||
153 IrOpcode::kTypeGuard == node->opcode());
154 // Update the value/context uses to the value input of the finish node and
156 for (Edge edge : node->use_edges()) {
159 edge.UpdateTo(NodeProperties::GetEffectInput(node));
163 edge.UpdateTo(node->InputAt(0));
166 node->Kill();
169 void TryCloneBranch(Node* node, BasicBlock* block, Zone* temp_zone,
174 DCHECK_EQ(IrOpcode::kBranch, node->opcode());
177 // input graph as shown below and clones the Branch node for every predecessor
226 source_positions->GetSourcePosition(node));
227 NodeOriginTable::Scope origin_scope(node_origins, "clone branch", node);
228 Node* branch = node;
229 Node* cond = NodeProperties::GetValueInput(branch, 0);
231 Node* merge = NodeProperties::GetControlInput(branch);
240 for (Node* const use : merge->uses()) {
252 Node* control = NodeProperties::GetControlInput(edge.from());
263 Node** const inputs = graph->zone()->NewArray<Node*>(2 * input_count);
264 Node** const merge_true_inputs = &inputs[0];
265 Node** const merge_false_inputs = &inputs[input_count];
267 Node* cond1 = NodeProperties::GetValueInput(cond, index);
268 Node* control1 = NodeProperties::GetControlInput(merge, index);
269 Node* branch1 = graph->NewNode(common->Branch(hint), cond1, control1);
273 Node* const merge_true = matcher.IfTrue();
274 Node* const merge_false = matcher.IfFalse();
290 for (Node* const phi : phis) {
295 Node* phi_true = graph->NewNode(phi->op(), input_count + 1, inputs);
297 Node* phi_false = graph->NewNode(phi->op(), input_count + 1, inputs);
302 Node* control = NodeProperties::GetControlInput(edge.from());
337 // The control node should be the first.
338 Node* control = block->NodeAt(instr);
353 Node* effect_phi = nullptr;
354 Node* terminate = nullptr;
356 Node* node = block->NodeAt(instr);
358 if (node->opcode() == IrOpcode::kEffectPhi) {
363 effect_phi = node;
364 } else if (node->opcode() == IrOpcode::kPhi) {
366 } else if (node->opcode() == IrOpcode::kTerminate) {
368 terminate = node;
386 Node* effect = effect_phi;
420 // to create an effect phi node.
427 // For loops, we update the effect phi node later to break cycles.
442 // Fixup the Terminate node.
452 Node* frame_state = nullptr;
470 Node* node = block->NodeAt(instr);
471 ProcessNode(node, &frame_state, &effect, &control);
520 void EffectControlLinearizer::ProcessNode(Node* node, Node** frame_state,
521 Node** effect, Node** control) {
523 source_positions_->GetSourcePosition(node));
524 NodeOriginTable::Scope origin_scope(node_origins_, "process node", node);
526 // If the node needs to be wired into the effect/control chain, do this
528 if (TryWireInStateEffect(node, *frame_state, effect, control)) {
532 // If the node has a visible effect, then there must be a checkpoint in the
536 !node->op()->HasProperty(Operator::kNoWrite)) {
538 frame_state_zapper_ = node;
543 if (node->opcode() == IrOpcode::kFinishRegion) {
546 // Update the value uses to the value input of the finish node and
548 return RemoveRenameNode(node);
550 if (node->opcode() == IrOpcode::kBeginRegion) {
555 region_observability_ = RegionObservabilityOf(node->op());
556 // Update the value uses to the value input of the finish node and
558 return RemoveRenameNode(node);
560 if (node->opcode() == IrOpcode::kTypeGuard) {
561 return RemoveRenameNode(node);
565 if (node->opcode() == IrOpcode::kCheckpoint) {
569 *frame_state = NodeProperties::GetFrameStateInput(node);
575 DCHECK_NE(IrOpcode::kIfSuccess, node->opcode());
577 // If the node takes an effect, replace with the current one.
578 if (node->op()->EffectInputCount() > 0) {
579 DCHECK_EQ(1, node->op()->EffectInputCount());
580 Node* input_effect = NodeProperties::GetEffectInput(node);
583 NodeProperties::ReplaceEffectInput(node, *effect);
586 // If the node produces an effect, update our current effect. (However,
588 if (node->op()->EffectOutputCount() > 0) {
589 DCHECK_EQ(1, node->op()->EffectOutputCount());
590 *effect = node;
593 // New effect chain is only started with a Start or ValueEffect node.
594 DCHECK(node->op()->EffectOutputCount() == 0 ||
595 node->opcode() == IrOpcode::kStart);
599 for (int i = 0; i < node->op()->ControlInputCount(); i++) {
600 NodeProperties::ReplaceControlInput(node, *control, i);
603 if (node->op()->ControlOutputCount() > 0) {
604 *control = node;
608 // Mark the following code for deletion by connecting to the {Dead} node.
609 if (node->opcode() == IrOpcode::kUnreachable) {
615 bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
616 Node* frame_state,
617 Node** effect,
618 Node** control) {
620 Node* result = nullptr;
621 switch (node->opcode()) {
623 result = LowerChangeBitToTagged(node);
626 result = LowerChangeInt31ToTaggedSigned(node);
629 result = LowerChangeInt32ToTagged(node);
632 result = LowerChangeUint32ToTagged(node);
635 result = LowerChangeFloat64ToTagged(node);
638 result = LowerChangeFloat64ToTaggedPointer(node);
641 result = LowerChangeTaggedSignedToInt32(node);
644 result = LowerChangeTaggedToBit(node);
647 result = LowerChangeTaggedToInt32(node);
650 result = LowerChangeTaggedToUint32(node);
653 result = LowerChangeTaggedToFloat64(node);
656 result = LowerChangeTaggedToTaggedSigned(node);
659 result = LowerTruncateTaggedToBit(node);
662 result = LowerTruncateTaggedPointerToBit(node);
665 result = LowerTruncateTaggedToFloat64(node);
668 result = LowerCheckBounds(node, frame_state);
671 result = LowerPoisonIndex(node);
674 LowerCheckMaps(node, frame_state);
677 result = LowerCompareMaps(node);
680 result = LowerCheckNumber(node, frame_state);
683 result = LowerCheckReceiver(node, frame_state);
686 result = LowerCheckSymbol(node, frame_state);
689 result = LowerCheckString(node, frame_state);
692 result = LowerCheckInternalizedString(node, frame_state);
695 LowerCheckIf(node, frame_state);
698 result = LowerCheckedInt32Add(node, frame_state);
701 result = LowerCheckedInt32Sub(node, frame_state);
704 result = LowerCheckedInt32Div(node, frame_state);
707 result = LowerCheckedInt32Mod(node, frame_state);
710 result = LowerCheckedUint32Div(node, frame_state);
713 result = LowerCheckedUint32Mod(node, frame_state);
716 result = LowerCheckedInt32Mul(node, frame_state);
719 result = LowerCheckedInt32ToTaggedSigned(node, frame_state);
722 result = LowerCheckedUint32ToInt32(node, frame_state);
725 result = LowerCheckedUint32ToTaggedSigned(node, frame_state);
728 result = LowerCheckedFloat64ToInt32(node, frame_state);
735 result = LowerCheckedTaggedSignedToInt32(node, frame_state);
738 result = LowerCheckedTaggedToInt32(node, frame_state);
741 result = LowerCheckedTaggedToFloat64(node, frame_state);
744 result = LowerCheckedTaggedToTaggedSigned(node, frame_state);
747 result = LowerCheckedTaggedToTaggedPointer(node, frame_state);
750 result = LowerTruncateTaggedToWord32(node);
753 result = LowerCheckedTruncateTaggedToWord32(node, frame_state);
756 result = LowerNumberToString(node);
759 result = LowerObjectIsArrayBufferView(node);
762 result = LowerObjectIsBigInt(node);
765 result = LowerObjectIsCallable(node);
768 result = LowerObjectIsConstructor(node);
771 result = LowerObjectIsDetectableCallable(node);
774 result = LowerObjectIsMinusZero(node);
777 result = LowerObjectIsNaN(node);
780 result = LowerNumberIsNaN(node);
783 result = LowerObjectIsNonCallable(node);
786 result = LowerObjectIsNumber(node);
789 result = LowerObjectIsReceiver(node);
792 result = LowerObjectIsSmi(node);
795 result = LowerObjectIsString(node);
798 result = LowerObjectIsSymbol(node);
801 result = LowerObjectIsUndetectable(node);
804 result = LowerArgumentsFrame(node);
807 result = LowerArgumentsLength(node);
810 result = LowerToBoolean(node);
813 result = LowerTypeOf(node);
816 result = LowerNewDoubleElements(node);
819 result = LowerNewSmiOrObjectElements(node);
822 result = LowerNewArgumentsElements(node);
825 result = LowerNewConsString(node);
828 result = LowerArrayBufferWasNeutered(node);
831 result = LowerSameValue(node);
834 result = LowerDeadValue(node);
837 result = LowerStringFromSingleCharCode(node);
840 result = LowerStringFromSingleCodePoint(node);
843 result = LowerStringIndexOf(node);
846 result = LowerStringLength(node);
849 result = LowerStringToNumber(node);
852 result = LowerStringCharCodeAt(node);
855 node, UnicodeEncodingOf(node->op()));
858 result = LowerStringToLowerCaseIntl(node);
861 result = LowerStringToUpperCaseIntl(node);
864 result = LowerStringSubstring(node);
867 result = LowerStringEqual(node);
870 result = LowerStringLessThan(node);
873 result = LowerStringLessThanOrEqual(node);
876 result = LowerNumberIsFloat64Hole(node);
879 result = LowerNumberIsFinite(node);
882 result = LowerObjectIsFiniteNumber(node);
885 result = LowerNumberIsInteger(node);
888 result = LowerObjectIsInteger(node);
891 result = LowerNumberIsSafeInteger(node);
894 result = LowerObjectIsSafeInteger(node);
897 result = LowerCheckFloat64Hole(node, frame_state);
900 result = LowerCheckNotTaggedHole(node, frame_state);
903 result = LowerConvertTaggedHoleToUndefined(node);
906 LowerCheckEqualsInternalizedString(node, frame_state);
909 result = LowerAllocate(node);
912 LowerCheckEqualsSymbol(node, frame_state);
915 result = LowerPlainPrimitiveToNumber(node);
918 result = LowerPlainPrimitiveToWord32(node);
921 result = LowerPlainPrimitiveToFloat64(node);
924 result = LowerEnsureWritableFastElements(node);
927 result = LowerMaybeGrowFastElements(node, frame_state);
930 LowerTransitionElementsKind(node);
933 result = LowerLoadFieldByIndex(node);
936 result = LowerLoadTypedElement(node);
939 result = LowerLoadDataViewElement(node);
942 LowerStoreTypedElement(node);
945 LowerStoreDataViewElement(node);
948 LowerStoreSignedSmallElement(node);
951 result = LowerFindOrderedHashMapEntry(node);
954 result = LowerFindOrderedHashMapEntryForInt32Key(node);
957 LowerTransitionAndStoreNumberElement(node);
960 LowerTransitionAndStoreNonNumberElement(node);
963 LowerTransitionAndStoreElement(node);
966 LowerRuntimeAbort(node);
969 result = LowerConvertReceiver(node);
972 if (!LowerFloat64RoundUp(node).To(&result)) {
977 if (!LowerFloat64RoundDown(node).To(&result)) {
982 if (!LowerFloat64RoundTruncate(node).To(&result)) {
987 if (!LowerFloat64RoundTiesEven(node).To(&result)) {
992 result = LowerDateNow(node);
998 if ((result ? 1 : 0) != node->op()->ValueOutputCount()) {
1002 node->op()->mnemonic());
1007 NodeProperties::ReplaceUses(node, result, *effect, *control);
1013 Node* EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node) {
1014 CheckForMinusZeroMode mode = CheckMinusZeroModeOf(node->op());
1015 Node* value = node->InputAt(0);
1021 Node* value32 = __ RoundFloat64ToInt32(value);
1029 Node* zero = __ Int32Constant(0);
1048 Node* value_smi = ChangeInt32ToSmi(value32);
1052 Node* add = __ Int32AddWithOverflow(value32, value32);
1053 Node* ovf = __ Projection(1, add);
1055 Node* value_smi = __ Projection(0, add);
1063 Node* value_number = AllocateHeapNumberWithValue(value);
1071 Node* EffectControlLinearizer::LowerChangeFloat64ToTaggedPointer(Node* node) {
1072 Node* value = node->InputAt(0);
1076 Node* EffectControlLinearizer::LowerChangeBitToTagged(Node* node) {
1077 Node* value = node->InputAt(0);
1092 Node* EffectControlLinearizer::LowerChangeInt31ToTaggedSigned(Node* node) {
1093 Node* value = node->InputAt(0);
1097 Node* EffectControlLinearizer::LowerChangeInt32ToTagged(Node* node) {
1098 Node* value = node->InputAt(0);
1108 Node* add = __ Int32AddWithOverflow(value, value);
1109 Node* ovf = __ Projection(1, add);
1111 Node* value_smi = __ Projection(0, add);
1116 Node* number = AllocateHeapNumberWithValue(__ ChangeInt32ToFloat64(value));
1123 Node* EffectControlLinearizer::LowerChangeUint32ToTagged(Node* node) {
1124 Node* value = node->InputAt(0);
1129 Node* check = __ Uint32LessThanOrEqual(value, SmiMaxValueConstant());
1134 Node* number = AllocateHeapNumberWithValue(__ ChangeUint32ToFloat64(value));
1142 Node* EffectControlLinearizer::LowerChangeTaggedSignedToInt32(Node* node) {
1143 Node* value = node->InputAt(0);
1147 Node* EffectControlLinearizer::LowerChangeTaggedToBit(Node* node) {
1148 Node* value = node->InputAt(0);
1153 Node* node, GraphAssemblerLabel<1>* done) {
1154 Node* value = node->InputAt(0);
1159 Node* zero = __ Int32Constant(0);
1160 Node* fzero = __ Float64Constant(0.0);
1169 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1173 Node* value_map_bitfield =
1187 Node* value_instance_type =
1199 Node* value_value =
1206 Node* bitfield = __ LoadField(AccessBuilder::ForBigIntBitfield(), value);
1207 Node* length_is_zero = __ WordEqual(
1214 Node* EffectControlLinearizer::LowerTruncateTaggedToBit(Node* node) {
1218 Node* value = node->InputAt(0);
1221 TruncateTaggedPointerToBit(node, &done);
1234 Node* EffectControlLinearizer::LowerTruncateTaggedPointerToBit(Node* node) {
1237 TruncateTaggedPointerToBit(node, &done);
1243 Node* EffectControlLinearizer::LowerChangeTaggedToInt32(Node* node) {
1244 Node* value = node->InputAt(0);
1249 Node* check = ObjectIsSmi(value);
1255 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
1263 Node* EffectControlLinearizer::LowerChangeTaggedToUint32(Node* node) {
1264 Node* value = node->InputAt(0);
1269 Node* check = ObjectIsSmi(value);
1275 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
1283 Node* EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node) {
1284 return LowerTruncateTaggedToFloat64(node);
1287 Node* EffectControlLinearizer::LowerChangeTaggedToTaggedSigned(Node* node) {
1288 Node* value = node->InputAt(0);
1293 Node* check = ObjectIsSmi(value);
1299 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
1308 Node* EffectControlLinearizer::LowerTruncateTaggedToFloat64(Node* node) {
1309 Node* value = node->InputAt(0);
1314 Node* check = ObjectIsSmi(value);
1316 Node* vtrue = ChangeSmiToInt32(value);
1322 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
1329 Node* EffectControlLinearizer::LowerCheckBounds(Node* node, Node* frame_state) {
1330 Node* index = node->InputAt(0);
1331 Node* limit = node->InputAt(1);
1332 const CheckParameters& params = CheckParametersOf(node->op());
1334 Node* check = __ Uint32LessThan(index, limit);
1340 Node* EffectControlLinearizer::LowerPoisonIndex(Node* node) {
1341 Node* index = node->InputAt(0);
1348 void EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state) {
1349 CheckMapsParameters const& p = CheckMapsParametersOf(node->op());
1350 Node* value = node->InputAt(0);
1360 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1364 Node* map = __ HeapConstant(maps[i]);
1365 Node* check = __ WordEqual(value_map, map);
1378 Node* bitfield3 =
1380 Node* if_not_deprecated = __ WordEqual(
1391 Node* result = __ Call(call_descriptor, __ CEntryStubConstant(1), value,
1394 Node* check = ObjectIsSmi(result);
1404 Node* map = __ HeapConstant(maps[i]);
1405 Node* check = __ WordEqual(value_map, map);
1420 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1423 Node* map = __ HeapConstant(maps[i]);
1424 Node* check = __ WordEqual(value_map, map);
1437 Node* EffectControlLinearizer::LowerCompareMaps(Node* node) {
1438 ZoneHandleSet<Map> const& maps = CompareMapsParametersOf(node->op()).maps();
1440 Node* value = node->InputAt(0);
1445 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1448 Node* map = __ HeapConstant(maps[i]);
1449 Node* check = __ WordEqual(value_map, map);
1458 Node* EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state) {
1459 Node* value = node->InputAt(0);
1460 const CheckParameters& params = CheckParametersOf(node->op());
1465 Node* check0 = ObjectIsSmi(value);
1470 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1471 Node* check1 = __ WordEqual(value_map, __ HeapNumberMapConstant());
1480 Node* EffectControlLinearizer::LowerCheckReceiver(Node* node,
1481 Node* frame_state) {
1482 Node* value = node->InputAt(0);
1484 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1485 Node* value_instance_type =
1489 Node* check = __ Uint32LessThanOrEqual(
1496 Node* EffectControlLinearizer::LowerCheckSymbol(Node* node, Node* frame_state) {
1497 Node* value = node->InputAt(0);
1499 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1501 Node* check =
1508 Node* EffectControlLinearizer::LowerCheckString(Node* node, Node* frame_state) {
1509 Node* value = node->InputAt(0);
1510 const CheckParameters& params = CheckParametersOf(node->op());
1512 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1513 Node* value_instance_type =
1516 Node* check = __ Uint32LessThan(value_instance_type,
1523 Node* EffectControlLinearizer::LowerCheckInternalizedString(Node* node,
1524 Node* frame_state) {
1525 Node* value = node->InputAt(0);
1527 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1528 Node* value_instance_type =
1531 Node* check = __ Word32Equal(
1541 void EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state) {
1542 Node* value = node->InputAt(0);
1543 const CheckIfParameters& p = CheckIfParametersOf(node->op());
1547 Node* EffectControlLinearizer::LowerCheckedInt32Add(Node* node,
1548 Node* frame_state) {
1549 Node* lhs = node->InputAt(0);
1550 Node* rhs = node->InputAt(1);
1552 Node* value = __ Int32AddWithOverflow(lhs, rhs);
1553 Node* check = __ Projection(1, value);
1559 Node* EffectControlLinearizer::LowerCheckedInt32Sub(Node* node,
1560 Node* frame_state) {
1561 Node* lhs = node->InputAt(0);
1562 Node* rhs = node->InputAt(1);
1564 Node* value = __ Int32SubWithOverflow(lhs, rhs);
1565 Node* check = __ Projection(1, value);
1571 Node* EffectControlLinearizer::LowerCheckedInt32Div(Node* node,
1572 Node* frame_state) {
1573 Node* lhs = node->InputAt(0);
1574 Node* rhs = node->InputAt(1);
1581 Node* zero = __ Int32Constant(0);
1584 Node* check0 = __ Int32LessThan(zero, rhs);
1594 Node* check = __ Word32Equal(rhs, zero);
1605 Node* minint = __ Int32Constant(std::numeric_limits<int32_t>::min());
1606 Node* check1 = graph()->NewNode(machine()->Word32Equal(), lhs, minint);
1612 Node* minusone = __ Int32Constant(-1);
1613 Node* is_minus_one = __ Word32Equal(rhs, minusone);
1624 Node* value = done.PhiAt(0);
1627 Node* check = __ Word32Equal(lhs, __ Int32Mul(rhs, value));
1634 Node* EffectControlLinearizer::BuildUint32Mod(Node* lhs, Node* rhs) {
1639 Node* one = __ Int32Constant(1);
1640 Node* msk = __ Int32Sub(rhs, one);
1660 Node* EffectControlLinearizer::LowerCheckedInt32Mod(Node* node,
1661 Node* frame_state) {
1686 Node* lhs = node->InputAt(0);
1687 Node* rhs = node->InputAt(1);
1695 Node* zero = __ Int32Constant(0);
1698 Node* check0 = __ Int32LessThanOrEqual(rhs, zero);
1706 Node* vtrue0 = __ Int32Sub(zero, rhs);
1726 Node* res = BuildUint32Mod(__ Int32Sub(zero, lhs), rhs);
1738 Node* EffectControlLinearizer::LowerCheckedUint32Div(Node* node,
1739 Node* frame_state) {
1740 Node* lhs = node->InputAt(0);
1741 Node* rhs = node->InputAt(1);
1743 Node* zero = __ Int32Constant(0);
1746 Node* check = __ Word32Equal(rhs, zero);
1751 Node* value = __ Uint32Div(lhs, rhs);
1760 Node* EffectControlLinearizer::LowerCheckedUint32Mod(Node* node,
1761 Node* frame_state) {
1762 Node* lhs = node->InputAt(0);
1763 Node* rhs = node->InputAt(1);
1765 Node* zero = __ Int32Constant(0);
1768 Node* check = __ Word32Equal(rhs, zero);
1776 Node* EffectControlLinearizer::LowerCheckedInt32Mul(Node* node,
1777 Node* frame_state) {
1778 CheckForMinusZeroMode mode = CheckMinusZeroModeOf(node->op());
1779 Node* lhs = node->InputAt(0);
1780 Node* rhs = node->InputAt(1);
1782 Node* projection = __ Int32MulWithOverflow(lhs, rhs);
1783 Node* check = __ Projection(1, projection);
1787 Node* value = __ Projection(0, projection);
1792 Node* zero = __ Int32Constant(0);
1793 Node* check_zero = __ Word32Equal(value, zero);
1799 Node* check_or = __ Int32LessThan(__ Word32Or(lhs, rhs), zero);
1810 Node* EffectControlLinearizer::LowerCheckedInt32ToTaggedSigned(
1811 Node* node, Node* frame_state) {
1813 Node* value = node->InputAt(0);
1814 const CheckParameters& params = CheckParametersOf(node->op());
1816 Node* add = __ Int32AddWithOverflow(value, value);
1817 Node* check = __ Projection(1, add);
1820 Node* result = __ Projection(0, add);
1825 Node* EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node,
1826 Node* frame_state) {
1827 Node* value = node->InputAt(0);
1828 const CheckParameters& params = CheckParametersOf(node->op());
1829 Node* unsafe = __ Int32LessThan(value, __ Int32Constant(0));
1835 Node* EffectControlLinearizer::LowerCheckedUint32ToTaggedSigned(
1836 Node* node, Node* frame_state) {
1837 Node* value = node->InputAt(0);
1838 const CheckParameters& params = CheckParametersOf(node->op());
1839 Node* check = __ Uint32LessThanOrEqual(value, SmiMaxValueConstant());
1845 Node* EffectControlLinearizer::BuildCheckedFloat64ToInt32(
1846 CheckForMinusZeroMode mode, const VectorSlotPair& feedback, Node* value,
1847 Node* frame_state) {
1848 Node* value32 = __ RoundFloat64ToInt32(value);
1849 Node* check_same = __ Float64Equal(value, __ ChangeInt32ToFloat64(value32));
1858 Node* check_zero = __ Word32Equal(value32, __ Int32Constant(0));
1864 Node* check_negative = __ Int32LessThan(__ Float64ExtractHighWord32(value),
1875 Node* EffectControlLinearizer::LowerCheckedFloat64ToInt32(Node* node,
1876 Node* frame_state) {
1878 CheckMinusZeroParametersOf(node->op());
1879 Node* value = node->InputAt(0);
1884 Node* EffectControlLinearizer::LowerCheckedTaggedSignedToInt32(
1885 Node* node, Node* frame_state) {
1886 Node* value = node->InputAt(0);
1887 const CheckParameters& params = CheckParametersOf(node->op());
1888 Node* check = ObjectIsSmi(value);
1894 Node* EffectControlLinearizer::LowerCheckedTaggedToInt32(Node* node,
1895 Node* frame_state) {
1897 CheckMinusZeroParametersOf(node->op());
1898 Node* value = node->InputAt(0);
1903 Node* check = ObjectIsSmi(value);
1911 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1912 Node* check_map = __ WordEqual(value_map, __ HeapNumberMapConstant());
1915 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
1924 Node* EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64(
1925 CheckTaggedInputMode mode, const VectorSlotPair& feedback, Node* value,
1926 Node* frame_state) {
1927 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
1928 Node* check_number = __ WordEqual(value_map, __ HeapNumberMapConstant());
1941 Node* instance_type =
1943 Node* check_oddball =
1957 Node* EffectControlLinearizer::LowerCheckedTaggedToFloat64(Node* node,
1958 Node* frame_state) {
1960 CheckTaggedInputParametersOf(node->op());
1961 Node* value = node->InputAt(0);
1966 Node* check = ObjectIsSmi(value);
1971 Node* number = BuildCheckedHeapNumberOrOddballToFloat64(
1976 Node* from_smi = ChangeSmiToInt32(value);
1984 Node* EffectControlLinearizer::LowerCheckedTaggedToTaggedSigned(
1985 Node* node, Node* frame_state) {
1986 Node* value = node->InputAt(0);
1987 const CheckParameters& params = CheckParametersOf(node->op());
1989 Node* check = ObjectIsSmi(value);
1996 Node* EffectControlLinearizer::LowerCheckedTaggedToTaggedPointer(
1997 Node* node, Node* frame_state) {
1998 Node* value = node->InputAt(0);
1999 const CheckParameters& params = CheckParametersOf(node->op());
2001 Node* check = ObjectIsSmi(value);
2007 Node* EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node) {
2008 Node* value = node->InputAt(0);
2013 Node* check = ObjectIsSmi(value);
2019 Node* vfalse = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
2027 Node* EffectControlLinearizer::LowerCheckedTruncateTaggedToWord32(
2028 Node* node, Node* frame_state) {
2030 CheckTaggedInputParametersOf(node->op());
2031 Node* value = node->InputAt(0);
2036 Node* check = ObjectIsSmi(value);
2044 Node* number = BuildCheckedHeapNumberOrOddballToFloat64(
2053 Node* EffectControlLinearizer::LowerAllocate(Node* node) {
2054 Node* size = node->InputAt(0);
2055 PretenureFlag pretenure = PretenureFlagOf(node->op());
2056 Node* new_node = __ Allocate(pretenure, size);
2060 Node* EffectControlLinearizer::LowerNumberToString(Node* node) {
2061 Node* argument = node->InputAt(0);
2073 Node* EffectControlLinearizer::LowerObjectIsArrayBufferView(Node* node) {
2074 Node* value = node->InputAt(0);
2079 Node* check = ObjectIsSmi(value);
2082 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2083 Node* value_instance_type =
2086 Node* vfalse = __ Uint32LessThan(
2098 Node* EffectControlLinearizer::LowerObjectIsBigInt(Node* node) {
2099 Node* value = node->InputAt(0);
2104 Node* check = ObjectIsSmi(value);
2106 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2107 Node* value_instance_type =
2109 Node* vfalse =
2120 Node* EffectControlLinearizer::LowerObjectIsCallable(Node* node) {
2121 Node* value = node->InputAt(0);
2126 Node* check = ObjectIsSmi(value);
2129 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2130 Node* value_bit_field =
2132 Node* vfalse =
2145 Node* EffectControlLinearizer::LowerObjectIsConstructor(Node* node) {
2146 Node* value = node->InputAt(0);
2151 Node* check = ObjectIsSmi(value);
2154 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2155 Node* value_bit_field =
2157 Node* vfalse = __ Word32Equal(
2170 Node* EffectControlLinearizer::LowerObjectIsDetectableCallable(Node* node) {
2171 Node* value = node->InputAt(0);
2176 Node* check = ObjectIsSmi(value);
2179 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2180 Node* value_bit_field =
2182 Node* vfalse = __ Word32Equal(
2196 Node* EffectControlLinearizer::LowerNumberIsFloat64Hole(Node* node) {
2197 Node* value = node->InputAt(0);
2198 Node* check = __ Word32Equal(__ Float64ExtractHighWord32(value),
2203 Node* EffectControlLinearizer::LowerNumberIsFinite(Node* node) {
2204 Node* number = node->InputAt(0);
2205 Node* diff = __ Float64Sub(number, number);
2206 Node* check = __ Float64Equal(diff, diff);
2210 Node* EffectControlLinearizer::LowerObjectIsFiniteNumber(Node* node) {
2211 Node* object = node->InputAt(0);
2212 Node* zero = __ Int32Constant(0);
2213 Node* one = __ Int32Constant(1);
2221 Node* value_map = __ LoadField(AccessBuilder::ForMap(), object);
2226 Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), object);
2227 Node* diff = __ Float64Sub(value, value);
2228 Node* check = __ Float64Equal(diff, diff);
2235 Node* EffectControlLinearizer::LowerNumberIsInteger(Node* node) {
2236 Node* number = node->InputAt(0);
2237 Node* trunc = BuildFloat64RoundTruncate(number);
2238 Node* diff = __ Float64Sub(number, trunc);
2239 Node* check = __ Float64Equal(diff, __ Float64Constant(0));
2243 Node* EffectControlLinearizer::LowerObjectIsInteger(Node* node) {
2244 Node* object = node->InputAt(0);
2245 Node* zero = __ Int32Constant(0);
2246 Node* one = __ Int32Constant(1);
2254 Node* value_map = __ LoadField(AccessBuilder::ForMap(), object);
2259 Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), object);
2260 Node* trunc = BuildFloat64RoundTruncate(value);
2261 Node* diff = __ Float64Sub(value, trunc);
2262 Node* check = __ Float64Equal(diff, __ Float64Constant(0));
2269 Node* EffectControlLinearizer::LowerNumberIsSafeInteger(Node* node) {
2270 Node* number = node->InputAt(0);
2271 Node* zero = __ Int32Constant(0);
2274 Node* trunc = BuildFloat64RoundTruncate(number);
2275 Node* diff = __ Float64Sub(number, trunc);
2276 Node* check = __ Float64Equal(diff, __ Float64Constant(0));
2278 Node* in_range = __ Float64LessThanOrEqual(
2286 Node* EffectControlLinearizer::LowerObjectIsSafeInteger(Node* node) {
2287 Node* object = node->InputAt(0);
2288 Node* zero = __ Int32Constant(0);
2289 Node* one = __ Int32Constant(1);
2297 Node* value_map = __ LoadField(AccessBuilder::ForMap(), object);
2302 Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), object);
2303 Node* trunc = BuildFloat64RoundTruncate(value);
2304 Node* diff = __ Float64Sub(value, trunc);
2305 Node* check = __ Float64Equal(diff, __ Float64Constant(0));
2307 Node* in_range = __ Float64LessThanOrEqual(
2315 Node* EffectControlLinearizer::LowerObjectIsMinusZero(Node* node) {
2316 Node* value = node->InputAt(0);
2317 Node* zero = __ Int32Constant(0);
2325 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2330 Node* value_value = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
2340 Node* EffectControlLinearizer::LowerObjectIsNaN(Node* node) {
2341 Node* value = node->InputAt(0);
2342 Node* zero = __ Int32Constant(0);
2350 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2355 Node* value_value = __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
2363 Node* EffectControlLinearizer::LowerNumberIsNaN(Node* node) {
2364 Node* number = node->InputAt(0);
2365 Node* diff = __ Float64Equal(number, number);
2366 Node* check = __ Word32Equal(diff, __ Int32Constant(0));
2370 Node* EffectControlLinearizer::LowerObjectIsNonCallable(Node* node) {
2371 Node* value = node->InputAt(0);
2376 Node* check0 = ObjectIsSmi(value);
2379 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2380 Node* value_instance_type =
2383 Node* check1 = __ Uint32LessThanOrEqual(
2387 Node* value_bit_field =
2389 Node* check2 =
2402 Node* EffectControlLinearizer::LowerObjectIsNumber(Node* node) {
2403 Node* value = node->InputAt(0);
2409 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2419 Node* EffectControlLinearizer::LowerObjectIsReceiver(Node* node) {
2420 Node* value = node->InputAt(0);
2428 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2429 Node* value_instance_type =
2431 Node* result = __ Uint32LessThanOrEqual(
2442 Node* EffectControlLinearizer::LowerObjectIsSmi(Node* node) {
2443 Node* value = node->InputAt(0);
2447 Node* EffectControlLinearizer::LowerObjectIsString(Node* node) {
2448 Node* value = node->InputAt(0);
2453 Node* check = ObjectIsSmi(value);
2455 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2456 Node* value_instance_type =
2458 Node* vfalse = __ Uint32LessThan(value_instance_type,
2469 Node* EffectControlLinearizer::LowerObjectIsSymbol(Node* node) {
2470 Node* value = node->InputAt(0);
2475 Node* check = ObjectIsSmi(value);
2477 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2478 Node* value_instance_type =
2480 Node* vfalse =
2491 Node* EffectControlLinearizer::LowerObjectIsUndetectable(Node* node) {
2492 Node* value = node->InputAt(0);
2497 Node* check = ObjectIsSmi(value);
2500 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
2501 Node* value_bit_field =
2503 Node* vfalse = __ Word32Equal(
2518 Node* EffectControlLinearizer::LowerTypeOf(Node* node) {
2519 Node* obj = node->InputAt(0);
2529 Node* EffectControlLinearizer::LowerToBoolean(Node* node) {
2530 Node* obj = node->InputAt(0);
2541 Node* EffectControlLinearizer::LowerArgumentsLength(Node* node) {
2542 Node* arguments_frame = NodeProperties::GetValueInput(node, 0);
2543 int formal_parameter_count = FormalParameterCountOf(node->op());
2544 bool is_rest_length = IsRestLengthOf(node->op());
2548 // The ArgumentsLength node is computing the number of rest parameters,
2555 Node* frame = __ LoadFramePointer();
2560 Node* arguments_length = __ Load(
2564 Node* rest_length =
2573 // The ArgumentsLength node is computing the actual number of arguments.
2579 Node* frame = __ LoadFramePointer();
2585 Node* arguments_length = __ Load(
2595 Node* EffectControlLinearizer::LowerArgumentsFrame(Node* node) {
2598 Node* frame = __ LoadFramePointer();
2599 Node* parent_frame =
2602 Node* parent_frame_type = __ Load(
2615 Node* EffectControlLinearizer::LowerNewDoubleElements(Node* node) {
2616 PretenureFlag const pretenure = PretenureFlagOf(node->op());
2617 Node* length = node->InputAt(0);
2620 Node* zero_length = __ Word32Equal(length, __ Int32Constant(0));
2625 Node* size =
2630 Node* result = __ Allocate(pretenure, size);
2638 Node* limit = ChangeUint32ToUintPtr(length);
2639 Node* the_hole =
2646 Node* index = loop.PhiAt(0);
2647 Node* check = __ UintLessThan(index, limit);
2652 Node* offset = __ IntAdd(
2666 Node* EffectControlLinearizer::LowerNewSmiOrObjectElements(Node* node) {
2667 PretenureFlag const pretenure = PretenureFlagOf(node->op());
2668 Node* length = node->InputAt(0);
2671 Node* zero_length = __ Word32Equal(length, __ Int32Constant(0));
2676 Node* size =
2681 Node* result = __ Allocate(pretenure, size);
2687 Node* limit = ChangeUint32ToUintPtr(length);
2688 Node* the_hole = __ TheHoleConstant();
2694 Node* index = loop.PhiAt(0);
2695 Node* check = __ UintLessThan(index, limit);
2700 Node* offset =
2714 Node* EffectControlLinearizer::LowerNewArgumentsElements(Node* node) {
2715 Node* frame = NodeProperties::GetValueInput(node, 0);
2716 Node* length = NodeProperties::GetValueInput(node, 1);
2717 int mapped_count = NewArgumentsElementsMappedCountOf(node->op());
2721 Operator::Properties const properties = node->op()->properties();
2729 Node* EffectControlLinearizer::LowerNewConsString(Node* node) {
2730 Node* length = node->InputAt(0);
2731 Node* first = node->InputAt(1);
2732 Node* second = node->InputAt(2);
2735 Node* first_map = __ LoadField(AccessBuilder::ForMap(), first);
2736 Node* first_instance_type =
2738 Node* second_map = __ LoadField(AccessBuilder::ForMap(), second);
2739 Node* second_instance_type =
2751 Node* instance_type = __ Word32And(first_instance_type, second_instance_type);
2752 Node* encoding =
2762 Node* result_map = done.PhiAt(0);
2765 Node* result = __ Allocate(NOT_TENURED, __ Int32Constant(ConsString::kSize));
2775 Node* EffectControlLinearizer::LowerArrayBufferWasNeutered(Node* node) {
2776 Node* value = node->InputAt(0);
2778 Node* value_bit_field =
2788 Node* EffectControlLinearizer::LowerSameValue(Node* node) {
2789 Node* lhs = node->InputAt(0);
2790 Node* rhs = node->InputAt(1);
2802 Node* EffectControlLinearizer::LowerDeadValue(Node* node) {
2803 Node* input = NodeProperties::GetValueInput(node, 0);
2805 Node* unreachable = __ Unreachable();
2806 NodeProperties::ReplaceValueInput(node, unreachable, 0);
2808 return node;
2811 Node* EffectControlLinearizer::LowerStringToNumber(Node* node) {
2812 Node* string = node->InputAt(0);
2824 Node* EffectControlLinearizer::LowerStringCharCodeAt(Node* node) {
2825 Node* receiver = node->InputAt(0);
2826 Node* position = node->InputAt(1);
2838 Node* receiver = loop.PhiAt(0);
2839 Node* position = loop.PhiAt(1);
2840 Node* receiver_map = __ LoadField(AccessBuilder::ForMap(), receiver);
2841 Node* receiver_instance_type =
2843 Node* receiver_representation = __ Word32And(
2871 Node* receiver_is_onebyte = __ Word32Equal(
2876 Node* result = LoadFromSeqString(receiver, position, receiver_is_onebyte);
2882 Node* receiver_actual =
2889 Node* receiver_second =
2893 Node* receiver_first =
2907 Node* receiver_data = __ LoadField(
2920 Node* result = __ Load(MachineType::Uint8(), receiver_data,
2927 Node* result = __ Load(
2936 Node* receiver_offset =
2938 Node* receiver_parent =
2950 Node* result = __ Call(call_descriptor, __ CEntryStubConstant(1),
2964 Node* EffectControlLinearizer::LowerStringCodePointAt(
2965 Node* node, UnicodeEncoding encoding) {
2966 Node* receiver = node->InputAt(0);
2967 Node* position = node->InputAt(1);
2982 Node* EffectControlLinearizer::LoadFromSeqString(Node* receiver, Node* position,
2983 Node* is_one_byte) {
2987 Node* two_byte_result = __ LoadElement(
2992 Node* one_byte_element = __ LoadElement(
3000 Node* EffectControlLinearizer::LowerStringFromSingleCharCode(Node* node) {
3001 Node* value = node->InputAt(0);
3002 Node* code = __ Word32And(value, __ Uint32Constant(0xFFFF));
3009 Node* check1 = __ Uint32LessThanOrEqual(
3014 Node* cache = __ HeapConstant(factory()->single_character_string_cache());
3017 Node* index = machine()->Is32() ? code : __ ChangeUint32ToUint64(code);
3021 Node* entry =
3024 Node* check2 = __ WordEqual(entry, __ UndefinedConstant());
3033 Node* vtrue2 = __ Allocate(
3057 Node* vfalse1 = __ Allocate(NOT_TENURED,
3078 Node* EffectControlLinearizer::LowerStringToLowerCaseIntl(Node* node) {
3079 Node* receiver = node->InputAt(0);
3091 Node* EffectControlLinearizer::LowerStringToUpperCaseIntl(Node* node) {
3092 Node* receiver = node->InputAt(0);
3104 Node* EffectControlLinearizer::LowerStringToLowerCaseIntl(Node* node) {
3109 Node* EffectControlLinearizer::LowerStringToUpperCaseIntl(Node* node) {
3116 Node* EffectControlLinearizer::LowerStringFromSingleCodePoint(Node* node) {
3117 Node* value = node->InputAt(0);
3118 Node* code = value;
3126 Node* check0 = __ Uint32LessThanOrEqual(code, __ Uint32Constant(0xFFFF));
3131 Node* check1 = __ Uint32LessThanOrEqual(
3136 Node* cache = __ HeapConstant(factory()->single_character_string_cache());
3139 Node* index = machine()->Is32() ? code : __ ChangeUint32ToUint64(code);
3143 Node* entry =
3146 Node* check2 = __ WordEqual(entry, __ UndefinedConstant());
3155 Node* vtrue2 = __ Allocate(
3179 Node* vfalse1 = __ Allocate(
3199 switch (UnicodeEncodingOf(node->op())) {
3205 Node* lead_offset = __ Int32Constant(0xD800 - (0x10000 >> 10));
3208 Node* lead =
3212 Node* trail = __ Int32Add(__ Word32And(code, __ Int32Constant(0x3FF)),
3226 Node* vfalse0 = __ Allocate(NOT_TENURED,
3245 Node* EffectControlLinearizer::LowerStringIndexOf(Node* node) {
3246 Node* subject = node->InputAt(0);
3247 Node* search_string = node->InputAt(1);
3248 Node* position = node->InputAt(2);
3260 Node* EffectControlLinearizer::LowerStringLength(Node* node) {
3261 Node* subject = node->InputAt(0);
3266 Node* EffectControlLinearizer::LowerStringComparison(Callable const& callable,
3267 Node* node) {
3268 Node* lhs = node->InputAt(0);
3269 Node* rhs = node->InputAt(1);
3279 Node* EffectControlLinearizer::LowerStringSubstring(Node* node) {
3280 Node* receiver = node->InputAt(0);
3281 Node* start = ChangeInt32ToIntPtr(node->InputAt(1));
3282 Node* end = ChangeInt32ToIntPtr(node->InputAt(2));
3294 Node* EffectControlLinearizer::LowerStringEqual(Node* node) {
3296 Builtins::CallableFor(isolate(), Builtins::kStringEqual), node);
3299 Node* EffectControlLinearizer::LowerStringLessThan(Node* node) {
3301 Builtins::CallableFor(isolate(), Builtins::kStringLessThan), node);
3304 Node* EffectControlLinearizer::LowerStringLessThanOrEqual(Node* node) {
3306 Builtins::CallableFor(isolate(), Builtins::kStringLessThanOrEqual), node);
3309 Node* EffectControlLinearizer::LowerCheckFloat64Hole(Node* node,
3310 Node* frame_state) {
3311 // If we reach this point w/o eliminating the {node} that's marked
3315 CheckFloat64HoleParametersOf(node->op());
3316 Node* value = node->InputAt(0);
3317 Node* check = __ Word32Equal(__ Float64ExtractHighWord32(value),
3324 Node* EffectControlLinearizer::LowerCheckNotTaggedHole(Node* node,
3325 Node* frame_state) {
3326 Node* value = node->InputAt(0);
3327 Node* check = __ WordEqual(value, __ TheHoleConstant());
3333 Node* EffectControlLinearizer::LowerConvertTaggedHoleToUndefined(Node* node) {
3334 Node* value = node->InputAt(0);
3339 Node* check = __ WordEqual(value, __ TheHoleConstant());
3351 Node* node, Node* frame_state) {
3352 Node* exp = node->InputAt(0);
3353 Node* val = node->InputAt(1);
3368 Node* val_map = __ LoadField(AccessBuilder::ForMap(), val);
3369 Node* val_instance_type =
3397 Node* try_internalize_string_function = __ ExternalConstant(
3399 Node* const isolate_ptr =
3403 Node* val_internalized =
3416 Node* val_actual =
3427 void EffectControlLinearizer::LowerCheckEqualsSymbol(Node* node,
3428 Node* frame_state) {
3429 Node* exp = node->InputAt(0);
3430 Node* val = node->InputAt(1);
3431 Node* check = __ WordEqual(exp, val);
3436 Node* EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value) {
3437 Node* result = __ Allocate(NOT_TENURED, __ Int32Constant(HeapNumber::kSize));
3443 Node* EffectControlLinearizer::ChangeInt32ToSmi(Node* value) {
3447 Node* EffectControlLinearizer::ChangeInt32ToIntPtr(Node* value) {
3454 Node* EffectControlLinearizer::ChangeIntPtrToInt32(Node* value) {
3461 Node* EffectControlLinearizer::ChangeUint32ToUintPtr(Node* value) {
3468 Node* EffectControlLinearizer::ChangeUint32ToSmi(Node* value) {
3473 Node* EffectControlLinearizer::ChangeSmiToIntPtr(Node* value) {
3477 Node* EffectControlLinearizer::ChangeSmiToInt32(Node* value) {
3485 Node* EffectControlLinearizer::ObjectIsSmi(Node* value) {
3490 Node* EffectControlLinearizer::SmiMaxValueConstant() {
3494 Node* EffectControlLinearizer::SmiShiftBitsConstant() {
3498 Node* EffectControlLinearizer::LowerPlainPrimitiveToNumber(Node* node) {
3499 Node* value = node->InputAt(0);
3503 Node* EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node) {
3504 Node* value = node->InputAt(0);
3510 Node* check0 = ObjectIsSmi(value);
3515 Node* to_number = __ ToNumber(value);
3517 Node* check1 = ObjectIsSmi(to_number);
3519 Node* number = __ LoadField(AccessBuilder::ForHeapNumberValue(), to_number);
3529 Node* EffectControlLinearizer::LowerPlainPrimitiveToFloat64(Node* node) {
3530 Node* value = node->InputAt(0);
3536 Node* check0 = ObjectIsSmi(value);
3538 Node* from_smi = ChangeSmiToInt32(value);
3542 Node* to_number = __ ToNumber(value);
3543 Node* check1 = ObjectIsSmi(to_number);
3546 Node* number = __ LoadField(AccessBuilder::ForHeapNumberValue(), to_number);
3550 Node* number_from_smi = ChangeSmiToInt32(to_number);
3558 Node* EffectControlLinearizer::LowerEnsureWritableFastElements(Node* node) {
3559 Node* object = node->InputAt(0);
3560 Node* elements = node->InputAt(1);
3566 Node* elements_map = __ LoadField(AccessBuilder::ForMap(), elements);
3569 Node* check = __ WordEqual(elements_map, __ FixedArrayMapConstant());
3582 Node* result = __ Call(call_descriptor, __ HeapConstant(callable.code()),
3590 Node* EffectControlLinearizer::LowerMaybeGrowFastElements(Node* node,
3591 Node* frame_state) {
3592 GrowFastElementsParameters params = GrowFastElementsParametersOf(node->op());
3593 Node* object = node->InputAt(0);
3594 Node* elements = node->InputAt(1);
3595 Node* index = node->InputAt(2);
3596 Node* elements_length = node->InputAt(3);
3603 Node* check = __ Uint32LessThan(index, elements_length);
3618 Node* new_elements =
3631 void EffectControlLinearizer::LowerTransitionElementsKind(Node* node) {
3632 ElementsTransition const transition = ElementsTransitionOf(node->op());
3633 Node* object = node->InputAt(0);
3638 Node* source_map = __ HeapConstant(transition.source());
3639 Node* target_map = __ HeapConstant(transition.target());
3642 Node* object_map = __ LoadField(AccessBuilder::ForMap(), object);
3645 Node* check = __ WordEqual(object_map, source_map);
3672 Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
3673 Node* object = node->InputAt(0);
3674 Node* index = node->InputAt(1);
3675 Node* zero = __ IntPtrConstant(0);
3676 Node* one = __ IntPtrConstant(1);
3698 Node* offset =
3701 Node* result = __ Load(MachineType::AnyTagged(), object, offset);
3709 Node* properties =
3711 Node* offset =
3716 Node* result = __ Load(MachineType::AnyTagged(), properties, offset);
3735 Node* offset =
3739 Node* result = __ Load(MachineType::Float64(), object, offset);
3742 Node* result = __ Load(MachineType::AnyTagged(), object, offset);
3750 Node* properties =
3752 Node* offset =
3757 Node* result = __ Load(MachineType::AnyTagged(), properties, offset);
3764 Node* result = AllocateHeapNumberWithValue(done_double.PhiAt(0));
3773 Node* EffectControlLinearizer::BuildReverseBytes(ExternalArrayType type,
3774 Node* value) {
3782 Node* result = __ Word32ReverseBytes(value);
3788 Node* result = __ Word32ReverseBytes(value);
3798 Node* result = __ BitcastFloat32ToInt32(value);
3806 Node* result = __ BitcastFloat64ToInt64(value);
3811 Node* lo = __ Word32ReverseBytes(__ Float64ExtractLowWord32(value));
3812 Node* hi = __ Word32ReverseBytes(__ Float64ExtractHighWord32(value));
3813 Node* result = __ Float64Constant(0.0);
3826 Node* EffectControlLinearizer::LowerLoadDataViewElement(Node* node) {
3827 ExternalArrayType element_type = ExternalArrayTypeOf(node->op());
3828 Node* buffer = node->InputAt(0);
3829 Node* storage = node->InputAt(1);
3830 Node* index = node->InputAt(2);
3831 Node* is_little_endian = node->InputAt(3);
3846 Node* value = __ LoadUnaligned(machine_type, storage, index);
3873 void EffectControlLinearizer::LowerStoreDataViewElement(Node* node) {
3874 ExternalArrayType element_type = ExternalArrayTypeOf(node->op());
3875 Node* buffer = node->InputAt(0);
3876 Node* storage = node->InputAt(1);
3877 Node* index = node->InputAt(2);
3878 Node* value = node->InputAt(3);
3879 Node* is_little_endian = node->InputAt(4);
3920 Node* EffectControlLinearizer::LowerLoadTypedElement(Node* node) {
3921 ExternalArrayType array_type = ExternalArrayTypeOf(node->op());
3922 Node* buffer = node->InputAt(0);
3923 Node* base = node->InputAt(1);
3924 Node* external = node->InputAt(2);
3925 Node* index = node->InputAt(3);
3934 Node* storage = IntPtrMatcher(base).Is(0)
3944 void EffectControlLinearizer::LowerStoreTypedElement(Node* node) {
3945 ExternalArrayType array_type = ExternalArrayTypeOf(node->op());
3946 Node* buffer = node->InputAt(0);
3947 Node* base = node->InputAt(1);
3948 Node* external = node->InputAt(2);
3949 Node* index = node->InputAt(3);
3950 Node* value = node->InputAt(4);
3959 Node* storage = IntPtrMatcher(base).Is(0)
3968 void EffectControlLinearizer::TransitionElementsTo(Node* node, Node* array,
3974 Handle<Map> target(to == HOLEY_ELEMENTS ? FastMapParameterOf(node->op())
3975 : DoubleMapParameterOf(node->op()));
3976 Node* target_map = __ HeapConstant(target);
3992 Node* EffectControlLinearizer::IsElementsKindGreaterThan(
3993 Node* kind, ElementsKind reference_kind) {
3994 Node* ref_kind = __ Int32Constant(reference_kind);
3995 Node* ret = __ Int32LessThan(ref_kind, kind);
3999 void EffectControlLinearizer::LowerTransitionAndStoreElement(Node* node) {
4000 Node* array = node->InputAt(0);
4001 Node* index = node->InputAt(1);
4002 Node* value = node->InputAt(2);
4040 Node* map = __ LoadField(AccessBuilder::ForMap(), array);
4041 Node* kind;
4043 Node* bit_field2 = __ LoadField(AccessBuilder::ForMapBitField2(), map);
4044 Node* mask = __ Int32Constant(Map::ElementsKindBits::kMask);
4045 Node* andit = __ Word32And(bit_field2, mask);
4046 Node* shift = __ Int32Constant(Map::ElementsKindBits::kShift);
4065 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
4066 Node* heap_number_map = __ HeapNumberMapConstant();
4067 Node* check = __ WordEqual(value_map, heap_number_map);
4077 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
4078 Node* heap_number_map = __ HeapNumberMapConstant();
4079 Node* check = __ WordEqual(value_map, heap_number_map);
4083 TransitionElementsTo(node, array, HOLEY_SMI_ELEMENTS,
4089 TransitionElementsTo(node, array, HOLEY_SMI_ELEMENTS, HOLEY_ELEMENTS);
4096 TransitionElementsTo(node, array, HOLEY_DOUBLE_ELEMENTS, HOLEY_ELEMENTS);
4104 Node* elements = __ LoadField(AccessBuilder::ForJSObjectElements(), array);
4121 Node* int_value = ChangeSmiToInt32(value);
4122 Node* float_value = __ ChangeInt32ToFloat64(int_value);
4129 Node* float_value =
4140 void EffectControlLinearizer::LowerTransitionAndStoreNumberElement(Node* node) {
4141 Node* array = node->InputAt(0);
4142 Node* index = node->InputAt(1);
4143 Node* value = node->InputAt(2); // This is a Float64, not tagged.
4158 Node* map = __ LoadField(AccessBuilder::ForMap(), array);
4159 Node* kind;
4161 Node* bit_field2 = __ LoadField(AccessBuilder::ForMapBitField2(), map);
4162 Node* mask = __ Int32Constant(Map::ElementsKindBits::kMask);
4163 Node* andit = __ Word32And(bit_field2, mask);
4164 Node* shift = __ Int32Constant(Map::ElementsKindBits::kShift);
4181 // TODO(turbofan): It would be good to have an "Unreachable()" node type.
4189 TransitionElementsTo(node, array, HOLEY_SMI_ELEMENTS,
4196 Node* elements = __ LoadField(AccessBuilder::ForJSObjectElements(), array);
4202 Node* node) {
4203 Node* array = node->InputAt(0);
4204 Node* index = node->InputAt(1);
4205 Node* value = node->InputAt(2);
4221 Node* map = __ LoadField(AccessBuilder::ForMap(), array);
4222 Node* kind;
4224 Node* bit_field2 = __ LoadField(AccessBuilder::ForMapBitField2(), map);
4225 Node* mask = __ Int32Constant(Map::ElementsKindBits::kMask);
4226 Node* andit = __ Word32And(bit_field2, mask);
4227 Node* shift = __ Int32Constant(Map::ElementsKindBits::kShift);
4246 TransitionElementsTo(node, array, HOLEY_SMI_ELEMENTS, HOLEY_ELEMENTS);
4252 TransitionElementsTo(node, array, HOLEY_DOUBLE_ELEMENTS, HOLEY_ELEMENTS);
4258 Node* elements = __ LoadField(AccessBuilder::ForJSObjectElements(), array);
4261 Type value_type = ValueTypeParameterOf(node->op());
4269 void EffectControlLinearizer::LowerStoreSignedSmallElement(Node* node) {
4270 Node* array = node->InputAt(0);
4271 Node* index = node->InputAt(1);
4272 Node* value = node->InputAt(2); // int32
4288 Node* map = __ LoadField(AccessBuilder::ForMap(), array);
4289 Node* kind;
4291 Node* bit_field2 = __ LoadField(AccessBuilder::ForMapBitField2(), map);
4292 Node* mask = __ Int32Constant(Map::ElementsKindBits::kMask);
4293 Node* andit = __ Word32And(bit_field2, mask);
4294 Node* shift = __ Int32Constant(Map::ElementsKindBits::kShift);
4298 Node* elements = __ LoadField(AccessBuilder::ForJSObjectElements(), array);
4311 Node* smi_value = ChangeInt32ToSmi(value);
4318 Node* float_value = __ ChangeInt32ToFloat64(value);
4327 void EffectControlLinearizer::LowerRuntimeAbort(Node* node) {
4328 AbortReason reason = AbortReasonOf(node->op());
4339 Node* EffectControlLinearizer::LowerConvertReceiver(Node* node) {
4340 ConvertReceiverMode const mode = ConvertReceiverModeOf(node->op());
4341 Node* value = node->InputAt(0);
4342 Node* global_proxy = node->InputAt(1);
4355 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
4356 Node* value_instance_type =
4358 Node* check = __ Uint32LessThan(
4370 Node* native_context = __ LoadField(
4372 Node* result = __ Call(call_descriptor, __ HeapConstant(callable.code()),
4387 Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
4388 Node* value_instance_type =
4390 Node* check = __ Uint32LessThan(
4405 Node* native_context = __ LoadField(
4407 Node* result = __ Call(call_descriptor, __ HeapConstant(callable.code()),
4424 Maybe<Node*> EffectControlLinearizer::LowerFloat64RoundUp(Node* node) {
4427 return Nothing<Node*>();
4430 Node* const input = node->InputAt(0);
4462 Node* const zero = __ Float64Constant(0.0);
4463 Node* const two_52 = __ Float64Constant(4503599627370496.0E0);
4464 Node* const one = __ Float64Constant(1.0);
4466 Node* check0 = __ Float64LessThan(zero, input);
4469 Node* check1 = __ Float64LessThanOrEqual(two_52, input);
4472 Node* temp1 = __ Float64Sub(__ Float64Add(two_52, input), two_52);
4483 Node* check1 = __ Float64Equal(input, zero);
4486 Node* const minus_two_52 = __ Float64Constant(-4503599627370496.0E0);
4487 Node* check2 = __ Float64LessThanOrEqual(input, minus_two_52);
4491 Node* const minus_zero = __ Float64Constant(-0.0);
4492 Node* temp1 = __ Float64Sub(minus_zero, input);
4493 Node* temp2 = __ Float64Sub(__ Float64Add(two_52, temp1), two_52);
4494 Node* check3 = __ Float64LessThan(temp1, temp2);
4499 Node* temp3 = done_temp3.PhiAt(0);
4512 Node* EffectControlLinearizer::BuildFloat64RoundDown(Node* value) {
4517 Node* const input = value;
4551 Node* const zero = __ Float64Constant(0.0);
4552 Node* const two_52 = __ Float64Constant(4503599627370496.0E0);
4554 Node* check0 = __ Float64LessThan(zero, input);
4557 Node* check1 = __ Float64LessThanOrEqual(two_52, input);
4560 Node* const one = __ Float64Constant(1.0);
4561 Node* temp1 = __ Float64Sub(__ Float64Add(two_52, input), two_52);
4572 Node* check1 = __ Float64Equal(input, zero);
4575 Node* const minus_two_52 = __ Float64Constant(-4503599627370496.0E0);
4576 Node* check2 = __ Float64LessThanOrEqual(input, minus_two_52);
4580 Node* const minus_zero = __ Float64Constant(-0.0);
4581 Node* temp1 = __ Float64Sub(minus_zero, input);
4582 Node* temp2 = __ Float64Sub(__ Float64Add(two_52, temp1), two_52);
4583 Node* check3 = __ Float64LessThan(temp2, temp1);
4600 Maybe<Node*> EffectControlLinearizer::LowerFloat64RoundDown(Node* node) {
4603 return Nothing<Node*>();
4606 Node* const input = node->InputAt(0);
4610 Maybe<Node*> EffectControlLinearizer::LowerFloat64RoundTiesEven(Node* node) {
4613 return Nothing<Node*>();
4616 Node* const input = node->InputAt(0);
4636 Node* value = BuildFloat64RoundDown(input);
4637 Node* temp1 = __ Float64Sub(input, value);
4639 Node* const half = __ Float64Constant(0.5);
4640 Node* check0 = __ Float64LessThan(temp1, half);
4643 Node* const one = __ Float64Constant(1.0);
4644 Node* check1 = __ Float64LessThan(half, temp1);
4649 Node* temp2 = __ Float64Mod(value, __ Float64Constant(2.0));
4650 Node* check2 = __ Float64Equal(temp2, __ Float64Constant(0.0));
4658 Node* EffectControlLinearizer::BuildFloat64RoundTruncate(Node* input) {
4695 Node* const zero = __ Float64Constant(0.0);
4696 Node* const two_52 = __ Float64Constant(4503599627370496.0E0);
4697 Node* const one = __ Float64Constant(1.0);
4699 Node* check0 = __ Float64LessThan(zero, input);
4702 Node* check1 = __ Float64LessThanOrEqual(two_52, input);
4705 Node* temp1 = __ Float64Sub(__ Float64Add(two_52, input), two_52);
4716 Node* check1 = __ Float64Equal(input, zero);
4719 Node* const minus_two_52 = __ Float64Constant(-4503599627370496.0E0);
4720 Node* check2 = __ Float64LessThanOrEqual(input, minus_two_52);
4724 Node* const minus_zero = __ Float64Constant(-0.0);
4725 Node* temp1 = __ Float64Sub(minus_zero, input);
4726 Node* temp2 = __ Float64Sub(__ Float64Add(two_52, temp1), two_52);
4727 Node* check3 = __ Float64LessThan(temp1, temp2);
4732 Node* temp3 = done_temp3.PhiAt(0);
4745 Maybe<Node*> EffectControlLinearizer::LowerFloat64RoundTruncate(Node* node) {
4748 return Nothing<Node*>();
4751 Node* const input = node->InputAt(0);
4755 Node* EffectControlLinearizer::LowerFindOrderedHashMapEntry(Node* node) {
4756 Node* table = NodeProperties::GetValueInput(node, 0);
4757 Node* key = NodeProperties::GetValueInput(node, 1);
4762 Operator::Properties const properties = node->op()->properties();
4771 Node* EffectControlLinearizer::ComputeIntegerHash(Node* value) {
4784 Node* EffectControlLinearizer::LowerFindOrderedHashMapEntryForInt32Key(
4785 Node* node) {
4786 Node* table = NodeProperties::GetValueInput(node, 0);
4787 Node* key = NodeProperties::GetValueInput(node, 1);
4790 Node* hash = ChangeUint32ToUintPtr(ComputeIntegerHash(key));
4792 Node* number_of_buckets = ChangeSmiToIntPtr(__ LoadField(
4795 Node* first_entry = ChangeSmiToIntPtr(__ Load(
4806 Node* entry = loop.PhiAt(0);
4807 Node* check =
4814 Node* candidate_key = __ Load(
4839 Node* index = ChangeIntPtrToInt32(entry);
4845 Node* next_entry = ChangeSmiToIntPtr(__ Load(
4860 Node* EffectControlLinearizer::LowerDateNow(Node* node) {