[turbo] Rename CallConstruct* operators to Construct*.

Review-Url: https://codereview.chromium.org/2662263002
Cr-Commit-Position: refs/heads/master@{#42836}
This commit is contained in:
petermarshall 2017-02-01 00:11:43 -08:00 committed by Commit bot
parent f33cd98cd6
commit 1a1a3cc492
19 changed files with 139 additions and 153 deletions

View File

@ -1861,7 +1861,7 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) {
float const frequency = ComputeCallFrequency(expr->CallNewFeedbackSlot()); float const frequency = ComputeCallFrequency(expr->CallNewFeedbackSlot());
VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot()); VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot());
const Operator* call = const Operator* call =
javascript()->CallConstruct(args->length() + 2, frequency, feedback); javascript()->Construct(args->length() + 2, frequency, feedback);
Node* value = ProcessArguments(call, args->length() + 2); Node* value = ProcessArguments(call, args->length() + 2);
PrepareFrameState(value, expr->ReturnId(), OutputFrameStateCombine::Push()); PrepareFrameState(value, expr->ReturnId(), OutputFrameStateCombine::Push());
ast_context()->ProduceValue(expr, value); ast_context()->ProduceValue(expr, value);

View File

@ -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 JSCallConstruct nodes. // Computes the frequency for JSCallFunction and JSConstruct nodes.
float ComputeCallFrequency(FeedbackVectorSlot slot) const; float ComputeCallFrequency(FeedbackVectorSlot slot) const;
// =========================================================================== // ===========================================================================

View File

@ -1377,7 +1377,7 @@ void BytecodeGraphBuilder::VisitNewWithSpread() {
Node* callee = environment()->LookupRegister(callee_reg); Node* callee = environment()->LookupRegister(callee_reg);
const Operator* op = const Operator* op =
javascript()->CallConstructWithSpread(static_cast<int>(arg_count) + 2); javascript()->ConstructWithSpread(static_cast<int>(arg_count) + 2);
Node* value = ProcessCallNewWithSpreadArguments(op, callee, new_target, Node* value = ProcessCallNewWithSpreadArguments(op, callee, new_target,
first_arg, arg_count + 2); first_arg, arg_count + 2);
environment()->BindAccumulator(value, Environment::kAttachFrameState); environment()->BindAccumulator(value, Environment::kAttachFrameState);
@ -1426,7 +1426,7 @@ void BytecodeGraphBuilder::VisitNew() {
Node* callee = environment()->LookupRegister(callee_reg); Node* callee = environment()->LookupRegister(callee_reg);
float const frequency = ComputeCallFrequency(slot_id); float const frequency = ComputeCallFrequency(slot_id);
const Operator* call = javascript()->CallConstruct( const Operator* call = javascript()->Construct(
static_cast<int>(arg_count) + 2, frequency, feedback); static_cast<int>(arg_count) + 2, frequency, feedback);
Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg,
arg_count + 2); arg_count + 2);

View File

