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

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

Issue 1182193005: [turbofan] Remove the TryLowerDirectJSCall hack from generic lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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-typed-lowering.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index f3b8012ea313fcae2d4aa02282a57bbb29aaadc2..94fae662131e566ef35437c2c69758070161aa87 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -1263,6 +1263,39 @@ Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
}
+Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) {
+ DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode());
+ CallFunctionParameters const& p = CallFunctionParametersOf(node->op());
+ int const arity = static_cast<int>(p.arity() - 2);
+ Node* const function = NodeProperties::GetValueInput(node, 0);
+ Type* const function_type = NodeProperties::GetBounds(function).upper;
+ Node* const receiver = NodeProperties::GetValueInput(node, 1);
+ Type* const receiver_type = NodeProperties::GetBounds(receiver).upper;
+ Node* const effect = NodeProperties::GetEffectInput(node);
+ Node* const control = NodeProperties::GetControlInput(node);
+
+ // Check that {function} is actually a JSFunction with the correct arity.
+ if (function_type->IsFunction() &&
+ function_type->AsFunction()->Arity() == arity) {
+ // Check that the {receiver} doesn't need to be wrapped.
+ if (receiver_type->Is(Type::ReceiverOrUndefined())) {
+ Node* const context = graph()->NewNode(
+ simplified()->LoadField(AccessBuilder::ForJSFunctionContext()),
+ function, effect, control);
+ NodeProperties::ReplaceContextInput(node, context);
+ CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState;
+ if (is_strict(p.language_mode())) {
+ flags |= CallDescriptor::kSupportsTailCalls;
+ }
+ node->set_op(common()->Call(Linkage::GetJSCallDescriptor(
+ graph()->zone(), false, 1 + arity, flags)));
+ return Changed(node);
+ }
+ }
+ return NoChange();
+}
+
+
Reduction JSTypedLowering::ReduceJSForInDone(Node* node) {
DCHECK_EQ(IrOpcode::kJSForInDone, node->opcode());
node->set_op(machine()->Word32Equal());
@@ -1631,6 +1664,8 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSCreateWithContext(node);
case IrOpcode::kJSCreateBlockContext:
return ReduceJSCreateBlockContext(node);
+ case IrOpcode::kJSCallFunction:
+ return ReduceJSCallFunction(node);
case IrOpcode::kJSForInDone:
return ReduceJSForInDone(node);
case IrOpcode::kJSForInNext:
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698