Chromium Code Reviews

Unified Diff: src/interpreter/interpreter.cc

Issue 1369123002: [Interpreter] Add interpreter support for compare ops and ToBoolean. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Compilation fix. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « BUILD.gn ('k') | src/objects.h » ('j') | src/runtime/runtime-interpreter.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index f993724c3e1692a74513b6cc96b764a59b6cf8ad..a8a67e9c57faf2b7ee8998994f4ef44c2af2a944 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -294,15 +294,6 @@ void Interpreter::DoBinaryOp(Runtime::FunctionId function_id,
}
-void Interpreter::DoCompareOp(Token::Value op,
- compiler::InterpreterAssembler* assembler) {
- // TODO(oth): placeholder until compare path fixed.
- // The accumulator should be set to true on success (or false otherwise)
- // by the comparisons so it can be used for conditional jumps.
- DoLdaTrue(assembler);
-}
-
-
// Add <src>
//
// Add register <src> to accumulator.
@@ -363,7 +354,7 @@ void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) {
//
// Test if the value in the <src> register equals the accumulator.
void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::EQ, assembler);
+ DoBinaryOp(Runtime::kInterpreterEquals, assembler);
}
@@ -371,7 +362,7 @@ void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) {
//
// Test if the value in the <src> register is not equal to the accumulator.
void Interpreter::DoTestNotEqual(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::NE, assembler);
+ DoBinaryOp(Runtime::kInterpreterNotEquals, assembler);
}
@@ -379,7 +370,7 @@ void Interpreter::DoTestNotEqual(compiler::InterpreterAssembler* assembler) {
//
// Test if the value in the <src> register is strictly equal to the accumulator.
void Interpreter::DoTestEqualStrict(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::EQ_STRICT, assembler);
+ DoBinaryOp(Runtime::kInterpreterStrictEquals, assembler);
}
@@ -389,7 +380,7 @@ void Interpreter::DoTestEqualStrict(compiler::InterpreterAssembler* assembler) {
// accumulator.
void Interpreter::DoTestNotEqualStrict(
compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::NE_STRICT, assembler);
+ DoBinaryOp(Runtime::kInterpreterStrictNotEquals, assembler);
}
@@ -397,7 +388,7 @@ void Interpreter::DoTestNotEqualStrict(
//
// Test if the value in the <src> register is less than the accumulator.
void Interpreter::DoTestLessThan(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::LT, assembler);
+ DoBinaryOp(Runtime::kInterpreterLessThan, assembler);
}
@@ -405,7 +396,7 @@ void Interpreter::DoTestLessThan(compiler::InterpreterAssembler* assembler) {
//
// Test if the value in the <src> register is greater than the accumulator.
void Interpreter::DoTestGreaterThan(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::GT, assembler);
+ DoBinaryOp(Runtime::kInterpreterGreaterThan, assembler);
}
@@ -415,7 +406,7 @@ void Interpreter::DoTestGreaterThan(compiler::InterpreterAssembler* assembler) {
// accumulator.
void Interpreter::DoTestLessThanEqual(
compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::LTE, assembler);
+ DoBinaryOp(Runtime::kInterpreterLessThanEqual, assembler);
}
@@ -425,16 +416,16 @@ void Interpreter::DoTestLessThanEqual(
// accumulator.
void Interpreter::DoTestGreaterThanEqual(
compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::GTE, assembler);
+ DoBinaryOp(Runtime::kInterpreterGreaterThanEqual, assembler);
}
// TestIn <src>
//
-// Test if the value in the <src> register is in the collection referenced
-// by the accumulator.
+// Test if the object referenced by the register operand is a property of the
+// object referenced by the accumulator.
void Interpreter::DoTestIn(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::IN, assembler);
+ DoBinaryOp(Runtime::kHasProperty, assembler);
}
@@ -443,7 +434,7 @@ void Interpreter::DoTestIn(compiler::InterpreterAssembler* assembler) {
// Test if the object referenced by the <src> register is an an instance of type
// referenced by the accumulator.
void Interpreter::DoTestInstanceOf(compiler::InterpreterAssembler* assembler) {
- DoCompareOp(Token::Value::INSTANCEOF, assembler);
+ DoBinaryOp(Runtime::kInstanceOf, assembler);
}
« no previous file with comments | « BUILD.gn ('k') | src/objects.h » ('j') | src/runtime/runtime-interpreter.cc » ('J')

Powered by Google App Engine