| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 4006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4017 const ParameterCount& actual, | 4017 const ParameterCount& actual, |
| 4018 InvokeFlag flag, | 4018 InvokeFlag flag, |
| 4019 const CallWrapper& call_wrapper) { | 4019 const CallWrapper& call_wrapper) { |
| 4020 // You can't call a function without a valid frame. | 4020 // You can't call a function without a valid frame. |
| 4021 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4021 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 4022 | 4022 |
| 4023 Label done; | 4023 Label done; |
| 4024 bool definitely_mismatches = false; | 4024 bool definitely_mismatches = false; |
| 4025 InvokePrologue(expected, | 4025 InvokePrologue(expected, |
| 4026 actual, | 4026 actual, |
| 4027 Handle<Code>::null(), | |
| 4028 code, | |
| 4029 &done, | 4027 &done, |
| 4030 &definitely_mismatches, | 4028 &definitely_mismatches, |
| 4031 flag, | 4029 flag, |
| 4032 Label::kNear, | 4030 Label::kNear, |
| 4033 call_wrapper); | 4031 call_wrapper); |
| 4034 if (!definitely_mismatches) { | 4032 if (!definitely_mismatches) { |
| 4035 if (flag == CALL_FUNCTION) { | 4033 if (flag == CALL_FUNCTION) { |
| 4036 call_wrapper.BeforeCall(CallSize(code)); | 4034 call_wrapper.BeforeCall(CallSize(code)); |
| 4037 call(code); | 4035 call(code); |
| 4038 call_wrapper.AfterCall(); | 4036 call_wrapper.AfterCall(); |
| 4039 } else { | 4037 } else { |
| 4040 DCHECK(flag == JUMP_FUNCTION); | 4038 DCHECK(flag == JUMP_FUNCTION); |
| 4041 jmp(code); | 4039 jmp(code); |
| 4042 } | 4040 } |
| 4043 bind(&done); | 4041 bind(&done); |
| 4044 } | 4042 } |
| 4045 } | 4043 } |
| 4046 | 4044 |
| 4047 | 4045 |
| 4048 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 4046 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
| 4049 const ParameterCount& actual, | 4047 const ParameterCount& actual, |
| 4050 Handle<Code> code_constant, | |
| 4051 Register code_register, | |
| 4052 Label* done, | 4048 Label* done, |
| 4053 bool* definitely_mismatches, | 4049 bool* definitely_mismatches, |
| 4054 InvokeFlag flag, | 4050 InvokeFlag flag, |
| 4055 Label::Distance near_jump, | 4051 Label::Distance near_jump, |
| 4056 const CallWrapper& call_wrapper) { | 4052 const CallWrapper& call_wrapper) { |
| 4057 bool definitely_matches = false; | 4053 bool definitely_matches = false; |
| 4058 *definitely_mismatches = false; | 4054 *definitely_mismatches = false; |
| 4059 Label invoke; | 4055 Label invoke; |
| 4060 if (expected.is_immediate()) { | 4056 if (expected.is_immediate()) { |
| 4061 DCHECK(actual.is_immediate()); | 4057 DCHECK(actual.is_immediate()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4091 j(equal, &invoke, Label::kNear); | 4087 j(equal, &invoke, Label::kNear); |
| 4092 DCHECK(actual.reg().is(rax)); | 4088 DCHECK(actual.reg().is(rax)); |
| 4093 DCHECK(expected.reg().is(rbx)); | 4089 DCHECK(expected.reg().is(rbx)); |
| 4094 } else { | 4090 } else { |
| 4095 Move(rax, actual.reg()); | 4091 Move(rax, actual.reg()); |
| 4096 } | 4092 } |
| 4097 } | 4093 } |
| 4098 | 4094 |
| 4099 if (!definitely_matches) { | 4095 if (!definitely_matches) { |
| 4100 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 4096 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 4101 if (!code_constant.is_null()) { | |
| 4102 Move(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); | |
| 4103 addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
| 4104 } else if (!code_register.is(rdx)) { | |
| 4105 movp(rdx, code_register); | |
| 4106 } | |
| 4107 | |
| 4108 if (flag == CALL_FUNCTION) { | 4097 if (flag == CALL_FUNCTION) { |
| 4109 call_wrapper.BeforeCall(CallSize(adaptor)); | 4098 call_wrapper.BeforeCall(CallSize(adaptor)); |
| 4110 Call(adaptor, RelocInfo::CODE_TARGET); | 4099 Call(adaptor, RelocInfo::CODE_TARGET); |
| 4111 call_wrapper.AfterCall(); | 4100 call_wrapper.AfterCall(); |
| 4112 if (!*definitely_mismatches) { | 4101 if (!*definitely_mismatches) { |
| 4113 jmp(done, near_jump); | 4102 jmp(done, near_jump); |
| 4114 } | 4103 } |
| 4115 } else { | 4104 } else { |
| 4116 Jump(adaptor, RelocInfo::CODE_TARGET); | 4105 Jump(adaptor, RelocInfo::CODE_TARGET); |
| 4117 } | 4106 } |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5513 movl(rax, dividend); | 5502 movl(rax, dividend); |
| 5514 shrl(rax, Immediate(31)); | 5503 shrl(rax, Immediate(31)); |
| 5515 addl(rdx, rax); | 5504 addl(rdx, rax); |
| 5516 } | 5505 } |
| 5517 | 5506 |
| 5518 | 5507 |
| 5519 } // namespace internal | 5508 } // namespace internal |
| 5520 } // namespace v8 | 5509 } // namespace v8 |
| 5521 | 5510 |
| 5522 #endif // V8_TARGET_ARCH_X64 | 5511 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |