| 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/compiler/js-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 544 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 545 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 545 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
| 546 node->InsertInput(zone(), 0, stub_code); | 546 node->InsertInput(zone(), 0, stub_code); |
| 547 node->InsertInput(zone(), 2, stub_arity); | 547 node->InsertInput(zone(), 2, stub_arity); |
| 548 NodeProperties::ChangeOp(node, common()->Call(desc)); | 548 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 549 } | 549 } |
| 550 | 550 |
| 551 void JSGenericLowering::LowerJSCallFunctionWithSpread(Node* node) { | 551 void JSGenericLowering::LowerJSCallFunctionWithSpread(Node* node) { |
| 552 CallFunctionWithSpreadParameters const& p = | 552 CallFunctionWithSpreadParameters const& p = |
| 553 CallFunctionWithSpreadParametersOf(node->op()); | 553 CallFunctionWithSpreadParametersOf(node->op()); |
| 554 ReplaceWithRuntimeCall(node, Runtime::kCallWithSpread, | 554 int const arg_count = static_cast<int>(p.arity() - 2); |
| 555 static_cast<int>(p.arity())); | 555 Callable callable = CodeFactory::CallWithSpread(isolate()); |
| 556 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 557 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 558 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
| 559 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 560 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
| 561 node->InsertInput(zone(), 0, stub_code); |
| 562 node->InsertInput(zone(), 2, stub_arity); |
| 563 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 556 } | 564 } |
| 557 | 565 |
| 558 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 566 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
| 559 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 567 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
| 560 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 568 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
| 561 } | 569 } |
| 562 | 570 |
| 563 void JSGenericLowering::LowerJSConvertReceiver(Node* node) { | 571 void JSGenericLowering::LowerJSConvertReceiver(Node* node) { |
| 564 ReplaceWithRuntimeCall(node, Runtime::kConvertReceiver); | 572 ReplaceWithRuntimeCall(node, Runtime::kConvertReceiver); |
| 565 } | 573 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 } | 667 } |
| 660 | 668 |
| 661 | 669 |
| 662 MachineOperatorBuilder* JSGenericLowering::machine() const { | 670 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 663 return jsgraph()->machine(); | 671 return jsgraph()->machine(); |
| 664 } | 672 } |
| 665 | 673 |
| 666 } // namespace compiler | 674 } // namespace compiler |
| 667 } // namespace internal | 675 } // namespace internal |
| 668 } // namespace v8 | 676 } // namespace v8 |
| OLD | NEW |