Revision: 6805
Author: [email protected]
Date: Wed Feb 16 01:18:19 2011
Log: Fix non-simulated ARM calling of RegExp code.

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

Modified:
 /branches/bleeding_edge/src/arm/simulator-arm.h
 /branches/bleeding_edge/src/ia32/simulator-ia32.h
 /branches/bleeding_edge/src/regexp-macro-assembler.cc
 /branches/bleeding_edge/src/x64/simulator-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/simulator-arm.h     Tue Feb 15 05:53:51 2011
+++ /branches/bleeding_edge/src/arm/simulator-arm.h     Wed Feb 16 01:18:19 2011
@@ -48,10 +48,16 @@
 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
   (entry(p0, p1, p2, p3, p4))

-// Call the generated regexp code directly. The entry function pointer should
-// expect seven int/pointer sized arguments and return an int.
+typedef int (*arm_regexp_matcher)(String*, int, const byte*, const byte*,
+                                  void*, int*, Address, int);
+
+
+// Call the generated regexp code directly. The code at the entry address
+// should act as a function matching the type arm_regexp_matcher.
+// The fifth argument is a dummy that reserves the space used for
+// the return address added by the ExitFrame in native calls.
 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
-  (entry(p0, p1, p2, p3, NULL, p4, p5, p6))
+ (FUNCTION_CAST<arm_regexp_matcher>(entry)(p0, p1, p2, p3, NULL, p4, p5, p6))

 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
   (reinterpret_cast<TryCatch*>(try_catch_address))
@@ -362,8 +368,7 @@
       FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))

 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
-  Simulator::current()->Call( \
-      FUNCTION_ADDR(entry), 8, p0, p1, p2, p3, NULL, p4, p5, p6)
+  Simulator::current()->Call(entry, 8, p0, p1, p2, p3, NULL, p4, p5, p6)

 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
   try_catch_address == \
=======================================
--- /branches/bleeding_edge/src/ia32/simulator-ia32.h Tue Dec 7 03:01:02 2010 +++ /branches/bleeding_edge/src/ia32/simulator-ia32.h Wed Feb 16 01:18:19 2011
@@ -38,10 +38,15 @@
 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
   (entry(p0, p1, p2, p3, p4))

-// Call the generated regexp code directly. The entry function pointer should
+
+typedef int (*regexp_matcher)(String*, int, const byte*,
+                              const byte*, int*, Address, int);
+
+// Call the generated regexp code directly. The code at the entry address should
 // expect seven int/pointer sized arguments and return an int.
 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
-  (entry(p0, p1, p2, p3, p4, p5, p6))
+  (FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6))
+

 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
   (reinterpret_cast<TryCatch*>(try_catch_address))
=======================================
--- /branches/bleeding_edge/src/regexp-macro-assembler.cc Tue Dec 7 03:01:02 2010 +++ /branches/bleeding_edge/src/regexp-macro-assembler.cc Wed Feb 16 01:18:19 2011
@@ -154,16 +154,12 @@
     const byte* input_start,
     const byte* input_end,
     int* output) {
-  typedef int (*matcher)(String*, int, const byte*,
-                         const byte*, int*, Address, int);
-  matcher matcher_func = FUNCTION_CAST<matcher>(code->entry());
-
   // Ensure that the minimum stack has been allocated.
   RegExpStack stack;
   Address stack_base = RegExpStack::stack_base();

   int direct_call = 0;
-  int result = CALL_GENERATED_REGEXP_CODE(matcher_func,
+  int result = CALL_GENERATED_REGEXP_CODE(code->entry(),
                                           input,
                                           start_offset,
                                           input_start,
=======================================
--- /branches/bleeding_edge/src/x64/simulator-x64.h     Tue Dec  7 03:01:02 2010
+++ /branches/bleeding_edge/src/x64/simulator-x64.h     Wed Feb 16 01:18:19 2011
@@ -39,10 +39,13 @@
 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
   (entry(p0, p1, p2, p3, p4))

-// Call the generated regexp code directly. The entry function pointer should
+typedef int (*regexp_matcher)(String*, int, const byte*,
+                              const byte*, int*, Address, int);
+
+// Call the generated regexp code directly. The code at the entry address should
 // expect seven int/pointer sized arguments and return an int.
 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
-  (entry(p0, p1, p2, p3, p4, p5, p6))
+  (FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6))

 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
   (reinterpret_cast<TryCatch*>(try_catch_address))

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

Reply via email to