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