Commit cd85a88d authored by petermarshall's avatar petermarshall Committed by Commit bot

[turbo] Rename CallFunction* JSOperators to Call*.

Review-Url: https://codereview.chromium.org/2666783007
Cr-Commit-Position: refs/heads/master@{#42847}
parent 8b597e29
...@@ -1833,8 +1833,8 @@ void AstGraphBuilder::VisitCall(Call* expr) { ...@@ -1833,8 +1833,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
float const frequency = ComputeCallFrequency(expr->CallFeedbackICSlot()); float const frequency = ComputeCallFrequency(expr->CallFeedbackICSlot());
VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot()); VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot());
const Operator* call = const Operator* call =
javascript()->CallFunction(args->length() + 2, frequency, feedback, javascript()->Call(args->length() + 2, frequency, feedback, receiver_hint,
receiver_hint, expr->tail_call_mode()); expr->tail_call_mode());
PrepareEagerCheckpoint(expr->CallId()); PrepareEagerCheckpoint(expr->CallId());
Node* value = ProcessArguments(call, args->length() + 2); Node* value = ProcessArguments(call, args->length() + 2);
// The callee passed to the call, we just need to push something here to // The callee passed to the call, we just need to push something here to
...@@ -1882,7 +1882,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { ...@@ -1882,7 +1882,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
VisitForValues(args); VisitForValues(args);
// Create node to perform the JS runtime call. // Create node to perform the JS runtime call.
const Operator* call = javascript()->CallFunction(args->length() + 2); const Operator* call = javascript()->Call(args->length() + 2);
PrepareEagerCheckpoint(expr->CallId()); PrepareEagerCheckpoint(expr->CallId());
Node* value = ProcessArguments(call, args->length() + 2); Node* value = ProcessArguments(call, args->length() + 2);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
......
...@@ -248,7 +248,7 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> { ...@@ -248,7 +248,7 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> {
// Named and keyed loads require a VectorSlotPair for successful lowering. // Named and keyed loads require a VectorSlotPair for successful lowering.
VectorSlotPair CreateVectorSlotPair(FeedbackVectorSlot slot) const; VectorSlotPair CreateVectorSlotPair(FeedbackVectorSlot slot) const;
// Computes the frequency for JSCallFunction and JSConstruct nodes. // Computes the frequency for JSCall and JSConstruct nodes.
float ComputeCallFrequency(FeedbackVectorSlot slot) const; float ComputeCallFrequency(FeedbackVectorSlot slot) const;
// =========================================================================== // ===========================================================================
......
...@@ -1264,8 +1264,8 @@ void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode, ...@@ -1264,8 +1264,8 @@ void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode,
VectorSlotPair feedback = CreateVectorSlotPair(slot_id); VectorSlotPair feedback = CreateVectorSlotPair(slot_id);
float const frequency = ComputeCallFrequency(slot_id); float const frequency = ComputeCallFrequency(slot_id);
const Operator* call = javascript()->CallFunction( const Operator* call = javascript()->Call(arg_count + 1, frequency, feedback,
arg_count + 1, frequency, feedback, receiver_hint, tail_call_mode); receiver_hint, tail_call_mode);
Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
environment()->BindAccumulator(value, Environment::kAttachFrameState); environment()->BindAccumulator(value, Environment::kAttachFrameState);
} }
...@@ -1281,7 +1281,7 @@ void BytecodeGraphBuilder::VisitCallWithSpread() { ...@@ -1281,7 +1281,7 @@ void BytecodeGraphBuilder::VisitCallWithSpread() {
interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1);
size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
const Operator* call = const Operator* call =
javascript()->CallFunctionWithSpread(static_cast<int>(arg_count + 1)); javascript()->CallWithSpread(static_cast<int>(arg_count + 1));
Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
environment()->BindAccumulator(value, Environment::kAttachFrameState); environment()->BindAccumulator(value, Environment::kAttachFrameState);
...@@ -1307,7 +1307,7 @@ void BytecodeGraphBuilder::VisitCallJSRuntime() { ...@@ -1307,7 +1307,7 @@ void BytecodeGraphBuilder::VisitCallJSRuntime() {
size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
// Create node to perform the JS runtime call. // Create node to perform the JS runtime call.
const Operator* call = javascript()->CallFunction(arg_count + 1); const Operator* call = javascript()->Call(arg_count + 1);
Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
environment()->BindAccumulator(value, Environment::kAttachFrameState); environment()->BindAccumulator(value, Environment::kAttachFrameState);
} }
......
...@@ -21,17 +21,16 @@ namespace v8 { ...@@ -21,17 +21,16 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
// Helper class to access JSCall nodes that are potential candidates
// Helper class to access JSCallFunction nodes that are potential candidates
// for reduction when they have a BuiltinFunctionId associated with them. // for reduction when they have a BuiltinFunctionId associated with them.
class JSCallReduction { class JSCallReduction {
public: public:
explicit JSCallReduction(Node* node) : node_(node) {} explicit JSCallReduction(Node* node) : node_(node) {}
// Determines whether the node is a JSCallFunction operation that targets a // Determines whether the node is a JSCall operation that targets a
// constant callee being a well-known builtin with a BuiltinFunctionId. // constant callee being a well-known builtin with a BuiltinFunctionId.
bool HasBuiltinFunctionId() { bool HasBuiltinFunctionId() {
if (node_->opcode() != IrOpcode::kJSCallFunction) return false; if (node_->opcode() != IrOpcode::kJSCall) return false;
HeapObjectMatcher m(NodeProperties::GetValueInput(node_, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node_, 0));
if (!m.HasValue() || !m.Value()->IsJSFunction()) return false; if (!m.HasValue() || !m.Value()->IsJSFunction()) return false;
Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value()); Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value());
...@@ -40,7 +39,7 @@ class JSCallReduction { ...@@ -40,7 +39,7 @@ class JSCallReduction {
// Retrieves the BuiltinFunctionId as described above. // Retrieves the BuiltinFunctionId as described above.
BuiltinFunctionId GetBuiltinFunctionId() { BuiltinFunctionId GetBuiltinFunctionId() {
DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node_->opcode());
HeapObjectMatcher m(NodeProperties::GetValueInput(node_, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node_, 0));
Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value()); Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value());
return function->shared()->builtin_function_id(); return function->shared()->builtin_function_id();
...@@ -81,13 +80,13 @@ class JSCallReduction { ...@@ -81,13 +80,13 @@ class JSCallReduction {
Node* right() { return GetJSCallInput(1); } Node* right() { return GetJSCallInput(1); }
int GetJSCallArity() { int GetJSCallArity() {
DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node_->opcode());
// Skip first (i.e. callee) and second (i.e. receiver) operand. // Skip first (i.e. callee) and second (i.e. receiver) operand.
return node_->op()->ValueInputCount() - 2; return node_->op()->ValueInputCount() - 2;
} }
Node* GetJSCallInput(int index) { Node* GetJSCallInput(int index) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node_->opcode());
DCHECK_LT(index, GetJSCallArity()); DCHECK_LT(index, GetJSCallArity());
// Skip first (i.e. callee) and second (i.e. receiver) operand. // Skip first (i.e. callee) and second (i.e. receiver) operand.
return NodeProperties::GetValueInput(node_, index + 2); return NodeProperties::GetValueInput(node_, index + 2);
......
...@@ -24,8 +24,8 @@ Reduction JSCallReducer::Reduce(Node* node) { ...@@ -24,8 +24,8 @@ Reduction JSCallReducer::Reduce(Node* node) {
return ReduceJSConstruct(node); return ReduceJSConstruct(node);
case IrOpcode::kJSConstructWithSpread: case IrOpcode::kJSConstructWithSpread:
return ReduceJSConstructWithSpread(node); return ReduceJSConstructWithSpread(node);
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCall:
return ReduceJSCallFunction(node); return ReduceJSCall(node);
default: default:
break; break;
} }
...@@ -35,9 +35,9 @@ Reduction JSCallReducer::Reduce(Node* node) { ...@@ -35,9 +35,9 @@ Reduction JSCallReducer::Reduce(Node* node) {
// ES6 section 22.1.1 The Array Constructor // ES6 section 22.1.1 The Array Constructor
Reduction JSCallReducer::ReduceArrayConstructor(Node* node) { Reduction JSCallReducer::ReduceArrayConstructor(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
Node* target = NodeProperties::GetValueInput(node, 0); Node* target = NodeProperties::GetValueInput(node, 0);
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
// Check if we have an allocation site from the CallIC. // Check if we have an allocation site from the CallIC.
Handle<AllocationSite> site; Handle<AllocationSite> site;
...@@ -64,8 +64,8 @@ Reduction JSCallReducer::ReduceArrayConstructor(Node* node) { ...@@ -64,8 +64,8 @@ Reduction JSCallReducer::ReduceArrayConstructor(Node* node) {
// ES6 section 20.1.1 The Number Constructor // ES6 section 20.1.1 The Number Constructor
Reduction JSCallReducer::ReduceNumberConstructor(Node* node) { Reduction JSCallReducer::ReduceNumberConstructor(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
// Turn the {node} into a {JSToNumber} call. // Turn the {node} into a {JSToNumber} call.
DCHECK_LE(2u, p.arity()); DCHECK_LE(2u, p.arity());
...@@ -79,9 +79,9 @@ Reduction JSCallReducer::ReduceNumberConstructor(Node* node) { ...@@ -79,9 +79,9 @@ Reduction JSCallReducer::ReduceNumberConstructor(Node* node) {
// ES6 section 19.2.3.1 Function.prototype.apply ( thisArg, argArray ) // ES6 section 19.2.3.1 Function.prototype.apply ( thisArg, argArray )
Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) { Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
Node* target = NodeProperties::GetValueInput(node, 0); Node* target = NodeProperties::GetValueInput(node, 0);
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
// Tail calls to Function.prototype.apply are not properly supported // Tail calls to Function.prototype.apply are not properly supported
// down the pipeline, so we disable this optimization completely for // down the pipeline, so we disable this optimization completely for
// tail calls (for now). // tail calls (for now).
...@@ -175,24 +175,25 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) { ...@@ -175,24 +175,25 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
} else { } else {
return NoChange(); return NoChange();
} }
// Change {node} to the new {JSCallFunction} operator. // Change {node} to the new {JSCall} operator.
NodeProperties::ChangeOp( NodeProperties::ChangeOp(
node, javascript()->CallFunction(arity, p.frequency(), VectorSlotPair(), node,
convert_mode, p.tail_call_mode())); javascript()->Call(arity, p.frequency(), VectorSlotPair(), convert_mode,
p.tail_call_mode()));
// Change context of {node} to the Function.prototype.apply context, // Change context of {node} to the Function.prototype.apply context,
// to ensure any exception is thrown in the correct context. // to ensure any exception is thrown in the correct context.
NodeProperties::ReplaceContextInput( NodeProperties::ReplaceContextInput(
node, jsgraph()->HeapConstant(handle(apply->context(), isolate()))); node, jsgraph()->HeapConstant(handle(apply->context(), isolate())));
// Try to further reduce the JSCallFunction {node}. // Try to further reduce the JSCall {node}.
Reduction const reduction = ReduceJSCallFunction(node); Reduction const reduction = ReduceJSCall(node);
return reduction.Changed() ? reduction : Changed(node); return reduction.Changed() ? reduction : Changed(node);
} }
// ES6 section 19.2.3.3 Function.prototype.call (thisArg, ...args) // ES6 section 19.2.3.3 Function.prototype.call (thisArg, ...args)
Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) { Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
Handle<JSFunction> call = Handle<JSFunction>::cast( Handle<JSFunction> call = Handle<JSFunction>::cast(
HeapObjectMatcher(NodeProperties::GetValueInput(node, 0)).Value()); HeapObjectMatcher(NodeProperties::GetValueInput(node, 0)).Value());
// Change context of {node} to the Function.prototype.call context, // Change context of {node} to the Function.prototype.call context,
...@@ -217,16 +218,17 @@ Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) { ...@@ -217,16 +218,17 @@ Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) {
--arity; --arity;
} }
NodeProperties::ChangeOp( NodeProperties::ChangeOp(
node, javascript()->CallFunction(arity, p.frequency(), VectorSlotPair(), node,
convert_mode, p.tail_call_mode())); javascript()->Call(arity, p.frequency(), VectorSlotPair(), convert_mode,
// Try to further reduce the JSCallFunction {node}. p.tail_call_mode()));
Reduction const reduction = ReduceJSCallFunction(node); // Try to further reduce the JSCall {node}.
Reduction const reduction = ReduceJSCall(node);
return reduction.Changed() ? reduction : Changed(node); return reduction.Changed() ? reduction : Changed(node);
} }
// ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] (V) // ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] (V)
Reduction JSCallReducer::ReduceFunctionPrototypeHasInstance(Node* node) { Reduction JSCallReducer::ReduceFunctionPrototypeHasInstance(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
Node* receiver = NodeProperties::GetValueInput(node, 1); Node* receiver = NodeProperties::GetValueInput(node, 1);
Node* object = (node->op()->ValueInputCount() >= 3) Node* object = (node->op()->ValueInputCount() >= 3)
? NodeProperties::GetValueInput(node, 2) ? NodeProperties::GetValueInput(node, 2)
...@@ -281,12 +283,12 @@ MaybeHandle<Map> InferReceiverMap(Node* node) { ...@@ -281,12 +283,12 @@ MaybeHandle<Map> InferReceiverMap(Node* node) {
bool CanInlineApiCall(Isolate* isolate, Node* node, bool CanInlineApiCall(Isolate* isolate, Node* node,
Handle<FunctionTemplateInfo> function_template_info) { Handle<FunctionTemplateInfo> function_template_info) {
DCHECK(node->opcode() == IrOpcode::kJSCallFunction); DCHECK(node->opcode() == IrOpcode::kJSCall);
if (V8_UNLIKELY(FLAG_runtime_stats)) return false; if (V8_UNLIKELY(FLAG_runtime_stats)) return false;
if (function_template_info->call_code()->IsUndefined(isolate)) { if (function_template_info->call_code()->IsUndefined(isolate)) {
return false; return false;
} }
CallFunctionParameters const& params = CallFunctionParametersOf(node->op()); CallParameters const& params = CallParametersOf(node->op());
// CallApiCallbackStub expects the target in a register, so we count it out, // CallApiCallbackStub expects the target in a register, so we count it out,
// and counts the receiver as an implicit argument, so we count the receiver // and counts the receiver as an implicit argument, so we count the receiver
// out too. // out too.
...@@ -334,7 +336,7 @@ JSCallReducer::HolderLookup JSCallReducer::LookupHolder( ...@@ -334,7 +336,7 @@ JSCallReducer::HolderLookup JSCallReducer::LookupHolder(
// ES6 section B.2.2.1.1 get Object.prototype.__proto__ // ES6 section B.2.2.1.1 get Object.prototype.__proto__
Reduction JSCallReducer::ReduceObjectPrototypeGetProto(Node* node) { Reduction JSCallReducer::ReduceObjectPrototypeGetProto(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
// Try to determine the {receiver} map. // Try to determine the {receiver} map.
Handle<Map> receiver_map; Handle<Map> receiver_map;
...@@ -368,7 +370,7 @@ Reduction JSCallReducer::ReduceCallApiFunction( ...@@ -368,7 +370,7 @@ Reduction JSCallReducer::ReduceCallApiFunction(
Handle<Object> data(call_handler_info->data(), isolate); Handle<Object> data(call_handler_info->data(), isolate);
Node* receiver_node = NodeProperties::GetValueInput(node, 1); Node* receiver_node = NodeProperties::GetValueInput(node, 1);
CallFunctionParameters const& params = CallFunctionParametersOf(node->op()); CallParameters const& params = CallParametersOf(node->op());
Handle<HeapObject> receiver = HeapObjectMatcher(receiver_node).Value(); Handle<HeapObject> receiver = HeapObjectMatcher(receiver_node).Value();
bool const receiver_is_undefined = receiver->IsUndefined(isolate); bool const receiver_is_undefined = receiver->IsUndefined(isolate);
...@@ -416,14 +418,14 @@ Reduction JSCallReducer::ReduceCallApiFunction( ...@@ -416,14 +418,14 @@ Reduction JSCallReducer::ReduceCallApiFunction(
return Changed(node); return Changed(node);
} }
Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { Reduction JSCallReducer::ReduceJSCall(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
Node* target = NodeProperties::GetValueInput(node, 0); Node* target = NodeProperties::GetValueInput(node, 0);
Node* control = NodeProperties::GetControlInput(node); Node* control = NodeProperties::GetControlInput(node);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
// Try to specialize JSCallFunction {node}s with constant {target}s. // Try to specialize JSCall {node}s with constant {target}s.
HeapObjectMatcher m(target); HeapObjectMatcher m(target);
if (m.HasValue()) { if (m.HasValue()) {
if (m.Value()->IsJSFunction()) { if (m.Value()->IsJSFunction()) {
...@@ -476,7 +478,7 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { ...@@ -476,7 +478,7 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
Handle<Object> bound_this(function->bound_this(), isolate()); Handle<Object> bound_this(function->bound_this(), isolate());
Handle<FixedArray> bound_arguments(function->bound_arguments(), Handle<FixedArray> bound_arguments(function->bound_arguments(),
isolate()); isolate());
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
ConvertReceiverMode const convert_mode = ConvertReceiverMode const convert_mode =
(bound_this->IsNullOrUndefined(isolate())) (bound_this->IsNullOrUndefined(isolate()))
? ConvertReceiverMode::kNullOrUndefined ? ConvertReceiverMode::kNullOrUndefined
...@@ -495,11 +497,12 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { ...@@ -495,11 +497,12 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
jsgraph()->Constant(handle(bound_arguments->get(i), isolate()))); jsgraph()->Constant(handle(bound_arguments->get(i), isolate())));
arity++; arity++;
} }
NodeProperties::ChangeOp(node, javascript()->CallFunction( NodeProperties::ChangeOp(
arity, p.frequency(), VectorSlotPair(), node,
javascript()->Call(arity, p.frequency(), VectorSlotPair(),
convert_mode, p.tail_call_mode())); convert_mode, p.tail_call_mode()));
// Try to further reduce the JSCallFunction {node}. // Try to further reduce the JSCall {node}.
Reduction const reduction = ReduceJSCallFunction(node); Reduction const reduction = ReduceJSCall(node);
return reduction.Changed() ? reduction : Changed(node); return reduction.Changed() ? reduction : Changed(node);
} }
...@@ -566,12 +569,12 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { ...@@ -566,12 +569,12 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
effect = effect =
graph()->NewNode(simplified()->CheckIf(), check, effect, control); graph()->NewNode(simplified()->CheckIf(), check, effect, control);
// Specialize the JSCallFunction node to the {target_function}. // Specialize the JSCall node to the {target_function}.
NodeProperties::ReplaceValueInput(node, target_function, 0); NodeProperties::ReplaceValueInput(node, target_function, 0);
NodeProperties::ReplaceEffectInput(node, effect); NodeProperties::ReplaceEffectInput(node, effect);
// Try to further reduce the JSCallFunction {node}. // Try to further reduce the JSCall {node}.
Reduction const reduction = ReduceJSCallFunction(node); Reduction const reduction = ReduceJSCall(node);
return reduction.Changed() ? reduction : Changed(node); return reduction.Changed() ? reduction : Changed(node);
} }
} }
......
...@@ -23,7 +23,7 @@ class JSGraph; ...@@ -23,7 +23,7 @@ class JSGraph;
class JSOperatorBuilder; class JSOperatorBuilder;
class SimplifiedOperatorBuilder; class SimplifiedOperatorBuilder;
// Performs strength reduction on {JSConstruct} and {JSCallFunction} nodes, // Performs strength reduction on {JSConstruct} and {JSCall} nodes,
// which might allow inlining or other optimizations to be performed afterwards. // which might allow inlining or other optimizations to be performed afterwards.
class JSCallReducer final : public AdvancedReducer { class JSCallReducer final : public AdvancedReducer {
public: public:
...@@ -57,7 +57,7 @@ class JSCallReducer final : public AdvancedReducer { ...@@ -57,7 +57,7 @@ class JSCallReducer final : public AdvancedReducer {
Reduction ReduceObjectPrototypeGetProto(Node* node); Reduction ReduceObjectPrototypeGetProto(Node* node);
Reduction ReduceJSConstruct(Node* node); Reduction ReduceJSConstruct(Node* node);
Reduction ReduceJSConstructWithSpread(Node* node); Reduction ReduceJSConstructWithSpread(Node* node);
Reduction ReduceJSCallFunction(Node* node); Reduction ReduceJSCall(Node* node);
enum HolderLookup { kHolderNotFound, kHolderIsReceiver, kHolderFound }; enum HolderLookup { kHolderNotFound, kHolderIsReceiver, kHolderFound };
......
...@@ -545,8 +545,8 @@ void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { ...@@ -545,8 +545,8 @@ void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) {
NodeProperties::ChangeOp(node, common()->Call(desc)); NodeProperties::ChangeOp(node, common()->Call(desc));
} }
void JSGenericLowering::LowerJSCallFunction(Node* node) { void JSGenericLowering::LowerJSCall(Node* node) {
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2); int const arg_count = static_cast<int>(p.arity() - 2);
ConvertReceiverMode const mode = p.convert_mode(); ConvertReceiverMode const mode = p.convert_mode();
Callable callable = CodeFactory::Call(isolate(), mode); Callable callable = CodeFactory::Call(isolate(), mode);
...@@ -563,9 +563,8 @@ void JSGenericLowering::LowerJSCallFunction(Node* node) { ...@@ -563,9 +563,8 @@ void JSGenericLowering::LowerJSCallFunction(Node* node) {
NodeProperties::ChangeOp(node, common()->Call(desc)); NodeProperties::ChangeOp(node, common()->Call(desc));
} }
void JSGenericLowering::LowerJSCallFunctionWithSpread(Node* node) { void JSGenericLowering::LowerJSCallWithSpread(Node* node) {
CallFunctionWithSpreadParameters const& p = CallWithSpreadParameters const& p = CallWithSpreadParametersOf(node->op());
CallFunctionWithSpreadParametersOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2); int const arg_count = static_cast<int>(p.arity() - 2);
Callable callable = CodeFactory::CallWithSpread(isolate()); Callable callable = CodeFactory::CallWithSpread(isolate());
CallDescriptor::Flags flags = FrameStateFlagForCall(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node);
......
...@@ -117,8 +117,8 @@ Reduction JSInliningHeuristic::Reduce(Node* node) { ...@@ -117,8 +117,8 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
} }
// Gather feedback on how often this call site has been hit before. // Gather feedback on how often this call site has been hit before.
if (node->opcode() == IrOpcode::kJSCallFunction) { if (node->opcode() == IrOpcode::kJSCall) {
CallFunctionParameters const p = CallFunctionParametersOf(node->op()); CallParameters const p = CallParametersOf(node->op());
candidate.frequency = p.frequency(); candidate.frequency = p.frequency();
} else { } else {
ConstructParameters const p = ConstructParametersOf(node->op()); ConstructParameters const p = ConstructParametersOf(node->op());
...@@ -175,7 +175,7 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) { ...@@ -175,7 +175,7 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) {
return reduction; return reduction;
} }
// Expand the JSCallFunction/JSConstruct node to a subgraph first if // Expand the JSCall/JSConstruct node to a subgraph first if
// we have multiple known target functions. // we have multiple known target functions.
DCHECK_LT(1, num_calls); DCHECK_LT(1, num_calls);
Node* calls[kMaxCallPolymorphism + 1]; Node* calls[kMaxCallPolymorphism + 1];
......
...@@ -31,21 +31,21 @@ namespace compiler { ...@@ -31,21 +31,21 @@ namespace compiler {
// Provides convenience accessors for the common layout of nodes having either // Provides convenience accessors for the common layout of nodes having either
// the {JSCallFunction} or the {JSConstruct} operator. // the {JSCall} or the {JSConstruct} operator.
class JSCallAccessor { class JSCallAccessor {
public: public:
explicit JSCallAccessor(Node* call) : call_(call) { explicit JSCallAccessor(Node* call) : call_(call) {
DCHECK(call->opcode() == IrOpcode::kJSCallFunction || DCHECK(call->opcode() == IrOpcode::kJSCall ||
call->opcode() == IrOpcode::kJSConstruct); call->opcode() == IrOpcode::kJSConstruct);
} }
Node* target() { Node* target() {
// Both, {JSCallFunction} and {JSConstruct}, have same layout here. // Both, {JSCall} and {JSConstruct}, have same layout here.
return call_->InputAt(0); return call_->InputAt(0);
} }
Node* receiver() { Node* receiver() {
DCHECK_EQ(IrOpcode::kJSCallFunction, call_->opcode()); DCHECK_EQ(IrOpcode::kJSCall, call_->opcode());
return call_->InputAt(1); return call_->InputAt(1);
} }
...@@ -55,20 +55,20 @@ class JSCallAccessor { ...@@ -55,20 +55,20 @@ class JSCallAccessor {
} }
Node* frame_state() { Node* frame_state() {
// Both, {JSCallFunction} and {JSConstruct}, have frame state. // Both, {JSCall} and {JSConstruct}, have frame state.
return NodeProperties::GetFrameStateInput(call_); return NodeProperties::GetFrameStateInput(call_);
} }
int formal_arguments() { int formal_arguments() {
// Both, {JSCallFunction} and {JSConstruct}, have two extra inputs: // Both, {JSCall} and {JSConstruct}, have two extra inputs:
// - JSConstruct: Includes target function and new target. // - JSConstruct: Includes target function and new target.
// - JSCallFunction: Includes target function and receiver. // - JSCall: Includes target function and receiver.
return call_->op()->ValueInputCount() - 2; return call_->op()->ValueInputCount() - 2;
} }
float frequency() const { float frequency() const {
return (call_->opcode() == IrOpcode::kJSCallFunction) return (call_->opcode() == IrOpcode::kJSCall)
? CallFunctionParametersOf(call_->op()).frequency() ? CallParametersOf(call_->op()).frequency()
: ConstructParametersOf(call_->op()).frequency(); : ConstructParametersOf(call_->op()).frequency();
} }
...@@ -353,7 +353,7 @@ Reduction JSInliner::Reduce(Node* node) { ...@@ -353,7 +353,7 @@ Reduction JSInliner::Reduce(Node* node) {
// This reducer can handle both normal function calls as well a constructor // This reducer can handle both normal function calls as well a constructor
// calls whenever the target is a constant function object, as follows: // calls whenever the target is a constant function object, as follows:
// - JSCallFunction(target:constant, receiver, args...) // - JSCall(target:constant, receiver, args...)
// - JSConstruct(target:constant, args..., new.target) // - JSConstruct(target:constant, args..., new.target)
HeapObjectMatcher match(node->InputAt(0)); HeapObjectMatcher match(node->InputAt(0));
if (!match.HasValue() || !match.Value()->IsJSFunction()) return NoChange(); if (!match.HasValue() || !match.Value()->IsJSFunction()) return NoChange();
...@@ -394,7 +394,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) { ...@@ -394,7 +394,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
// Class constructors are callable, but [[Call]] will raise an exception. // Class constructors are callable, but [[Call]] will raise an exception.
// See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList ). // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList ).
if (node->opcode() == IrOpcode::kJSCallFunction && if (node->opcode() == IrOpcode::kJSCall &&
IsClassConstructor(shared_info->kind())) { IsClassConstructor(shared_info->kind())) {
TRACE("Not inlining %s into %s because callee is a class constructor.\n", TRACE("Not inlining %s into %s because callee is a class constructor.\n",
shared_info->DebugName()->ToCString().get(), shared_info->DebugName()->ToCString().get(),
...@@ -580,7 +580,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) { ...@@ -580,7 +580,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
} }
// Swizzle the inputs of the {JSConstruct} node to look like inputs to a // Swizzle the inputs of the {JSConstruct} node to look like inputs to a
// normal {JSCallFunction} node so that the rest of the inlining machinery // normal {JSCall} node so that the rest of the inlining machinery
// behaves as if we were dealing with a regular function invocation. // behaves as if we were dealing with a regular function invocation.
new_target = call.new_target(); // Retrieve new target value input. new_target = call.new_target(); // Retrieve new target value input.
node->RemoveInput(call.formal_arguments() + 1); // Drop new target. node->RemoveInput(call.formal_arguments() + 1); // Drop new target.
...@@ -605,11 +605,11 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) { ...@@ -605,11 +605,11 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
// state _before_ the call; it is not necessary to fiddle with the receiver // state _before_ the call; it is not necessary to fiddle with the receiver
// in that frame state tho, as the conversion of the receiver can be repeated // in that frame state tho, as the conversion of the receiver can be repeated
// any number of times, it's not observable. // any number of times, it's not observable.
if (node->opcode() == IrOpcode::kJSCallFunction && if (node->opcode() == IrOpcode::kJSCall &&
is_sloppy(shared_info->language_mode()) && !shared_info->native()) { is_sloppy(shared_info->language_mode()) && !shared_info->native()) {
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
if (NeedsConvertReceiver(call.receiver(), effect)) { if (NeedsConvertReceiver(call.receiver(), effect)) {
const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); const CallParameters& p = CallParametersOf(node->op());
Node* frame_state_before = NodeProperties::FindFrameStateBefore(node); Node* frame_state_before = NodeProperties::FindFrameStateBefore(node);
Node* convert = effect = graph()->NewNode( Node* convert = effect = graph()->NewNode(
javascript()->ConvertReceiver(p.convert_mode()), call.receiver(), javascript()->ConvertReceiver(p.convert_mode()), call.receiver(),
...@@ -626,8 +626,8 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) { ...@@ -626,8 +626,8 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
// the case when the outermost function inlines a tail call (it should remove // the case when the outermost function inlines a tail call (it should remove
// potential arguments adaptor frame that belongs to outermost function when // potential arguments adaptor frame that belongs to outermost function when
// deopt happens). // deopt happens).
if (node->opcode() == IrOpcode::kJSCallFunction) { if (node->opcode() == IrOpcode::kJSCall) {
const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); const CallParameters& p = CallParametersOf(node->op());
if (p.tail_call_mode() == TailCallMode::kAllow) { if (p.tail_call_mode() == TailCallMode::kAllow) {
frame_state = CreateTailCallerFrameState(node, frame_state); frame_state = CreateTailCallerFrameState(node, frame_state);
} }
......
...@@ -300,9 +300,9 @@ Reduction JSIntrinsicLowering::ReduceToString(Node* node) { ...@@ -300,9 +300,9 @@ Reduction JSIntrinsicLowering::ReduceToString(Node* node) {
Reduction JSIntrinsicLowering::ReduceCall(Node* node) { Reduction JSIntrinsicLowering::ReduceCall(Node* node) {
size_t const arity = CallRuntimeParametersOf(node->op()).arity(); size_t const arity = CallRuntimeParametersOf(node->op()).arity();
NodeProperties::ChangeOp( NodeProperties::ChangeOp(
node, javascript()->CallFunction(arity, 0.0f, VectorSlotPair(), node,
ConvertReceiverMode::kAny, javascript()->Call(arity, 0.0f, VectorSlotPair(),
TailCallMode::kDisallow)); ConvertReceiverMode::kAny, TailCallMode::kDisallow));
return Changed(node); return Changed(node);
} }
......
...@@ -210,7 +210,7 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { ...@@ -210,7 +210,7 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) {
node->ReplaceInput(5, effect); node->ReplaceInput(5, effect);
NodeProperties::ChangeOp( NodeProperties::ChangeOp(
node, node,
javascript()->CallFunction(3, 0.0f, VectorSlotPair(), javascript()->Call(3, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined)); ConvertReceiverMode::kNotNullOrUndefined));
// Rewire the value uses of {node} to ToBoolean conversion of the result. // Rewire the value uses of {node} to ToBoolean conversion of the result.
...@@ -1323,8 +1323,7 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -1323,8 +1323,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
// Introduce the call to the getter function. // Introduce the call to the getter function.
if (access_info.constant()->IsJSFunction()) { if (access_info.constant()->IsJSFunction()) {
value = effect = graph()->NewNode( value = effect = graph()->NewNode(
javascript()->CallFunction( javascript()->Call(2, 0.0f, VectorSlotPair(),
2, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined), ConvertReceiverMode::kNotNullOrUndefined),
target, receiver, context, frame_state0, effect, control); target, receiver, context, frame_state0, effect, control);
control = graph()->NewNode(common()->IfSuccess(), value); control = graph()->NewNode(common()->IfSuccess(), value);
...@@ -1361,8 +1360,7 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -1361,8 +1360,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
// Introduce the call to the setter function. // Introduce the call to the setter function.
if (access_info.constant()->IsJSFunction()) { if (access_info.constant()->IsJSFunction()) {
effect = graph()->NewNode( effect = graph()->NewNode(
javascript()->CallFunction( javascript()->Call(3, 0.0f, VectorSlotPair(),
3, 0.0f, VectorSlotPair(),
ConvertReceiverMode::kNotNullOrUndefined), ConvertReceiverMode::kNotNullOrUndefined),
target, receiver, value, context, frame_state0, effect, control); target, receiver, value, context, frame_state0, effect, control);
control = graph()->NewNode(common()->IfSuccess(), effect); control = graph()->NewNode(common()->IfSuccess(), effect);
......
...@@ -101,16 +101,15 @@ ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf( ...@@ -101,16 +101,15 @@ ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf(
return OpParameter<ConstructWithSpreadParameters>(op); return OpParameter<ConstructWithSpreadParameters>(op);
} }
std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { std::ostream& operator<<(std::ostream& os, CallParameters const& p) {
os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode() << ", " os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode() << ", "
<< p.tail_call_mode(); << p.tail_call_mode();
return os; return os;
} }
const CallParameters& CallParametersOf(const Operator* op) {
const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { DCHECK_EQ(IrOpcode::kJSCall, op->opcode());
DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); return OpParameter<CallParameters>(op);
return OpParameter<CallFunctionParameters>(op);
} }
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os,
...@@ -124,29 +123,27 @@ CallForwardVarargsParameters const& CallForwardVarargsParametersOf( ...@@ -124,29 +123,27 @@ CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
return OpParameter<CallForwardVarargsParameters>(op); return OpParameter<CallForwardVarargsParameters>(op);
} }
bool operator==(CallFunctionWithSpreadParameters const& lhs, bool operator==(CallWithSpreadParameters const& lhs,
CallFunctionWithSpreadParameters const& rhs) { CallWithSpreadParameters const& rhs) {
return lhs.arity() == rhs.arity(); return lhs.arity() == rhs.arity();
} }
bool operator!=(CallFunctionWithSpreadParameters const& lhs, bool operator!=(CallWithSpreadParameters const& lhs,
CallFunctionWithSpreadParameters const& rhs) { CallWithSpreadParameters const& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
size_t hash_value(CallFunctionWithSpreadParameters const& p) { size_t hash_value(CallWithSpreadParameters const& p) {
return base::hash_combine(p.arity()); return base::hash_combine(p.arity());
} }
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os, CallWithSpreadParameters const& p) {
CallFunctionWithSpreadParameters const& p) {
return os << p.arity(); return os << p.arity();
} }
CallFunctionWithSpreadParameters const& CallFunctionWithSpreadParametersOf( CallWithSpreadParameters const& CallWithSpreadParametersOf(Operator const* op) {
Operator const* op) { DCHECK_EQ(IrOpcode::kJSCallWithSpread, op->opcode());
DCHECK_EQ(IrOpcode::kJSCallFunctionWithSpread, op->opcode()); return OpParameter<CallWithSpreadParameters>(op);
return OpParameter<CallFunctionWithSpreadParameters>(op);
} }
bool operator==(CallRuntimeParameters const& lhs, bool operator==(CallRuntimeParameters const& lhs,
...@@ -741,23 +738,24 @@ const Operator* JSOperatorBuilder::CallForwardVarargs( ...@@ -741,23 +738,24 @@ const Operator* JSOperatorBuilder::CallForwardVarargs(
parameters); // parameter parameters); // parameter
} }
const Operator* JSOperatorBuilder::CallFunction( const Operator* JSOperatorBuilder::Call(size_t arity, float frequency,
size_t arity, float frequency, VectorSlotPair const& feedback, VectorSlotPair const& feedback,
ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { ConvertReceiverMode convert_mode,
CallFunctionParameters parameters(arity, frequency, feedback, tail_call_mode, TailCallMode tail_call_mode) {
CallParameters parameters(arity, frequency, feedback, tail_call_mode,
convert_mode); convert_mode);
return new (zone()) Operator1<CallFunctionParameters>( // -- return new (zone()) Operator1<CallParameters>( // --
IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode IrOpcode::kJSCall, Operator::kNoProperties, // opcode
"JSCallFunction", // name "JSCall", // name
parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs
parameters); // parameter parameters); // parameter
} }
const Operator* JSOperatorBuilder::CallFunctionWithSpread(uint32_t arity) { const Operator* JSOperatorBuilder::CallWithSpread(uint32_t arity) {
CallFunctionWithSpreadParameters parameters(arity); CallWithSpreadParameters parameters(arity);
return new (zone()) Operator1<CallFunctionWithSpreadParameters>( // -- return new (zone()) Operator1<CallWithSpreadParameters>( // --
IrOpcode::kJSCallFunctionWithSpread, Operator::kNoProperties, // opcode IrOpcode::kJSCallWithSpread, Operator::kNoProperties, // opcode
"JSCallFunctionWithSpread", // name "JSCallWithSpread", // name
parameters.arity(), 1, 1, 1, 1, 2, // counts parameters.arity(), 1, 1, 1, 1, 2, // counts
parameters); // parameter parameters); // parameter
} }
......
...@@ -147,13 +147,11 @@ CallForwardVarargsParameters const& CallForwardVarargsParametersOf( ...@@ -147,13 +147,11 @@ CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
Operator const*) WARN_UNUSED_RESULT; Operator const*) WARN_UNUSED_RESULT;
// Defines the arity and the call flags for a JavaScript function call. This is // Defines the arity and the call flags for a JavaScript function call. This is
// used as a parameter by JSCallFunction operators. // used as a parameter by JSCall operators.
class CallFunctionParameters final { class CallParameters final {
public: public:
CallFunctionParameters(size_t arity, float frequency, CallParameters(size_t arity, float frequency, VectorSlotPair const& feedback,
VectorSlotPair const& feedback, TailCallMode tail_call_mode, ConvertReceiverMode convert_mode)
TailCallMode tail_call_mode,
ConvertReceiverMode convert_mode)
: bit_field_(ArityField::encode(arity) | : bit_field_(ArityField::encode(arity) |
ConvertReceiverModeField::encode(convert_mode) | ConvertReceiverModeField::encode(convert_mode) |
TailCallModeField::encode(tail_call_mode)), TailCallModeField::encode(tail_call_mode)),
...@@ -170,17 +168,15 @@ class CallFunctionParameters final { ...@@ -170,17 +168,15 @@ class CallFunctionParameters final {
} }
VectorSlotPair const& feedback() const { return feedback_; } VectorSlotPair const& feedback() const { return feedback_; }
bool operator==(CallFunctionParameters const& that) const { bool operator==(CallParameters const& that) const {
return this->bit_field_ == that.bit_field_ && return this->bit_field_ == that.bit_field_ &&
this->frequency_ == that.frequency_ && this->frequency_ == that.frequency_ &&
this->feedback_ == that.feedback_; this->feedback_ == that.feedback_;
} }
bool operator!=(CallFunctionParameters const& that) const { bool operator!=(CallParameters const& that) const { return !(*this == that); }
return !(*this == that);
}
private: private:
friend size_t hash_value(CallFunctionParameters const& p) { friend size_t hash_value(CallParameters const& p) {
return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_); return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_);
} }
...@@ -193,18 +189,18 @@ class CallFunctionParameters final { ...@@ -193,18 +189,18 @@ class CallFunctionParameters final {
VectorSlotPair const feedback_; VectorSlotPair const feedback_;
}; };
size_t hash_value(CallFunctionParameters const&); size_t hash_value(CallParameters const&);
std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); std::ostream& operator<<(std::ostream&, CallParameters const&);
const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); const CallParameters& CallParametersOf(const Operator* op);
// Defines the arity for a JavaScript constructor call with a spread as the last // Defines the arity for a JavaScript constructor call with a spread as the last
// parameters. This is used as a parameter by JSConstructWithSpread // parameters. This is used as a parameter by JSConstructWithSpread
// operators. // operators.
class CallFunctionWithSpreadParameters final { class CallWithSpreadParameters final {
public: public:
explicit CallFunctionWithSpreadParameters(uint32_t arity) : arity_(arity) {} explicit CallWithSpreadParameters(uint32_t arity) : arity_(arity) {}
uint32_t arity() const { return arity_; } uint32_t arity() const { return arity_; }
...@@ -212,18 +208,16 @@ class CallFunctionWithSpreadParameters final { ...@@ -212,18 +208,16 @@ class CallFunctionWithSpreadParameters final {
uint32_t const arity_; uint32_t const arity_;
}; };
bool operator==(CallFunctionWithSpreadParameters const&, bool operator==(CallWithSpreadParameters const&,
CallFunctionWithSpreadParameters const&); CallWithSpreadParameters const&);
bool operator!=(CallFunctionWithSpreadParameters const&, bool operator!=(CallWithSpreadParameters const&,
CallFunctionWithSpreadParameters const&); CallWithSpreadParameters const&);
size_t hash_value(CallFunctionWithSpreadParameters const&); size_t hash_value(CallWithSpreadParameters const&);
std::ostream& operator<<(std::ostream&, std::ostream& operator<<(std::ostream&, CallWithSpreadParameters const&);
CallFunctionWithSpreadParameters const&);
CallFunctionWithSpreadParameters const& CallFunctionWithSpreadParametersOf( CallWithSpreadParameters const& CallWithSpreadParametersOf(Operator const*);
Operator const*);
// Defines the arity and the ID for a runtime function call. This is used as a // Defines the arity and the ID for a runtime function call. This is used as a
// parameter by JSCallRuntime operators. // parameter by JSCallRuntime operators.
...@@ -614,12 +608,12 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final ...@@ -614,12 +608,12 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CallForwardVarargs(uint32_t start_index, const Operator* CallForwardVarargs(uint32_t start_index,
TailCallMode tail_call_mode); TailCallMode tail_call_mode);
const Operator* CallFunction( const Operator* Call(
size_t arity, float frequency = 0.0f, size_t arity, float frequency = 0.0f,
VectorSlotPair const& feedback = VectorSlotPair(), VectorSlotPair const& feedback = VectorSlotPair(),
ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
TailCallMode tail_call_mode = TailCallMode::kDisallow); TailCallMode tail_call_mode = TailCallMode::kDisallow);
const Operator* CallFunctionWithSpread(uint32_t arity); const Operator* CallWithSpread(uint32_t arity);
const Operator* CallRuntime(Runtime::FunctionId id); const Operator* CallRuntime(Runtime::FunctionId id);
const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
const Operator* CallRuntime(const Runtime::Function* function, size_t arity); const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
......
...@@ -2052,9 +2052,9 @@ Reduction JSTypedLowering::ReduceJSCallForwardVarargs(Node* node) { ...@@ -2052,9 +2052,9 @@ Reduction JSTypedLowering::ReduceJSCallForwardVarargs(Node* node) {
return NoChange(); return NoChange();
} }
Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) { Reduction JSTypedLowering::ReduceJSCall(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
int const arity = static_cast<int>(p.arity() - 2); int const arity = static_cast<int>(p.arity() - 2);
ConvertReceiverMode convert_mode = p.convert_mode(); ConvertReceiverMode convert_mode = p.convert_mode();
Node* target = NodeProperties::GetValueInput(node, 0); Node* target = NodeProperties::GetValueInput(node, 0);
...@@ -2163,8 +2163,9 @@ Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) { ...@@ -2163,8 +2163,9 @@ Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) {
// Maybe we did at least learn something about the {receiver}. // Maybe we did at least learn something about the {receiver}.
if (p.convert_mode() != convert_mode) { if (p.convert_mode() != convert_mode) {
NodeProperties::ChangeOp( NodeProperties::ChangeOp(
node, javascript()->CallFunction(p.arity(), p.frequency(), p.feedback(), node,
convert_mode, p.tail_call_mode())); javascript()->Call(p.arity(), p.frequency(), p.feedback(), convert_mode,
p.tail_call_mode()));
return Changed(node); return Changed(node);
} }
...@@ -2416,8 +2417,8 @@ Reduction JSTypedLowering::Reduce(Node* node) { ...@@ -2416,8 +2417,8 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSConstruct(node); return ReduceJSConstruct(node);
case IrOpcode::kJSCallForwardVarargs: case IrOpcode::kJSCallForwardVarargs:
return ReduceJSCallForwardVarargs(node); return ReduceJSCallForwardVarargs(node);
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCall:
return ReduceJSCallFunction(node); return ReduceJSCall(node);
case IrOpcode::kJSForInNext: case IrOpcode::kJSForInNext:
return ReduceJSForInNext(node); return ReduceJSForInNext(node);
case IrOpcode::kJSLoadMessage: case IrOpcode::kJSLoadMessage:
......
...@@ -72,7 +72,7 @@ class V8_EXPORT_PRIVATE JSTypedLowering final ...@@ -72,7 +72,7 @@ class V8_EXPORT_PRIVATE JSTypedLowering final
Reduction ReduceJSConvertReceiver(Node* node); Reduction ReduceJSConvertReceiver(Node* node);
Reduction ReduceJSConstruct(Node* node); Reduction ReduceJSConstruct(Node* node);
Reduction ReduceJSCallForwardVarargs(Node* node); Reduction ReduceJSCallForwardVarargs(Node* node);
Reduction ReduceJSCallFunction(Node* node); Reduction ReduceJSCall(Node* node);
Reduction ReduceJSForInNext(Node* node); Reduction ReduceJSForInNext(Node* node);
Reduction ReduceJSLoadMessage(Node* node); Reduction ReduceJSLoadMessage(Node* node);
Reduction ReduceJSStoreMessage(Node* node); Reduction ReduceJSStoreMessage(Node* node);
......
...@@ -162,8 +162,8 @@ ...@@ -162,8 +162,8 @@
V(JSConstruct) \ V(JSConstruct) \
V(JSConstructWithSpread) \ V(JSConstructWithSpread) \
V(JSCallForwardVarargs) \ V(JSCallForwardVarargs) \
V(JSCallFunction) \ V(JSCall) \
V(JSCallFunctionWithSpread) \ V(JSCallWithSpread) \
V(JSCallRuntime) \ V(JSCallRuntime) \
V(JSConvertReceiver) \ V(JSConvertReceiver) \
V(JSForInNext) \ V(JSForInNext) \
...@@ -800,7 +800,7 @@ class V8_EXPORT_PRIVATE IrOpcode { ...@@ -800,7 +800,7 @@ class V8_EXPORT_PRIVATE IrOpcode {
// Returns true if opcode can be inlined. // Returns true if opcode can be inlined.
static bool IsInlineeOpcode(Value value) { static bool IsInlineeOpcode(Value value) {
return value == kJSConstruct || value == kJSCallFunction; return value == kJSConstruct || value == kJSCall;
} }
// Returns true if opcode for comparison operator. // Returns true if opcode for comparison operator.
......
...@@ -96,8 +96,8 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) { ...@@ -96,8 +96,8 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) {
case IrOpcode::kJSConstruct: case IrOpcode::kJSConstruct:
case IrOpcode::kJSConstructWithSpread: case IrOpcode::kJSConstructWithSpread:
case IrOpcode::kJSCallForwardVarargs: case IrOpcode::kJSCallForwardVarargs:
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCall:
case IrOpcode::kJSCallFunctionWithSpread: case IrOpcode::kJSCallWithSpread:
// Misc operations // Misc operations
case IrOpcode::kJSConvertReceiver: case IrOpcode::kJSConvertReceiver:
......
...@@ -297,7 +297,7 @@ class Typer::Visitor : public Reducer { ...@@ -297,7 +297,7 @@ class Typer::Visitor : public Reducer {
JS_SIMPLE_BINOP_LIST(DECLARE_METHOD) JS_SIMPLE_BINOP_LIST(DECLARE_METHOD)
#undef DECLARE_METHOD #undef DECLARE_METHOD
static Type* JSCallFunctionTyper(Type*, Typer*); static Type* JSCallTyper(Type*, Typer*);
static Type* ReferenceEqualTyper(Type*, Type*, Typer*); static Type* ReferenceEqualTyper(Type*, Type*, Typer*);
static Type* StringFromCharCodeTyper(Type*, Typer*); static Type* StringFromCharCodeTyper(Type*, Typer*);
...@@ -1328,7 +1328,7 @@ Type* Typer::Visitor::TypeJSConstructWithSpread(Node* node) { ...@@ -1328,7 +1328,7 @@ Type* Typer::Visitor::TypeJSConstructWithSpread(Node* node) {
return Type::Receiver(); return Type::Receiver();
} }
Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) { Type* Typer::Visitor::JSCallTyper(Type* fun, Typer* t) {
if (fun->IsHeapConstant() && fun->AsHeapConstant()->Value()->IsJSFunction()) { if (fun->IsHeapConstant() && fun->AsHeapConstant()->Value()->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction> function =
Handle<JSFunction>::cast(fun->AsHeapConstant()->Value()); Handle<JSFunction>::cast(fun->AsHeapConstant()->Value());
...@@ -1579,17 +1579,17 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) { ...@@ -1579,17 +1579,17 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
} }
Type* Typer::Visitor::TypeJSCallForwardVarargs(Node* node) { Type* Typer::Visitor::TypeJSCallForwardVarargs(Node* node) {
return TypeUnaryOp(node, JSCallFunctionTyper); return TypeUnaryOp(node, JSCallTyper);
} }
Type* Typer::Visitor::TypeJSCallFunction(Node* node) { Type* Typer::Visitor::TypeJSCall(Node* node) {
// TODO(bmeurer): We could infer better types if we wouldn't ignore the // TODO(bmeurer): We could infer better types if we wouldn't ignore the
// argument types for the JSCallFunctionTyper above. // argument types for the JSCallTyper above.
return TypeUnaryOp(node, JSCallFunctionTyper); return TypeUnaryOp(node, JSCallTyper);
} }
Type* Typer::Visitor::TypeJSCallFunctionWithSpread(Node* node) { Type* Typer::Visitor::TypeJSCallWithSpread(Node* node) {
return TypeUnaryOp(node, JSCallFunctionTyper); return TypeUnaryOp(node, JSCallTyper);
} }
Type* Typer::Visitor::TypeJSCallRuntime(Node* node) { Type* Typer::Visitor::TypeJSCallRuntime(Node* node) {
......
...@@ -682,8 +682,8 @@ void Verifier::Visitor::Check(Node* node) { ...@@ -682,8 +682,8 @@ void Verifier::Visitor::Check(Node* node) {
CheckTypeIs(node, Type::Receiver()); CheckTypeIs(node, Type::Receiver());
break; break;
case IrOpcode::kJSCallForwardVarargs: case IrOpcode::kJSCallForwardVarargs:
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCall:
case IrOpcode::kJSCallFunctionWithSpread: case IrOpcode::kJSCallWithSpread:
case IrOpcode::kJSCallRuntime: case IrOpcode::kJSCallRuntime:
// Type can be anything. // Type can be anything.
CheckTypeIs(node, Type::Any()); CheckTypeIs(node, Type::Any());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment