From 1a1a3cc492a62e37dfcd5acbfb1b03f3d7db8075 Mon Sep 17 00:00:00 2001 From: petermarshall Date: Wed, 1 Feb 2017 00:11:43 -0800 Subject: [PATCH] [turbo] Rename CallConstruct* operators to Construct*. Review-Url: https://codereview.chromium.org/2662263002 Cr-Commit-Position: refs/heads/master@{#42836} --- src/compiler/ast-graph-builder.cc | 2 +- src/compiler/ast-graph-builder.h | 2 +- src/compiler/bytecode-graph-builder.cc | 4 +- src/compiler/js-call-reducer.cc | 33 ++++++----- src/compiler/js-call-reducer.h | 6 +- src/compiler/js-generic-lowering.cc | 11 ++-- src/compiler/js-inlining-heuristic.cc | 4 +- src/compiler/js-inlining.cc | 26 ++++----- src/compiler/js-operator.cc | 71 +++++++++++------------- src/compiler/js-operator.h | 47 ++++++++-------- src/compiler/js-typed-lowering.cc | 12 ++-- src/compiler/js-typed-lowering.h | 2 +- src/compiler/opcodes.h | 6 +- src/compiler/operator-properties.cc | 4 +- src/compiler/typer.cc | 7 +-- src/compiler/verifier.cc | 4 +- src/interpreter/interpreter-assembler.cc | 21 ++++--- src/interpreter/interpreter-assembler.h | 22 ++++---- src/interpreter/interpreter.cc | 8 +-- 19 files changed, 139 insertions(+), 153 deletions(-) diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc index 3435d8d0d2..d5c8a5a7e7 100644 --- a/src/compiler/ast-graph-builder.cc +++ b/src/compiler/ast-graph-builder.cc @@ -1861,7 +1861,7 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) { float const frequency = ComputeCallFrequency(expr->CallNewFeedbackSlot()); VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot()); const Operator* call = - javascript()->CallConstruct(args->length() + 2, frequency, feedback); + javascript()->Construct(args->length() + 2, frequency, feedback); Node* value = ProcessArguments(call, args->length() + 2); PrepareFrameState(value, expr->ReturnId(), OutputFrameStateCombine::Push()); ast_context()->ProduceValue(expr, value); diff --git a/src/compiler/ast-graph-builder.h b/src/compiler/ast-graph-builder.h index 975e08094c..b36e7f68b8 100644 --- a/src/compiler/ast-graph-builder.h +++ b/src/compiler/ast-graph-builder.h @@ -248,7 +248,7 @@ class AstGraphBuilder : public AstVisitor { // Named and keyed loads require a VectorSlotPair for successful lowering. 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; // =========================================================================== diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc index bafc0e7a9d..1906abbb18 100644 --- a/src/compiler/bytecode-graph-builder.cc +++ b/src/compiler/bytecode-graph-builder.cc @@ -1377,7 +1377,7 @@ void BytecodeGraphBuilder::VisitNewWithSpread() { Node* callee = environment()->LookupRegister(callee_reg); const Operator* op = - javascript()->CallConstructWithSpread(static_cast(arg_count) + 2); + javascript()->ConstructWithSpread(static_cast(arg_count) + 2); Node* value = ProcessCallNewWithSpreadArguments(op, callee, new_target, first_arg, arg_count + 2); environment()->BindAccumulator(value, Environment::kAttachFrameState); @@ -1426,7 +1426,7 @@ void BytecodeGraphBuilder::VisitNew() { Node* callee = environment()->LookupRegister(callee_reg); float const frequency = ComputeCallFrequency(slot_id); - const Operator* call = javascript()->CallConstruct( + const Operator* call = javascript()->Construct( static_cast(arg_count) + 2, frequency, feedback); Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, arg_count + 2); diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc index 67e699961a..cff530c187 100644 --- a/src/compiler/js-call-reducer.cc +++ b/src/compiler/js-call-reducer.cc @@ -20,10 +20,10 @@ namespace compiler { Reduction JSCallReducer::Reduce(Node* node) { switch (node->opcode()) { - case IrOpcode::kJSCallConstruct: - return ReduceJSCallConstruct(node); - case IrOpcode::kJSCallConstructWithSpread: - return ReduceJSCallConstructWithSpread(node); + case IrOpcode::kJSConstruct: + return ReduceJSConstruct(node); + case IrOpcode::kJSConstructWithSpread: + return ReduceJSConstructWithSpread(node); case IrOpcode::kJSCallFunction: return ReduceJSCallFunction(node); default: @@ -578,10 +578,9 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { return NoChange(); } - -Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { - DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); - CallConstructParameters const& p = CallConstructParametersOf(node->op()); +Reduction JSCallReducer::ReduceJSConstruct(Node* node) { + DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode()); + ConstructParameters const& p = ConstructParametersOf(node->op()); DCHECK_LE(2u, p.arity()); int const arity = static_cast(p.arity() - 2); Node* target = NodeProperties::GetValueInput(node, 0); @@ -589,7 +588,7 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { Node* effect = NodeProperties::GetEffectInput(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); if (m.HasValue()) { if (m.Value()->IsJSFunction()) { @@ -678,15 +677,15 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { effect = 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::ReplaceEffectInput(node, effect); if (target == new_target) { NodeProperties::ReplaceValueInput(node, target_function, arity + 1); } - // Try to further reduce the JSCallConstruct {node}. - Reduction const reduction = ReduceJSCallConstruct(node); + // Try to further reduce the JSConstruct {node}. + Reduction const reduction = ReduceJSConstruct(node); return reduction.Changed() ? reduction : Changed(node); } } @@ -694,10 +693,10 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { return NoChange(); } -Reduction JSCallReducer::ReduceJSCallConstructWithSpread(Node* node) { - DCHECK_EQ(IrOpcode::kJSCallConstructWithSpread, node->opcode()); - CallConstructWithSpreadParameters const& p = - CallConstructWithSpreadParametersOf(node->op()); +Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) { + DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode()); + ConstructWithSpreadParameters const& p = + ConstructWithSpreadParametersOf(node->op()); DCHECK_LE(3u, p.arity()); int arity = static_cast(p.arity() - 2); @@ -762,7 +761,7 @@ Reduction JSCallReducer::ReduceJSCallConstructWithSpread(Node* node) { } NodeProperties::ChangeOp( - node, javascript()->CallConstruct(arity + 2, 7, VectorSlotPair())); + node, javascript()->Construct(arity + 2, 7, VectorSlotPair())); return Changed(node); } diff --git a/src/compiler/js-call-reducer.h b/src/compiler/js-call-reducer.h index e31d9d79fd..f42c5fec0d 100644 --- a/src/compiler/js-call-reducer.h +++ b/src/compiler/js-call-reducer.h @@ -23,7 +23,7 @@ class JSGraph; class JSOperatorBuilder; 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. class JSCallReducer final : public AdvancedReducer { public: @@ -55,8 +55,8 @@ class JSCallReducer final : public AdvancedReducer { Reduction ReduceFunctionPrototypeCall(Node* node); Reduction ReduceFunctionPrototypeHasInstance(Node* node); Reduction ReduceObjectPrototypeGetProto(Node* node); - Reduction ReduceJSCallConstruct(Node* node); - Reduction ReduceJSCallConstructWithSpread(Node* node); + Reduction ReduceJSConstruct(Node* node); + Reduction ReduceJSConstructWithSpread(Node* node); Reduction ReduceJSCallFunction(Node* node); enum HolderLookup { kHolderNotFound, kHolderIsReceiver, kHolderFound }; diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc index 5a6b34a123..64d4224a64 100644 --- a/src/compiler/js-generic-lowering.cc +++ b/src/compiler/js-generic-lowering.cc @@ -490,9 +490,8 @@ void JSGenericLowering::LowerJSCreateScriptContext(Node* node) { ReplaceWithRuntimeCall(node, Runtime::kNewScriptContext); } - -void JSGenericLowering::LowerJSCallConstruct(Node* node) { - CallConstructParameters const& p = CallConstructParametersOf(node->op()); +void JSGenericLowering::LowerJSConstruct(Node* node) { + ConstructParameters const& p = ConstructParametersOf(node->op()); int const arg_count = static_cast(p.arity() - 2); CallDescriptor::Flags flags = FrameStateFlagForCall(node); Callable callable = CodeFactory::Construct(isolate()); @@ -510,9 +509,9 @@ void JSGenericLowering::LowerJSCallConstruct(Node* node) { NodeProperties::ChangeOp(node, common()->Call(desc)); } -void JSGenericLowering::LowerJSCallConstructWithSpread(Node* node) { - CallConstructWithSpreadParameters const& p = - CallConstructWithSpreadParametersOf(node->op()); +void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { + ConstructWithSpreadParameters const& p = + ConstructWithSpreadParametersOf(node->op()); int const arg_count = static_cast(p.arity() - 2); CallDescriptor::Flags flags = FrameStateFlagForCall(node); Callable callable = CodeFactory::ConstructWithSpread(isolate()); diff --git a/src/compiler/js-inlining-heuristic.cc b/src/compiler/js-inlining-heuristic.cc index 672d322a24..c924f60e81 100644 --- a/src/compiler/js-inlining-heuristic.cc +++ b/src/compiler/js-inlining-heuristic.cc @@ -121,7 +121,7 @@ Reduction JSInliningHeuristic::Reduce(Node* node) { CallFunctionParameters const p = CallFunctionParametersOf(node->op()); candidate.frequency = p.frequency(); } else { - CallConstructParameters const p = CallConstructParametersOf(node->op()); + ConstructParameters const p = ConstructParametersOf(node->op()); candidate.frequency = p.frequency(); } @@ -175,7 +175,7 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) { 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. DCHECK_LT(1, num_calls); Node* calls[kMaxCallPolymorphism + 1]; diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc index 3869a3ef9b..448881501c 100644 --- a/src/compiler/js-inlining.cc +++ b/src/compiler/js-inlining.cc @@ -31,16 +31,16 @@ namespace compiler { // 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 { public: explicit JSCallAccessor(Node* call) : call_(call) { DCHECK(call->opcode() == IrOpcode::kJSCallFunction || - call->opcode() == IrOpcode::kJSCallConstruct); + call->opcode() == IrOpcode::kJSConstruct); } Node* target() { - // Both, {JSCallFunction} and {JSCallConstruct}, have same layout here. + // Both, {JSCallFunction} and {JSConstruct}, have same layout here. return call_->InputAt(0); } @@ -50,18 +50,18 @@ class JSCallAccessor { } Node* new_target() { - DCHECK_EQ(IrOpcode::kJSCallConstruct, call_->opcode()); + DCHECK_EQ(IrOpcode::kJSConstruct, call_->opcode()); return call_->InputAt(formal_arguments() + 1); } Node* frame_state() { - // Both, {JSCallFunction} and {JSCallConstruct}, have frame state. + // Both, {JSCallFunction} and {JSConstruct}, have frame state. return NodeProperties::GetFrameStateInput(call_); } int formal_arguments() { - // Both, {JSCallFunction} and {JSCallConstruct}, have two extra inputs: - // - JSCallConstruct: Includes target function and new target. + // Both, {JSCallFunction} and {JSConstruct}, have two extra inputs: + // - JSConstruct: Includes target function and new target. // - JSCallFunction: Includes target function and receiver. return call_->op()->ValueInputCount() - 2; } @@ -69,7 +69,7 @@ class JSCallAccessor { float frequency() const { return (call_->opcode() == IrOpcode::kJSCallFunction) ? CallFunctionParametersOf(call_->op()).frequency() - : CallConstructParametersOf(call_->op()).frequency(); + : ConstructParametersOf(call_->op()).frequency(); } private: @@ -354,7 +354,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...) - // - JSCallConstruct(target:constant, args..., new.target) + // - JSConstruct(target:constant, args..., new.target) HeapObjectMatcher match(node->InputAt(0)); if (!match.HasValue() || !match.Value()->IsJSFunction()) return NoChange(); Handle function = Handle::cast(match.Value()); @@ -384,7 +384,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle function) { } // Constructor must be constructable. - if (node->opcode() == IrOpcode::kJSCallConstruct && + if (node->opcode() == IrOpcode::kJSConstruct && IsNonConstructible(shared_info)) { TRACE("Not inlining %s into %s because constructor is not constructable.\n", shared_info->DebugName()->ToCString().get(), @@ -550,8 +550,8 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle function) { Node* frame_state = call.frame_state(); Node* new_target = jsgraph()->UndefinedConstant(); - // Inline {JSCallConstruct} requires some additional magic. - if (node->opcode() == IrOpcode::kJSCallConstruct) { + // Inline {JSConstruct} requires some additional magic. + if (node->opcode() == IrOpcode::kJSConstruct) { // Insert nodes around the call that model the behavior required for a // constructor dispatch (allocate implicit receiver and check return value). // This models the behavior usually accomplished by our {JSConstructStub}. @@ -579,7 +579,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle function) { 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 // behaves as if we were dealing with a regular function invocation. new_target = call.new_target(); // Retrieve new target value input. diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc index 847ef6aee5..af652a36e4 100644 --- a/src/compiler/js-operator.cc +++ b/src/compiler/js-operator.cc @@ -52,58 +52,53 @@ ToBooleanHints ToBooleanHintsOf(Operator const* op) { return OpParameter(op); } - -bool operator==(CallConstructParameters const& lhs, - CallConstructParameters const& rhs) { +bool operator==(ConstructParameters const& lhs, + ConstructParameters const& rhs) { return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() && lhs.feedback() == rhs.feedback(); } - -bool operator!=(CallConstructParameters const& lhs, - CallConstructParameters const& rhs) { +bool operator!=(ConstructParameters const& lhs, + ConstructParameters const& rhs) { return !(lhs == rhs); } - -size_t hash_value(CallConstructParameters const& p) { +size_t hash_value(ConstructParameters const& p) { return base::hash_combine(p.arity(), p.frequency(), p.feedback()); } - -std::ostream& operator<<(std::ostream& os, CallConstructParameters const& p) { +std::ostream& operator<<(std::ostream& os, ConstructParameters const& p) { return os << p.arity() << ", " << p.frequency(); } - -CallConstructParameters const& CallConstructParametersOf(Operator const* op) { - DCHECK_EQ(IrOpcode::kJSCallConstruct, op->opcode()); - return OpParameter(op); +ConstructParameters const& ConstructParametersOf(Operator const* op) { + DCHECK_EQ(IrOpcode::kJSConstruct, op->opcode()); + return OpParameter(op); } -bool operator==(CallConstructWithSpreadParameters const& lhs, - CallConstructWithSpreadParameters const& rhs) { +bool operator==(ConstructWithSpreadParameters const& lhs, + ConstructWithSpreadParameters const& rhs) { return lhs.arity() == rhs.arity(); } -bool operator!=(CallConstructWithSpreadParameters const& lhs, - CallConstructWithSpreadParameters const& rhs) { +bool operator!=(ConstructWithSpreadParameters const& lhs, + ConstructWithSpreadParameters const& rhs) { return !(lhs == rhs); } -size_t hash_value(CallConstructWithSpreadParameters const& p) { +size_t hash_value(ConstructWithSpreadParameters const& p) { return base::hash_combine(p.arity()); } std::ostream& operator<<(std::ostream& os, - CallConstructWithSpreadParameters const& p) { + ConstructWithSpreadParameters const& p) { return os << p.arity(); } -CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( +ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf( Operator const* op) { - DCHECK_EQ(IrOpcode::kJSCallConstructWithSpread, op->opcode()); - return OpParameter(op); + DCHECK_EQ(IrOpcode::kJSConstructWithSpread, op->opcode()); + return OpParameter(op); } std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { @@ -791,23 +786,23 @@ const Operator* JSOperatorBuilder::CallRuntime(const Runtime::Function* f, parameters); // parameter } -const Operator* JSOperatorBuilder::CallConstruct( - uint32_t arity, float frequency, VectorSlotPair const& feedback) { - CallConstructParameters parameters(arity, frequency, feedback); - return new (zone()) Operator1( // -- - IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode - "JSCallConstruct", // name - parameters.arity(), 1, 1, 1, 1, 2, // counts - parameters); // parameter +const Operator* JSOperatorBuilder::Construct(uint32_t arity, float frequency, + VectorSlotPair const& feedback) { + ConstructParameters parameters(arity, frequency, feedback); + return new (zone()) Operator1( // -- + IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode + "JSConstruct", // name + parameters.arity(), 1, 1, 1, 1, 2, // counts + parameters); // parameter } -const Operator* JSOperatorBuilder::CallConstructWithSpread(uint32_t arity) { - CallConstructWithSpreadParameters parameters(arity); - return new (zone()) Operator1( // -- - IrOpcode::kJSCallConstructWithSpread, Operator::kNoProperties, // opcode - "JSCallConstructWithSpread", // name - parameters.arity(), 1, 1, 1, 1, 2, // counts - parameters); // parameter +const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) { + ConstructWithSpreadParameters parameters(arity); + return new (zone()) Operator1( // -- + IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode + "JSConstructWithSpread", // name + parameters.arity(), 1, 1, 1, 1, 2, // counts + parameters); // parameter } const Operator* JSOperatorBuilder::ConvertReceiver( diff --git a/src/compiler/js-operator.h b/src/compiler/js-operator.h index a6bae4827d..72efbe591d 100644 --- a/src/compiler/js-operator.h +++ b/src/compiler/js-operator.h @@ -58,11 +58,11 @@ ToBooleanHints ToBooleanHintsOf(Operator const* op); // Defines the arity and the feedback for a JavaScript constructor call. This is -// used as a parameter by JSCallConstruct operators. -class CallConstructParameters final { +// used as a parameter by JSConstruct operators. +class ConstructParameters final { public: - CallConstructParameters(uint32_t arity, float frequency, - VectorSlotPair const& feedback) + ConstructParameters(uint32_t arity, float frequency, + VectorSlotPair const& feedback) : arity_(arity), frequency_(frequency), feedback_(feedback) {} uint32_t arity() const { return arity_; } @@ -75,21 +75,21 @@ class CallConstructParameters final { VectorSlotPair const feedback_; }; -bool operator==(CallConstructParameters const&, CallConstructParameters const&); -bool operator!=(CallConstructParameters const&, CallConstructParameters const&); +bool operator==(ConstructParameters const&, ConstructParameters 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 -// parameters. This is used as a parameter by JSCallConstructWithSpread +// parameters. This is used as a parameter by JSConstructWithSpread // operators. -class CallConstructWithSpreadParameters final { +class ConstructWithSpreadParameters final { public: - explicit CallConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {} + explicit ConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {} uint32_t arity() const { return arity_; } @@ -97,17 +97,16 @@ class CallConstructWithSpreadParameters final { uint32_t const arity_; }; -bool operator==(CallConstructWithSpreadParameters const&, - CallConstructWithSpreadParameters const&); -bool operator!=(CallConstructWithSpreadParameters const&, - CallConstructWithSpreadParameters const&); +bool operator==(ConstructWithSpreadParameters const&, + ConstructWithSpreadParameters const&); +bool operator!=(ConstructWithSpreadParameters const&, + ConstructWithSpreadParameters const&); -size_t hash_value(CallConstructWithSpreadParameters const&); +size_t hash_value(ConstructWithSpreadParameters const&); -std::ostream& operator<<(std::ostream&, - CallConstructWithSpreadParameters const&); +std::ostream& operator<<(std::ostream&, ConstructWithSpreadParameters const&); -CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( +ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf( Operator const*); // 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); // 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. class CallFunctionWithSpreadParameters final { public: @@ -624,9 +623,9 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final 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); - const Operator* CallConstruct(uint32_t arity, float frequency, - VectorSlotPair const& feedback); - const Operator* CallConstructWithSpread(uint32_t arity); + const Operator* Construct(uint32_t arity, float frequency, + VectorSlotPair const& feedback); + const Operator* ConstructWithSpread(uint32_t arity); const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index 5d5fc899f2..5bf47ec00b 100644 --- a/src/compiler/js-typed-lowering.cc +++ b/src/compiler/js-typed-lowering.cc @@ -1888,7 +1888,7 @@ void ReduceBuiltin(Isolate* isolate, JSGraph* jsgraph, Node* node, // The logic contained here is mirrored in Builtins::Generate_Adaptor. // 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_EQ(0, flags & CallDescriptor::kSupportsTailCalls); @@ -1948,9 +1948,9 @@ bool NeedsArgumentAdaptorFrame(Handle shared, int arity) { } // namespace -Reduction JSTypedLowering::ReduceJSCallConstruct(Node* node) { - DCHECK_EQ(IrOpcode::kJSCallConstruct, node->opcode()); - CallConstructParameters const& p = CallConstructParametersOf(node->op()); +Reduction JSTypedLowering::ReduceJSConstruct(Node* node) { + DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode()); + ConstructParameters const& p = ConstructParametersOf(node->op()); DCHECK_LE(2u, p.arity()); int const arity = static_cast(p.arity() - 2); Node* target = NodeProperties::GetValueInput(node, 0); @@ -2412,8 +2412,8 @@ Reduction JSTypedLowering::Reduce(Node* node) { return ReduceJSStoreModule(node); case IrOpcode::kJSConvertReceiver: return ReduceJSConvertReceiver(node); - case IrOpcode::kJSCallConstruct: - return ReduceJSCallConstruct(node); + case IrOpcode::kJSConstruct: + return ReduceJSConstruct(node); case IrOpcode::kJSCallForwardVarargs: return ReduceJSCallForwardVarargs(node); case IrOpcode::kJSCallFunction: diff --git a/src/compiler/js-typed-lowering.h b/src/compiler/js-typed-lowering.h index 9a037cf3c1..aaa18ece4c 100644 --- a/src/compiler/js-typed-lowering.h +++ b/src/compiler/js-typed-lowering.h @@ -70,7 +70,7 @@ class V8_EXPORT_PRIVATE JSTypedLowering final Reduction ReduceJSToString(Node* node); Reduction ReduceJSToObject(Node* node); Reduction ReduceJSConvertReceiver(Node* node); - Reduction ReduceJSCallConstruct(Node* node); + Reduction ReduceJSConstruct(Node* node); Reduction ReduceJSCallForwardVarargs(Node* node); Reduction ReduceJSCallFunction(Node* node); Reduction ReduceJSForInNext(Node* node); diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h index d79b166960..5077e0aaf3 100644 --- a/src/compiler/opcodes.h +++ b/src/compiler/opcodes.h @@ -159,8 +159,8 @@ V(JSCreateScriptContext) #define JS_OTHER_OP_LIST(V) \ - V(JSCallConstruct) \ - V(JSCallConstructWithSpread) \ + V(JSConstruct) \ + V(JSConstructWithSpread) \ V(JSCallForwardVarargs) \ V(JSCallFunction) \ V(JSCallFunctionWithSpread) \ @@ -800,7 +800,7 @@ class V8_EXPORT_PRIVATE IrOpcode { // Returns true if opcode can be inlined. static bool IsInlineeOpcode(Value value) { - return value == kJSCallConstruct || value == kJSCallFunction; + return value == kJSConstruct || value == kJSCallFunction; } // Returns true if opcode for comparison operator. diff --git a/src/compiler/operator-properties.cc b/src/compiler/operator-properties.cc index e6c0cc9924..7e95bc7cf4 100644 --- a/src/compiler/operator-properties.cc +++ b/src/compiler/operator-properties.cc @@ -93,8 +93,8 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) { case IrOpcode::kJSToString: // Call operations - case IrOpcode::kJSCallConstruct: - case IrOpcode::kJSCallConstructWithSpread: + case IrOpcode::kJSConstruct: + case IrOpcode::kJSConstructWithSpread: case IrOpcode::kJSCallForwardVarargs: case IrOpcode::kJSCallFunction: case IrOpcode::kJSCallFunctionWithSpread: diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc index 352776994b..6bec5f7777 100644 --- a/src/compiler/typer.cc +++ b/src/compiler/typer.cc @@ -1322,12 +1322,9 @@ Type* Typer::Visitor::TypeJSCreateScriptContext(Node* node) { // JS other operators. +Type* Typer::Visitor::TypeJSConstruct(Node* node) { return Type::Receiver(); } -Type* Typer::Visitor::TypeJSCallConstruct(Node* node) { - return Type::Receiver(); -} - -Type* Typer::Visitor::TypeJSCallConstructWithSpread(Node* node) { +Type* Typer::Visitor::TypeJSConstructWithSpread(Node* node) { return Type::Receiver(); } diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc index 1121f9cf2b..2cfe832e64 100644 --- a/src/compiler/verifier.cc +++ b/src/compiler/verifier.cc @@ -675,8 +675,8 @@ void Verifier::Visitor::Check(Node* node) { break; } - case IrOpcode::kJSCallConstruct: - case IrOpcode::kJSCallConstructWithSpread: + case IrOpcode::kJSConstruct: + case IrOpcode::kJSConstructWithSpread: case IrOpcode::kJSConvertReceiver: // Type is Receiver. CheckTypeIs(node, Type::Receiver()); diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc index 34fbc433a9..9e3c65079f 100644 --- a/src/interpreter/interpreter-assembler.cc +++ b/src/interpreter/interpreter-assembler.cc @@ -695,10 +695,10 @@ Node* InterpreterAssembler::CallJSWithSpread(Node* function, Node* context, first_arg, function); } -Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, - Node* new_target, Node* first_arg, - Node* arg_count, Node* slot_id, - Node* type_feedback_vector) { +Node* InterpreterAssembler::Construct(Node* constructor, Node* context, + Node* new_target, Node* first_arg, + Node* arg_count, Node* slot_id, + Node* type_feedback_vector) { Variable return_value(this, MachineRepresentation::kTagged); Variable allocation_feedback(this, MachineRepresentation::kTagged); Label call_construct_function(this, &allocation_feedback), @@ -728,7 +728,7 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, Bind(&call_construct_function); { - Comment("call using callConstructFunction"); + Comment("call using ConstructFunction"); IncrementCallCount(type_feedback_vector, slot_id); Callable callable_function = CodeFactory::InterpreterPushArgsAndConstruct( isolate(), InterpreterPushArgsMode::kJSFunction); @@ -832,7 +832,7 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, Bind(&call_construct); { - Comment("call using callConstruct builtin"); + Comment("call using Construct builtin"); Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( isolate(), InterpreterPushArgsMode::kOther); Node* code_target = HeapConstant(callable.code()); @@ -846,11 +846,10 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, return return_value.value(); } -Node* InterpreterAssembler::CallConstructWithSpread(Node* constructor, - Node* context, - Node* new_target, - Node* first_arg, - Node* arg_count) { +Node* InterpreterAssembler::ConstructWithSpread(Node* constructor, + Node* context, Node* new_target, + Node* first_arg, + Node* arg_count) { Variable return_value(this, MachineRepresentation::kTagged); Comment("call using ConstructWithSpread"); Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( diff --git a/src/interpreter/interpreter-assembler.h b/src/interpreter/interpreter-assembler.h index 937f3481d0..0020477cd7 100644 --- a/src/interpreter/interpreter-assembler.h +++ b/src/interpreter/interpreter-assembler.h @@ -145,23 +145,21 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler { // |first_arg|. The |new_target| is the same as the // |constructor| for the new keyword, but differs for the super // keyword. - compiler::Node* CallConstruct(compiler::Node* constructor, - compiler::Node* context, - compiler::Node* new_target, - compiler::Node* first_arg, - compiler::Node* arg_count, - compiler::Node* slot_id, - compiler::Node* type_feedback_vector); + compiler::Node* Construct(compiler::Node* constructor, + compiler::Node* context, compiler::Node* new_target, + compiler::Node* first_arg, + compiler::Node* arg_count, compiler::Node* slot_id, + compiler::Node* type_feedback_vector); // Call constructor |constructor| with |arg_count| arguments (not including // 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 // the new keyword, but differs for the super keyword. - compiler::Node* CallConstructWithSpread(compiler::Node* constructor, - compiler::Node* context, - compiler::Node* new_target, - compiler::Node* first_arg, - compiler::Node* arg_count); + compiler::Node* ConstructWithSpread(compiler::Node* constructor, + compiler::Node* context, + compiler::Node* new_target, + compiler::Node* first_arg, + compiler::Node* arg_count); // Call runtime function with |arg_count| arguments and the first argument // located at |first_arg|. diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc index 938d47ad1e..d63a7c0ef4 100644 --- a/src/interpreter/interpreter.cc +++ b/src/interpreter/interpreter.cc @@ -2213,8 +2213,8 @@ void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) { Node* first_arg = __ RegisterLocation(first_arg_reg); Node* args_count = __ BytecodeOperandCount(2); Node* context = __ GetContext(); - Node* result = __ CallConstructWithSpread(constructor, context, new_target, - first_arg, args_count); + Node* result = __ ConstructWithSpread(constructor, context, new_target, + first_arg, args_count); __ SetAccumulator(result); __ Dispatch(); } @@ -2235,8 +2235,8 @@ void Interpreter::DoNew(InterpreterAssembler* assembler) { Node* slot_id = __ BytecodeOperandIdx(3); Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* context = __ GetContext(); - Node* result = __ CallConstruct(constructor, context, new_target, first_arg, - args_count, slot_id, type_feedback_vector); + Node* result = __ Construct(constructor, context, new_target, first_arg, + args_count, slot_id, type_feedback_vector); __ SetAccumulator(result); __ Dispatch(); }