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