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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1884103002: [crankshaft] Hook the binary operators TurboFan code stubs with crankshaft. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index fee42921f6eb0a6b53f57f87c27f3eee363fb448..3d314d0e1e1a040ec5b1bce75278e75d0ae2ba6e 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -11290,46 +11290,54 @@ HValue* HGraphBuilder::BuildBinaryOperation(Token::Value op, HValue* left,
// 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) {
- Runtime::FunctionId function_id;
+ HValue* values[] = {context(), left, right};
+#define GET_STUB(Name) \
+ do { \
+ Callable callable = CodeFactory::Name(isolate()); \
+ HValue* stub = Add<HConstant>(callable.code()); \
+ instr = AddUncasted<HCallWithDescriptor>( \
+ stub, 0, callable.descriptor(), \
+ Vector<HValue*>(values, arraysize(values))); \
+ } while (false)
+
switch (op) {
default:
UNREACHABLE();
case Token::ADD:
- function_id = Runtime::kAdd;
+ GET_STUB(Add);
break;
case Token::SUB:
- function_id = Runtime::kSubtract;
+ GET_STUB(Subtract);
break;
case Token::MUL:
- function_id = Runtime::kMultiply;
+ GET_STUB(Multiply);
break;
case Token::DIV:
- function_id = Runtime::kDivide;
+ GET_STUB(Divide);
break;
case Token::MOD:
- function_id = Runtime::kModulus;
+ GET_STUB(Modulus);
break;
case Token::BIT_OR:
- function_id = Runtime::kBitwiseOr;
+ GET_STUB(BitwiseOr);
break;
case Token::BIT_AND:
- function_id = Runtime::kBitwiseAnd;
+ GET_STUB(BitwiseAnd);
break;
case Token::BIT_XOR:
- function_id = Runtime::kBitwiseXor;
+ GET_STUB(BitwiseXor);
break;
case Token::SAR:
- function_id = Runtime::kShiftRight;
+ GET_STUB(ShiftRight);
break;
case Token::SHR:
- function_id = Runtime::kShiftRightLogical;
+ GET_STUB(ShiftRightLogical);
break;
case Token::SHL:
- function_id = Runtime::kShiftLeft;
+ GET_STUB(ShiftLeft);
break;
}
- Add<HPushArguments>(left, right);
- instr = AddUncasted<HCallRuntime>(Runtime::FunctionForId(function_id), 2);
+#undef GET_STUB
} else {
switch (op) {
case Token::ADD:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698