Commit 2749ebba authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[interpreter] Deprecate DeleteLookupSlot bytecode.

This replaces the bytecode in question with a runtime call within the
bytecode stream. The tradeoff is to safe one bytecode opcode for more
expensive encoding of lookup slot deletion.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1690913002

Cr-Commit-Position: refs/heads/master@{#33907}
parent ba55f559
......@@ -1305,14 +1305,6 @@ void BytecodeGraphBuilder::VisitDeletePropertySloppy() {
BuildDelete(LanguageMode::SLOPPY);
}
void BytecodeGraphBuilder::VisitDeleteLookupSlot() {
FrameStateBeforeAndAfter states(this);
Node* name = environment()->LookupAccumulator();
const Operator* op = javascript()->CallRuntime(Runtime::kDeleteLookupSlot);
Node* result = NewNode(op, name);
environment()->BindAccumulator(result, &states);
}
void BytecodeGraphBuilder::BuildCompareOp(const Operator* js_op) {
FrameStateBeforeAndAfter states(this);
Node* left =
......
......@@ -1204,12 +1204,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object,
}
BytecodeArrayBuilder& BytecodeArrayBuilder::DeleteLookupSlot() {
Output(Bytecode::kDeleteLookupSlot);
return *this;
}
size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
return constant_array_builder()->Insert(object);
}
......
......@@ -207,7 +207,6 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover {
// Deletes property from an object. This expects that accumulator contains
// the key to be deleted and the register contains a reference to the object.
BytecodeArrayBuilder& Delete(Register object, LanguageMode language_mode);
BytecodeArrayBuilder& DeleteLookupSlot();
// Tests.
BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg,
......
......@@ -2423,7 +2423,11 @@ void BytecodeGenerator::VisitDelete(UnaryOperation* expr) {
break;
}
case VariableLocation::LOOKUP: {
builder()->LoadLiteral(variable->name()).DeleteLookupSlot();
Register name_reg = register_allocator()->NewRegister();
builder()
->LoadLiteral(variable->name())
.StoreAccumulatorInRegister(name_reg)
.CallRuntime(Runtime::kDeleteLookupSlot, name_reg, 1);
break;
}
default:
......
......@@ -162,7 +162,6 @@ namespace interpreter {
V(TypeOf, OperandType::kNone) \
V(DeletePropertyStrict, OperandType::kReg8) \
V(DeletePropertySloppy, OperandType::kReg8) \
V(DeleteLookupSlot, OperandType::kNone) \
\
/* Call operations */ \
V(Call, OperandType::kReg8, OperandType::kReg8, OperandType::kRegCount8, \
......
......@@ -1020,18 +1020,6 @@ void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) {
}
// DeleteLookupSlot
//
// Delete the variable with the name specified in the accumulator by dynamically
// looking it up.
void Interpreter::DoDeleteLookupSlot(InterpreterAssembler* assembler) {
Node* name = __ GetAccumulator();
Node* context = __ GetContext();
Node* result = __ CallRuntime(Runtime::kDeleteLookupSlot, context, name);
__ SetAccumulator(result);
__ Dispatch();
}
void Interpreter::DoJSCall(InterpreterAssembler* assembler) {
Node* function_reg = __ BytecodeOperandReg(0);
Node* function = __ LoadRegister(function_reg);
......
......@@ -8028,15 +8028,16 @@ TEST(DeleteLookupSlotInEval) {
// clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"delete x;",
0 * kPointerSize,
1 * kPointerSize,
1,
6,
12,
{
B(StackCheck), //
B(LdaConstant), U8(0), //
B(DeleteLookupSlot), //
B(LdaUndefined), //
B(Return) //
B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), //
B(LdaUndefined), //
B(Return) //
},
1,
{"x"}},
......@@ -8051,14 +8052,15 @@ TEST(DeleteLookupSlotInEval) {
},
0},
{"return delete z;",
0 * kPointerSize,
1 * kPointerSize,
1,
5,
11,
{
B(StackCheck), //
B(LdaConstant), U8(0), //
B(DeleteLookupSlot), //
B(Return) //
B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), //
B(Return) //
},
1,
{"z"}},
......
......@@ -133,9 +133,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
builder.LogicalNot().TypeOf();
// Emit delete
builder.Delete(reg, LanguageMode::SLOPPY)
.Delete(reg, LanguageMode::STRICT)
.DeleteLookupSlot();
builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT);
// Emit new.
builder.New(reg, reg, 0);
......
......@@ -95,7 +95,6 @@ TEST(Bytecodes, HasAnyRegisterOperands) {
2);
CHECK_EQ(Bytecodes::NumberOfRegisterOperands(Bytecode::kDeletePropertyStrict),
1);
CHECK_EQ(Bytecodes::NumberOfRegisterOperands(Bytecode::kDeleteLookupSlot), 0);
CHECK_EQ(Bytecodes::NumberOfRegisterOperands(Bytecode::kForInPrepare), 1);
CHECK_EQ(Bytecodes::NumberOfRegisterOperands(Bytecode::kForInPrepareWide), 1);
CHECK_EQ(Bytecodes::NumberOfRegisterOperands(Bytecode::kInc), 0);
......
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