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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 InvokeFlag flag, | 793 InvokeFlag flag, |
794 const CallWrapper& call_wrapper) { | 794 const CallWrapper& call_wrapper) { |
795 // Calls are not allowed in some stubs. | 795 // Calls are not allowed in some stubs. |
796 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); | 796 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); |
797 | 797 |
798 // Rely on the assertion to check that the number of provided | 798 // Rely on the assertion to check that the number of provided |
799 // arguments match the expected number of arguments. Fake a | 799 // arguments match the expected number of arguments. Fake a |
800 // parameter count to avoid emitting code to do the check. | 800 // parameter count to avoid emitting code to do the check. |
801 ParameterCount expected(0); | 801 ParameterCount expected(0); |
802 GetBuiltinEntry(rdx, id); | 802 GetBuiltinEntry(rdx, id); |
803 InvokeCode(rdx, expected, expected, flag, call_wrapper); | 803 InvokeCode(rdx, expected, expected, flag, call_wrapper, CALL_AS_METHOD); |
804 } | 804 } |
805 | 805 |
806 | 806 |
807 void MacroAssembler::GetBuiltinFunction(Register target, | 807 void MacroAssembler::GetBuiltinFunction(Register target, |
808 Builtins::JavaScript id) { | 808 Builtins::JavaScript id) { |
809 // Load the builtins object into target register. | 809 // Load the builtins object into target register. |
810 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 810 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
811 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); | 811 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); |
812 movq(target, FieldOperand(target, | 812 movq(target, FieldOperand(target, |
813 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | 813 JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
(...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 2871 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
2872 | 2872 |
2873 ParameterCount expected(rbx); | 2873 ParameterCount expected(rbx); |
2874 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); | 2874 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); |
2875 } | 2875 } |
2876 | 2876 |
2877 | 2877 |
2878 void MacroAssembler::InvokeFunction(JSFunction* function, | 2878 void MacroAssembler::InvokeFunction(JSFunction* function, |
2879 const ParameterCount& actual, | 2879 const ParameterCount& actual, |
2880 InvokeFlag flag, | 2880 InvokeFlag flag, |
2881 const CallWrapper& call_wrapper) { | 2881 const CallWrapper& call_wrapper, |
| 2882 CallKind call_kind) { |
2882 ASSERT(function->is_compiled()); | 2883 ASSERT(function->is_compiled()); |
2883 // Get the function and setup the context. | 2884 // Get the function and setup the context. |
2884 Move(rdi, Handle<JSFunction>(function)); | 2885 Move(rdi, Handle<JSFunction>(function)); |
2885 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 2886 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
2886 | 2887 |
2887 if (V8::UseCrankshaft()) { | 2888 if (V8::UseCrankshaft()) { |
2888 // Since Crankshaft can recompile a function, we need to load | 2889 // Since Crankshaft can recompile a function, we need to load |
2889 // the Code object every time we call the function. | 2890 // the Code object every time we call the function. |
2890 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 2891 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
2891 ParameterCount expected(function->shared()->formal_parameter_count()); | 2892 ParameterCount expected(function->shared()->formal_parameter_count()); |
2892 InvokeCode(rdx, expected, actual, flag, call_wrapper); | 2893 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); |
2893 } else { | 2894 } else { |
2894 // Invoke the cached code. | 2895 // Invoke the cached code. |
2895 Handle<Code> code(function->code()); | 2896 Handle<Code> code(function->code()); |
2896 ParameterCount expected(function->shared()->formal_parameter_count()); | 2897 ParameterCount expected(function->shared()->formal_parameter_count()); |
2897 InvokeCode(code, | 2898 InvokeCode(code, |
2898 expected, | 2899 expected, |
2899 actual, | 2900 actual, |
2900 RelocInfo::CODE_TARGET, | 2901 RelocInfo::CODE_TARGET, |
2901 flag, | 2902 flag, |
2902 call_wrapper); | 2903 call_wrapper, |
| 2904 call_kind); |
2903 } | 2905 } |
2904 } | 2906 } |
2905 | 2907 |
2906 | 2908 |
2907 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 2909 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
2908 const ParameterCount& actual, | 2910 const ParameterCount& actual, |
2909 Handle<Code> code_constant, | 2911 Handle<Code> code_constant, |
2910 Register code_register, | 2912 Register code_register, |
2911 Label* done, | 2913 Label* done, |
2912 InvokeFlag flag, | 2914 InvokeFlag flag, |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3736 CPU::FlushICache(address_, size_); | 3738 CPU::FlushICache(address_, size_); |
3737 | 3739 |
3738 // Check that the code was patched as expected. | 3740 // Check that the code was patched as expected. |
3739 ASSERT(masm_.pc_ == address_ + size_); | 3741 ASSERT(masm_.pc_ == address_ + size_); |
3740 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 3742 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
3741 } | 3743 } |
3742 | 3744 |
3743 } } // namespace v8::internal | 3745 } } // namespace v8::internal |
3744 | 3746 |
3745 #endif // V8_TARGET_ARCH_X64 | 3747 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |