From: lrn@chromium.org Date: Wed, 16 Feb 2011 09:18:19 +0000 (+0000) Subject: Fix non-simulated ARM calling of RegExp code. X-Git-Tag: upstream/4.7.83~20195 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abbcadf22103f381621edc5036c45525d441cfa1;p=platform%2Fupstream%2Fv8.git Fix non-simulated ARM calling of RegExp code. Review URL: http://codereview.chromium.org/6526043 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6805 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/simulator-arm.h b/src/arm/simulator-arm.h index 09fb19b..bdf1f8a 100644 --- a/src/arm/simulator-arm.h +++ b/src/arm/simulator-arm.h @@ -48,10 +48,16 @@ namespace internal { #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(entry)(p0, p1, p2, p3, NULL, p4, p5, p6)) #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ (reinterpret_cast(try_catch_address)) @@ -362,8 +368,7 @@ class Simulator { 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 == \ diff --git a/src/ia32/simulator-ia32.h b/src/ia32/simulator-ia32.h index 88d0b61..43b7ea3 100644 --- a/src/ia32/simulator-ia32.h +++ b/src/ia32/simulator-ia32.h @@ -38,10 +38,15 @@ namespace internal { #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(entry)(p0, p1, p2, p3, p4, p5, p6)) + #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ (reinterpret_cast(try_catch_address)) diff --git a/src/regexp-macro-assembler.cc b/src/regexp-macro-assembler.cc index 09797ca..51f4015 100644 --- a/src/regexp-macro-assembler.cc +++ b/src/regexp-macro-assembler.cc @@ -154,16 +154,12 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( 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(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, diff --git a/src/x64/simulator-x64.h b/src/x64/simulator-x64.h index e607c8b..3a62ffd 100644 --- a/src/x64/simulator-x64.h +++ b/src/x64/simulator-x64.h @@ -39,10 +39,13 @@ namespace internal { #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(entry)(p0, p1, p2, p3, p4, p5, p6)) #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ (reinterpret_cast(try_catch_address))