Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 51ae7f5a44c29fc4b69f66651b95fcfef7a6f2fa..658e265b9fbb0749a4c5c1dd3c531cb633fc6fc8 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8282,6 +8282,24 @@ bool CanBeZero(HValue *right) { |
} |
+bool HGraphBuilder::MatchMultiplyAdd(HValue* left, HValue* right, HValue** a, HValue** b, HValue** c) { |
+ if (right->IsMul()) { |
+ HValue *tmp = left; |
+ left = right; |
+ right = tmp; |
+ } |
+ if (!left->IsMul()) |
+ return false; |
+ |
+ HMul* mul = HMul::cast(left); |
+ *a = mul->left(); |
+ *b = mul->right(); |
+ *c = right; |
+ //printf("matched multiply-add\n"); |
+ return true; |
+} |
+ |
+ |
HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, |
HValue* left, |
HValue* right) { |
@@ -8294,17 +8312,27 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, |
} |
HInstruction* instr = NULL; |
switch (expr->op()) { |
- case Token::ADD: |
+ case Token::ADD: { |
+#ifdef V8_TARGET_ARCH_ARM |
+ HValue* a, *b, *c; |
+#endif |
if (info.IsString()) { |
AddInstruction(new(zone()) HCheckNonSmi(left)); |
AddInstruction(HCheckInstanceType::NewIsString(left, zone())); |
AddInstruction(new(zone()) HCheckNonSmi(right)); |
AddInstruction(HCheckInstanceType::NewIsString(right, zone())); |
instr = new(zone()) HStringAdd(context, left, right); |
+#ifdef V8_TARGET_ARCH_ARM |
+ } else if (info.IsDouble() && MatchMultiplyAdd(left, right, &a, &b, &c)) { |
+ // FIXME: Probably need to check types here? |
ulan_google
2012/11/07 09:54:03
Setting input representation should be sufficient.
|
+ // FIXME: I'm not sure I'm hooking this up correctly :/ |
+ instr = new(zone()) HMultiplyAdd(context, a, b, c); |
+#endif |
} else { |
instr = HAdd::NewHAdd(zone(), context, left, right); |
} |
break; |
+ } |
case Token::SUB: |
instr = HSub::NewHSub(zone(), context, left, right); |
break; |