Lines Matching refs:Node
13 #include "src/compiler/node-matchers.h"
14 #include "src/compiler/node-properties.h"
27 Reduction JSIntrinsicLowering::Reduce(Node* node) {
28 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange();
30 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id());
34 return ReduceCreateIterResultObject(node);
36 return ReduceDebugIsActive(node);
38 return ReduceDeoptimizeNow(node);
40 return ReduceGeneratorClose(node);
42 return ReduceCreateJSGeneratorObject(node);
44 return ReduceGeneratorGetInputOrDebugPos(node);
46 return ReduceAsyncGeneratorReject(node);
48 return ReduceAsyncGeneratorResolve(node);
50 return ReduceAsyncGeneratorYield(node);
52 return ReduceGeneratorGetResumeMode(node);
54 return ReduceIsInstanceType(node, JS_ARRAY_TYPE);
56 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
58 return ReduceIsInstanceType(node, JS_PROXY_TYPE);
60 return ReduceIsJSReceiver(node);
62 return ReduceIsSmi(node);
64 return ReduceRejectPromise(node);
66 return ReduceResolvePromise(node);
68 return ReduceToInteger(node);
70 return ReduceToLength(node);
72 return ReduceToNumber(node);
74 return ReduceToObject(node);
76 return ReduceToString(node);
78 return ReduceCall(node);
86 Reduction JSIntrinsicLowering::ReduceCreateIterResultObject(Node* node) {
87 Node* const value = NodeProperties::GetValueInput(node, 0);
88 Node* const done = NodeProperties::GetValueInput(node, 1);
89 Node* const context = NodeProperties::GetContextInput(node);
90 Node* const effect = NodeProperties::GetEffectInput(node);
91 return Change(node, javascript()->CreateIterResultObject(), value, done,
95 Reduction JSIntrinsicLowering::ReduceDebugIsActive(Node* node) {
96 Node* const value = jsgraph()->ExternalConstant(
98 Node* const effect = NodeProperties::GetEffectInput(node);
99 Node* const control = NodeProperties::GetControlInput(node);
102 return Change(node, op, value, effect, control);
105 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
106 Node* const frame_state = NodeProperties::GetFrameStateInput(node);
107 Node* const effect = NodeProperties::GetEffectInput(node);
108 Node* const control = NodeProperties::GetControlInput(node);
111 Node* deoptimize = graph()->NewNode(
118 node->TrimInputCount(0);
119 NodeProperties::ChangeOp(node, common()->Dead());
120 return Changed(node);
123 Reduction JSIntrinsicLowering::ReduceCreateJSGeneratorObject(Node* node) {
124 Node* const closure = NodeProperties::GetValueInput(node, 0);
125 Node* const receiver = NodeProperties::GetValueInput(node, 1);
126 Node* const context = NodeProperties::GetContextInput(node);
127 Node* const effect = NodeProperties::GetEffectInput(node);
128 Node* const control = NodeProperties::GetControlInput(node);
130 Node* create_generator =
132 ReplaceWithValue(node, create_generator, create_generator);
136 Reduction JSIntrinsicLowering::ReduceGeneratorClose(Node* node) {
137 Node* const generator = NodeProperties::GetValueInput(node, 0);
138 Node* const effect = NodeProperties::GetEffectInput(node);
139 Node* const control = NodeProperties::GetControlInput(node);
140 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed);
141 Node* const undefined = jsgraph()->UndefinedConstant();
145 ReplaceWithValue(node, undefined, node);
146 NodeProperties::RemoveType(node);
147 return Change(node, op, generator, closed, effect, control);
150 Reduction JSIntrinsicLowering::ReduceGeneratorGetInputOrDebugPos(Node* node) {
151 Node* const generator = NodeProperties::GetValueInput(node, 0);
152 Node* const effect = NodeProperties::GetEffectInput(node);
153 Node* const control = NodeProperties::GetControlInput(node);
157 return Change(node, op, generator, effect, control);
160 Reduction JSIntrinsicLowering::ReduceAsyncGeneratorReject(Node* node) {
162 node, Builtins::CallableFor(isolate(), Builtins::kAsyncGeneratorReject),
166 Reduction JSIntrinsicLowering::ReduceAsyncGeneratorResolve(Node* node) {
168 node, Builtins::CallableFor(isolate(), Builtins::kAsyncGeneratorResolve),
172 Reduction JSIntrinsicLowering::ReduceAsyncGeneratorYield(Node* node) {
174 node, Builtins::CallableFor(isolate(), Builtins::kAsyncGeneratorYield),
178 Reduction JSIntrinsicLowering::ReduceGeneratorGetResumeMode(Node* node) {
179 Node* const generator = NodeProperties::GetValueInput(node, 0);
180 Node* const effect = NodeProperties::GetEffectInput(node);
181 Node* const control = NodeProperties::GetControlInput(node);
185 return Change(node, op, generator, effect, control);
189 Node* node, InstanceType instance_type) {
195 Node* value = NodeProperties::GetValueInput(node, 0);
196 Node* effect = NodeProperties::GetEffectInput(node);
197 Node* control = NodeProperties::GetControlInput(node);
199 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
200 Node* branch = graph()->NewNode(common()->Branch(), check, control);
202 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
203 Node* etrue = effect;
204 Node* vtrue = jsgraph()->FalseConstant();
206 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
207 Node* efalse = effect;
208 Node* map = efalse =
211 Node* map_instance_type = efalse = graph()->NewNode(
214 Node* vfalse =
218 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
220 // Replace all effect uses of {node} with the {ephi}.
221 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
222 ReplaceWithValue(node, node, ephi, merge);
224 // Turn the {node} into a Phi.
225 return Change(node, common()->Phi(MachineRepresentation::kTagged, 2), vtrue,
230 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) {
231 return Change(node, simplified()->ObjectIsReceiver());
235 Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) {
236 return Change(node, simplified()->ObjectIsSmi());
239 Reduction JSIntrinsicLowering::ReduceRejectPromise(Node* node) {
240 RelaxControls(node);
241 NodeProperties::ChangeOp(node, javascript()->RejectPromise());
242 return Changed(node);
245 Reduction JSIntrinsicLowering::ReduceResolvePromise(Node* node) {
246 RelaxControls(node);
247 NodeProperties::ChangeOp(node, javascript()->ResolvePromise());
248 return Changed(node);
251 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op) {
252 // Replace all effect uses of {node} with the effect dependency.
253 RelaxEffectsAndControls(node);
255 NodeProperties::RemoveNonValueInputs(node);
257 NodeProperties::ChangeOp(node, op);
258 return Changed(node);
261 Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) {
262 NodeProperties::ChangeOp(node, javascript()->ToInteger());
263 return Changed(node);
267 Reduction JSIntrinsicLowering::ReduceToNumber(Node* node) {
268 NodeProperties::ChangeOp(node, javascript()->ToNumber());
269 return Changed(node);
273 Reduction JSIntrinsicLowering::ReduceToLength(Node* node) {
274 NodeProperties::ChangeOp(node, javascript()->ToLength());
275 return Changed(node);
279 Reduction JSIntrinsicLowering::ReduceToObject(Node* node) {
280 NodeProperties::ChangeOp(node, javascript()->ToObject());
281 return Changed(node);
285 Reduction JSIntrinsicLowering::ReduceToString(Node* node) {
287 HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
289 ReplaceWithValue(node, m.node());
290 return Replace(m.node());
292 NodeProperties::ChangeOp(node, javascript()->ToString());
293 return Changed(node);
297 Reduction JSIntrinsicLowering::ReduceCall(Node* node) {
298 size_t const arity = CallRuntimeParametersOf(node->op()).arity();
299 NodeProperties::ChangeOp(node, javascript()->Call(arity));
300 return Changed(node);
303 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) {
304 NodeProperties::ChangeOp(node, javascript()->GetSuperConstructor());
305 return Changed(node);
308 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
309 Node* b) {
310 RelaxControls(node);
311 node->ReplaceInput(0, a);
312 node->ReplaceInput(1, b);
313 node->TrimInputCount(2);
314 NodeProperties::ChangeOp(node, op);
315 return Changed(node);
319 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
320 Node* b, Node* c) {
321 RelaxControls(node);
322 node->ReplaceInput(0, a);
323 node->ReplaceInput(1, b);
324 node->ReplaceInput(2, c);
325 node->TrimInputCount(3);
326 NodeProperties::ChangeOp(node, op);
327 return Changed(node);
331 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
332 Node* b, Node* c, Node* d) {
333 RelaxControls(node);
334 node->ReplaceInput(0, a);
335 node->ReplaceInput(1, b);
336 node->ReplaceInput(2, c);
337 node->ReplaceInput(3, d);
338 node->TrimInputCount(4);
339 NodeProperties::ChangeOp(node, op);
340 return Changed(node);
344 Reduction JSIntrinsicLowering::Change(Node* node, Callable const& callable,
348 CallDescriptor::kNeedsFrameState, node->op()->properties());
349 node->InsertInput(graph()->zone(), 0,
351 NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
352 return Changed(node);