Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/builtins.cc

Issue 7978023: Fixed alignment problem when generating code for builtins. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 ASSERT(!initialized_); 1609 ASSERT(!initialized_);
1610 Isolate* isolate = Isolate::Current(); 1610 Isolate* isolate = Isolate::Current();
1611 Heap* heap = isolate->heap(); 1611 Heap* heap = isolate->heap();
1612 1612
1613 // Create a scope for the handles in the builtins. 1613 // Create a scope for the handles in the builtins.
1614 HandleScope scope(isolate); 1614 HandleScope scope(isolate);
1615 1615
1616 const BuiltinDesc* functions = BuiltinFunctionTable::functions(); 1616 const BuiltinDesc* functions = BuiltinFunctionTable::functions();
1617 1617
1618 // For now we generate builtin adaptor code into a stack-allocated 1618 // For now we generate builtin adaptor code into a stack-allocated
1619 // buffer, before copying it into individual code objects. 1619 // buffer, before copying it into individual code objects. Be careful
1620 byte buffer[4*KB]; 1620 // with alignment, some platforms don't like unaligned code.
1621 union { int force_alignment; byte buffer[4*KB]; } u;
1621 1622
1622 // Traverse the list of builtins and generate an adaptor in a 1623 // Traverse the list of builtins and generate an adaptor in a
1623 // separate code object for each one. 1624 // separate code object for each one.
1624 for (int i = 0; i < builtin_count; i++) { 1625 for (int i = 0; i < builtin_count; i++) {
1625 if (create_heap_objects) { 1626 if (create_heap_objects) {
1626 MacroAssembler masm(isolate, buffer, sizeof buffer); 1627 MacroAssembler masm(isolate, u.buffer, sizeof u.buffer);
1627 // Generate the code/adaptor. 1628 // Generate the code/adaptor.
1628 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); 1629 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments);
1629 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); 1630 Generator g = FUNCTION_CAST<Generator>(functions[i].generator);
1630 // We pass all arguments to the generator, but it may not use all of 1631 // We pass all arguments to the generator, but it may not use all of
1631 // them. This works because the first arguments are on top of the 1632 // them. This works because the first arguments are on top of the
1632 // stack. 1633 // stack.
1633 ASSERT(!masm.has_frame()); 1634 ASSERT(!masm.has_frame());
1634 g(&masm, functions[i].name, functions[i].extra_args); 1635 g(&masm, functions[i].name, functions[i].extra_args);
1635 // Move the code into the object heap. 1636 // Move the code into the object heap.
1636 CodeDesc desc; 1637 CodeDesc desc;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 return Handle<Code>(code_address); \ 1714 return Handle<Code>(code_address); \
1714 } 1715 }
1715 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1716 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1716 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1717 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1717 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1718 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1718 #undef DEFINE_BUILTIN_ACCESSOR_C 1719 #undef DEFINE_BUILTIN_ACCESSOR_C
1719 #undef DEFINE_BUILTIN_ACCESSOR_A 1720 #undef DEFINE_BUILTIN_ACCESSOR_A
1720 1721
1721 1722
1722 } } // namespace v8::internal 1723 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698