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
parent 14087f43
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment