Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1300)

Unified Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1386133002: [Interpreter] Add bitwise operators (Or, Xor, And) to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/interpreter/test-interpreter.cc
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc
index d87f244318af3704fe3421e617976e7e4db33219..0db7f4bc98698adde1c6c44b5c28e9a50e5176f9 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -350,12 +350,22 @@ TEST(InterpreterLoadStoreRegisters) {
static const Token::Value kArithmeticOperators[] = {
- Token::Value::ADD, Token::Value::SUB, Token::Value::MUL, Token::Value::DIV,
- Token::Value::MOD};
+ Token::Value::BIT_OR, Token::Value::BIT_XOR, Token::Value::BIT_AND,
+ Token::Value::ADD, Token::Value::SUB, Token::Value::MUL,
+ Token::Value::DIV, Token::Value::MOD};
static double BinaryOpC(Token::Value op, double lhs, double rhs) {
switch (op) {
+ case Token::Value::BIT_OR:
+ return (v8::internal::DoubleToInt32(lhs) |
+ v8::internal::DoubleToInt32(rhs));
+ case Token::Value::BIT_XOR:
+ return (v8::internal::DoubleToInt32(lhs) ^
+ v8::internal::DoubleToInt32(rhs));
+ case Token::Value::BIT_AND:
+ return (v8::internal::DoubleToInt32(lhs) &
+ v8::internal::DoubleToInt32(rhs));
case Token::Value::ADD:
return lhs + rhs;
case Token::Value::SUB:
@@ -387,7 +397,7 @@ TEST(InterpreterBinaryOpsSmi) {
builder.set_parameter_count(1);
Register reg(0);
int lhs = lhs_inputs[l];
- int rhs = rhs_inputs[l];
+ int rhs = rhs_inputs[r];
builder.LoadLiteral(Smi::FromInt(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(rhs))
@@ -422,7 +432,7 @@ TEST(InterpreterBinaryOpsHeapNumber) {
builder.set_parameter_count(1);
Register reg(0);
double lhs = lhs_inputs[l];
- double rhs = rhs_inputs[l];
+ double rhs = rhs_inputs[r];
builder.LoadLiteral(factory->NewNumber(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(factory->NewNumber(rhs))

Powered by Google App Engine
This is Rietveld 408576698