@ -20,10 +20,10 @@ namespace compiler {
Reduction JSCallReducer::Reduce(Node* node) { Reduction JSCallReducer::Reduce(Node* node) {
switch (node->opcode()) { switch (node->opcode()) {
case IrOpcode::kJSCallConstruct: case IrOpcode::kJSConstruct:
return ReduceJSCallConstruct(node); return ReduceJSConstruct(node);
case IrOpcode::kJSCallConstructWithSpread: case IrOpcode::kJSConstructWithSpread:
return ReduceJSCallConstructWithSpread(node); return ReduceJSConstructWithSpread(node);
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCallFunction:
return ReduceJSCallFunction(node); return ReduceJSCallFunction(node);
default: default:
@ -578,10 +578,9 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
return NoChange(); return NoChange();
} }
Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode());
DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); ConstructParameters const& p = ConstructParametersOf(node->op());
CallConstructParameters const& p = CallConstructParametersOf(node->op());
DCHECK_LE(2u, p.arity()); DCHECK_LE(2u, p.arity());
int const arity = static_cast<int>(p.arity() - 2); int const arity = static_cast<int>(p.arity() - 2);
Node* target = NodeProperties::GetValueInput(node, 0); Node* target = NodeProperties::GetValueInput(node, 0);
@ -589,7 +588,7 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node); Node* control = NodeProperties::GetControlInput(node);
// Try to specialize JSCallConstruct {node}s with constant {target}s. // Try to specialize JSConstruct {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()) {
@ -678,15 +677,15 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
effect = effect =
graph()->NewNode(simplified()->CheckIf(), check, effect, control); graph()->NewNode(simplified()->CheckIf(), check, effect, control);
// Specialize the JSCallConstruct node to the {target_function}. // Specialize the JSConstruct 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);
if (target == new_target) { if (target == new_target) {
NodeProperties::ReplaceValueInput(node, target_function, arity + 1); NodeProperties::ReplaceValueInput(node, target_function, arity + 1);
} }
// Try to further reduce the JSCallConstruct {node}. // Try to further reduce the JSConstruct {node}.
Reduction const reduction = ReduceJSCallConstruct(node); Reduction const reduction = ReduceJSConstruct(node);
return reduction.Changed() ? reduction : Changed(node); return reduction.Changed() ? reduction : Changed(node);
} }
} }
@ -694,10 +693,10 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
return NoChange(); return NoChange();
} }
Reduction JSCallReducer::ReduceJSCallConstructWithSpread(Node* node) { Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallConstructWithSpread, node->opcode()); DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode());
CallConstructWithSpreadParameters const& p = ConstructWithSpreadParameters const& p =
CallConstructWithSpreadParametersOf(node->op()); ConstructWithSpreadParametersOf(node->op());
DCHECK_LE(3u, p.arity()); DCHECK_LE(3u, p.arity());
int arity = static_cast<int>(p.arity() - 2); int arity = static_cast<int>(p.arity() - 2);
@ -762,7 +761,7 @@ Reduction JSCallReducer::ReduceJSCallConstructWithSpread(Node* node) {
} }
NodeProperties::ChangeOp( NodeProperties::ChangeOp(
node, javascript()->CallConstruct(arity + 2, 7, VectorSlotPair())); node, javascript()->Construct(arity + 2, 7, VectorSlotPair()));
return Changed(node); return Changed(node);
} }

View File

@ -23,7 +23,7 @@ class JSGraph;
class JSOperatorBuilder; class JSOperatorBuilder;
class SimplifiedOperatorBuilder; class SimplifiedOperatorBuilder;
// Performs strength reduction on {JSCallConstruct} and {JSCallFunction} nodes, // Performs strength reduction on {JSConstruct} and {JSCallFunction} 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:
@ -55,8 +55,8 @@ class JSCallReducer final : public AdvancedReducer {
Reduction ReduceFunctionPrototypeCall(Node* node); Reduction ReduceFunctionPrototypeCall(Node* node);
Reduction ReduceFunctionPrototypeHasInstance(Node* node); Reduction ReduceFunctionPrototypeHasInstance(Node* node);
Reduction ReduceObjectPrototypeGetProto(Node* node); Reduction ReduceObjectPrototypeGetProto(Node* node);
Reduction ReduceJSCallConstruct(Node* node); Reduction ReduceJSConstruct(Node* node);
Reduction ReduceJSCallConstructWithSpread(Node* node); Reduction ReduceJSConstructWithSpread(Node* node);
Reduction ReduceJSCallFunction(Node* node); Reduction ReduceJSCallFunction(Node* node);
enum HolderLookup { kHolderNotFound, kHolderIsReceiver, kHolderFound }; enum HolderLookup { kHolderNotFound, kHolderIsReceiver, kHolderFound };

View File

@ -490,9 +490,8 @@ void JSGenericLowering::LowerJSCreateScriptContext(Node* node) {
ReplaceWithRuntimeCall(node, Runtime::kNewScriptContext); ReplaceWithRuntimeCall(node, Runtime::kNewScriptContext);
} }
void JSGenericLowering::LowerJSConstruct(Node* node) {
void JSGenericLowering::LowerJSCallConstruct(Node* node) { ConstructParameters const& p = ConstructParametersOf(node->op());
CallConstructParameters const& p = CallConstructParametersOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2); int const arg_count = static_cast<int>(p.arity() - 2);
CallDescriptor::Flags flags = FrameStateFlagForCall(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node);
Callable callable = CodeFactory::Construct(isolate()); Callable callable = CodeFactory::Construct(isolate());
@ -510,9 +509,9 @@ void JSGenericLowering::LowerJSCallConstruct(Node* node) {
NodeProperties::ChangeOp(node, common()->Call(desc)); NodeProperties::ChangeOp(node, common()->Call(desc));
} }
void JSGenericLowering::LowerJSCallConstructWithSpread(Node* node) { void JSGenericLowering::LowerJSConstructWithSpread(Node* node) {
CallConstructWithSpreadParameters const& p = ConstructWithSpreadParameters const& p =
CallConstructWithSpreadParametersOf(node->op()); ConstructWithSpreadParametersOf(node->op());
int const arg_count = static_cast<int>(p.arity() - 2); int const arg_count = static_cast<int>(p.arity() - 2);
CallDescriptor::Flags flags = FrameStateFlagForCall(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node);
Callable callable = CodeFactory::ConstructWithSpread(isolate()); Callable callable = CodeFactory::ConstructWithSpread(isolate());

View File

@ -121,7 +121,7 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
CallFunctionParameters const p = CallFunctionParametersOf(node->op()); CallFunctionParameters const p = CallFunctionParametersOf(node->op());
candidate.frequency = p.frequency(); candidate.frequency = p.frequency();
} else { } else {
CallConstructParameters const p = CallConstructParametersOf(node->op()); ConstructParameters const p = ConstructParametersOf(node->op());
candidate.frequency = p.frequency(); candidate.frequency = p.frequency();
} }
@ -175,7 +175,7 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) {
return reduction; return reduction;
} }
// Expand the JSCallFunction/JSCallConstruct node to a subgraph first if // Expand the JSCallFunction/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];

