Lines Matching refs:node
13 #include "src/compiler/node-matchers.h"
14 #include "src/compiler/node-properties.h"
32 Reduction JSIntrinsicLowering::Reduce(Node* node) {
33 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange();
35 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id());
39 return ReduceConstructDouble(node);
41 return ReduceCreateIterResultObject(node);
43 return ReduceDeoptimizeNow(node);
45 return ReduceDoubleHi(node);
47 return ReduceDoubleLo(node);
49 return ReduceIncrementStatsCounter(node);
51 return ReduceIsInstanceType(node, JS_ARRAY_TYPE);
53 return ReduceIsInstanceType(node, JS_DATE_TYPE);
55 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
57 return ReduceIsFunction(node);
59 return ReduceIsInstanceType(node, JS_REGEXP_TYPE);
61 return ReduceIsJSReceiver(node);
63 return ReduceIsSmi(node);
65 return ReduceJSValueGetValue(node);
67 return ReduceMathClz32(node);
69 return ReduceMathFloor(node);
71 return ReduceMathSqrt(node);
73 return ReduceValueOf(node);
75 return ReduceIsMinusZero(node);
77 return ReduceFixedArrayGet(node);
79 return ReduceFixedArraySet(node);
81 return ReduceRegExpConstructResult(node);
83 return ReduceRegExpExec(node);
85 return ReduceRegExpFlags(node);
87 return ReduceRegExpSource(node);
89 return ReduceSubString(node);
91 return ReduceToInteger(node);
93 return ReduceToLength(node);
95 return ReduceToName(node);
97 return ReduceToNumber(node);
99 return ReduceToObject(node);
101 return ReduceToPrimitive(node);
103 return ReduceToString(node);
105 return ReduceCall(node);
107 return ReduceTailCall(node);
109 return ReduceGetSuperConstructor(node);
117 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) {
118 Node* const value = NodeProperties::GetValueInput(node, 0);
119 Node* const done = NodeProperties::GetValueInput(node, 1);
120 Node* const context = NodeProperties::GetContextInput(node);
121 Node* const effect = NodeProperties::GetEffectInput(node);
122 return Change(node, javascript()->CreateIterResultObject(), value, done,
127 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) {
128 Node* high = NodeProperties::GetValueInput(node, 0);
129 Node* low = NodeProperties::GetValueInput(node, 1);
130 Node* value =
135 ReplaceWithValue(node, value);
140 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
142 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0);
143 Node* const effect = NodeProperties::GetEffectInput(node);
144 Node* const control = NodeProperties::GetControlInput(node);
147 Node* deoptimize =
152 node->TrimInputCount(0);
153 NodeProperties::ChangeOp(node, common()->Dead());
154 return Changed(node);
158 Reduction JSIntrinsicLowering::ReduceDoubleHi(Node* node) {
159 return Change(node, machine()->Float64ExtractHighWord32());
163 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) {
164 return Change(node, machine()->Float64ExtractLowWord32());
168 Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) {
169 if (!FLAG_native_code_counters) return ChangeToUndefined(node);
170 HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
172 return ChangeToUndefined(node);
177 if (!counter.Enabled()) return ChangeToUndefined(node);
179 Node* effect = NodeProperties::GetEffectInput(node);
180 Node* control = NodeProperties::GetControlInput(node);
182 Node* cnt = jsgraph()->ExternalConstant(ExternalReference(&counter));
183 Node* load =
185 Node* inc =
187 Node* store = graph()->NewNode(simplified()->StoreField(access), cnt, inc,
189 return ChangeToUndefined(node, store);
194 Node* node, InstanceType instance_type) {
200 Node* value = NodeProperties::GetValueInput(node, 0);
201 Node* effect = NodeProperties::GetEffectInput(node);
202 Node* control = NodeProperties::GetControlInput(node);
204 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
205 Node* branch = graph()->NewNode(common()->Branch(), check, control);
207 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
208 Node* etrue = effect;
209 Node* vtrue = jsgraph()->FalseConstant();
211 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
212 Node* efalse = graph()->NewNode(
217 Node* vfalse = graph()->NewNode(machine()->Word32Equal(), efalse,
220 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
222 // Replace all effect uses of {node} with the {ephi}.
223 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
224 ReplaceWithValue(node, node, ephi);
226 // Turn the {node} into a Phi.
227 return Change(node, common()->Phi(MachineRepresentation::kTagged, 2), vtrue,
232 Reduction JSIntrinsicLowering::ReduceIsFunction(Node* node) {
233 Node* value = NodeProperties::GetValueInput(node, 0);
235 Node* effect = NodeProperties::GetEffectInput(node);
236 Node* control = NodeProperties::GetControlInput(node);
247 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
248 Node* branch = graph()->NewNode(common()->Branch(), check, control);
250 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
251 Node* etrue = effect;
252 Node* vtrue = jsgraph()->FalseConstant();
254 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
255 Node* efalse = graph()->NewNode(
260 Node* vfalse =
269 ReplaceWithValue(node, node, effect, control);
274 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) {
275 Node* value = NodeProperties::GetValueInput(node, 0);
277 Node* effect = NodeProperties::GetEffectInput(node);
278 Node* control = NodeProperties::GetControlInput(node);
291 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
292 Node* branch = graph()->NewNode(common()->Branch(), check, control);
294 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
295 Node* etrue = effect;
296 Node* vtrue = jsgraph()->FalseConstant();
298 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
299 Node* efalse = graph()->NewNode(
304 Node* vfalse = graph()->NewNode(
313 ReplaceWithValue(node, node, effect, control);
318 Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) {
319 return Change(node, simplified()->ObjectIsSmi());
323 Reduction JSIntrinsicLowering::ReduceJSValueGetValue(Node* node) {
324 Node* value = NodeProperties::GetValueInput(node, 0);
325 Node* effect = NodeProperties::GetEffectInput(node);
326 Node* control = NodeProperties::GetControlInput(node);
327 return Change(node, simplified()->LoadField(AccessBuilder::ForValue()), value,
332 Reduction JSIntrinsicLowering::ReduceMathClz32(Node* node) {
333 return Change(node, machine()->Word32Clz());
337 Reduction JSIntrinsicLowering::ReduceMathFloor(Node* node) {
339 return Change(node, machine()->Float64RoundDown().op());
343 Reduction JSIntrinsicLowering::ReduceMathSqrt(Node* node) {
344 return Change(node, machine()->Float64Sqrt());
348 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) {
361 Node* value = NodeProperties::GetValueInput(node, 0);
362 Node* effect = NodeProperties::GetEffectInput(node);
363 Node* control = NodeProperties::GetControlInput(node);
365 Node* check0 = graph()->NewNode(simplified()->ObjectIsSmi(), value);
366 Node* branch0 = graph()->NewNode(common()->Branch(), check0, control);
368 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
369 Node* etrue0 = effect;
370 Node* vtrue0 = value;
372 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
373 Node* efalse0;
374 Node* vfalse0;
376 Node* check1 = graph()->NewNode(
384 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
386 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
387 Node* etrue1 =
390 Node* vtrue1 = etrue1;
392 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
393 Node* efalse1 = effect;
394 Node* vfalse1 = value;
396 Node* merge1 = graph()->NewNode(merge_op, if_true1, if_false1);
401 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0);
403 // Replace all effect uses of {node} with the {ephi0}.
404 Node* ephi0 = graph()->NewNode(ephi_op, etrue0, efalse0, merge0);
405 ReplaceWithValue(node, node, ephi0);
407 // Turn the {node} into a Phi.
408 return Change(node, phi_op, vtrue0, vfalse0, merge0);
412 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op) {
413 // Replace all effect uses of {node} with the effect dependency.
414 RelaxEffectsAndControls(node);
416 NodeProperties::RemoveNonValueInputs(node);
418 NodeProperties::ChangeOp(node, op);
419 return Changed(node);
423 Reduction JSIntrinsicLowering::ReduceIsMinusZero(Node* node) {
424 Node* value = NodeProperties::GetValueInput(node, 0);
425 Node* effect = NodeProperties::GetEffectInput(node);
427 Node* double_lo =
429 Node* check1 = graph()->NewNode(machine()->Word32Equal(), double_lo,
432 Node* double_hi =
434 Node* check2 = graph()->NewNode(
438 ReplaceWithValue(node, node, effect);
440 Node* and_result = graph()->NewNode(machine()->Word32And(), check1, check2);
442 return Change(node, machine()->Word32Equal(), and_result,
447 Reduction JSIntrinsicLowering::ReduceFixedArrayGet(Node* node) {
448 Node* base = node->InputAt(0);
449 Node* index = node->InputAt(1);
450 Node* effect = NodeProperties::GetEffectInput(node);
451 Node* control = NodeProperties::GetControlInput(node);
453 node, simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()),
458 Reduction JSIntrinsicLowering::ReduceFixedArraySet(Node* node) {
459 Node* base = node->InputAt(0);
460 Node* index = node->InputAt(1);
461 Node* value = node->InputAt(2);
462 Node* effect = NodeProperties::GetEffectInput(node);
463 Node* control = NodeProperties::GetControlInput(node);
464 Node* store = (graph()->NewNode(
467 ReplaceWithValue(node, value, store);
472 Reduction JSIntrinsicLowering::ReduceRegExpConstructResult(Node* node) {
474 return Change(node, CodeFactory::RegExpConstructResult(isolate()), 0);
478 Reduction JSIntrinsicLowering::ReduceRegExpExec(Node* node) {
479 return Change(node, CodeFactory::RegExpExec(isolate()), 4);
483 Reduction JSIntrinsicLowering::ReduceRegExpFlags(Node* node) {
484 Node* const receiver = NodeProperties::GetValueInput(node, 0);
485 Node* const effect = NodeProperties::GetEffectInput(node);
486 Node* const control = NodeProperties::GetControlInput(node);
489 return Change(node, op, receiver, effect, control);
493 Reduction JSIntrinsicLowering::ReduceRegExpSource(Node* node) {
494 Node* const receiver = NodeProperties::GetValueInput(node, 0);
495 Node* const effect = NodeProperties::GetEffectInput(node);
496 Node* const control = NodeProperties::GetControlInput(node);
499 return Change(node, op, receiver, effect, control);
503 Reduction JSIntrinsicLowering::ReduceSubString(Node* node) {
504 return Change(node, CodeFactory::SubString(isolate()), 3);
508 Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) {
509 Node* value = NodeProperties::GetValueInput(node, 0);
512 ReplaceWithValue(node, value);
519 Reduction JSIntrinsicLowering::ReduceToName(Node* node) {
520 NodeProperties::ChangeOp(node, javascript()->ToName());
521 return Changed(node);
525 Reduction JSIntrinsicLowering::ReduceToNumber(Node* node) {
526 NodeProperties::ChangeOp(node, javascript()->ToNumber());
527 return Changed(node);
531 Reduction JSIntrinsicLowering::ReduceToLength(Node* node) {
532 Node* value = NodeProperties::GetValueInput(node, 0);
560 ReplaceWithValue(node, value);
563 return Change(node, CodeFactory::ToLength(isolate()), 0);
567 Reduction JSIntrinsicLowering::ReduceToObject(Node* node) {
568 NodeProperties::ChangeOp(node, javascript()->ToObject());
569 return Changed(node);
573 Reduction JSIntrinsicLowering::ReduceToPrimitive(Node* node) {
574 Node* value = NodeProperties::GetValueInput(node, 0);
577 ReplaceWithValue(node, value);
584 Reduction JSIntrinsicLowering::ReduceToString(Node* node) {
585 NodeProperties::ChangeOp(node, javascript()->ToString());
586 return Changed(node);
590 Reduction JSIntrinsicLowering::ReduceCall(Node* node) {
591 size_t const arity = CallRuntimeParametersOf(node->op()).arity();
593 node, javascript()->CallFunction(arity, STRICT, VectorSlotPair(),
596 return Changed(node);
600 Reduction JSIntrinsicLowering::ReduceTailCall(Node* node) {
601 size_t const arity = CallRuntimeParametersOf(node->op()).arity();
603 node, javascript()->CallFunction(arity, STRICT, VectorSlotPair(),
606 return Changed(node);
610 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) {
611 Node* active_function = NodeProperties::GetValueInput(node, 0);
612 Node* effect = NodeProperties::GetEffectInput(node);
613 Node* control = NodeProperties::GetControlInput(node);
614 Node* active_function_map = effect =
617 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()),
622 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
623 Node* b) {
624 RelaxControls(node);
625 node->ReplaceInput(0, a);
626 node->ReplaceInput(1, b);
627 node->TrimInputCount(2);
628 NodeProperties::ChangeOp(node, op);
629 return Changed(node);
633 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
634 Node* b, Node* c) {
635 RelaxControls(node);
636 node->ReplaceInput(0, a);
637 node->ReplaceInput(1, b);
638 node->ReplaceInput(2, c);
639 node->TrimInputCount(3);
640 NodeProperties::ChangeOp(node, op);
641 return Changed(node);
645 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
646 Node* b, Node* c, Node* d) {
647 RelaxControls(node);
648 node->ReplaceInput(0, a);
649 node->ReplaceInput(1, b);
650 node->ReplaceInput(2, c);
651 node->ReplaceInput(3, d);
652 node->TrimInputCount(4);
653 NodeProperties::ChangeOp(node, op);
654 return Changed(node);
658 Reduction JSIntrinsicLowering::ChangeToUndefined(Node* node, Node* effect) {
659 ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect);
660 return Changed(node);
664 Reduction JSIntrinsicLowering::Change(Node* node, Callable const& callable,
668 CallDescriptor::kNeedsFrameState, node->op()->properties());
669 node->InsertInput(graph()->zone(), 0,
671 NodeProperties::ChangeOp(node, common()->Call(desc));
672 return Changed(node);