| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 state, \ | 1592 state, \ |
| 1593 extra); \ | 1593 extra); \ |
| 1594 functions->extra_args = NO_EXTRA_ARGUMENTS; \ | 1594 functions->extra_args = NO_EXTRA_ARGUMENTS; \ |
| 1595 ++functions; | 1595 ++functions; |
| 1596 | 1596 |
| 1597 #define DEF_FUNCTION_PTR_H(aname, kind) \ | 1597 #define DEF_FUNCTION_PTR_H(aname, kind) \ |
| 1598 functions->generator = FUNCTION_ADDR(Generate_##aname); \ | 1598 functions->generator = FUNCTION_ADDR(Generate_##aname); \ |
| 1599 functions->c_code = NULL; \ | 1599 functions->c_code = NULL; \ |
| 1600 functions->s_name = #aname; \ | 1600 functions->s_name = #aname; \ |
| 1601 functions->name = k##aname; \ | 1601 functions->name = k##aname; \ |
| 1602 functions->flags = Code::ComputeHandlerFlags(Code::kind); \ | 1602 functions->flags = Code::ComputeFlags( \ |
| 1603 Code::HANDLER, MONOMORPHIC, kNoExtraICState, \ |
| 1604 Code::NORMAL, Code::kind); \ |
| 1603 functions->extra_args = NO_EXTRA_ARGUMENTS; \ | 1605 functions->extra_args = NO_EXTRA_ARGUMENTS; \ |
| 1604 ++functions; | 1606 ++functions; |
| 1605 | 1607 |
| 1606 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) | 1608 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) |
| 1607 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) | 1609 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) |
| 1608 BUILTIN_LIST_H(DEF_FUNCTION_PTR_H) | 1610 BUILTIN_LIST_H(DEF_FUNCTION_PTR_H) |
| 1609 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) | 1611 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) |
| 1610 | 1612 |
| 1611 #undef DEF_FUNCTION_PTR_C | 1613 #undef DEF_FUNCTION_PTR_C |
| 1612 #undef DEF_FUNCTION_PTR_A | 1614 #undef DEF_FUNCTION_PTR_A |
| 1613 } | 1615 } |
| 1614 | 1616 |
| 1615 | 1617 |
| 1616 void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) { | 1618 void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) { |
| 1617 ASSERT(!initialized_); | 1619 ASSERT(!initialized_); |
| 1618 Heap* heap = isolate->heap(); | 1620 Heap* heap = isolate->heap(); |
| 1619 | 1621 |
| 1620 // Create a scope for the handles in the builtins. | 1622 // Create a scope for the handles in the builtins. |
| 1621 HandleScope scope(isolate); | 1623 HandleScope scope(isolate); |
| 1622 | 1624 |
| 1623 const BuiltinDesc* functions = builtin_function_table.functions(); | 1625 const BuiltinDesc* functions = builtin_function_table.functions(); |
| 1624 | 1626 |
| 1625 // For now we generate builtin adaptor code into a stack-allocated | 1627 // For now we generate builtin adaptor code into a stack-allocated |
| 1626 // buffer, before copying it into individual code objects. Be careful | 1628 // buffer, before copying it into individual code objects. Be careful |
| 1627 // with alignment, some platforms don't like unaligned code. | 1629 // with alignment, some platforms don't like unaligned code. |
| 1628 // TODO(jbramley): I had to increase the size of this buffer from 8KB because | 1630 union { int force_alignment; byte buffer[8*KB]; } u; |
| 1629 // we can generate a lot of debug code on A64. | |
| 1630 union { int force_alignment; byte buffer[16*KB]; } u; | |
| 1631 | 1631 |
| 1632 // Traverse the list of builtins and generate an adaptor in a | 1632 // Traverse the list of builtins and generate an adaptor in a |
| 1633 // separate code object for each one. | 1633 // separate code object for each one. |
| 1634 for (int i = 0; i < builtin_count; i++) { | 1634 for (int i = 0; i < builtin_count; i++) { |
| 1635 if (create_heap_objects) { | 1635 if (create_heap_objects) { |
| 1636 MacroAssembler masm(isolate, u.buffer, sizeof u.buffer); | 1636 MacroAssembler masm(isolate, u.buffer, sizeof u.buffer); |
| 1637 // Generate the code/adaptor. | 1637 // Generate the code/adaptor. |
| 1638 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); | 1638 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); |
| 1639 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); | 1639 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); |
| 1640 // We pass all arguments to the generator, but it may not use all of | 1640 // We pass all arguments to the generator, but it may not use all of |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 } | 1741 } |
| 1742 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1742 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1743 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1743 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1744 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1744 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1745 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1745 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1746 #undef DEFINE_BUILTIN_ACCESSOR_C | 1746 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1747 #undef DEFINE_BUILTIN_ACCESSOR_A | 1747 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1748 | 1748 |
| 1749 | 1749 |
| 1750 } } // namespace v8::internal | 1750 } } // namespace v8::internal |
| OLD | NEW |