View File

@ -31,16 +31,16 @@ 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 {JSCallConstruct} operator. // the {JSCallFunction} 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::kJSCallFunction ||
call->opcode() == IrOpcode::kJSCallConstruct); call->opcode() == IrOpcode::kJSConstruct);
} }
Node* target() { Node* target() {
// Both, {JSCallFunction} and {JSCallConstruct}, have same layout here. // Both, {JSCallFunction} and {JSConstruct}, have same layout here.
return call_->InputAt(0); return call_->InputAt(0);
} }
@ -50,18 +50,18 @@ class JSCallAccessor {
} }
Node* new_target() { Node* new_target() {
DCHECK_EQ(IrOpcode::kJSCallConstruct, call_->opcode()); DCHECK_EQ(IrOpcode::kJSConstruct, call_->opcode());
return call_->InputAt(formal_arguments() + 1); return call_->InputAt(formal_arguments() + 1);
} }
Node* frame_state() { Node* frame_state() {
// Both, {JSCallFunction} and {JSCallConstruct}, have frame state. // Both, {JSCallFunction} and {JSConstruct}, have frame state.
return NodeProperties::GetFrameStateInput(call_); return NodeProperties::GetFrameStateInput(call_);
} }
int formal_arguments() { int formal_arguments() {
// Both, {JSCallFunction} and {JSCallConstruct}, have two extra inputs: // Both, {JSCallFunction} and {JSConstruct}, have two extra inputs:
// - JSCallConstruct: Includes target function and new target. // - JSConstruct: Includes target function and new target.
// - JSCallFunction: Includes target function and receiver. // - JSCallFunction: Includes target function and receiver.
return call_->op()->ValueInputCount() - 2; return call_->op()->ValueInputCount() - 2;
} }
@ -69,7 +69,7 @@ class JSCallAccessor {
float frequency() const { float frequency() const {
return (call_->opcode() == IrOpcode::kJSCallFunction) return (call_->opcode() == IrOpcode::kJSCallFunction)
? CallFunctionParametersOf(call_->op()).frequency() ? CallFunctionParametersOf(call_->op()).frequency()
: CallConstructParametersOf(call_->op()).frequency(); : ConstructParametersOf(call_->op()).frequency();
} }
private: private:
@ -354,7 +354,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...) // - JSCallFunction(target:constant, receiver, args...)
// - JSCallConstruct(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();
Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value()); Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value());
@ -384,7 +384,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
} }
// Constructor must be constructable. // Constructor must be constructable.
if (node->opcode() == IrOpcode::kJSCallConstruct && if (node->opcode() == IrOpcode::kJSConstruct &&
IsNonConstructible(shared_info)) { IsNonConstructible(shared_info)) {
TRACE("Not inlining %s into %s because constructor is not constructable.\n", TRACE("Not inlining %s into %s because constructor is not constructable.\n",
shared_info->DebugName()->ToCString().get(), shared_info->DebugName()->ToCString().get(),
@ -550,8 +550,8 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
Node* frame_state = call.frame_state(); Node* frame_state = call.frame_state();
Node* new_target = jsgraph()->UndefinedConstant(); Node* new_target = jsgraph()->UndefinedConstant();
// Inline {JSCallConstruct} requires some additional magic. // Inline {JSConstruct} requires some additional magic.
if (node->opcode() == IrOpcode::kJSCallConstruct) { if (node->opcode() == IrOpcode::kJSConstruct) {
// Insert nodes around the call that model the behavior required for a // Insert nodes around the call that model the behavior required for a
// constructor dispatch (allocate implicit receiver and check return value). // constructor dispatch (allocate implicit receiver and check return value).
// This models the behavior usually accomplished by our {JSConstructStub}. // This models the behavior usually accomplished by our {JSConstructStub}.
@ -579,7 +579,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
receiver = create; // The implicit receiver. receiver = create; // The implicit receiver.
} }
// Swizzle the inputs of the {JSCallConstruct} 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 {JSCallFunction} 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.

View File

@ -52,58 +52,53 @@ ToBooleanHints ToBooleanHintsOf(Operator const* op) {
return OpParameter<ToBooleanHints>(op); return OpParameter<ToBooleanHints>(op);
} }
bool operator==(ConstructParameters const& lhs,
bool operator==(CallConstructParameters const& lhs, ConstructParameters const& rhs) {
CallConstructParameters const& rhs) {
return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() && return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() &&
lhs.feedback() == rhs.feedback(); lhs.feedback() == rhs.feedback();
} }
bool operator!=(ConstructParameters const& lhs,
bool operator!=(CallConstructParameters const& lhs, ConstructParameters const& rhs) {
CallConstructParameters const& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
size_t hash_value(ConstructParameters const& p) {
size_t hash_value(CallConstructParameters const& p) {
return base::hash_combine(p.arity(), p.frequency(), p.feedback()); return base::hash_combine(p.arity(), p.frequency(), p.feedback());
} }
std::ostream& operator<<(std::ostream& os, ConstructParameters const& p) {
std::ostream& operator<<(std::ostream& os, CallConstructParameters const& p) {
return os << p.arity() << ", " << p.frequency(); return os << p.arity() << ", " << p.frequency();
} }
ConstructParameters const& ConstructParametersOf(Operator const* op) {
CallConstructParameters const& CallConstructParametersOf(Operator const* op) { DCHECK_EQ(IrOpcode::kJSConstruct, op->opcode());
DCHECK_EQ(IrOpcode::kJSCallConstruct, op->opcode()); return OpParameter<ConstructParameters>(op);
return OpParameter<CallConstructParameters>(op);
} }
bool operator==(CallConstructWithSpreadParameters const& lhs, bool operator==(ConstructWithSpreadParameters const& lhs,
CallConstructWithSpreadParameters const& rhs) { ConstructWithSpreadParameters const& rhs) {
return lhs.arity() == rhs.arity(); return lhs.arity() == rhs.arity();
} }
bool operator!=(CallConstructWithSpreadParameters const& lhs, bool operator!=(ConstructWithSpreadParameters const& lhs,
CallConstructWithSpreadParameters const& rhs) { ConstructWithSpreadParameters const& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
size_t hash_value(CallConstructWithSpreadParameters const& p) { size_t hash_value(ConstructWithSpreadParameters 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,
CallConstructWithSpreadParameters const& p) { ConstructWithSpreadParameters const& p) {
return os << p.arity(); return os << p.arity();
} }
CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf(
Operator const* op) { Operator const* op) {
DCHECK_EQ(IrOpcode::kJSCallConstructWithSpread, op->opcode()); DCHECK_EQ(IrOpcode::kJSConstructWithSpread, op->opcode());
return OpParameter<CallConstructWithSpreadParameters>(op); return OpParameter<ConstructWithSpreadParameters>(op);
} }
std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) {
@ -791,23 +786,23 @@ const Operator* JSOperatorBuilder::CallRuntime(const Runtime::Function* f,
parameters); // parameter parameters); // parameter
} }
const Operator* JSOperatorBuilder::CallConstruct( const Operator* JSOperatorBuilder::Construct(uint32_t arity, float frequency,
uint32_t arity, float frequency, VectorSlotPair const& feedback) { VectorSlotPair const& feedback) {
CallConstructParameters parameters(arity, frequency, feedback); ConstructParameters parameters(arity, frequency, feedback);
return new (zone()) Operator1<CallConstructParameters>( // -- return new (zone()) Operator1<ConstructParameters>( // --
IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode
"JSCallConstruct", // name "JSConstruct", // name
parameters.arity(), 1, 1, 1, 1, 2, // counts parameters.arity(), 1, 1, 1, 1, 2, // counts
parameters); // parameter parameters); // parameter
} }
const Operator* JSOperatorBuilder::CallConstructWithSpread(uint32_t arity) { const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) {
CallConstructWithSpreadParameters parameters(arity); ConstructWithSpreadParameters parameters(arity);
return new (zone()) Operator1<CallConstructWithSpreadParameters>( // -- return new (zone()) Operator1<ConstructWithSpreadParameters>( // --
IrOpcode::kJSCallConstructWithSpread, Operator::kNoProperties, // opcode IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode
"JSCallConstructWithSpread", // name "JSConstructWithSpread", // name
parameters.arity(), 1, 1, 1, 1, 2, // counts parameters.arity(), 1, 1, 1, 1, 2, // counts
parameters); // parameter parameters); // parameter
} }
const Operator* JSOperatorBuilder::ConvertReceiver( const Operator* JSOperatorBuilder::ConvertReceiver(

View File

@ -58,11 +58,11 @@ ToBooleanHints ToBooleanHintsOf(Operator const* op);
// Defines the arity and the feedback for a JavaScript constructor call. This is // Defines the arity and the feedback for a JavaScript constructor call. This is
// used as a parameter by JSCallConstruct operators. // used as a parameter by JSConstruct operators.
class CallConstructParameters final { class ConstructParameters final {
public: public:
CallConstructParameters(uint32_t arity, float frequency, ConstructParameters(uint32_t arity, float frequency,
VectorSlotPair const& feedback) VectorSlotPair const& feedback)
: arity_(arity), frequency_(frequency), feedback_(feedback) {} : arity_(arity), frequency_(frequency), feedback_(feedback) {}
uint32_t arity() const { return arity_; } uint32_t arity() const { return arity_; }
@ -75,21 +75,21 @@ class CallConstructParameters final {
VectorSlotPair const feedback_; VectorSlotPair const feedback_;
}; };
bool operator==(CallConstructParameters const&, CallConstructParameters const&); bool operator==(ConstructParameters const&, ConstructParameters const&);
bool operator!=(CallConstructParameters const&, CallConstructParameters const&); bool operator!=(ConstructParameters const&, ConstructParameters const&);
size_t hash_value(CallConstructParameters const&); size_t hash_value(ConstructParameters const&);
std::ostream& operator<<(std::ostream&, CallConstructParameters const&); std::ostream& operator<<(std::ostream&, ConstructParameters const&);
CallConstructParameters const& CallConstructParametersOf(Operator const*); ConstructParameters const& ConstructParametersOf(Operator const*);
// 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 JSCallConstructWithSpread // parameters. This is used as a parameter by JSConstructWithSpread
// operators. // operators.
class CallConstructWithSpreadParameters final { class ConstructWithSpreadParameters final {
public: public:
explicit CallConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {} explicit ConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {}
uint32_t arity() const { return arity_; } uint32_t arity() const { return arity_; }
@ -97,17 +97,16 @@ class CallConstructWithSpreadParameters final {
uint32_t const arity_; uint32_t const arity_;
}; };
bool operator==(CallConstructWithSpreadParameters const&, bool operator==(ConstructWithSpreadParameters const&,
CallConstructWithSpreadParameters const&); ConstructWithSpreadParameters const&);
bool operator!=(CallConstructWithSpreadParameters const&, bool operator!=(ConstructWithSpreadParameters const&,
CallConstructWithSpreadParameters const&); ConstructWithSpreadParameters const&);
size_t hash_value(CallConstructWithSpreadParameters const&); size_t hash_value(ConstructWithSpreadParameters const&);
std::ostream& operator<<(std::ostream&, std::ostream& operator<<(std::ostream&, ConstructWithSpreadParameters const&);
CallConstructWithSpreadParameters const&);
CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf(
Operator const*); Operator const*);
// Defines the flags for a JavaScript call forwarding parameters. This // Defines the flags for a JavaScript call forwarding parameters. This
@ -201,7 +200,7 @@ std::ostream& operator<<(std::ostream&, CallFunctionParameters const&);
const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); const CallFunctionParameters& CallFunctionParametersOf(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 JSCallConstructWithSpread // parameters. This is used as a parameter by JSConstructWithSpread
// operators. // operators.
class CallFunctionWithSpreadParameters final { class CallFunctionWithSpreadParameters final {
public: public:
@ -624,9 +623,9 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
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);
const Operator* CallConstruct(uint32_t arity, float frequency, const Operator* Construct(uint32_t arity, float frequency,
VectorSlotPair const& feedback); VectorSlotPair const& feedback);
const Operator* CallConstructWithSpread(uint32_t arity); const Operator* ConstructWithSpread(uint32_t arity);
const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); const Operator* ConvertReceiver(ConvertReceiverMode convert_mode);

View File

@ -1888,7 +1888,7 @@ void ReduceBuiltin(Isolate* isolate, JSGraph* jsgraph, Node* node,
// The logic contained here is mirrored in Builtins::Generate_Adaptor. // The logic contained here is mirrored in Builtins::Generate_Adaptor.
// Keep these in sync. // Keep these in sync.
const bool is_construct = (node->opcode() == IrOpcode::kJSCallConstruct); const bool is_construct = (node->opcode() == IrOpcode::kJSConstruct);
DCHECK(Builtins::HasCppImplementation(builtin_index)); DCHECK(Builtins::HasCppImplementation(builtin_index));
DCHECK_EQ(0, flags & CallDescriptor::kSupportsTailCalls); DCHECK_EQ(0, flags & CallDescriptor::kSupportsTailCalls);
@ -1948,9 +1948,9 @@ bool NeedsArgumentAdaptorFrame(Handle<SharedFunctionInfo> shared, int arity) {
} // namespace } // namespace
Reduction JSTypedLowering::ReduceJSCallConstruct(Node* node) { Reduction JSTypedLowering::ReduceJSConstruct(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode());
CallConstructParameters const& p = CallConstructParametersOf(node->op()); ConstructParameters const& p = ConstructParametersOf(node->op());
DCHECK_LE(2u, p.arity()); DCHECK_LE(2u, p.arity());
int const arity = static_cast<int>(p.arity() - 2); int const arity = static_cast<int>(p.arity() - 2);
Node* target = NodeProperties::GetValueInput(node, 0); Node* target = NodeProperties::GetValueInput(node, 0);
@ -2412,8 +2412,8 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSStoreModule(node); return ReduceJSStoreModule(node);
case IrOpcode::kJSConvertReceiver: case IrOpcode::kJSConvertReceiver:
return ReduceJSConvertReceiver(node); return ReduceJSConvertReceiver(node);
case IrOpcode::kJSCallConstruct: case IrOpcode::kJSConstruct:
return ReduceJSCallConstruct(node); return ReduceJSConstruct(node);
case IrOpcode::kJSCallForwardVarargs: case IrOpcode::kJSCallForwardVarargs:
return ReduceJSCallForwardVarargs(node); return ReduceJSCallForwardVarargs(node);
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCallFunction:

View File

@ -70,7 +70,7 @@ class V8_EXPORT_PRIVATE JSTypedLowering final
Reduction ReduceJSToString(Node* node); Reduction ReduceJSToString(Node* node);
Reduction ReduceJSToObject(Node* node); Reduction ReduceJSToObject(Node* node);
Reduction ReduceJSConvertReceiver(Node* node); Reduction ReduceJSConvertReceiver(Node* node);
Reduction ReduceJSCallConstruct(Node* node); Reduction ReduceJSConstruct(Node* node);
Reduction ReduceJSCallForwardVarargs(Node* node); Reduction ReduceJSCallForwardVarargs(Node* node);
Reduction ReduceJSCallFunction(Node* node); Reduction ReduceJSCallFunction(Node* node);
Reduction ReduceJSForInNext(Node* node); Reduction ReduceJSForInNext(Node* node);

View File

@ -159,8 +159,8 @@
V(JSCreateScriptContext) V(JSCreateScriptContext)
#define JS_OTHER_OP_LIST(V) \ #define JS_OTHER_OP_LIST(V) \
V(JSCallConstruct) \ V(JSConstruct) \
V(JSCallConstructWithSpread) \ V(JSConstructWithSpread) \
V(JSCallForwardVarargs) \ V(JSCallForwardVarargs) \
V(JSCallFunction) \ V(JSCallFunction) \
V(JSCallFunctionWithSpread) \ V(JSCallFunctionWithSpread) \
@ -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 == kJSCallConstruct || value == kJSCallFunction; return value == kJSConstruct || value == kJSCallFunction;
} }
// Returns true if opcode for comparison operator. // Returns true if opcode for comparison operator.

View File

@ -93,8 +93,8 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) {
case IrOpcode::kJSToString: case IrOpcode::kJSToString:
// Call operations // Call operations
case IrOpcode::kJSCallConstruct: case IrOpcode::kJSConstruct:
case IrOpcode::kJSCallConstructWithSpread: case IrOpcode::kJSConstructWithSpread:
case IrOpcode::kJSCallForwardVarargs: case IrOpcode::kJSCallForwardVarargs:
case IrOpcode::kJSCallFunction: case IrOpcode::kJSCallFunction:
case IrOpcode::kJSCallFunctionWithSpread: case IrOpcode::kJSCallFunctionWithSpread:

View File

@ -1322,12 +1322,9 @@ Type* Typer::Visitor::TypeJSCreateScriptContext(Node* node) {
// JS other operators. // JS other operators.
Type* Typer::Visitor::TypeJSConstruct(Node* node) { return Type::Receiver(); }
Type* Typer::Visitor::TypeJSCallConstruct(Node* node) { Type* Typer::Visitor::TypeJSConstructWithSpread(Node* node) {
return Type::Receiver();
}
Type* Typer::Visitor::TypeJSCallConstructWithSpread(Node* node) {
return Type::Receiver(); return Type::Receiver();
} }

View File

@ -675,8 +675,8 @@ void Verifier::Visitor::Check(Node* node) {
break; break;
} }
case IrOpcode::kJSCallConstruct: case IrOpcode::kJSConstruct:
case IrOpcode::kJSCallConstructWithSpread: case IrOpcode::kJSConstructWithSpread:
case IrOpcode::kJSConvertReceiver: case IrOpcode::kJSConvertReceiver:
// Type is Receiver. // Type is Receiver.
CheckTypeIs(node, Type::Receiver()); CheckTypeIs(node, Type::Receiver());

View File

@ -695,10 +695,10 @@ Node* InterpreterAssembler::CallJSWithSpread(Node* function, Node* context,
first_arg, function); first_arg, function);
} }
Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, Node* InterpreterAssembler::Construct(Node* constructor, Node* context,
Node* new_target, Node* first_arg, Node* new_target, Node* first_arg,
Node* arg_count, Node* slot_id, Node* arg_count, Node* slot_id,
Node* type_feedback_vector) { Node* type_feedback_vector) {
Variable return_value(this, MachineRepresentation::kTagged); Variable return_value(this, MachineRepresentation::kTagged);
Variable allocation_feedback(this, MachineRepresentation::kTagged); Variable allocation_feedback(this, MachineRepresentation::kTagged);
Label call_construct_function(this, &allocation_feedback), Label call_construct_function(this, &allocation_feedback),
@ -728,7 +728,7 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context,
Bind(&call_construct_function); Bind(&call_construct_function);
{ {
Comment("call using callConstructFunction"); Comment("call using ConstructFunction");
IncrementCallCount(type_feedback_vector, slot_id); IncrementCallCount(type_feedback_vector, slot_id);
Callable callable_function = CodeFactory::InterpreterPushArgsAndConstruct( Callable callable_function = CodeFactory::InterpreterPushArgsAndConstruct(
isolate(), InterpreterPushArgsMode::kJSFunction); isolate(), InterpreterPushArgsMode::kJSFunction);
@ -832,7 +832,7 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context,
Bind(&call_construct); Bind(&call_construct);
{ {
Comment("call using callConstruct builtin"); Comment("call using Construct builtin");
Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( Callable callable = CodeFactory::InterpreterPushArgsAndConstruct(
isolate(), InterpreterPushArgsMode::kOther); isolate(), InterpreterPushArgsMode::kOther);
Node* code_target = HeapConstant(callable.code()); Node* code_target = HeapConstant(callable.code());
@ -846,11 +846,10 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context,
return return_value.value(); return return_value.value();
} }
Node* InterpreterAssembler::CallConstructWithSpread(Node* constructor, Node* InterpreterAssembler::ConstructWithSpread(Node* constructor,
Node* context, Node* context, Node* new_target,
Node* new_target, Node* first_arg,
Node* first_arg, Node* arg_count) {
Node* arg_count) {
Variable return_value(this, MachineRepresentation::kTagged); Variable return_value(this, MachineRepresentation::kTagged);
Comment("call using ConstructWithSpread"); Comment("call using ConstructWithSpread");
Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( Callable callable = CodeFactory::InterpreterPushArgsAndConstruct(

View File

@ -145,23 +145,21 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
// |first_arg|. The |new_target| is the same as the // |first_arg|. The |new_target| is the same as the
// |constructor| for the new keyword, but differs for the super // |constructor| for the new keyword, but differs for the super
// keyword. // keyword.
compiler::Node* CallConstruct(compiler::Node* constructor, compiler::Node* Construct(compiler::Node* constructor,
compiler::Node* context, compiler::Node* context, compiler::Node* new_target,
compiler::Node* new_target, compiler::Node* first_arg,
compiler::Node* first_arg, compiler::Node* arg_count, compiler::Node* slot_id,
compiler::Node* arg_count, compiler::Node* type_feedback_vector);
compiler::Node* slot_id,
compiler::Node* type_feedback_vector);
// Call constructor |constructor| with |arg_count| arguments (not including // Call constructor |constructor| with |arg_count| arguments (not including
// receiver) and the first argument located at |first_arg|. The last argument // receiver) and the first argument located at |first_arg|. The last argument
// is always a spread. The |new_target| is the same as the |constructor| for // is always a spread. The |new_target| is the same as the |constructor| for
// the new keyword, but differs for the super keyword. // the new keyword, but differs for the super keyword.
compiler::Node* CallConstructWithSpread(compiler::Node* constructor, compiler::Node* ConstructWithSpread(compiler::Node* constructor,
compiler::Node* context, compiler::Node* context,
compiler::Node* new_target, compiler::Node* new_target,
compiler::Node* first_arg, compiler::Node* first_arg,
compiler::Node* arg_count); compiler::Node* arg_count);
// Call runtime function with |arg_count| arguments and the first argument // Call runtime function with |arg_count| arguments and the first argument
// located at |first_arg|. // located at |first_arg|.

View File

@ -2213,8 +2213,8 @@ void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) {
Node* first_arg = __ RegisterLocation(first_arg_reg); Node* first_arg = __ RegisterLocation(first_arg_reg);
Node* args_count = __ BytecodeOperandCount(2); Node* args_count = __ BytecodeOperandCount(2);
Node* context = __ GetContext(); Node* context = __ GetContext();
Node* result = __ CallConstructWithSpread(constructor, context, new_target, Node* result = __ ConstructWithSpread(constructor, context, new_target,
first_arg, args_count); first_arg, args_count);
__ SetAccumulator(result); __ SetAccumulator(result);
__ Dispatch(); __ Dispatch();
} }
@ -2235,8 +2235,8 @@ void Interpreter::DoNew(InterpreterAssembler* assembler) {
Node* slot_id = __ BytecodeOperandIdx(3); Node* slot_id = __ BytecodeOperandIdx(3);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext(); Node* context = __ GetContext();
Node* result = __ CallConstruct(constructor, context, new_target, first_arg, Node* result = __ Construct(constructor, context, new_target, first_arg,
args_count, slot_id, type_feedback_vector); args_count, slot_id, type_feedback_vector);
__ SetAccumulator(result); __ SetAccumulator(result);
__ Dispatch(); __ Dispatch();
} }