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

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

Issue 1392913002: [Interpreter] Adds shift operators to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased the patch 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 9e087e7bf970cbe88fb4f24a462d08cafe950082..722c0b4c873916b69c033ace001c4cd10a303eba 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -352,8 +352,8 @@ TEST(InterpreterLoadStoreRegisters) {
static const Token::Value kArithmeticOperators[] = {
- Token::Value::ADD, Token::Value::SUB, Token::Value::MUL, Token::Value::DIV,
- Token::Value::MOD};
+ Token::Value::SHL, Token::Value::SAR, Token::Value::SHR, 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) {
@@ -368,6 +368,21 @@ static double BinaryOpC(Token::Value op, double lhs, double rhs) {
return lhs / rhs;
case Token::Value::MOD:
return std::fmod(lhs, rhs);
+ case Token::Value::SHL: {
+ int32_t val = v8::internal::DoubleToInt32(lhs);
+ uint32_t count = v8::internal::DoubleToUint32(rhs) & 0x1F;
+ return val << count;
+ }
+ case Token::Value::SAR: {
+ int32_t val = v8::internal::DoubleToInt32(lhs);
+ uint32_t count = v8::internal::DoubleToUint32(rhs) & 0x1F;
+ return val >> count;
+ }
+ case Token::Value::SHR: {
+ uint32_t val = v8::internal::DoubleToUint32(lhs);
+ uint32_t count = v8::internal::DoubleToUint32(rhs) & 0x1F;
+ return val >> count;
oth 2015/10/07 13:53:17 Can we have a separate test for the shift operator
mythria 2015/10/08 14:33:44 Done.
+ }
default:
UNREACHABLE();
return std::numeric_limits<double>::min();

Powered by Google App Engine
This is Rietveld 408576698