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

[Ignition] Rename New and NewWithSpread bytecodes.

Rename to Construct and ConstructWithSpread, to match the names of
the JSOperators used.

Unfortunately, I can't find a way for auto-formatting to stay happy unless we
change the indentation for the whole BYTECODE_LIST macro.

Review-Url: https://codereview.chromium.org/2663963003
Cr-Commit-Position: refs/heads/master@{#42840}
parent 44cac16f
......@@ -1352,7 +1352,7 @@ void BytecodeGraphBuilder::VisitCallRuntimeForPair() {
Environment::kAttachFrameState);
}
Node* BytecodeGraphBuilder::ProcessCallNewWithSpreadArguments(
Node* BytecodeGraphBuilder::ProcessConstructWithSpreadArguments(
const Operator* op, Node* callee, Node* new_target,
interpreter::Register first_arg, size_t arity) {
Node** all = local_zone()->NewArray<Node*>(arity);
......@@ -1367,7 +1367,7 @@ Node* BytecodeGraphBuilder::ProcessCallNewWithSpreadArguments(
return value;
}
void BytecodeGraphBuilder::VisitNewWithSpread() {
void BytecodeGraphBuilder::VisitConstructWithSpread() {
PrepareEagerCheckpoint();
interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0);
interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
......@@ -1378,8 +1378,8 @@ void BytecodeGraphBuilder::VisitNewWithSpread() {
const Operator* op =
javascript()->ConstructWithSpread(static_cast<int>(arg_count) + 2);
Node* value = ProcessCallNewWithSpreadArguments(op, callee, new_target,
first_arg, arg_count + 2);
Node* value = ProcessConstructWithSpreadArguments(op, callee, new_target,
first_arg, arg_count + 2);
environment()->BindAccumulator(value, Environment::kAttachFrameState);
}
......@@ -1396,7 +1396,7 @@ void BytecodeGraphBuilder::VisitInvokeIntrinsic() {
environment()->BindAccumulator(value, Environment::kAttachFrameState);
}
Node* BytecodeGraphBuilder::ProcessCallNewArguments(
Node* BytecodeGraphBuilder::ProcessConstructArguments(
const Operator* call_new_op, Node* callee, Node* new_target,
interpreter::Register first_arg, size_t arity) {
Node** all = local_zone()->NewArray<Node*>(arity);
......@@ -1411,7 +1411,7 @@ Node* BytecodeGraphBuilder::ProcessCallNewArguments(
return value;
}
void BytecodeGraphBuilder::VisitNew() {
void BytecodeGraphBuilder::VisitConstruct() {
PrepareEagerCheckpoint();
interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0);
interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
......@@ -1428,8 +1428,8 @@ void BytecodeGraphBuilder::VisitNew() {
float const frequency = ComputeCallFrequency(slot_id);
const Operator* call = javascript()->Construct(
static_cast<int>(arg_count) + 2, frequency, feedback);
Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg,
arg_count + 2);
Node* value = ProcessConstructArguments(call, callee, new_target, first_arg,
arg_count + 2);
environment()->BindAccumulator(value, Environment::kAttachFrameState);
}
......
......@@ -111,13 +111,14 @@ class BytecodeGraphBuilder {
Node* ProcessCallArguments(const Operator* call_op, Node* callee,
interpreter::Register receiver, size_t arity);
Node* ProcessCallNewArguments(const Operator* call_new_op, Node* callee,
Node* new_target,
interpreter::Register first_arg, size_t arity);
Node* ProcessCallNewWithSpreadArguments(const Operator* op, Node* callee,
Node* new_target,
interpreter::Register first_arg,
size_t arity);
Node* ProcessConstructArguments(const Operator* call_new_op, Node* callee,
Node* new_target,
interpreter::Register first_arg,
size_t arity);
Node* ProcessConstructWithSpreadArguments(const Operator* op, Node* callee,
Node* new_target,
interpreter::Register first_arg,
size_t arity);
Node* ProcessCallRuntimeArguments(const Operator* call_runtime_op,
interpreter::Register first_arg,
size_t arity);
......
......@@ -306,7 +306,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) {
typedef interpreter::Bytecode Bytecode;
typedef interpreter::Bytecodes Bytecodes;
if (Bytecodes::IsWithoutExternalSideEffects(bytecode)) return true;
if (Bytecodes::IsCallOrNew(bytecode)) return true;
if (Bytecodes::IsCallOrConstruct(bytecode)) return true;
if (Bytecodes::WritesBooleanToAccumulator(bytecode)) return true;
if (Bytecodes::IsJumpIfToBoolean(bytecode)) return true;
if (Bytecodes::IsPrefixScalingBytecode(bytecode)) return true;
......
......@@ -328,7 +328,7 @@ DebugBreakType BytecodeArrayBreakIterator::GetDebugBreakType() {
return isolate()->is_tail_call_elimination_enabled()
? DEBUG_BREAK_SLOT_AT_TAIL_CALL
: DEBUG_BREAK_SLOT_AT_CALL;
} else if (interpreter::Bytecodes::IsCallOrNew(bytecode)) {
} else if (interpreter::Bytecodes::IsCallOrConstruct(bytecode)) {
return DEBUG_BREAK_SLOT_AT_CALL;
} else if (source_position_iterator_.is_statement()) {
return DEBUG_BREAK_SLOT;
......
......@@ -905,10 +905,16 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallWithSpread(Register callable,
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
RegisterList args,
int feedback_slot_id) {
OutputNew(constructor, args, args.register_count(), feedback_slot_id);
BytecodeArrayBuilder& BytecodeArrayBuilder::Construct(Register constructor,
RegisterList args,
int feedback_slot_id) {
OutputConstruct(constructor, args, args.register_count(), feedback_slot_id);
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::ConstructWithSpread(
Register constructor, RegisterList args) {
OutputConstructWithSpread(constructor, args, args.register_count());
return *this;
}
......@@ -961,12 +967,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(int context_index,
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::NewWithSpread(Register constructor,
RegisterList args) {
OutputNewWithSpread(constructor, args, args.register_count());
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object,
LanguageMode language_mode) {
if (language_mode == SLOPPY) {
......
......@@ -218,15 +218,16 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final
// onwards. The final argument must be a spread.
BytecodeArrayBuilder& CallWithSpread(Register callable, RegisterList args);
// Call the new operator. The accumulator holds the |new_target|.
// Call the Construct operator. The accumulator holds the |new_target|.
// The |constructor| is in a register and arguments are in |args|.
BytecodeArrayBuilder& New(Register constructor, RegisterList args,
int feedback_slot);
BytecodeArrayBuilder& Construct(Register constructor, RegisterList args,
int feedback_slot);
// Call the new operator for use with a spread. The accumulator holds the
// |new_target|. The |constructor| is in a register and arguments are in
// Call the Construct operator for use with a spread. The accumulator holds
// the |new_target|. The |constructor| is in a register and arguments are in
// |args|. The final argument must be a spread.
BytecodeArrayBuilder& NewWithSpread(Register constructor, RegisterList args);
BytecodeArrayBuilder& ConstructWithSpread(Register constructor,
RegisterList args);
// Call the runtime function with |function_id| and arguments |args|.
BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id,
......
......@@ -2606,7 +2606,7 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
// if there is exactly one spread, and it is the last argument.
if (expr->only_last_arg_is_spread()) {
// TODO(petermarshall): Collect type on the feedback slot.
builder()->NewWithSpread(constructor, args_regs);
builder()->ConstructWithSpread(constructor, args_regs);
} else {
// Call construct.
// TODO(turbofan): For now we do gather feedback on super constructor
......@@ -2616,7 +2616,7 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) {
// the job done for now. In the long run we might want to revisit this
// and come up with a better way.
int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot());
builder()->New(constructor, args_regs, feedback_slot_index);
builder()->Construct(constructor, args_regs, feedback_slot_index);
}
}
......@@ -2632,10 +2632,10 @@ void BytecodeGenerator::VisitCallNew(CallNew* expr) {
if (expr->only_last_arg_is_spread()) {
// TODO(petermarshall): Collect type on the feedback slot.
builder()->NewWithSpread(constructor, args);
builder()->ConstructWithSpread(constructor, args);
} else {
builder()->New(constructor, args,
feedback_index(expr->CallNewFeedbackSlot()));
builder()->Construct(constructor, args,
feedback_index(expr->CallNewFeedbackSlot()));
}
}
......
......@@ -227,7 +227,8 @@ bool Bytecodes::IsStarLookahead(Bytecode bytecode, OperandScale operand_scale) {
case Bytecode::kTypeOf:
case Bytecode::kCall:
case Bytecode::kCallProperty:
case Bytecode::kNew:
case Bytecode::kConstruct:
case Bytecode::kConstructWithSpread:
return true;
default:
return false;
......
This diff is collapsed.
......@@ -2199,13 +2199,13 @@ void Interpreter::DoCallWithSpread(InterpreterAssembler* assembler) {
__ Dispatch();
}
// NewWithSpread <first_arg> <arg_count>
// ConstructWithSpread <first_arg> <arg_count>
//
// Call the constructor in |constructor| with the first argument in register
// |first_arg| and |arg_count| arguments in subsequent registers. The final
// argument is always a spread. The new.target is in the accumulator.
//
void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) {
void Interpreter::DoConstructWithSpread(InterpreterAssembler* assembler) {
Node* new_target = __ GetAccumulator();
Node* constructor_reg = __ BytecodeOperandReg(0);
Node* constructor = __ LoadRegister(constructor_reg);
......@@ -2219,13 +2219,13 @@ void Interpreter::DoNewWithSpread(InterpreterAssembler* assembler) {
__ Dispatch();
}
// New <constructor> <first_arg> <arg_count>
// Construct <constructor> <first_arg> <arg_count>
//
// Call operator new with |constructor| and the first argument in
// Call operator construct with |constructor| and the first argument in
// register |first_arg| and |arg_count| arguments in subsequent
// registers. The new.target is in the accumulator.
//
void Interpreter::DoNew(InterpreterAssembler* assembler) {
void Interpreter::DoConstruct(InterpreterAssembler* assembler) {
Node* new_target = __ GetAccumulator();
Node* constructor_reg = __ BytecodeOperandReg(0);
Node* constructor = __ LoadRegister(constructor_reg);
......
......@@ -19,7 +19,7 @@ bytecodes: [
/* 45 E> */ B(StackCheck),
/* 50 S> */ B(LdaGlobal), U8(0), U8(4),
B(Star), R(0),
/* 57 E> */ B(New), R(0), R(0), U8(0), U8(2),
/* 57 E> */ B(Construct), R(0), R(0), U8(0), U8(2),
/* 68 S> */ B(Return),
]
constant pool: [
......@@ -44,7 +44,7 @@ bytecodes: [
B(LdaSmi), I8(3),
B(Star), R(1),
B(Ldar), R(0),
/* 70 E> */ B(New), R(0), R(1), U8(1), U8(2),
/* 70 E> */ B(Construct), R(0), R(1), U8(1), U8(2),
/* 82 S> */ B(Return),
]
constant pool: [
......@@ -78,7 +78,7 @@ bytecodes: [
B(LdaSmi), I8(5),
B(Star), R(3),
B(Ldar), R(0),
/* 112 E> */ B(New), R(0), R(1), U8(3), U8(2),
/* 112 E> */ B(Construct), R(0), R(1), U8(3), U8(2),
/* 130 S> */ B(Return),
]
constant pool: [
......
......@@ -118,7 +118,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(3),
B(Ldar), R(0),
/* 118 E> */ B(New), R(2), R(3), U8(1), U8(2),
/* 118 E> */ B(Construct), R(2), R(3), U8(1), U8(2),
B(Star), R(2),
B(Ldar), R(this),
B(JumpIfNotHole), U8(4),
......@@ -171,7 +171,7 @@ bytecodes: [
/* 117 S> */ B(Ldar), R(1),
B(GetSuperConstructor), R(2),
B(Ldar), R(0),
/* 117 E> */ B(New), R(2), R(0), U8(0), U8(2),
/* 117 E> */ B(Construct), R(2), R(0), U8(0), U8(2),
B(Star), R(2),
B(Ldar), R(this),
B(JumpIfNotHole), U8(4),
......
......@@ -215,7 +215,7 @@ bytecodes: [
B(Star), R(1),
B(Star), R(2),
/* 87 S> */ B(Nop),
/* 94 E> */ B(New), R(2), R(0), U8(0), U8(3),
/* 94 E> */ B(Construct), R(2), R(0), U8(0), U8(3),
/* 103 S> */ B(Return),
]
constant pool: [
......
......@@ -38,7 +38,7 @@ bytecodes: [
/* 89 S> */ B(CreateArrayLiteral), U8(1), U8(5), U8(9),
B(Star), R(4),
B(Ldar), R(2),
/* 89 E> */ B(NewWithSpread), R(2), R(4), U8(1),
/* 89 E> */ B(ConstructWithSpread), R(2), R(4), U8(1),
B(LdaUndefined),
/* 110 S> */ B(Return),
]
......@@ -84,7 +84,7 @@ bytecodes: [
B(CreateArrayLiteral), U8(1), U8(5), U8(9),
B(Star), R(5),
B(Ldar), R(2),
/* 89 E> */ B(NewWithSpread), R(2), R(4), U8(2),
/* 89 E> */ B(ConstructWithSpread), R(2), R(4), U8(2),
B(LdaUndefined),
/* 113 S> */ B(Return),
]
......
......@@ -30,7 +30,7 @@ bytecodes: [
/* 93 S> */ B(Ldar), R(1),
B(GetSuperConstructor), R(3),
B(Ldar), R(0),
/* 93 E> */ B(NewWithSpread), R(3), R(2), U8(1),
/* 93 E> */ B(ConstructWithSpread), R(3), R(2), U8(1),
/* 93 S> */ B(Return),
]
constant pool: [
......@@ -67,7 +67,7 @@ bytecodes: [
B(Star), R(4),
B(Ldar), R(0),
B(Mov), R(2), R(5),
/* 140 E> */ B(NewWithSpread), R(3), R(4), U8(2),
/* 140 E> */ B(ConstructWithSpread), R(3), R(4), U8(2),
B(Star), R(3),
B(Ldar), R(this),
B(JumpIfNotHole), U8(4),
......
......@@ -138,7 +138,6 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.CallRuntime(Runtime::kIsArray, reg)
.CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair)
.CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list)
.NewWithSpread(reg, reg_list)
.CallWithSpread(reg, reg_list);
// Emit binary operator invocations.
......@@ -185,8 +184,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit delete
builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT);
// Emit new.
builder.New(reg, reg_list, 1);
// Emit construct.
builder.Construct(reg, reg_list, 1).ConstructWithSpread(reg, reg_list);
// Emit test operator invocations.
builder.CompareOperation(Token::Value::EQ, reg, 1)
......
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