We would like this to be split into smaller changes in these steps:
1. Changing TailCallRuntime to TailCallExternalReference can go in a
separate
change
2. Add PrepareCallCFunction/CallCFunction to macro-assembler-ia32 and use
it in
regexp-macro-assembler-ia32.cc
3. Direct call support on ia32 only and only enabled for one or two of the
hottest runtime functions suitable and make it just simply pass all
arguments on
the stack (standard calling convention).
Don't use the SIGNATURE_XXX macros, instead add the calling convention to
the
functions lists in runtime.h, e.g.
F(GetProperty, 2, 1, EXIT_FRAME_CALL) \
F(KeyedGetProperty, 2, 1, EXIT_FRAME_CALL) \
...
Then add a the list RUNTIME_FUNCTION_LIST_DIRECT_CALL:
#ifdef V8_TARGET_ARCH_IA32
#define RUNTIME_FUNCTION_LIST_DIRECT_CALL(F) \
F(XXX, 2, 1, DIRECT_CALL)
#endif
#ifdef V8_TARGET_ARCH_X64
#define RUNTIME_FUNCTION_LIST_DIRECT_CALL(F) \
F(XXX, 2, 1, EXIT_FRAME_CALL)
#endif
#ifdef V8_TARGET_ARCH_ARM
#define RUNTIME_FUNCTION_LIST_DIRECT_CALL(F) \
F(XXX, 2, 1, EXIT_FRAME_CALL)
#endif
and remove XXX from RUNTIME_FUNCTION_LIST_ALWAYS_X. Add the new list:
#define RUNTIME_FUNCTION_LIST(F) \
RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
RUNTIME_FUNCTION_LIST_DIRECT_CALL(F) \
RUNTIME_FUNCTION_LIST_DEBUG(F) \
RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \
RUNTIME_FUNCTION_LIST_PROFILER_SUPPORT(F)
In runtime.cc have two "duplicate" versions of Runtime_XXX:
#ifdef DIRECT_CALL_SUPPORTED
static Object* Runtime_XXX(Object* x, Object* y) {
// Full body.
}
#else
static Object* Runtime_XXX(Arguments args) {
// Full body.
}
#endif
4. Port direct call to x64
5. Port direct call to ARM
6. Extend the number of runtime functions for which direct call is
supported.
7. Add more advanced optimizations.
8. Goto 7 :-)
http://codereview.chromium.org/598072/diff/11034/10043
File src/ia32/macro-assembler-ia32.cc (right):
http://codereview.chromium.org/598072/diff/11034/10043#newcode1171
src/ia32/macro-assembler-ia32.cc:1171:
I still think we should have the handling of calling a C function
directly abstracted into a PrepareCallCFunction function and retire
FrameAlign etc. in regexp-macro-assembler-ia32.cc.
As far as I can see you optimize the removal of the existing arguments
into restoring esp, and use push instead of
mov(xxx, Operand(eax, Y * kPointerSize);
mov(Operand(esp, X * kPointerSize), xxx);
I don't know whether it makes a performance difference, but if it does
the PrepareCallCFunction could take parameters to indicate whether the
stack should be prepared for push or storing into and number additional
stack slots to get rid of when restoring after alignment.
http://codereview.chromium.org/598072/diff/11034/10043#newcode1218
src/ia32/macro-assembler-ia32.cc:1218: }
Maybe just adjust the stack by f->nargs in an else to keep things
simpler. Otherwise please comment on then mov(esp, ... removes the
arguments.
http://codereview.chromium.org/598072/diff/11034/10048
File src/runtime.h (right):
http://codereview.chromium.org/598072/diff/11034/10048#newcode376
src/runtime.h:376: DIRECT_CALL_NOT_FAILS
NOT -> NEVER.
http://codereview.chromium.org/598072
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev