OLD | NEW |
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 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 | 1683 |
1684 ParameterCount expected(ebx); | 1684 ParameterCount expected(ebx); |
1685 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 1685 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
1686 expected, actual, flag, call_wrapper, call_kind); | 1686 expected, actual, flag, call_wrapper, call_kind); |
1687 } | 1687 } |
1688 | 1688 |
1689 | 1689 |
1690 void MacroAssembler::InvokeFunction(JSFunction* function, | 1690 void MacroAssembler::InvokeFunction(JSFunction* function, |
1691 const ParameterCount& actual, | 1691 const ParameterCount& actual, |
1692 InvokeFlag flag, | 1692 InvokeFlag flag, |
1693 const CallWrapper& call_wrapper) { | 1693 const CallWrapper& call_wrapper, |
| 1694 CallKind call_kind) { |
1694 ASSERT(function->is_compiled()); | 1695 ASSERT(function->is_compiled()); |
1695 // Get the function and setup the context. | 1696 // Get the function and setup the context. |
1696 mov(edi, Immediate(Handle<JSFunction>(function))); | 1697 mov(edi, Immediate(Handle<JSFunction>(function))); |
1697 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 1698 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
1698 | 1699 |
1699 ParameterCount expected(function->shared()->formal_parameter_count()); | 1700 ParameterCount expected(function->shared()->formal_parameter_count()); |
1700 if (V8::UseCrankshaft()) { | 1701 if (V8::UseCrankshaft()) { |
1701 // TODO(kasperl): For now, we always call indirectly through the | 1702 // TODO(kasperl): For now, we always call indirectly through the |
1702 // code field in the function to allow recompilation to take effect | 1703 // code field in the function to allow recompilation to take effect |
1703 // without changing any of the call sites. | 1704 // without changing any of the call sites. |
1704 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 1705 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
1705 expected, actual, flag, call_wrapper); | 1706 expected, actual, flag, call_wrapper, call_kind); |
1706 } else { | 1707 } else { |
1707 Handle<Code> code(function->code()); | 1708 Handle<Code> code(function->code()); |
1708 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, | 1709 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, |
1709 flag, call_wrapper); | 1710 flag, call_wrapper, call_kind); |
1710 } | 1711 } |
1711 } | 1712 } |
1712 | 1713 |
1713 | 1714 |
1714 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 1715 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
1715 InvokeFlag flag, | 1716 InvokeFlag flag, |
1716 const CallWrapper& call_wrapper) { | 1717 const CallWrapper& call_wrapper) { |
1717 // Calls are not allowed in some stubs. | 1718 // Calls are not allowed in some stubs. |
1718 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); | 1719 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); |
1719 | 1720 |
1720 // Rely on the assertion to check that the number of provided | 1721 // Rely on the assertion to check that the number of provided |
1721 // arguments match the expected number of arguments. Fake a | 1722 // arguments match the expected number of arguments. Fake a |
1722 // parameter count to avoid emitting code to do the check. | 1723 // parameter count to avoid emitting code to do the check. |
1723 ParameterCount expected(0); | 1724 ParameterCount expected(0); |
1724 GetBuiltinFunction(edi, id); | 1725 GetBuiltinFunction(edi, id); |
1725 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 1726 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
1726 expected, expected, flag, call_wrapper); | 1727 expected, expected, flag, call_wrapper, CALL_AS_METHOD); |
1727 } | 1728 } |
1728 | 1729 |
1729 void MacroAssembler::GetBuiltinFunction(Register target, | 1730 void MacroAssembler::GetBuiltinFunction(Register target, |
1730 Builtins::JavaScript id) { | 1731 Builtins::JavaScript id) { |
1731 // Load the JavaScript builtin function from the builtins object. | 1732 // Load the JavaScript builtin function from the builtins object. |
1732 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1733 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1733 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); | 1734 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); |
1734 mov(target, FieldOperand(target, | 1735 mov(target, FieldOperand(target, |
1735 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | 1736 JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
1736 } | 1737 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 | 2128 |
2128 // Check that the code was patched as expected. | 2129 // Check that the code was patched as expected. |
2129 ASSERT(masm_.pc_ == address_ + size_); | 2130 ASSERT(masm_.pc_ == address_ + size_); |
2130 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2131 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2131 } | 2132 } |
2132 | 2133 |
2133 | 2134 |
2134 } } // namespace v8::internal | 2135 } } // namespace v8::internal |
2135 | 2136 |
2136 #endif // V8_TARGET_ARCH_IA32 | 2137 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |