Revision: 3032
Author: [email protected]
Date: Wed Oct  7 07:55:41 2009
Log: Added command line flag --sync_with_push (default: true) to
emit 'push' instead of 'sub esp, xxx' followed by 'mov' instructions
Reduces generated code size by 10-15% on several benchmarks.
Done on ia32 and x64 (no sync operation in the virtual frame on ARM
architecture)

Review URL: http://codereview.chromium.org/259058
http://code.google.com/p/v8/source/detail?r=3032

Modified:
  /branches/bleeding_edge/src/ia32/virtual-frame-ia32.cc
  /branches/bleeding_edge/src/x64/virtual-frame-x64.cc

=======================================
--- /branches/bleeding_edge/src/ia32/virtual-frame-ia32.cc      Wed Sep  9  
03:49:40 2009
+++ /branches/bleeding_edge/src/ia32/virtual-frame-ia32.cc      Wed Oct  7  
07:55:41 2009
@@ -161,15 +161,16 @@
    // on the stack.
    int start = Min(begin, stack_pointer_ + 1);

-  // If positive we have to adjust the stack pointer.
-  int delta = end - stack_pointer_;
-  if (delta > 0) {
-    stack_pointer_ = end;
-    __ sub(Operand(esp), Immediate(delta * kPointerSize));
-  }
-
+  // Emit normal 'push' instructions for elements above stack pointer
+  // and use mov instructions if we are below stack pointer.
    for (int i = start; i <= end; i++) {
-    if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i);
+    if (!elements_[i].is_synced()) {
+      if (i <= stack_pointer_) {
+        SyncElementBelowStackPointer(i);
+      } else {
+        SyncElementByPushing(i);
+      }
+    }
    }
  }

=======================================
--- /branches/bleeding_edge/src/x64/virtual-frame-x64.cc        Thu Sep 10  
05:55:27 2009
+++ /branches/bleeding_edge/src/x64/virtual-frame-x64.cc        Wed Oct  7  
07:55:41 2009
@@ -883,15 +883,16 @@
    // on the stack.
    int start = Min(begin, stack_pointer_ + 1);

-  // If positive we have to adjust the stack pointer.
-  int delta = end - stack_pointer_;
-  if (delta > 0) {
-    stack_pointer_ = end;
-    __ subq(rsp, Immediate(delta * kPointerSize));
-  }
-
+  // Emit normal 'push' instructions for elements above stack pointer
+  // and use mov instructions if we are below stack pointer.
    for (int i = start; i <= end; i++) {
-    if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i);
+    if (!elements_[i].is_synced()) {
+      if (i <= stack_pointer_) {
+        SyncElementBelowStackPointer(i);
+      } else {
+        SyncElementByPushing(i);
+      }
+    }
    }
  }


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

Reply via email to