OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/graph-inl.h" | 7 #include "src/compiler/graph-inl.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-aux-data-inl.h" | 10 #include "src/compiler/node-aux-data-inl.h" |
11 #include "src/compiler/node-properties-inl.h" | 11 #include "src/compiler/node-properties-inl.h" |
12 #include "src/unique.h" | 12 #include "src/unique.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 | 18 |
19 // TODO(mstarzinger): This is a temporary workaround for non-hydrogen stubs for | 19 // TODO(mstarzinger): This is a temporary workaround for non-hydrogen stubs for |
20 // which we don't have an interface descriptor yet. Use ReplaceWithICStubCall | 20 // which we don't have an interface descriptor yet. Use ReplaceWithStubCall |
21 // once these stub have been made into a HydrogenCodeStub. | 21 // once these stub have been made into a HydrogenCodeStub. |
22 template <typename T> | 22 template <typename T> |
23 static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate, | 23 static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate, |
24 T* stub) { | 24 T* stub) { |
25 CodeStub::Major key = static_cast<CodeStub*>(stub)->MajorKey(); | 25 CodeStub::Major key = static_cast<CodeStub*>(stub)->MajorKey(); |
26 CodeStubInterfaceDescriptor* d = isolate->code_stub_interface_descriptor(key); | 26 CodeStubInterfaceDescriptor* d = isolate->code_stub_interface_descriptor(key); |
27 stub->InitializeInterfaceDescriptor(d); | 27 stub->InitializeInterfaceDescriptor(d); |
28 return d; | 28 return d; |
29 } | 29 } |
30 | 30 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 #undef DECLARE_CASE | 211 #undef DECLARE_CASE |
212 default: | 212 default: |
213 // Nothing to see. | 213 // Nothing to see. |
214 return NoChange(); | 214 return NoChange(); |
215 } | 215 } |
216 DCHECK_EQ(node, replacement); | 216 DCHECK_EQ(node, replacement); |
217 return Changed(replacement); | 217 return Changed(replacement); |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 #define REPLACE_IC_STUB_CALL(op, StubDeclaration) \ | 221 #define REPLACE_BINARY_OP_IC_CALL(op, token) \ |
222 Node* JSGenericLowering::Lower##op(Node* node) { \ | 222 Node* JSGenericLowering::Lower##op(Node* node) { \ |
223 StubDeclaration; \ | 223 BinaryOpICStub stub(isolate(), token); \ |
224 ReplaceWithICStubCall(node, &stub); \ | 224 ReplaceWithStubCall(node, &stub, \ |
225 return node; \ | 225 CallDescriptor::kPatchableCallSiteWithNop); \ |
| 226 return node; \ |
226 } | 227 } |
227 REPLACE_IC_STUB_CALL(JSBitwiseOr, BinaryOpICStub stub(isolate(), Token::BIT_OR)) | 228 REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR) |
228 REPLACE_IC_STUB_CALL(JSBitwiseXor, | 229 REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR) |
229 BinaryOpICStub stub(isolate(), Token::BIT_XOR)) | 230 REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND) |
230 REPLACE_IC_STUB_CALL(JSBitwiseAnd, | 231 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) |
231 BinaryOpICStub stub(isolate(), Token::BIT_AND)) | 232 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) |
232 REPLACE_IC_STUB_CALL(JSShiftLeft, BinaryOpICStub stub(isolate(), Token::SHL)) | 233 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) |
233 REPLACE_IC_STUB_CALL(JSShiftRight, BinaryOpICStub stub(isolate(), Token::SAR)) | 234 REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD) |
234 REPLACE_IC_STUB_CALL(JSShiftRightLogical, | 235 REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB) |
235 BinaryOpICStub stub(isolate(), Token::SHR)) | 236 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL) |
236 REPLACE_IC_STUB_CALL(JSAdd, BinaryOpICStub stub(isolate(), Token::ADD)) | 237 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) |
237 REPLACE_IC_STUB_CALL(JSSubtract, BinaryOpICStub stub(isolate(), Token::SUB)) | 238 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) |
238 REPLACE_IC_STUB_CALL(JSMultiply, BinaryOpICStub stub(isolate(), Token::MUL)) | 239 #undef REPLACE_BINARY_OP_IC_CALL |
239 REPLACE_IC_STUB_CALL(JSDivide, BinaryOpICStub stub(isolate(), Token::DIV)) | 240 |
240 REPLACE_IC_STUB_CALL(JSModulus, BinaryOpICStub stub(isolate(), Token::MOD)) | 241 |
241 REPLACE_IC_STUB_CALL(JSToNumber, ToNumberStub stub(isolate())) | 242 #define REPLACE_STUB_CALL(op, StubDeclaration) \ |
242 #undef REPLACE_IC_STUB_CALL | 243 Node* JSGenericLowering::Lower##op(Node* node) { \ |
| 244 StubDeclaration; \ |
| 245 ReplaceWithStubCall(node, &stub, CallDescriptor::kNoFlags); \ |
| 246 return node; \ |
| 247 } |
| 248 REPLACE_STUB_CALL(JSToNumber, ToNumberStub stub(isolate())) |
| 249 #undef REPLACE_STUB_CALL |
243 | 250 |
244 | 251 |
245 #define REPLACE_COMPARE_IC_CALL(op, token, pure) \ | 252 #define REPLACE_COMPARE_IC_CALL(op, token, pure) \ |
246 Node* JSGenericLowering::Lower##op(Node* node) { \ | 253 Node* JSGenericLowering::Lower##op(Node* node) { \ |
247 ReplaceWithCompareIC(node, token, pure); \ | 254 ReplaceWithCompareIC(node, token, pure); \ |
248 return node; \ | 255 return node; \ |
249 } | 256 } |
250 REPLACE_COMPARE_IC_CALL(JSEqual, Token::EQ, false) | 257 REPLACE_COMPARE_IC_CALL(JSEqual, Token::EQ, false) |
251 REPLACE_COMPARE_IC_CALL(JSNotEqual, Token::NE, false) | 258 REPLACE_COMPARE_IC_CALL(JSNotEqual, Token::NE, false) |
252 REPLACE_COMPARE_IC_CALL(JSStrictEqual, Token::EQ_STRICT, true) | 259 REPLACE_COMPARE_IC_CALL(JSStrictEqual, Token::EQ_STRICT, true) |
(...skipping 26 matching lines...) Expand all Loading... |
279 UNIMPLEMENTED(); \ | 286 UNIMPLEMENTED(); \ |
280 return node; \ | 287 return node; \ |
281 } | 288 } |
282 REPLACE_UNIMPLEMENTED(JSToString) | 289 REPLACE_UNIMPLEMENTED(JSToString) |
283 REPLACE_UNIMPLEMENTED(JSToName) | 290 REPLACE_UNIMPLEMENTED(JSToName) |
284 REPLACE_UNIMPLEMENTED(JSYield) | 291 REPLACE_UNIMPLEMENTED(JSYield) |
285 REPLACE_UNIMPLEMENTED(JSDebugger) | 292 REPLACE_UNIMPLEMENTED(JSDebugger) |
286 #undef REPLACE_UNIMPLEMENTED | 293 #undef REPLACE_UNIMPLEMENTED |
287 | 294 |
288 | 295 |
289 static CallDescriptor::DeoptimizationSupport DeoptimizationSupportForNode( | 296 static CallDescriptor::Flags FlagsForNode(Node* node) { |
290 Node* node) { | 297 CallDescriptor::Flags result = CallDescriptor::kNoFlags; |
291 int result = CallDescriptor::kNoDeoptimization; | |
292 if (OperatorProperties::CanLazilyDeoptimize(node->op())) { | 298 if (OperatorProperties::CanLazilyDeoptimize(node->op())) { |
293 result |= CallDescriptor::kLazyDeoptimization; | 299 result |= CallDescriptor::kLazyDeoptimization; |
294 } | 300 } |
295 if (OperatorProperties::HasFrameStateInput(node->op())) { | 301 if (OperatorProperties::HasFrameStateInput(node->op())) { |
296 result |= CallDescriptor::kNeedsFrameState; | 302 result |= CallDescriptor::kNeedsFrameState; |
297 } | 303 } |
298 return static_cast<CallDescriptor::DeoptimizationSupport>(result); | 304 return result; |
299 } | 305 } |
300 | 306 |
301 | 307 |
302 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token, | 308 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token, |
303 bool pure) { | 309 bool pure) { |
304 BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack. | 310 BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack. |
305 CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor(); | 311 CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor(); |
306 CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(d); | 312 CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor( |
| 313 d, 0, CallDescriptor::kPatchableCallSiteWithNop); |
307 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token); | 314 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token); |
308 Node* compare; | 315 Node* compare; |
309 if (pure) { | 316 if (pure) { |
310 // A pure (strict) comparison doesn't have an effect or control. | 317 // A pure (strict) comparison doesn't have an effect or control. |
311 // But for the graph, we need to add these inputs. | 318 // But for the graph, we need to add these inputs. |
312 compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic), | 319 compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic), |
313 NodeProperties::GetValueInput(node, 0), | 320 NodeProperties::GetValueInput(node, 0), |
314 NodeProperties::GetValueInput(node, 1), | 321 NodeProperties::GetValueInput(node, 1), |
315 NodeProperties::GetContextInput(node), | 322 NodeProperties::GetContextInput(node), |
316 graph()->start(), graph()->start()); | 323 graph()->start(), graph()->start()); |
317 } else { | 324 } else { |
318 compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic), | 325 compare = graph()->NewNode(common()->Call(desc_compare), CodeConstant(ic), |
319 NodeProperties::GetValueInput(node, 0), | 326 NodeProperties::GetValueInput(node, 0), |
320 NodeProperties::GetValueInput(node, 1), | 327 NodeProperties::GetValueInput(node, 1), |
321 NodeProperties::GetContextInput(node), | 328 NodeProperties::GetContextInput(node), |
322 NodeProperties::GetEffectInput(node), | 329 NodeProperties::GetEffectInput(node), |
323 NodeProperties::GetControlInput(node)); | 330 NodeProperties::GetControlInput(node)); |
324 } | 331 } |
325 node->ReplaceInput(0, compare); | 332 node->ReplaceInput(0, compare); |
326 node->ReplaceInput(1, SmiConstant(token)); | 333 node->ReplaceInput(1, SmiConstant(token)); |
327 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); | 334 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); |
328 } | 335 } |
329 | 336 |
330 | 337 |
331 void JSGenericLowering::ReplaceWithICStubCall(Node* node, | 338 void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub, |
332 HydrogenCodeStub* stub) { | 339 CallDescriptor::Flags flags) { |
333 CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor(); | 340 CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor(); |
334 CallDescriptor* desc = linkage()->GetStubCallDescriptor( | 341 CallDescriptor* desc = |
335 d, 0, DeoptimizationSupportForNode(node)); | 342 linkage()->GetStubCallDescriptor(d, 0, flags | FlagsForNode(node)); |
336 Node* stub_code = CodeConstant(stub->GetCode()); | 343 Node* stub_code = CodeConstant(stub->GetCode()); |
337 PatchInsertInput(node, 0, stub_code); | 344 PatchInsertInput(node, 0, stub_code); |
338 PatchOperator(node, common()->Call(desc)); | 345 PatchOperator(node, common()->Call(desc)); |
339 } | 346 } |
340 | 347 |
341 | 348 |
342 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, | 349 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, |
343 Builtins::JavaScript id, | 350 Builtins::JavaScript id, |
344 int nargs) { | 351 int nargs) { |
345 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); | 352 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); |
(...skipping 10 matching lines...) Expand all Loading... |
356 PatchOperator(node, common()->Call(desc)); | 363 PatchOperator(node, common()->Call(desc)); |
357 } | 364 } |
358 | 365 |
359 | 366 |
360 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, | 367 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, |
361 Runtime::FunctionId f, | 368 Runtime::FunctionId f, |
362 int nargs_override) { | 369 int nargs_override) { |
363 Operator::Property props = node->op()->properties(); | 370 Operator::Property props = node->op()->properties(); |
364 const Runtime::Function* fun = Runtime::FunctionForId(f); | 371 const Runtime::Function* fun = Runtime::FunctionForId(f); |
365 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override; | 372 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override; |
366 CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor( | 373 CallDescriptor* desc = |
367 f, nargs, props, DeoptimizationSupportForNode(node)); | 374 linkage()->GetRuntimeCallDescriptor(f, nargs, props, FlagsForNode(node)); |
368 Node* ref = ExternalConstant(ExternalReference(f, isolate())); | 375 Node* ref = ExternalConstant(ExternalReference(f, isolate())); |
369 Node* arity = Int32Constant(nargs); | 376 Node* arity = Int32Constant(nargs); |
370 if (!centrystub_constant_.is_set()) { | 377 if (!centrystub_constant_.is_set()) { |
371 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode())); | 378 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode())); |
372 } | 379 } |
373 PatchInsertInput(node, 0, centrystub_constant_.get()); | 380 PatchInsertInput(node, 0, centrystub_constant_.get()); |
374 PatchInsertInput(node, nargs + 1, ref); | 381 PatchInsertInput(node, nargs + 1, ref); |
375 PatchInsertInput(node, nargs + 2, arity); | 382 PatchInsertInput(node, nargs + 2, arity); |
376 PatchOperator(node, common()->Call(desc)); | 383 PatchOperator(node, common()->Call(desc)); |
377 } | 384 } |
378 | 385 |
379 | 386 |
380 Node* JSGenericLowering::LowerBranch(Node* node) { | 387 Node* JSGenericLowering::LowerBranch(Node* node) { |
381 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), | 388 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), |
382 jsgraph()->TrueConstant()); | 389 jsgraph()->TrueConstant()); |
383 node->ReplaceInput(0, test); | 390 node->ReplaceInput(0, test); |
384 return node; | 391 return node; |
385 } | 392 } |
386 | 393 |
387 | 394 |
388 Node* JSGenericLowering::LowerJSUnaryNot(Node* node) { | 395 Node* JSGenericLowering::LowerJSUnaryNot(Node* node) { |
389 ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); | 396 ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); |
390 ReplaceWithICStubCall(node, &stub); | 397 ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite); |
391 return node; | 398 return node; |
392 } | 399 } |
393 | 400 |
394 | 401 |
395 Node* JSGenericLowering::LowerJSToBoolean(Node* node) { | 402 Node* JSGenericLowering::LowerJSToBoolean(Node* node) { |
396 ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); | 403 ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); |
397 ReplaceWithICStubCall(node, &stub); | 404 ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite); |
398 return node; | 405 return node; |
399 } | 406 } |
400 | 407 |
401 | 408 |
402 Node* JSGenericLowering::LowerJSToObject(Node* node) { | 409 Node* JSGenericLowering::LowerJSToObject(Node* node) { |
403 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); | 410 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); |
404 return node; | 411 return node; |
405 } | 412 } |
406 | 413 |
407 | 414 |
408 Node* JSGenericLowering::LowerJSLoadProperty(Node* node) { | 415 Node* JSGenericLowering::LowerJSLoadProperty(Node* node) { |
409 KeyedLoadICStubShim stub(isolate()); | 416 KeyedLoadICStubShim stub(isolate()); |
410 ReplaceWithICStubCall(node, &stub); | 417 ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite); |
411 return node; | 418 return node; |
412 } | 419 } |
413 | 420 |
414 | 421 |
415 Node* JSGenericLowering::LowerJSLoadNamed(Node* node) { | 422 Node* JSGenericLowering::LowerJSLoadNamed(Node* node) { |
416 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node); | 423 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node); |
417 LoadICStubShim stub(isolate(), p.contextual_mode); | 424 LoadICStubShim stub(isolate(), p.contextual_mode); |
418 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name)); | 425 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name)); |
419 ReplaceWithICStubCall(node, &stub); | 426 ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite); |
420 return node; | 427 return node; |
421 } | 428 } |
422 | 429 |
423 | 430 |
424 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) { | 431 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) { |
425 StrictMode strict_mode = OpParameter<StrictMode>(node); | 432 StrictMode strict_mode = OpParameter<StrictMode>(node); |
426 KeyedStoreICStubShim stub(isolate(), strict_mode); | 433 KeyedStoreICStubShim stub(isolate(), strict_mode); |
427 ReplaceWithICStubCall(node, &stub); | 434 ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite); |
428 return node; | 435 return node; |
429 } | 436 } |
430 | 437 |
431 | 438 |
432 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) { | 439 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) { |
433 StoreNamedParameters params = OpParameter<StoreNamedParameters>(node); | 440 StoreNamedParameters params = OpParameter<StoreNamedParameters>(node); |
434 StoreICStubShim stub(isolate(), params.strict_mode); | 441 StoreICStubShim stub(isolate(), params.strict_mode); |
435 PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name)); | 442 PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name)); |
436 ReplaceWithICStubCall(node, &stub); | 443 ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite); |
437 return node; | 444 return node; |
438 } | 445 } |
439 | 446 |
440 | 447 |
441 Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 448 Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
442 StrictMode strict_mode = OpParameter<StrictMode>(node); | 449 StrictMode strict_mode = OpParameter<StrictMode>(node); |
443 PatchInsertInput(node, 2, SmiConstant(strict_mode)); | 450 PatchInsertInput(node, 2, SmiConstant(strict_mode)); |
444 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); | 451 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); |
445 return node; | 452 return node; |
446 } | 453 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); | 507 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); |
501 PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier)); | 508 PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier)); |
502 return node; | 509 return node; |
503 } | 510 } |
504 | 511 |
505 | 512 |
506 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { | 513 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { |
507 int arity = OpParameter<int>(node); | 514 int arity = OpParameter<int>(node); |
508 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); | 515 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); |
509 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 516 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); |
510 CallDescriptor* desc = linkage()->GetStubCallDescriptor( | 517 CallDescriptor* desc = |
511 d, arity, DeoptimizationSupportForNode(node)); | 518 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node)); |
512 Node* stub_code = CodeConstant(stub.GetCode()); | 519 Node* stub_code = CodeConstant(stub.GetCode()); |
513 Node* construct = NodeProperties::GetValueInput(node, 0); | 520 Node* construct = NodeProperties::GetValueInput(node, 0); |
514 PatchInsertInput(node, 0, stub_code); | 521 PatchInsertInput(node, 0, stub_code); |
515 PatchInsertInput(node, 1, Int32Constant(arity - 1)); | 522 PatchInsertInput(node, 1, Int32Constant(arity - 1)); |
516 PatchInsertInput(node, 2, construct); | 523 PatchInsertInput(node, 2, construct); |
517 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); | 524 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); |
518 PatchOperator(node, common()->Call(desc)); | 525 PatchOperator(node, common()->Call(desc)); |
519 return node; | 526 return node; |
520 } | 527 } |
521 | 528 |
522 | 529 |
523 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { | 530 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { |
524 CallParameters p = OpParameter<CallParameters>(node); | 531 CallParameters p = OpParameter<CallParameters>(node); |
525 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); | 532 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); |
526 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 533 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); |
527 CallDescriptor* desc = linkage()->GetStubCallDescriptor( | 534 CallDescriptor* desc = |
528 d, p.arity - 1, DeoptimizationSupportForNode(node)); | 535 linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node)); |
529 Node* stub_code = CodeConstant(stub.GetCode()); | 536 Node* stub_code = CodeConstant(stub.GetCode()); |
530 PatchInsertInput(node, 0, stub_code); | 537 PatchInsertInput(node, 0, stub_code); |
531 PatchOperator(node, common()->Call(desc)); | 538 PatchOperator(node, common()->Call(desc)); |
532 return node; | 539 return node; |
533 } | 540 } |
534 | 541 |
535 | 542 |
536 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 543 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
537 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 544 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
538 int arity = OperatorProperties::GetValueInputCount(node->op()); | 545 int arity = OperatorProperties::GetValueInputCount(node->op()); |
539 ReplaceWithRuntimeCall(node, function, arity); | 546 ReplaceWithRuntimeCall(node, function, arity); |
540 return node; | 547 return node; |
541 } | 548 } |
542 } | 549 |
543 } | 550 } // namespace compiler |
544 } // namespace v8::internal::compiler | 551 } // namespace internal |
| 552 } // namespace v8 |
OLD | NEW |