Line data Source code
1 : // Copyright 2014 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/compiler/js-generic-lowering.h"
6 :
7 : #include "src/ast/ast.h"
8 : #include "src/builtins/builtins-constructor.h"
9 : #include "src/code-factory.h"
10 : #include "src/compiler/common-operator.h"
11 : #include "src/compiler/js-graph.h"
12 : #include "src/compiler/machine-operator.h"
13 : #include "src/compiler/node-matchers.h"
14 : #include "src/compiler/node-properties.h"
15 : #include "src/compiler/operator-properties.h"
16 : #include "src/feedback-vector.h"
17 : #include "src/objects/feedback-cell.h"
18 : #include "src/objects/scope-info.h"
19 :
20 : namespace v8 {
21 : namespace internal {
22 : namespace compiler {
23 :
24 : namespace {
25 :
26 : CallDescriptor::Flags FrameStateFlagForCall(Node* node) {
27 3665885 : return OperatorProperties::HasFrameStateInput(node->op())
28 : ? CallDescriptor::kNeedsFrameState
29 3665900 : : CallDescriptor::kNoFlags;
30 : }
31 :
32 : } // namespace
33 :
34 927630 : JSGenericLowering::JSGenericLowering(JSGraph* jsgraph) : jsgraph_(jsgraph) {}
35 :
36 : JSGenericLowering::~JSGenericLowering() = default;
37 :
38 :
39 45423882 : Reduction JSGenericLowering::Reduce(Node* node) {
40 45423882 : switch (node->opcode()) {
41 : #define DECLARE_CASE(x) \
42 : case IrOpcode::k##x: \
43 : Lower##x(node); \
44 : break;
45 11924 : JS_OP_LIST(DECLARE_CASE)
46 : #undef DECLARE_CASE
47 : default:
48 : // Nothing to see.
49 : return NoChange();
50 : }
51 : return Changed(node);
52 : }
53 :
54 : #define REPLACE_STUB_CALL(Name) \
55 : void JSGenericLowering::LowerJS##Name(Node* node) { \
56 : CallDescriptor::Flags flags = FrameStateFlagForCall(node); \
57 : Callable callable = Builtins::CallableFor(isolate(), Builtins::k##Name); \
58 : ReplaceWithStubCall(node, callable, flags); \
59 : }
60 172770 : REPLACE_STUB_CALL(Add)
61 25770 : REPLACE_STUB_CALL(Subtract)
62 37760 : REPLACE_STUB_CALL(Multiply)
63 53225 : REPLACE_STUB_CALL(Divide)
64 3130 : REPLACE_STUB_CALL(Modulus)
65 755 : REPLACE_STUB_CALL(Exponentiate)
66 35590 : REPLACE_STUB_CALL(BitwiseAnd)
67 44185 : REPLACE_STUB_CALL(BitwiseOr)
68 1285 : REPLACE_STUB_CALL(BitwiseXor)
69 9895 : REPLACE_STUB_CALL(ShiftLeft)
70 2655 : REPLACE_STUB_CALL(ShiftRight)
71 4660 : REPLACE_STUB_CALL(ShiftRightLogical)
72 94820 : REPLACE_STUB_CALL(LessThan)
73 7265 : REPLACE_STUB_CALL(LessThanOrEqual)
74 83525 : REPLACE_STUB_CALL(GreaterThan)
75 7715 : REPLACE_STUB_CALL(GreaterThanOrEqual)
76 660 : REPLACE_STUB_CALL(BitwiseNot)
77 10220 : REPLACE_STUB_CALL(Decrement)
78 51655 : REPLACE_STUB_CALL(Increment)
79 19725 : REPLACE_STUB_CALL(Negate)
80 7655 : REPLACE_STUB_CALL(HasProperty)
81 45435 : REPLACE_STUB_CALL(Equal)
82 135 : REPLACE_STUB_CALL(ToLength)
83 38065 : REPLACE_STUB_CALL(ToNumber)
84 350 : REPLACE_STUB_CALL(ToNumberConvertBigInt)
85 14550 : REPLACE_STUB_CALL(ToNumeric)
86 5385 : REPLACE_STUB_CALL(ToName)
87 0 : REPLACE_STUB_CALL(ToObject)
88 10670 : REPLACE_STUB_CALL(ToString)
89 7140 : REPLACE_STUB_CALL(ForInEnumerate)
90 615 : REPLACE_STUB_CALL(AsyncFunctionEnter)
91 530 : REPLACE_STUB_CALL(AsyncFunctionReject)
92 555 : REPLACE_STUB_CALL(AsyncFunctionResolve)
93 3715 : REPLACE_STUB_CALL(FulfillPromise)
94 885 : REPLACE_STUB_CALL(PerformPromiseThen)
95 470 : REPLACE_STUB_CALL(PromiseResolve)
96 5415 : REPLACE_STUB_CALL(RejectPromise)
97 1415 : REPLACE_STUB_CALL(ResolvePromise)
98 : #undef REPLACE_STUB_CALL
99 :
100 2285095 : void JSGenericLowering::ReplaceWithStubCall(Node* node,
101 : Callable callable,
102 : CallDescriptor::Flags flags) {
103 4570189 : ReplaceWithStubCall(node, callable, flags, node->op()->properties());
104 2285094 : }
105 :
106 2372043 : void JSGenericLowering::ReplaceWithStubCall(Node* node,
107 : Callable callable,
108 : CallDescriptor::Flags flags,
109 : Operator::Properties properties) {
110 : const CallInterfaceDescriptor& descriptor = callable.descriptor();
111 : auto call_descriptor = Linkage::GetStubCallDescriptor(
112 : zone(), descriptor, descriptor.GetStackParameterCount(), flags,
113 2372043 : properties);
114 2372042 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
115 2372045 : node->InsertInput(zone(), 0, stub_code);
116 2372047 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
117 2372043 : }
118 :
119 :
120 869568 : void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
121 : Runtime::FunctionId f,
122 : int nargs_override) {
123 869582 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
124 869582 : Operator::Properties properties = node->op()->properties();
125 869582 : const Runtime::Function* fun = Runtime::FunctionForId(f);
126 869564 : int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
127 : auto call_descriptor =
128 869564 : Linkage::GetRuntimeCallDescriptor(zone(), f, nargs, properties, flags);
129 869575 : Node* ref = jsgraph()->ExternalConstant(ExternalReference::Create(f));
130 869589 : Node* arity = jsgraph()->Int32Constant(nargs);
131 869587 : node->InsertInput(zone(), 0, jsgraph()->CEntryStubConstant(fun->result_size));
132 869588 : node->InsertInput(zone(), nargs + 1, ref);
133 869589 : node->InsertInput(zone(), nargs + 2, arity);
134 869582 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
135 869582 : }
136 :
137 86949 : void JSGenericLowering::LowerJSStrictEqual(Node* node) {
138 : // The === operator doesn't need the current context.
139 86949 : NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant());
140 86949 : Callable callable = Builtins::CallableFor(isolate(), Builtins::kStrictEqual);
141 86949 : node->RemoveInput(4); // control
142 86949 : ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags,
143 86949 : Operator::kEliminatable);
144 86949 : }
145 :
146 38983 : void JSGenericLowering::LowerJSLoadProperty(Node* node) {
147 38983 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
148 38983 : const PropertyAccess& p = PropertyAccessOf(node->op());
149 38983 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
150 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
151 77966 : node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
152 38983 : if (outer_state->opcode() != IrOpcode::kFrameState) {
153 : Callable callable = Builtins::CallableFor(
154 : isolate(), p.feedback().ic_state() == MEGAMORPHIC
155 : ? Builtins::kKeyedLoadICTrampoline_Megamorphic
156 36743 : : Builtins::kKeyedLoadICTrampoline);
157 73486 : ReplaceWithStubCall(node, callable, flags);
158 : } else {
159 : Callable callable = Builtins::CallableFor(
160 : isolate(), p.feedback().ic_state() == MEGAMORPHIC
161 : ? Builtins::kKeyedLoadIC_Megamorphic
162 2240 : : Builtins::kKeyedLoadIC);
163 2240 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
164 2240 : node->InsertInput(zone(), 3, vector);
165 4480 : ReplaceWithStubCall(node, callable, flags);
166 : }
167 38983 : }
168 :
169 434828 : void JSGenericLowering::LowerJSLoadNamed(Node* node) {
170 434828 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
171 434828 : NamedAccess const& p = NamedAccessOf(node->op());
172 434828 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
173 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
174 434828 : node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
175 434829 : if (!p.feedback().IsValid()) {
176 : Callable callable =
177 182844 : Builtins::CallableFor(isolate(), Builtins::kGetProperty);
178 365688 : ReplaceWithStubCall(node, callable, flags);
179 : return;
180 : }
181 503970 : node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
182 251985 : if (outer_state->opcode() != IrOpcode::kFrameState) {
183 : Callable callable = Builtins::CallableFor(
184 : isolate(), p.feedback().ic_state() == MEGAMORPHIC
185 : ? Builtins::kLoadICTrampoline_Megamorphic
186 249125 : : Builtins::kLoadICTrampoline);
187 498250 : ReplaceWithStubCall(node, callable, flags);
188 : } else {
189 : Callable callable =
190 : Builtins::CallableFor(isolate(), p.feedback().ic_state() == MEGAMORPHIC
191 : ? Builtins::kLoadIC_Megamorphic
192 2860 : : Builtins::kLoadIC);
193 2860 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
194 2860 : node->InsertInput(zone(), 3, vector);
195 5720 : ReplaceWithStubCall(node, callable, flags);
196 : }
197 : }
198 :
199 832724 : void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
200 832724 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
201 832724 : const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
202 832724 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
203 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
204 832724 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
205 1665448 : node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
206 832724 : if (outer_state->opcode() != IrOpcode::kFrameState) {
207 820935 : Callable callable = CodeFactory::LoadGlobalIC(isolate(), p.typeof_mode());
208 1641870 : ReplaceWithStubCall(node, callable, flags);
209 : } else {
210 : Callable callable =
211 11789 : CodeFactory::LoadGlobalICInOptimizedCode(isolate(), p.typeof_mode());
212 11789 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
213 11789 : node->InsertInput(zone(), 2, vector);
214 23578 : ReplaceWithStubCall(node, callable, flags);
215 : }
216 832724 : }
217 :
218 8647 : void JSGenericLowering::LowerJSStoreProperty(Node* node) {
219 8647 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
220 8647 : PropertyAccess const& p = PropertyAccessOf(node->op());
221 8647 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
222 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
223 17294 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
224 8647 : if (outer_state->opcode() != IrOpcode::kFrameState) {
225 : Callable callable =
226 8458 : Builtins::CallableFor(isolate(), Builtins::kKeyedStoreICTrampoline);
227 16916 : ReplaceWithStubCall(node, callable, flags);
228 : } else {
229 : Callable callable =
230 189 : Builtins::CallableFor(isolate(), Builtins::kKeyedStoreIC);
231 189 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
232 189 : node->InsertInput(zone(), 4, vector);
233 378 : ReplaceWithStubCall(node, callable, flags);
234 : }
235 8647 : }
236 :
237 84818 : void JSGenericLowering::LowerJSStoreNamed(Node* node) {
238 84818 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
239 84818 : NamedAccess const& p = NamedAccessOf(node->op());
240 84818 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
241 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
242 84818 : node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
243 84818 : if (!p.feedback().IsValid()) {
244 19194 : ReplaceWithRuntimeCall(node, Runtime::kSetNamedProperty);
245 19194 : return;
246 : }
247 131248 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
248 65624 : if (outer_state->opcode() != IrOpcode::kFrameState) {
249 : Callable callable =
250 60253 : Builtins::CallableFor(isolate(), Builtins::kStoreICTrampoline);
251 120506 : ReplaceWithStubCall(node, callable, flags);
252 : } else {
253 5371 : Callable callable = Builtins::CallableFor(isolate(), Builtins::kStoreIC);
254 5371 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
255 5371 : node->InsertInput(zone(), 4, vector);
256 10742 : ReplaceWithStubCall(node, callable, flags);
257 : }
258 : }
259 :
260 30253 : void JSGenericLowering::LowerJSStoreNamedOwn(Node* node) {
261 30253 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
262 30253 : StoreNamedOwnParameters const& p = StoreNamedOwnParametersOf(node->op());
263 30253 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
264 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
265 30253 : node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
266 60506 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
267 30253 : if (outer_state->opcode() != IrOpcode::kFrameState) {
268 30220 : Callable callable = CodeFactory::StoreOwnIC(isolate());
269 60440 : ReplaceWithStubCall(node, callable, flags);
270 : } else {
271 33 : Callable callable = CodeFactory::StoreOwnICInOptimizedCode(isolate());
272 33 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
273 33 : node->InsertInput(zone(), 4, vector);
274 66 : ReplaceWithStubCall(node, callable, flags);
275 : }
276 30253 : }
277 :
278 206172 : void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
279 206172 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
280 206172 : const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
281 206172 : Node* frame_state = NodeProperties::GetFrameStateInput(node);
282 : Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
283 206172 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
284 412344 : node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
285 206172 : if (outer_state->opcode() != IrOpcode::kFrameState) {
286 : Callable callable =
287 206137 : Builtins::CallableFor(isolate(), Builtins::kStoreGlobalICTrampoline);
288 412274 : ReplaceWithStubCall(node, callable, flags);
289 : } else {
290 : Callable callable =
291 35 : Builtins::CallableFor(isolate(), Builtins::kStoreGlobalIC);
292 35 : Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
293 35 : node->InsertInput(zone(), 3, vector);
294 70 : ReplaceWithStubCall(node, callable, flags);
295 : }
296 206172 : }
297 :
298 444 : void JSGenericLowering::LowerJSStoreDataPropertyInLiteral(Node* node) {
299 444 : FeedbackParameter const& p = FeedbackParameterOf(node->op());
300 444 : node->InsertInputs(zone(), 4, 2);
301 444 : node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector()));
302 888 : node->ReplaceInput(5, jsgraph()->SmiConstant(p.feedback().index()));
303 444 : ReplaceWithRuntimeCall(node, Runtime::kDefineDataPropertyInLiteral);
304 444 : }
305 :
306 47152 : void JSGenericLowering::LowerJSStoreInArrayLiteral(Node* node) {
307 : Callable callable =
308 47152 : Builtins::CallableFor(isolate(), Builtins::kStoreInArrayLiteralIC);
309 47152 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
310 47152 : FeedbackParameter const& p = FeedbackParameterOf(node->op());
311 94304 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
312 47152 : node->InsertInput(zone(), 4, jsgraph()->HeapConstant(p.feedback().vector()));
313 94304 : ReplaceWithStubCall(node, callable, flags);
314 47152 : }
315 :
316 1069 : void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
317 1069 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
318 : Callable callable =
319 1069 : Builtins::CallableFor(isolate(), Builtins::kDeleteProperty);
320 2138 : ReplaceWithStubCall(node, callable, flags);
321 1069 : }
322 :
323 76 : void JSGenericLowering::LowerJSGetSuperConstructor(Node* node) {
324 76 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
325 : Callable callable =
326 76 : Builtins::CallableFor(isolate(), Builtins::kGetSuperConstructor);
327 152 : ReplaceWithStubCall(node, callable, flags);
328 76 : }
329 :
330 0 : void JSGenericLowering::LowerJSHasInPrototypeChain(Node* node) {
331 0 : ReplaceWithRuntimeCall(node, Runtime::kHasInPrototypeChain);
332 0 : }
333 :
334 2837 : void JSGenericLowering::LowerJSInstanceOf(Node* node) {
335 2837 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
336 2837 : Callable callable = Builtins::CallableFor(isolate(), Builtins::kInstanceOf);
337 5674 : ReplaceWithStubCall(node, callable, flags);
338 2837 : }
339 :
340 136 : void JSGenericLowering::LowerJSOrdinaryHasInstance(Node* node) {
341 136 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
342 : Callable callable =
343 136 : Builtins::CallableFor(isolate(), Builtins::kOrdinaryHasInstance);
344 272 : ReplaceWithStubCall(node, callable, flags);
345 136 : }
346 :
347 0 : void JSGenericLowering::LowerJSLoadContext(Node* node) {
348 0 : UNREACHABLE(); // Eliminated in typed lowering.
349 : }
350 :
351 :
352 0 : void JSGenericLowering::LowerJSStoreContext(Node* node) {
353 0 : UNREACHABLE(); // Eliminated in typed lowering.
354 : }
355 :
356 :
357 276 : void JSGenericLowering::LowerJSCreate(Node* node) {
358 276 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
359 : Callable callable =
360 276 : Builtins::CallableFor(isolate(), Builtins::kFastNewObject);
361 552 : ReplaceWithStubCall(node, callable, flags);
362 276 : }
363 :
364 :
365 8 : void JSGenericLowering::LowerJSCreateArguments(Node* node) {
366 8 : CreateArgumentsType const type = CreateArgumentsTypeOf(node->op());
367 8 : switch (type) {
368 : case CreateArgumentsType::kMappedArguments:
369 8 : ReplaceWithRuntimeCall(node, Runtime::kNewSloppyArguments_Generic);
370 8 : break;
371 : case CreateArgumentsType::kUnmappedArguments:
372 0 : ReplaceWithRuntimeCall(node, Runtime::kNewStrictArguments);
373 0 : break;
374 : case CreateArgumentsType::kRestParameter:
375 0 : ReplaceWithRuntimeCall(node, Runtime::kNewRestParameter);
376 0 : break;
377 : }
378 8 : }
379 :
380 :
381 119 : void JSGenericLowering::LowerJSCreateArray(Node* node) {
382 119 : CreateArrayParameters const& p = CreateArrayParametersOf(node->op());
383 119 : int const arity = static_cast<int>(p.arity());
384 238 : auto call_descriptor = Linkage::GetStubCallDescriptor(
385 : zone(), ArrayConstructorDescriptor{}, arity + 1,
386 119 : CallDescriptor::kNeedsFrameState, node->op()->properties());
387 119 : Node* stub_code = jsgraph()->ArrayConstructorStubConstant();
388 119 : Node* stub_arity = jsgraph()->Int32Constant(arity);
389 : MaybeHandle<AllocationSite> const maybe_site = p.site();
390 : Handle<AllocationSite> site;
391 : Node* type_info = maybe_site.ToHandle(&site) ? jsgraph()->HeapConstant(site)
392 194 : : jsgraph()->UndefinedConstant();
393 119 : Node* receiver = jsgraph()->UndefinedConstant();
394 119 : node->InsertInput(zone(), 0, stub_code);
395 119 : node->InsertInput(zone(), 3, stub_arity);
396 119 : node->InsertInput(zone(), 4, type_info);
397 119 : node->InsertInput(zone(), 5, receiver);
398 119 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
399 119 : }
400 :
401 0 : void JSGenericLowering::LowerJSCreateArrayIterator(Node* node) {
402 0 : UNREACHABLE(); // Eliminated in typed lowering.
403 : }
404 :
405 0 : void JSGenericLowering::LowerJSCreateAsyncFunctionObject(Node* node) {
406 0 : UNREACHABLE(); // Eliminated in typed lowering.
407 : }
408 :
409 0 : void JSGenericLowering::LowerJSCreateCollectionIterator(Node* node) {
410 0 : UNREACHABLE(); // Eliminated in typed lowering.
411 : }
412 :
413 0 : void JSGenericLowering::LowerJSCreateBoundFunction(Node* node) {
414 0 : UNREACHABLE(); // Eliminated in typed lowering.
415 : }
416 :
417 0 : void JSGenericLowering::LowerJSObjectIsArray(Node* node) {
418 0 : UNREACHABLE(); // Eliminated in typed lowering.
419 : }
420 :
421 64 : void JSGenericLowering::LowerJSCreateObject(Node* node) {
422 64 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
423 : Callable callable = Builtins::CallableFor(
424 64 : isolate(), Builtins::kCreateObjectWithoutProperties);
425 128 : ReplaceWithStubCall(node, callable, flags);
426 64 : }
427 :
428 206 : void JSGenericLowering::LowerJSParseInt(Node* node) {
429 206 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
430 206 : Callable callable = Builtins::CallableFor(isolate(), Builtins::kParseInt);
431 412 : ReplaceWithStubCall(node, callable, flags);
432 206 : }
433 :
434 481 : void JSGenericLowering::LowerJSRegExpTest(Node* node) {
435 481 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
436 : Callable callable =
437 481 : Builtins::CallableFor(isolate(), Builtins::kRegExpPrototypeTestFast);
438 962 : ReplaceWithStubCall(node, callable, flags);
439 481 : }
440 :
441 414670 : void JSGenericLowering::LowerJSCreateClosure(Node* node) {
442 414670 : CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
443 : Handle<SharedFunctionInfo> const shared_info = p.shared_info();
444 414673 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info));
445 414676 : node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.feedback_cell()));
446 414676 : node->RemoveInput(4); // control
447 :
448 : // Use the FastNewClosure builtin only for functions allocated in new space.
449 414676 : if (p.allocation() == AllocationType::kYoung) {
450 : Callable callable =
451 401306 : Builtins::CallableFor(isolate(), Builtins::kFastNewClosure);
452 401303 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
453 802607 : ReplaceWithStubCall(node, callable, flags);
454 : } else {
455 13370 : ReplaceWithRuntimeCall(node, Runtime::kNewClosure_Tenured);
456 : }
457 414674 : }
458 :
459 :
460 4721 : void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) {
461 : const CreateFunctionContextParameters& parameters =
462 4721 : CreateFunctionContextParametersOf(node->op());
463 : Handle<ScopeInfo> scope_info = parameters.scope_info();
464 : int slot_count = parameters.slot_count();
465 : ScopeType scope_type = parameters.scope_type();
466 4721 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
467 :
468 4721 : if (slot_count <= ConstructorBuiltins::MaximumFunctionContextSlots()) {
469 : Callable callable =
470 4721 : CodeFactory::FastNewFunctionContext(isolate(), scope_type);
471 4721 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
472 4721 : node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count));
473 9442 : ReplaceWithStubCall(node, callable, flags);
474 : } else {
475 0 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
476 0 : ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext);
477 : }
478 4721 : }
479 :
480 792 : void JSGenericLowering::LowerJSCreateGeneratorObject(Node* node) {
481 792 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
482 : Callable callable =
483 792 : Builtins::CallableFor(isolate(), Builtins::kCreateGeneratorObject);
484 792 : node->RemoveInput(4); // control
485 1584 : ReplaceWithStubCall(node, callable, flags);
486 792 : }
487 :
488 0 : void JSGenericLowering::LowerJSCreateIterResultObject(Node* node) {
489 0 : UNREACHABLE(); // Eliminated in typed lowering.
490 : }
491 :
492 0 : void JSGenericLowering::LowerJSCreateStringIterator(Node* node) {
493 0 : UNREACHABLE(); // Eliminated in typed lowering.
494 : }
495 :
496 0 : void JSGenericLowering::LowerJSCreateKeyValueArray(Node* node) {
497 0 : UNREACHABLE(); // Eliminated in typed lowering.
498 : }
499 :
500 0 : void JSGenericLowering::LowerJSCreatePromise(Node* node) {
501 0 : UNREACHABLE(); // Eliminated in typed lowering.
502 : }
503 :
504 654 : void JSGenericLowering::LowerJSCreateTypedArray(Node* node) {
505 654 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
506 : Callable callable =
507 654 : Builtins::CallableFor(isolate(), Builtins::kCreateTypedArray);
508 1308 : ReplaceWithStubCall(node, callable, flags);
509 654 : }
510 :
511 5645 : void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
512 5645 : CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
513 5645 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
514 5645 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
515 11290 : node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
516 5645 : node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
517 :
518 : // Use the CreateShallowArrayLiteratlr builtin only for shallow boilerplates
519 : // without properties up to the number of elements that the stubs can handle.
520 5645 : if ((p.flags() & AggregateLiteral::kIsShallow) != 0 &&
521 : p.length() < ConstructorBuiltins::kMaximumClonedShallowArrayElements) {
522 : Callable callable =
523 5248 : Builtins::CallableFor(isolate(), Builtins::kCreateShallowArrayLiteral);
524 10496 : ReplaceWithStubCall(node, callable, flags);
525 : } else {
526 397 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
527 397 : ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral);
528 : }
529 5645 : }
530 :
531 21171 : void JSGenericLowering::LowerJSCreateEmptyLiteralArray(Node* node) {
532 21171 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
533 21171 : FeedbackParameter const& p = FeedbackParameterOf(node->op());
534 21171 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
535 42342 : node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
536 21171 : node->RemoveInput(4); // control
537 : Callable callable =
538 21171 : Builtins::CallableFor(isolate(), Builtins::kCreateEmptyArrayLiteral);
539 42342 : ReplaceWithStubCall(node, callable, flags);
540 21171 : }
541 :
542 533 : void JSGenericLowering::LowerJSCreateArrayFromIterable(Node* node) {
543 533 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
544 : Callable callable = Builtins::CallableFor(
545 533 : isolate(), Builtins::kIterableToListWithSymbolLookup);
546 1066 : ReplaceWithStubCall(node, callable, flags);
547 533 : }
548 :
549 12780 : void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) {
550 12780 : CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
551 12780 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
552 12780 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
553 25560 : node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
554 12780 : node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
555 12780 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
556 :
557 : // Use the CreateShallowObjectLiteratal builtin only for shallow boilerplates
558 : // without elements up to the number of properties that the stubs can handle.
559 12780 : if ((p.flags() & AggregateLiteral::kIsShallow) != 0 &&
560 : p.length() <=
561 : ConstructorBuiltins::kMaximumClonedShallowObjectProperties) {
562 : Callable callable =
563 12196 : Builtins::CallableFor(isolate(), Builtins::kCreateShallowObjectLiteral);
564 24392 : ReplaceWithStubCall(node, callable, flags);
565 : } else {
566 584 : ReplaceWithRuntimeCall(node, Runtime::kCreateObjectLiteral);
567 : }
568 12780 : }
569 :
570 93 : void JSGenericLowering::LowerJSCloneObject(Node* node) {
571 93 : CloneObjectParameters const& p = CloneObjectParametersOf(node->op());
572 93 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
573 : Callable callable =
574 93 : Builtins::CallableFor(isolate(), Builtins::kCloneObjectIC);
575 93 : node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.flags()));
576 186 : node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
577 93 : node->InsertInput(zone(), 3, jsgraph()->HeapConstant(p.feedback().vector()));
578 186 : ReplaceWithStubCall(node, callable, flags);
579 93 : }
580 :
581 0 : void JSGenericLowering::LowerJSCreateEmptyLiteralObject(Node* node) {
582 0 : UNREACHABLE(); // Eliminated in typed lowering.
583 : }
584 :
585 5897 : void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) {
586 5897 : CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
587 5897 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
588 : Callable callable =
589 5897 : Builtins::CallableFor(isolate(), Builtins::kCreateRegExpLiteral);
590 5897 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
591 11794 : node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
592 5897 : node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
593 5897 : node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
594 11794 : ReplaceWithStubCall(node, callable, flags);
595 5897 : }
596 :
597 :
598 0 : void JSGenericLowering::LowerJSCreateCatchContext(Node* node) {
599 0 : UNREACHABLE(); // Eliminated in typed lowering.
600 : }
601 :
602 0 : void JSGenericLowering::LowerJSCreateWithContext(Node* node) {
603 0 : UNREACHABLE(); // Eliminated in typed lowering.
604 : }
605 :
606 0 : void JSGenericLowering::LowerJSCreateBlockContext(Node* node) {
607 0 : Handle<ScopeInfo> scope_info = ScopeInfoOf(node->op());
608 0 : node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
609 0 : ReplaceWithRuntimeCall(node, Runtime::kPushBlockContext);
610 0 : }
611 :
612 39 : void JSGenericLowering::LowerJSConstructForwardVarargs(Node* node) {
613 : ConstructForwardVarargsParameters p =
614 39 : ConstructForwardVarargsParametersOf(node->op());
615 39 : int const arg_count = static_cast<int>(p.arity() - 2);
616 39 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
617 39 : Callable callable = CodeFactory::ConstructForwardVarargs(isolate());
618 78 : auto call_descriptor = Linkage::GetStubCallDescriptor(
619 78 : zone(), callable.descriptor(), arg_count + 1, flags);
620 39 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
621 39 : Node* stub_arity = jsgraph()->Int32Constant(arg_count);
622 39 : Node* start_index = jsgraph()->Uint32Constant(p.start_index());
623 : Node* new_target = node->InputAt(arg_count + 1);
624 39 : Node* receiver = jsgraph()->UndefinedConstant();
625 39 : node->RemoveInput(arg_count + 1); // Drop new target.
626 39 : node->InsertInput(zone(), 0, stub_code);
627 39 : node->InsertInput(zone(), 2, new_target);
628 39 : node->InsertInput(zone(), 3, stub_arity);
629 39 : node->InsertInput(zone(), 4, start_index);
630 39 : node->InsertInput(zone(), 5, receiver);
631 39 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
632 39 : }
633 :
634 32528 : void JSGenericLowering::LowerJSConstruct(Node* node) {
635 32528 : ConstructParameters const& p = ConstructParametersOf(node->op());
636 32528 : int const arg_count = static_cast<int>(p.arity() - 2);
637 32528 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
638 32528 : Callable callable = CodeFactory::Construct(isolate());
639 65056 : auto call_descriptor = Linkage::GetStubCallDescriptor(
640 65056 : zone(), callable.descriptor(), arg_count + 1, flags);
641 32528 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
642 32528 : Node* stub_arity = jsgraph()->Int32Constant(arg_count);
643 : Node* new_target = node->InputAt(arg_count + 1);
644 32528 : Node* receiver = jsgraph()->UndefinedConstant();
645 32528 : node->RemoveInput(arg_count + 1); // Drop new target.
646 32528 : node->InsertInput(zone(), 0, stub_code);
647 32528 : node->InsertInput(zone(), 2, new_target);
648 32528 : node->InsertInput(zone(), 3, stub_arity);
649 32528 : node->InsertInput(zone(), 4, receiver);
650 32528 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
651 32528 : }
652 :
653 55 : void JSGenericLowering::LowerJSConstructWithArrayLike(Node* node) {
654 : Callable callable =
655 55 : Builtins::CallableFor(isolate(), Builtins::kConstructWithArrayLike);
656 55 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
657 : auto call_descriptor =
658 110 : Linkage::GetStubCallDescriptor(zone(), callable.descriptor(), 1, flags);
659 55 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
660 55 : Node* receiver = jsgraph()->UndefinedConstant();
661 : Node* arguments_list = node->InputAt(1);
662 : Node* new_target = node->InputAt(2);
663 55 : node->InsertInput(zone(), 0, stub_code);
664 55 : node->ReplaceInput(2, new_target);
665 55 : node->ReplaceInput(3, arguments_list);
666 55 : node->InsertInput(zone(), 4, receiver);
667 55 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
668 55 : }
669 :
670 65 : void JSGenericLowering::LowerJSConstructWithSpread(Node* node) {
671 65 : ConstructParameters const& p = ConstructParametersOf(node->op());
672 65 : int const arg_count = static_cast<int>(p.arity() - 2);
673 : int const spread_index = arg_count;
674 65 : int const new_target_index = arg_count + 1;
675 65 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
676 65 : Callable callable = CodeFactory::ConstructWithSpread(isolate());
677 65 : auto call_descriptor = Linkage::GetStubCallDescriptor(
678 130 : zone(), callable.descriptor(), arg_count, flags);
679 65 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
680 65 : Node* stack_arg_count = jsgraph()->Int32Constant(arg_count - 1);
681 : Node* new_target = node->InputAt(new_target_index);
682 : Node* spread = node->InputAt(spread_index);
683 65 : Node* receiver = jsgraph()->UndefinedConstant();
684 : DCHECK(new_target_index > spread_index);
685 65 : node->RemoveInput(new_target_index); // Drop new target.
686 65 : node->RemoveInput(spread_index);
687 :
688 65 : node->InsertInput(zone(), 0, stub_code);
689 65 : node->InsertInput(zone(), 2, new_target);
690 65 : node->InsertInput(zone(), 3, stack_arg_count);
691 65 : node->InsertInput(zone(), 4, spread);
692 65 : node->InsertInput(zone(), 5, receiver);
693 65 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
694 65 : }
695 :
696 79 : void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) {
697 79 : CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op());
698 79 : int const arg_count = static_cast<int>(p.arity() - 2);
699 79 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
700 79 : Callable callable = CodeFactory::CallForwardVarargs(isolate());
701 158 : auto call_descriptor = Linkage::GetStubCallDescriptor(
702 158 : zone(), callable.descriptor(), arg_count + 1, flags);
703 79 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
704 79 : Node* stub_arity = jsgraph()->Int32Constant(arg_count);
705 79 : Node* start_index = jsgraph()->Uint32Constant(p.start_index());
706 79 : node->InsertInput(zone(), 0, stub_code);
707 79 : node->InsertInput(zone(), 2, stub_arity);
708 79 : node->InsertInput(zone(), 3, start_index);
709 79 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
710 79 : }
711 :
712 457038 : void JSGenericLowering::LowerJSCall(Node* node) {
713 457038 : CallParameters const& p = CallParametersOf(node->op());
714 457038 : int const arg_count = static_cast<int>(p.arity() - 2);
715 : ConvertReceiverMode const mode = p.convert_mode();
716 457038 : Callable callable = CodeFactory::Call(isolate(), mode);
717 457038 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
718 914076 : auto call_descriptor = Linkage::GetStubCallDescriptor(
719 914076 : zone(), callable.descriptor(), arg_count + 1, flags);
720 457038 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
721 457038 : Node* stub_arity = jsgraph()->Int32Constant(arg_count);
722 457038 : node->InsertInput(zone(), 0, stub_code);
723 457038 : node->InsertInput(zone(), 2, stub_arity);
724 457038 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
725 457038 : }
726 :
727 357 : void JSGenericLowering::LowerJSCallWithArrayLike(Node* node) {
728 357 : Callable callable = CodeFactory::CallWithArrayLike(isolate());
729 357 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
730 : auto call_descriptor =
731 714 : Linkage::GetStubCallDescriptor(zone(), callable.descriptor(), 1, flags);
732 357 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
733 : Node* receiver = node->InputAt(1);
734 : Node* arguments_list = node->InputAt(2);
735 357 : node->InsertInput(zone(), 0, stub_code);
736 357 : node->ReplaceInput(3, receiver);
737 357 : node->ReplaceInput(2, arguments_list);
738 357 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
739 357 : }
740 :
741 888 : void JSGenericLowering::LowerJSCallWithSpread(Node* node) {
742 888 : CallParameters const& p = CallParametersOf(node->op());
743 888 : int const arg_count = static_cast<int>(p.arity() - 2);
744 888 : int const spread_index = static_cast<int>(p.arity() + 1);
745 888 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
746 888 : Callable callable = CodeFactory::CallWithSpread(isolate());
747 888 : auto call_descriptor = Linkage::GetStubCallDescriptor(
748 1776 : zone(), callable.descriptor(), arg_count, flags);
749 888 : Node* stub_code = jsgraph()->HeapConstant(callable.code());
750 : // We pass the spread in a register, not on the stack.
751 888 : Node* stack_arg_count = jsgraph()->Int32Constant(arg_count - 1);
752 888 : node->InsertInput(zone(), 0, stub_code);
753 888 : node->InsertInput(zone(), 2, stack_arg_count);
754 888 : node->InsertInput(zone(), 3, node->InputAt(spread_index));
755 888 : node->RemoveInput(spread_index + 1);
756 888 : NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
757 888 : }
758 :
759 310234 : void JSGenericLowering::LowerJSCallRuntime(Node* node) {
760 310234 : const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op());
761 310234 : ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity()));
762 310234 : }
763 :
764 0 : void JSGenericLowering::LowerJSForInNext(Node* node) {
765 0 : UNREACHABLE(); // Eliminated in typed lowering.
766 : }
767 :
768 0 : void JSGenericLowering::LowerJSForInPrepare(Node* node) {
769 0 : UNREACHABLE(); // Eliminated in typed lowering.
770 : }
771 :
772 0 : void JSGenericLowering::LowerJSLoadMessage(Node* node) {
773 0 : UNREACHABLE(); // Eliminated in typed lowering.
774 : }
775 :
776 :
777 0 : void JSGenericLowering::LowerJSStoreMessage(Node* node) {
778 0 : UNREACHABLE(); // Eliminated in typed lowering.
779 : }
780 :
781 0 : void JSGenericLowering::LowerJSLoadModule(Node* node) {
782 0 : UNREACHABLE(); // Eliminated in typed lowering.
783 : }
784 :
785 0 : void JSGenericLowering::LowerJSStoreModule(Node* node) {
786 0 : UNREACHABLE(); // Eliminated in typed lowering.
787 : }
788 :
789 0 : void JSGenericLowering::LowerJSGeneratorStore(Node* node) {
790 0 : UNREACHABLE(); // Eliminated in typed lowering.
791 : }
792 :
793 0 : void JSGenericLowering::LowerJSGeneratorRestoreContinuation(Node* node) {
794 0 : UNREACHABLE(); // Eliminated in typed lowering.
795 : }
796 :
797 0 : void JSGenericLowering::LowerJSGeneratorRestoreContext(Node* node) {
798 0 : UNREACHABLE(); // Eliminated in typed lowering.
799 : }
800 :
801 0 : void JSGenericLowering::LowerJSGeneratorRestoreInputOrDebugPos(Node* node) {
802 0 : UNREACHABLE(); // Eliminated in typed lowering.
803 : }
804 :
805 0 : void JSGenericLowering::LowerJSGeneratorRestoreRegister(Node* node) {
806 0 : UNREACHABLE(); // Eliminated in typed lowering.
807 : }
808 :
809 525329 : void JSGenericLowering::LowerJSStackCheck(Node* node) {
810 525329 : Node* effect = NodeProperties::GetEffectInput(node);
811 525350 : Node* control = NodeProperties::GetControlInput(node);
812 :
813 525357 : Node* limit = effect = graph()->NewNode(
814 : machine()->Load(MachineType::Pointer()),
815 : jsgraph()->ExternalConstant(
816 : ExternalReference::address_of_stack_limit(isolate())),
817 : jsgraph()->IntPtrConstant(0), effect, control);
818 525360 : Node* pointer = graph()->NewNode(machine()->LoadStackPointer());
819 :
820 525354 : Node* check = graph()->NewNode(machine()->UintLessThan(), limit, pointer);
821 : Node* branch =
822 525359 : graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
823 :
824 525359 : Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
825 : Node* etrue = effect;
826 :
827 525359 : Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
828 525358 : NodeProperties::ReplaceControlInput(node, if_false);
829 525357 : NodeProperties::ReplaceEffectInput(node, effect);
830 : Node* efalse = if_false = node;
831 :
832 525356 : Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
833 525357 : Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
834 :
835 : // Wire the new diamond into the graph, {node} can still throw.
836 525358 : NodeProperties::ReplaceUses(node, node, ephi, merge, merge);
837 525359 : NodeProperties::ReplaceControlInput(merge, if_false, 1);
838 525358 : NodeProperties::ReplaceEffectInput(ephi, efalse, 1);
839 :
840 : // This iteration cuts out potential {IfSuccess} or {IfException} projection
841 : // uses of the original node and places them inside the diamond, so that we
842 : // can change the original {node} into the slow-path runtime call.
843 4174547 : for (Edge edge : merge->use_edges()) {
844 1824597 : if (!NodeProperties::IsControlEdge(edge)) continue;
845 1824627 : if (edge.from()->opcode() == IrOpcode::kIfSuccess) {
846 7037 : NodeProperties::ReplaceUses(edge.from(), nullptr, nullptr, merge);
847 7037 : NodeProperties::ReplaceControlInput(merge, edge.from(), 1);
848 7037 : edge.UpdateTo(node);
849 : }
850 1824608 : if (edge.from()->opcode() == IrOpcode::kIfException) {
851 7037 : NodeProperties::ReplaceEffectInput(edge.from(), node);
852 7037 : edge.UpdateTo(node);
853 : }
854 : }
855 :
856 : // Turn the stack check into a runtime call.
857 525353 : ReplaceWithRuntimeCall(node, Runtime::kStackGuard);
858 525351 : }
859 :
860 908 : void JSGenericLowering::LowerJSDebugger(Node* node) {
861 908 : CallDescriptor::Flags flags = FrameStateFlagForCall(node);
862 908 : Callable callable = CodeFactory::HandleDebuggerStatement(isolate());
863 1816 : ReplaceWithStubCall(node, callable, flags);
864 908 : }
865 :
866 0 : Zone* JSGenericLowering::zone() const { return graph()->zone(); }
867 :
868 :
869 0 : Isolate* JSGenericLowering::isolate() const { return jsgraph()->isolate(); }
870 :
871 :
872 0 : Graph* JSGenericLowering::graph() const { return jsgraph()->graph(); }
873 :
874 :
875 0 : CommonOperatorBuilder* JSGenericLowering::common() const {
876 0 : return jsgraph()->common();
877 : }
878 :
879 :
880 0 : MachineOperatorBuilder* JSGenericLowering::machine() const {
881 0 : return jsgraph()->machine();
882 : }
883 :
884 : } // namespace compiler
885 : } // namespace internal
886 120216 : } // namespace v8
|