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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 REPLACE_STUB_CALL(ToString) | 81 REPLACE_STUB_CALL(ToString) |
82 #undef REPLACE_STUB_CALL | 82 #undef REPLACE_STUB_CALL |
83 | 83 |
84 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 84 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
85 CallDescriptor::Flags flags) { | 85 CallDescriptor::Flags flags) { |
86 ReplaceWithStubCall(node, callable, flags, node->op()->properties()); | 86 ReplaceWithStubCall(node, callable, flags, node->op()->properties()); |
87 } | 87 } |
88 | 88 |
89 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 89 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
90 CallDescriptor::Flags flags, | 90 CallDescriptor::Flags flags, |
91 Operator::Properties properties) { | 91 Operator::Properties properties, |
| 92 int result_size) { |
92 const CallInterfaceDescriptor& descriptor = callable.descriptor(); | 93 const CallInterfaceDescriptor& descriptor = callable.descriptor(); |
93 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 94 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
94 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), flags, | 95 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), flags, |
95 properties); | 96 properties, MachineType::AnyTagged(), result_size); |
96 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 97 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
97 node->InsertInput(zone(), 0, stub_code); | 98 node->InsertInput(zone(), 0, stub_code); |
98 NodeProperties::ChangeOp(node, common()->Call(desc)); | 99 NodeProperties::ChangeOp(node, common()->Call(desc)); |
99 } | 100 } |
100 | 101 |
101 | 102 |
102 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, | 103 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, |
103 Runtime::FunctionId f, | 104 Runtime::FunctionId f, |
104 int nargs_override) { | 105 int nargs_override) { |
105 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 106 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 580 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
580 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 581 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
581 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 582 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
582 } | 583 } |
583 | 584 |
584 void JSGenericLowering::LowerJSConvertReceiver(Node* node) { | 585 void JSGenericLowering::LowerJSConvertReceiver(Node* node) { |
585 ReplaceWithRuntimeCall(node, Runtime::kConvertReceiver); | 586 ReplaceWithRuntimeCall(node, Runtime::kConvertReceiver); |
586 } | 587 } |
587 | 588 |
588 void JSGenericLowering::LowerJSForInNext(Node* node) { | 589 void JSGenericLowering::LowerJSForInNext(Node* node) { |
589 ReplaceWithRuntimeCall(node, Runtime::kForInNext); | 590 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 591 Callable callable = CodeFactory::ForInNext(isolate()); |
| 592 ReplaceWithStubCall(node, callable, flags); |
590 } | 593 } |
591 | 594 |
592 | |
593 void JSGenericLowering::LowerJSForInPrepare(Node* node) { | 595 void JSGenericLowering::LowerJSForInPrepare(Node* node) { |
594 ReplaceWithRuntimeCall(node, Runtime::kForInPrepare); | 596 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 597 Callable callable = CodeFactory::ForInPrepare(isolate()); |
| 598 ReplaceWithStubCall(node, callable, flags, node->op()->properties(), 3); |
595 } | 599 } |
596 | 600 |
597 void JSGenericLowering::LowerJSLoadMessage(Node* node) { | 601 void JSGenericLowering::LowerJSLoadMessage(Node* node) { |
598 UNREACHABLE(); // Eliminated in typed lowering. | 602 UNREACHABLE(); // Eliminated in typed lowering. |
599 } | 603 } |
600 | 604 |
601 | 605 |
602 void JSGenericLowering::LowerJSStoreMessage(Node* node) { | 606 void JSGenericLowering::LowerJSStoreMessage(Node* node) { |
603 UNREACHABLE(); // Eliminated in typed lowering. | 607 UNREACHABLE(); // Eliminated in typed lowering. |
604 } | 608 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 689 } |
686 | 690 |
687 | 691 |
688 MachineOperatorBuilder* JSGenericLowering::machine() const { | 692 MachineOperatorBuilder* JSGenericLowering::machine() const { |
689 return jsgraph()->machine(); | 693 return jsgraph()->machine(); |
690 } | 694 } |
691 | 695 |
692 } // namespace compiler | 696 } // namespace compiler |
693 } // namespace internal | 697 } // namespace internal |
694 } // namespace v8 | 698 } // namespace v8 |
OLD | NEW |