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 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset)); | 3594 FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset)); |
3595 // Advances rdx to the end of the Code object header, to the start of | 3595 // Advances rdx to the end of the Code object header, to the start of |
3596 // the executable code. | 3596 // the executable code. |
3597 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 3597 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
3598 | 3598 |
3599 ParameterCount expected(rbx); | 3599 ParameterCount expected(rbx); |
3600 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); | 3600 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); |
3601 } | 3601 } |
3602 | 3602 |
3603 | 3603 |
3604 void MacroAssembler::InvokeFunction(Register function, | 3604 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
3605 const ParameterCount& expected, | 3605 const ParameterCount& expected, |
3606 const ParameterCount& actual, | 3606 const ParameterCount& actual, |
3607 InvokeFlag flag, | 3607 InvokeFlag flag, |
3608 const CallWrapper& call_wrapper, | 3608 const CallWrapper& call_wrapper, |
3609 CallKind call_kind) { | 3609 CallKind call_kind) { |
3610 // You can't call a function without a valid frame. | 3610 // You can't call a function without a valid frame. |
3611 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 3611 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
3612 | 3612 |
3613 ASSERT(function.is(rdi)); | 3613 // Get the function and setup the context. |
3614 movq(rsi, FieldOperand(function, JSFunction::kContextOffset)); | 3614 Move(rdi, function); |
3615 // Advances rdx to the end of the Code object header, to the start of | 3615 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
3616 // the executable code. | 3616 |
| 3617 // We call indirectly through the code field in the function to |
| 3618 // allow recompilation to take effect without changing any of the |
| 3619 // call sites. |
3617 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 3620 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
3618 | |
3619 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); | 3621 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); |
3620 } | 3622 } |
3621 | 3623 |
3622 | 3624 |
3623 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | |
3624 const ParameterCount& expected, | |
3625 const ParameterCount& actual, | |
3626 InvokeFlag flag, | |
3627 const CallWrapper& call_wrapper, | |
3628 CallKind call_kind) { | |
3629 Move(rdi, function); | |
3630 InvokeFunction(rdi, expected, actual, flag, call_wrapper, call_kind); | |
3631 } | |
3632 | |
3633 | |
3634 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 3625 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
3635 const ParameterCount& actual, | 3626 const ParameterCount& actual, |
3636 Handle<Code> code_constant, | 3627 Handle<Code> code_constant, |
3637 Register code_register, | 3628 Register code_register, |
3638 Label* done, | 3629 Label* done, |
3639 bool* definitely_mismatches, | 3630 bool* definitely_mismatches, |
3640 InvokeFlag flag, | 3631 InvokeFlag flag, |
3641 Label::Distance near_jump, | 3632 Label::Distance near_jump, |
3642 const CallWrapper& call_wrapper, | 3633 const CallWrapper& call_wrapper, |
3643 CallKind call_kind) { | 3634 CallKind call_kind) { |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5064 j(equal, found); | 5055 j(equal, found); |
5065 movq(current, FieldOperand(current, Map::kPrototypeOffset)); | 5056 movq(current, FieldOperand(current, Map::kPrototypeOffset)); |
5066 CompareRoot(current, Heap::kNullValueRootIndex); | 5057 CompareRoot(current, Heap::kNullValueRootIndex); |
5067 j(not_equal, &loop_again); | 5058 j(not_equal, &loop_again); |
5068 } | 5059 } |
5069 | 5060 |
5070 | 5061 |
5071 } } // namespace v8::internal | 5062 } } // namespace v8::internal |
5072 | 5063 |
5073 #endif // V8_TARGET_ARCH_X64 | 5064 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |