Revision: 6146
Author: [email protected]
Date: Tue Jan  4 03:02:58 2011
Log: Addresses some performance regression in the GenericBinaryOpStub on ARM following Crankshaft introduction.

BUG=none
TEST=none

Patch by Rodolph Perfetta from ARM Ltd.

Review URL: http://codereview.chromium.org/5781010

http://code.google.com/p/v8/source/detail?r=6146

Modified:
 /branches/bleeding_edge/src/arm/code-stubs-arm.cc
 /branches/bleeding_edge/src/arm/code-stubs-arm.h
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Mon Jan 3 06:59:12 2011 +++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Jan 4 03:02:58 2011
@@ -1222,16 +1222,22 @@
   bool generate_code_to_calculate_answer = true;

   if (ShouldGenerateFPCode()) {
+    // DIV has neither SmiSmi fast code nor specialized slow code.
+    // So don't try to patch a DIV Stub.
     if (runtime_operands_type_ == BinaryOpIC::DEFAULT) {
       switch (op_) {
         case Token::ADD:
         case Token::SUB:
         case Token::MUL:
-        case Token::DIV:
           GenerateTypeTransition(masm);  // Tail call.
           generate_code_to_calculate_answer = false;
           break;

+        case Token::DIV:
+          // DIV has neither SmiSmi fast code nor specialized slow code.
+          // So don't try to patch a DIV Stub.
+          break;
+
         default:
           break;
       }
@@ -1292,7 +1298,8 @@
       // HEAP_NUMBERS stub is slower than GENERIC on a pair of smis.
// r0 is known to be a smi. If r1 is also a smi then switch to GENERIC.
       Label r1_is_not_smi;
-      if (runtime_operands_type_ == BinaryOpIC::HEAP_NUMBERS) {
+      if ((runtime_operands_type_ == BinaryOpIC::HEAP_NUMBERS) &&
+          HasSmiSmiFastPath()) {
         __ tst(r1, Operand(kSmiTagMask));
         __ b(ne, &r1_is_not_smi);
         GenerateTypeTransition(masm);  // Tail call.
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.h Mon Jan 3 06:59:12 2011 +++ /branches/bleeding_edge/src/arm/code-stubs-arm.h Tue Jan 4 03:02:58 2011
@@ -77,7 +77,7 @@
         rhs_(rhs),
         constant_rhs_(constant_rhs),
         specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)),
-        runtime_operands_type_(BinaryOpIC::DEFAULT),
+        runtime_operands_type_(BinaryOpIC::UNINIT_OR_SMI),
         name_(NULL) { }

   GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info)
@@ -177,6 +177,10 @@
   Register RhsRegister(bool lhs_is_r0) {
     return lhs_is_r0 ? r1 : r0;
   }
+
+  bool HasSmiSmiFastPath() {
+    return op_ != Token::DIV;
+  }

   bool ShouldGenerateSmiCode() {
return ((op_ != Token::DIV && op_ != Token::MOD) || specialized_on_rhs_) &&
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Thu Dec 16 00:58:42 2010 +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Jan 4 03:02:58 2011
@@ -38,6 +38,8 @@
 #include "scopes.h"
 #include "stub-cache.h"

+#include "arm/code-stubs-arm.h"
+
 namespace v8 {
 namespace internal {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to