Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: src/compiler/js-generic-lowering.cc

Issue 2946893004: [WIP] Start adding JSCallWithVarargs
Patch Set: REBASE Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-generic-lowering.cc
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc
index 731a45ed7c961d734b22294723bf0a8210464110..19d8ef16a5de04673bc58e411f7759ba5c745c70 100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -632,6 +632,24 @@ void JSGenericLowering::LowerJSConstructWithSpread(Node* node) {
NodeProperties::ChangeOp(node, common()->Call(desc));
}
+void JSGenericLowering::LowerJSCall(Node* node) {
+ CallParameters const& p = CallParametersOf(node->op());
+ int const arg_count = static_cast<int>(p.arity() - 2);
+ ConvertReceiverMode const mode = p.convert_mode();
+ Callable callable = CodeFactory::Call(isolate(), mode);
+ CallDescriptor::Flags flags = FrameStateFlagForCall(node);
+ if (p.tail_call_mode() == TailCallMode::kAllow) {
+ flags |= CallDescriptor::kSupportsTailCalls;
+ }
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor(
+ isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
+ Node* stub_code = jsgraph()->HeapConstant(callable.code());
+ Node* stub_arity = jsgraph()->Int32Constant(arg_count);
+ node->InsertInput(zone(), 0, stub_code);
+ node->InsertInput(zone(), 2, stub_arity);
+ NodeProperties::ChangeOp(node, common()->Call(desc));
+}
+
void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) {
CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2);
@@ -651,21 +669,23 @@ void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) {
NodeProperties::ChangeOp(node, common()->Call(desc));
}
-void JSGenericLowering::LowerJSCall(Node* node) {
- CallParameters const& p = CallParametersOf(node->op());
+void JSGenericLowering::LowerJSCallVarargs(Node* node) {
+ CallVarargsParameters p = CallVarargsParametersOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2);
- ConvertReceiverMode const mode = p.convert_mode();
- Callable callable = CodeFactory::Call(isolate(), mode);
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
- if (p.tail_call_mode() == TailCallMode::kAllow) {
- flags |= CallDescriptor::kSupportsTailCalls;
- }
+ Callable callable = CodeFactory::CallVarargs(isolate());
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
Node* stub_code = jsgraph()->HeapConstant(callable.code());
Node* stub_arity = jsgraph()->Int32Constant(arg_count);
+ Node* arguments_list = node->InputAt(arg_count + 2);
+ Node* arguments_length = node->InputAt(arg_count + 3);
+ node->RemoveInput(arg_count + 3);
+ node->RemoveInput(arg_count + 2);
node->InsertInput(zone(), 0, stub_code);
node->InsertInput(zone(), 2, stub_arity);
+ node->InsertInput(zone(), 3, arguments_list);
+ node->InsertInput(zone(), 4, arguments_length);
NodeProperties::ChangeOp(node, common()->Call(desc));
}
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698