Fixed alignment problem when generating code for builtins.

This is not perfect, but it should fix the problem at hand. We should really clean up the memory handling responsibilities for the (macro)assemblers.

BUG=v8:1706
Review URL: http://codereview.chromium.org/7978023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9351 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2011-09-21 07:59:28 +00:00
parent 14087f430d
commit 4e3565cf7f

View File

@ -1616,14 +1616,15 @@ void Builtins::Setup(bool create_heap_objects) {
const BuiltinDesc* functions = BuiltinFunctionTable::functions();
// For now we generate builtin adaptor code into a stack-allocated
// buffer, before copying it into individual code objects.
byte buffer[4*KB];
// buffer, before copying it into individual code objects. Be careful
// with alignment, some platforms don't like unaligned code.
union { int force_alignment; byte buffer[4*KB]; } u;
// Traverse the list of builtins and generate an adaptor in a
// separate code object for each one.
for (int i = 0; i < builtin_count; i++) {
if (create_heap_objects) {
MacroAssembler masm(isolate, buffer, sizeof buffer);
MacroAssembler masm(isolate, u.buffer, sizeof u.buffer);
// Generate the code/adaptor.
typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments);
Generator g = FUNCTION_CAST<Generator>(functions[i].generator);