Home | History | Annotate | Download | only in compiler

Lines Matching refs:node

11 #include "src/compiler/node-matchers.h"
12 #include "src/compiler/node-properties.h"
19 static CallDescriptor::Flags AdjustFrameStatesForCall(Node* node) {
20 int count = OperatorProperties::GetFrameStateInputCount(node->op());
22 int index = NodeProperties::FirstFrameStateIndex(node) + 1;
24 node->RemoveInput(index);
36 Reduction JSGenericLowering::Reduce(Node* node) {
37 switch (node->opcode()) {
40 Lower##x(node); \
48 return Changed(node);
51 void JSGenericLowering::Lower##op(Node* node) { \
52 ReplaceWithRuntimeCall(node, fun); \
60 void JSGenericLowering::LowerJS##Name(Node* node) { \
61 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \
63 ReplaceWithStubCall(node, callable, flags); \
91 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
93 ReplaceWithStubCall(node, callable, flags, node->op()->properties());
96 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable,
101 Node* stub_code = jsgraph()->HeapConstant(callable.code());
102 node->InsertInput(zone(), 0, stub_code);
103 NodeProperties::ChangeOp(node, common()->Call(desc));
107 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
110 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
111 Operator::Properties properties = node->op()->properties();
116 Node* ref = jsgraph()->ExternalConstant(ExternalReference(f, isolate()));
117 Node* arity = jsgraph()->Int32Constant(nargs);
118 node->InsertInput(zone(), 0, jsgraph()->CEntryStubConstant(fun->result_size));
119 node->InsertInput(zone(), nargs + 1, ref);
120 node->InsertInput(zone(), nargs + 2, arity);
121 NodeProperties::ChangeOp(node, common()->Call(desc));
124 void JSGenericLowering::LowerJSStrictEqual(Node* node) {
126 node->AppendInput(zone(), graph()->start());
127 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags,
131 void JSGenericLowering::LowerJSStrictNotEqual(Node* node) {
133 node->AppendInput(zone(), graph()->start());
134 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags,
138 void JSGenericLowering::LowerJSToBoolean(Node* node) {
140 node->AppendInput(zone(), graph()->start());
141 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate,
145 void JSGenericLowering::LowerJSTypeOf(Node* node) {
147 node->AppendInput(zone(), graph()->start());
148 ReplaceWithStubCall(node, callable, CallDescriptor::kNoAllocate,
153 void JSGenericLowering::LowerJSLoadProperty(Node* node) {
154 Node* closure = NodeProperties::GetValueInput(node, 2);
155 Node* effect = NodeProperties::GetEffectInput(node);
156 Node* control = NodeProperties::GetControlInput(node);
157 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
158 const PropertyAccess& p = PropertyAccessOf(node->op());
161 Node* literals = effect = graph()->NewNode(
165 Node* vector = effect = graph()->NewNode(
170 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
171 node->ReplaceInput(3, vector);
172 node->ReplaceInput(6, effect);
173 ReplaceWithStubCall(node, callable, flags);
177 void JSGenericLowering::LowerJSLoadNamed(Node* node) {
178 Node* closure = NodeProperties::GetValueInput(node, 1);
179 Node* effect = NodeProperties::GetEffectInput(node);
180 Node* control = NodeProperties::GetControlInput(node);
181 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
182 NamedAccess const& p = NamedAccessOf(node->op());
185 Node* literals = effect = graph()->NewNode(
189 Node* vector = effect = graph()->NewNode(
194 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
195 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
196 node->ReplaceInput(3, vector);
197 node->ReplaceInput(6, effect);
198 ReplaceWithStubCall(node, callable, flags);
202 void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
203 Node* closure = NodeProperties::GetValueInput(node, 0);
204 Node* effect = NodeProperties::GetEffectInput(node);
205 Node* control = NodeProperties::GetControlInput(node);
206 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
207 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
211 Node* literals = effect = graph()->NewNode(
215 Node* vector = effect = graph()->NewNode(
220 node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index()));
221 node->ReplaceInput(1, vector);
222 node->ReplaceInput(4, effect);
223 ReplaceWithStubCall(node, callable, flags);
227 void JSGenericLowering::LowerJSStoreProperty(Node* node) {
228 Node* closure = NodeProperties::GetValueInput(node, 3);
229 Node* effect = NodeProperties::GetEffectInput(node);
230 Node* control = NodeProperties::GetControlInput(node);
231 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
232 PropertyAccess const& p = PropertyAccessOf(node->op());
237 Node* literals = effect = graph()->NewNode(
241 Node* vector = effect = graph()->NewNode(
246 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
247 node->ReplaceInput(4, vector);
248 node->ReplaceInput(7, effect);
249 ReplaceWithStubCall(node, callable, flags);
253 void JSGenericLowering::LowerJSStoreNamed(Node* node) {
254 Node* closure = NodeProperties::GetValueInput(node, 2);
255 Node* effect = NodeProperties::GetEffectInput(node);
256 Node* control = NodeProperties::GetControlInput(node);
257 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
258 NamedAccess const& p = NamedAccessOf(node->op());
262 Node* literals = effect = graph()->NewNode(
266 Node* vector = effect = graph()->NewNode(
271 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
272 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
273 node->ReplaceInput(4, vector);
274 node->ReplaceInput(7, effect);
275 ReplaceWithStubCall(node, callable, flags);
279 void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
280 Node* closure = NodeProperties::GetValueInput(node, 1);
281 Node* context = NodeProperties::GetContextInput(node);
282 Node* effect = NodeProperties::GetEffectInput(node);
283 Node* control = NodeProperties::GetControlInput(node);
284 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
285 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
289 Node* literals = effect = graph()->NewNode(
293 Node* vector = effect = graph()->NewNode(
299 Node* native_context = effect =
304 Node* global = effect = graph()->NewNode(
308 node->InsertInput(zone(), 0, global);
309 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
310 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
311 node->ReplaceInput(4, vector);
312 node->ReplaceInput(7, effect);
313 ReplaceWithStubCall(node, callable, flags);
317 void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
318 LanguageMode language_mode = OpParameter<LanguageMode>(node);
319 ReplaceWithRuntimeCall(node, is_strict(language_mode)
325 void JSGenericLowering::LowerJSInstanceOf(Node* node) {
326 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
328 ReplaceWithStubCall(node, callable, flags);
332 void JSGenericLowering::LowerJSLoadContext(Node* node) {
333 const ContextAccess& access = ContextAccessOf(node->op());
335 node->ReplaceInput(
337 NodeProperties::GetValueInput(node, 0),
340 NodeProperties::GetEffectInput(node),
343 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
345 node->AppendInput(zone(), graph()->start());
346 NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged()));
350 void JSGenericLowering::LowerJSStoreContext(Node* node) {
351 const ContextAccess& access = ContextAccessOf(node->op());
353 node->ReplaceInput(
355 NodeProperties::GetValueInput(node, 0),
358 NodeProperties::GetEffectInput(node),
361 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
362 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
365 node, machine()->Store(StoreRepresentation(MachineRepresentation::kTagged,
370 void JSGenericLowering::LowerJSCreate(Node* node) {
371 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
373 ReplaceWithStubCall(node, callable, flags);
377 void JSGenericLowering::LowerJSCreateArguments(Node* node) {
378 CreateArgumentsType const type = CreateArgumentsTypeOf(node->op());
381 ReplaceWithRuntimeCall(node, Runtime::kNewSloppyArguments_Generic);
384 ReplaceWithRuntimeCall(node, Runtime::kNewStrictArguments);
387 ReplaceWithRuntimeCall(node, Runtime::kNewRestParameter);
393 void JSGenericLowering::LowerJSCreateArray(Node* node) {
394 CreateArrayParameters const& p = CreateArrayParametersOf(node->op());
406 // Reduce {node} to the appropriate ArrayConstructorStub backend.
421 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode()));
422 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site));
423 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(0));
424 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
425 NodeProperties::ChangeOp(node, common()->Call(desc));
433 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode()));
434 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site));
435 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(1));
436 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
437 NodeProperties::ChangeOp(node, common()->Call(desc));
443 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode()));
444 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site));
445 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(arity));
446 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
447 NodeProperties::ChangeOp(node, common()->Call(desc));
450 Node* new_target = node->InputAt(1);
451 Node* type_info = site.is_null() ? jsgraph()->UndefinedConstant()
453 node->RemoveInput(1);
454 node->InsertInput(zone(), 1 + arity, new_target);
455 node->InsertInput(zone(), 2 + arity, type_info);
456 ReplaceWithRuntimeCall(node, Runtime::kNewArray, arity + 3);
461 void JSGenericLowering::LowerJSCreateClosure(Node* node) {
462 CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
463 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
465 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info));
471 ReplaceWithStubCall(node, callable, flags);
473 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED)
480 void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) {
481 int const slot_count = OpParameter<int>(node->op());
482 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
487 ReplaceWithStubCall(node, callable, flags);
489 ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext);
494 void JSGenericLowering::LowerJSCreateIterResultObject(Node* node) {
495 ReplaceWithRuntimeCall(node, Runtime::kCreateIterResultObject);
499 void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
500 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
501 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
502 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index()));
503 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
510 ReplaceWithStubCall(node, callable, flags);
512 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
513 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral);
518 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) {
519 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
520 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
521 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index()));
522 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
523 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
531 ReplaceWithStubCall(node, callable, flags);
533 ReplaceWithRuntimeCall(node, Runtime::kCreateObjectLiteral);
538 void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) {
539 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
540 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
542 Node* literal_index = jsgraph()->SmiConstant(p.index());
543 Node* literal_flags = jsgraph()->SmiConstant(p.flags());
544 Node* pattern = jsgraph()->HeapConstant(p.constant());
545 node->InsertInput(graph()->zone(), 1, literal_index);
546 node->InsertInput(graph()->zone(), 2, pattern);
547 node->InsertInput(graph()->zone(), 3, literal_flags);
548 ReplaceWithStubCall(node, callable, flags);
552 void JSGenericLowering::LowerJSCreateCatchContext(Node* node) {
553 Handle<String> name = OpParameter<Handle<String>>(node);
554 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(name));
555 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext);
559 void JSGenericLowering::LowerJSCreateBlockContext(Node* node) {
560 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node);
561 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
562 ReplaceWithRuntimeCall(node, Runtime::kPushBlockContext);
566 void JSGenericLowering::LowerJSCreateScriptContext(Node* node) {
567 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node);
568 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(scope_info));
569 ReplaceWithRuntimeCall(node, Runtime::kNewScriptContext);
573 void JSGenericLowering::LowerJSCallConstruct(Node* node) {
574 CallConstructParameters const& p = CallConstructParametersOf(node->op());
576 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
580 Node* stub_code = jsgraph()->HeapConstant(callable.code());
581 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
582 Node* new_target = node->InputAt(arg_count + 1);
583 Node* receiver = jsgraph()->UndefinedConstant();
584 node->RemoveInput(arg_count + 1); // Drop new target.
585 node->InsertInput(zone(), 0, stub_code);
586 node->InsertInput(zone(), 2, new_target);
587 node->InsertInput(zone(), 3, stub_arity);
588 node->InsertInput(zone(), 4, receiver);
589 NodeProperties::ChangeOp(node, common()->Call(desc));
593 void JSGenericLowering::LowerJSCallFunction(Node* node) {
594 CallFunctionParameters const& p = CallFunctionParametersOf(node->op());
598 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
604 Node* stub_code = jsgraph()->HeapConstant(callable.code());
605 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
606 node->InsertInput(zone(), 0, stub_code);
607 node->InsertInput(zone(), 2, stub_arity);
608 NodeProperties::ChangeOp(node, common()->Call(desc));
612 void JSGenericLowering::LowerJSCallRuntime(Node* node) {
613 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op());
614 AdjustFrameStatesForCall(node);
615 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity()));
619 void JSGenericLowering::LowerJSForInDone(Node* node) {
620 ReplaceWithRuntimeCall(node, Runtime::kForInDone);
624 void JSGenericLowering::LowerJSForInNext(Node* node) {
625 ReplaceWithRuntimeCall(node, Runtime::kForInNext);
629 void JSGenericLowering::LowerJSForInPrepare(Node* node) {
630 ReplaceWithRuntimeCall(node, Runtime::kForInPrepare);
634 void JSGenericLowering::LowerJSForInStep(Node* node) {
635 ReplaceWithRuntimeCall(node, Runtime::kForInStep);
639 void JSGenericLowering::LowerJSLoadMessage(Node* node) {
642 node->RemoveInput(NodeProperties::FirstContextIndex(node));
643 node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address));
644 node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0));
645 NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged()));
649 void JSGenericLowering::LowerJSStoreMessage(Node* node) {
652 node->RemoveInput(NodeProperties::FirstContextIndex(node));
653 node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address));
654 node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0));
657 NodeProperties::ChangeOp(node, machine()->Store(representation));
660 void JSGenericLowering::LowerJSGeneratorStore(Node* node) {
664 void JSGenericLowering::LowerJSGeneratorRestoreContinuation(Node* node) {
668 void JSGenericLowering::LowerJSGeneratorRestoreRegister(Node* node) {
672 void JSGenericLowering::LowerJSStackCheck(Node* node) {
673 Node* effect = NodeProperties::GetEffectInput(node);
674 Node* control = NodeProperties::GetControlInput(node);
676 Node* limit = graph()->NewNode(
681 Node* pointer = graph()->NewNode(machine()->LoadStackPointer());
683 Node* check = graph()->NewNode(machine()->UintLessThan(), limit, pointer);
684 Node* branch =
687 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
688 Node* etrue = effect;
690 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
691 NodeProperties::ReplaceControlInput(node, if_false);
692 Node* efalse = node;
694 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
695 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
697 // Wire the new diamond into the graph, {node} can still throw.
698 NodeProperties::ReplaceUses(node, node, ephi, node, node);
702 // the node and places it inside the diamond. Come up with a helper method!
703 for (Node* use : node->uses()) {
711 ReplaceWithRuntimeCall(node, Runtime::kStackGuard);