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

Unified Diff: src/hydrogen.cc

Issue 1333843002: [runtime] Move binary operator fallbacks into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: No need for frame states in bytecode handlers. Add test case. Created 5 years, 3 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: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 902e507258c6c722c829c244df0c1e17be632620..0ea706063fd0aa7392b1859ea2ede58d0f7611da 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -11066,10 +11066,57 @@ HValue* HGraphBuilder::BuildBinaryOperation(
// inline several instructions (including the two pushes) for every tagged
// operation in optimized code, which is more expensive, than a stub call.
if (graph()->info()->IsStub() && is_non_primitive) {
- HValue* function =
- AddLoadJSBuiltin(BinaryOpIC::TokenToContextIndex(op, strength));
+ Runtime::FunctionId function_id;
+ switch (op) {
+ default:
+ UNREACHABLE();
Michael Starzinger 2015/09/10 11:43:24 Sneaky fall-through to convince compiler that func
+ case Token::ADD:
+ function_id =
+ is_strong(strength) ? Runtime::kAdd_Strong : Runtime::kAdd;
+ break;
+ case Token::SUB:
+ function_id = is_strong(strength) ? Runtime::kSubtract_Strong
+ : Runtime::kSubtract;
+ break;
+ case Token::MUL:
+ function_id = is_strong(strength) ? Runtime::kMultiply_Strong
+ : Runtime::kMultiply;
+ break;
+ case Token::DIV:
+ function_id =
+ is_strong(strength) ? Runtime::kDivide_Strong : Runtime::kDivide;
+ break;
+ case Token::MOD:
+ function_id =
+ is_strong(strength) ? Runtime::kModulus_Strong : Runtime::kModulus;
+ break;
+ case Token::BIT_OR:
+ function_id = is_strong(strength) ? Runtime::kBitwiseOr_Strong
+ : Runtime::kBitwiseOr;
+ break;
+ case Token::BIT_AND:
+ function_id = is_strong(strength) ? Runtime::kBitwiseAnd_Strong
+ : Runtime::kBitwiseAnd;
+ break;
+ case Token::BIT_XOR:
+ function_id = is_strong(strength) ? Runtime::kBitwiseXor_Strong
+ : Runtime::kBitwiseXor;
+ break;
+ case Token::SAR:
+ function_id = is_strong(strength) ? Runtime::kShiftRight_Strong
+ : Runtime::kShiftRight;
+ break;
+ case Token::SHR:
+ function_id = is_strong(strength) ? Runtime::kShiftRightLogical_Strong
+ : Runtime::kShiftRightLogical;
+ break;
+ case Token::SHL:
+ function_id = is_strong(strength) ? Runtime::kShiftLeft_Strong
+ : Runtime::kShiftLeft;
+ break;
+ }
Add<HPushArguments>(left, right);
- instr = AddUncasted<HInvokeFunction>(function, 2);
+ instr = AddUncasted<HCallRuntime>(Runtime::FunctionForId(function_id), 2);
} else {
if (is_strong(strength) && Token::IsBitOp(op)) {
// TODO(conradw): This is not efficient, but is necessary to prevent
@@ -11119,7 +11166,7 @@ HValue* HGraphBuilder::BuildBinaryOperation(
instr = AddUncasted<HBitwise>(op, left, right, strength);
break;
case Token::BIT_OR: {
- HValue* operand, *shift_amount;
+ HValue *operand, *shift_amount;
if (left_type->Is(Type::Signed32()) &&
right_type->Is(Type::Signed32()) &&
MatchRotateRight(left, right, &operand, &shift_amount)) {

Powered by Google App Engine
This is Rietveld 408576698