Commit 19039efa authored by neis's avatar neis Committed by Commit bot

[interpreter] Clarify some names and comments.

Also remove an unused declaration.

R=bmeurer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2302163003
Cr-Commit-Position: refs/heads/master@{#39129}
parent 25603e0b
......@@ -415,19 +415,19 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) {
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToJSObject(
BytecodeArrayBuilder& BytecodeArrayBuilder::ConvertAccumulatorToObject(
Register out) {
Output(Bytecode::kToObject, RegisterOperand(out));
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToName(
BytecodeArrayBuilder& BytecodeArrayBuilder::ConvertAccumulatorToName(
Register out) {
Output(Bytecode::kToName, RegisterOperand(out));
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToNumber(
BytecodeArrayBuilder& BytecodeArrayBuilder::ConvertAccumulatorToNumber(
Register out) {
Output(Bytecode::kToNumber, RegisterOperand(out));
return *this;
......
......@@ -233,13 +233,10 @@ class BytecodeArrayBuilder final : public ZoneObject {
BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg,
int feedback_slot = kNoFeedbackSlot);
// Casts accumulator and stores result in accumulator.
BytecodeArrayBuilder& CastAccumulatorToBoolean();
// Casts accumulator and stores result in register |out|.
BytecodeArrayBuilder& CastAccumulatorToJSObject(Register out);
BytecodeArrayBuilder& CastAccumulatorToName(Register out);
BytecodeArrayBuilder& CastAccumulatorToNumber(Register out);
// Converts accumulator and stores result in register |out|.
BytecodeArrayBuilder& ConvertAccumulatorToObject(Register out);
BytecodeArrayBuilder& ConvertAccumulatorToName(Register out);
BytecodeArrayBuilder& ConvertAccumulatorToNumber(Register out);
// Flow Control.
BytecodeArrayBuilder& Bind(BytecodeLabel* label);
......
......@@ -1314,7 +1314,7 @@ void BytecodeGenerator::VisitForInStatement(ForInStatement* stmt) {
builder()->JumpIfUndefined(&subject_undefined_label);
builder()->JumpIfNull(&subject_null_label);
Register receiver = register_allocator()->NewRegister();
builder()->CastAccumulatorToJSObject(receiver);
builder()->ConvertAccumulatorToObject(receiver);
register_allocator()->PrepareForConsecutiveAllocations(3);
Register cache_type = register_allocator()->NextConsecutiveRegister();
......@@ -1555,7 +1555,7 @@ void BytecodeGenerator::VisitClassLiteralProperties(ClassLiteral* expr,
}
VisitForAccumulatorValue(property->key());
builder()->CastAccumulatorToName(key);
builder()->ConvertAccumulatorToName(key);
// The static prototype property is read only. We handle the non computed
// property name case in the parser. Since this is the only case where we
// need to check for an own read only property we special case this so we do
......@@ -1845,7 +1845,7 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
builder()->MoveRegister(literal, literal_argument);
VisitForAccumulatorValue(property->key());
builder()->CastAccumulatorToName(key);
builder()->ConvertAccumulatorToName(key);
VisitForAccumulatorValue(property->value());
builder()->StoreAccumulatorInRegister(value);
VisitSetHomeObject(value, literal, property);
......@@ -2955,7 +2955,7 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
old_value = register_allocator()->outer()->NewRegister();
// Convert old value into a number before saving it.
builder()->CastAccumulatorToNumber(old_value);
builder()->ConvertAccumulatorToNumber(old_value);
}
// Perform +1/-1 operation.
......@@ -3204,7 +3204,7 @@ void BytecodeGenerator::VisitNewLocalWithContext() {
Register extension_object = register_allocator()->NewRegister();
builder()->CastAccumulatorToJSObject(extension_object);
builder()->ConvertAccumulatorToObject(extension_object);
VisitFunctionClosureForContext();
builder()->CreateWithContext(extension_object);
execution_result()->SetResultInAccumulator();
......
......@@ -1303,7 +1303,7 @@ void Interpreter::DoUnaryOpWithFeedback(InterpreterAssembler* assembler) {
// ToName
//
// Cast the object referenced by the accumulator to a name.
// Convert the object referenced by the accumulator to a name.
void Interpreter::DoToName(InterpreterAssembler* assembler) {
Node* result = BuildUnaryOp(CodeFactory::ToName(isolate_), assembler);
__ StoreRegister(result, __ BytecodeOperandReg(0));
......@@ -1312,7 +1312,7 @@ void Interpreter::DoToName(InterpreterAssembler* assembler) {
// ToNumber
//
// Cast the object referenced by the accumulator to a number.
// Convert the object referenced by the accumulator to a number.
void Interpreter::DoToNumber(InterpreterAssembler* assembler) {
Node* result = BuildUnaryOp(CodeFactory::ToNumber(isolate_), assembler);
__ StoreRegister(result, __ BytecodeOperandReg(0));
......@@ -1321,7 +1321,7 @@ void Interpreter::DoToNumber(InterpreterAssembler* assembler) {
// ToObject
//
// Cast the object referenced by the accumulator to a JSObject.
// Convert the object referenced by the accumulator to a JSReceiver.
void Interpreter::DoToObject(InterpreterAssembler* assembler) {
Node* result = BuildUnaryOp(CodeFactory::ToObject(isolate_), assembler);
__ StoreRegister(result, __ BytecodeOperandReg(0));
......
......@@ -185,10 +185,10 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.CompareOperation(Token::Value::INSTANCEOF, reg, 8)
.CompareOperation(Token::Value::IN, reg, 9);
// Emit cast operator invocations.
builder.CastAccumulatorToNumber(reg)
.CastAccumulatorToJSObject(reg)
.CastAccumulatorToName(reg);
// Emit conversion operator invocations.
builder.ConvertAccumulatorToNumber(reg)
.ConvertAccumulatorToObject(reg)
.ConvertAccumulatorToName(reg);
// Emit control flow. Return must be the last instruction.
BytecodeLabel start;
......
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