Bug 40231

Summary: Add native call support for ARM and Thumb-2 JIT with JSValue32
Product: WebKit Reporter: Gabor Loki <loki>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: barraclough, ggaren, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: All   
Attachments:
Description Flags
Add native call support for ARM and Thumb-2 JIT with JSValue32.
loki: commit-queue-
Add native call support for ARM and Thumb-2 JIT ggaren: review+, loki: commit-queue-

Description Gabor Loki 2010-06-07 05:58:35 PDT
Currently the native call enhancement is available on x86 with JSValue32_64 and on x86_64 with JSValue64.

I am going to upload a patch which adds this call support for ARM and Thumb-2 JIT as well.
Comment 1 Gabor Loki 2010-06-07 06:09:33 PDT
Created attachment 58020 [details]
Add native call support for ARM and Thumb-2 JIT with JSValue32.

Same technique was used as on x86_64 with some limitations.
- we cannot use regT0 for the new callframe, because r0 (=regT0) should be the first argument of the host function.
- a callee preserved register should be used to hold the return address instead of the stack.
- preserveReturnAddressAfterCall/restoreReturnAddressBeforeReturn functions should be used to work with return address (instead of peek/poke on stack).
Comment 2 WebKit Review Bot 2010-06-07 06:11:54 PDT
Attachment 58020 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
JavaScriptCore/jit/JITOpcodes.cpp:249:  Extra space before ( in function call  [whitespace/parens] [4]
JavaScriptCore/wtf/Platform.h:973:  More than one command on the same line in if  [whitespace/parens] [4]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Gabor Loki 2010-06-07 06:55:49 PDT
Created attachment 58025 [details]
Add native call support for ARM and Thumb-2 JIT

It was easy to add the native call support for JSValue32_64 as well.

So, this patch contains the native call enhancement for each ARM JIT and for each supported JSValue representations.
Comment 4 WebKit Review Bot 2010-06-07 06:57:56 PDT
Attachment 58025 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
JavaScriptCore/wtf/Platform.h:973:  More than one command on the same line in if  [whitespace/parens] [4]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Geoffrey Garen 2010-06-21 11:13:34 PDT
Comment on attachment 58025 [details]
Add native call support for ARM and Thumb-2 JIT

JavaScriptCore/jit/JITOpcodes.cpp:226
 +      restoreReturnAddressBeforeReturn(regT3);
This implies that the link register is caller save. Is it? I thought it was callee save.

r=me
Comment 6 Gabor Loki 2010-06-22 02:04:08 PDT
>  +      restoreReturnAddressBeforeReturn(regT3);
> This implies that the link register is caller save. Is it? I thought it was callee save.

The link register (r14) is caller-save.
The callee-save registers are: r4-r11.
Comment 7 Gabor Loki 2010-06-22 05:25:31 PDT
Committed revision 61614.